amber-cli.js 2.0 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387
  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 Amber hierarchy.
  1103. All objects including `Object` inherit from SmalltalkRoot */
  1104. function SmalltalkRoot() {
  1105. }
  1106. function SmalltalkProtoObject() {
  1107. }
  1108. function SmalltalkObject() {
  1109. }
  1110. function SmalltalkNil() {
  1111. }
  1112. inherits(SmalltalkProtoObject, SmalltalkRoot);
  1113. inherits(SmalltalkObject, SmalltalkProtoObject);
  1114. inherits(SmalltalkNil, SmalltalkObject);
  1115. this.Object = SmalltalkObject;
  1116. this.nilAsReceiver = new SmalltalkNil();
  1117. // Adds an `isNil` property to the `nil` object. When sending
  1118. // nil objects from one environment to another, doing
  1119. // `anObject == nil` (in JavaScript) does not always answer
  1120. // true as the referenced nil object might come from the other
  1121. // environment.
  1122. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1123. value: true,
  1124. enumerable: false, configurable: false, writable: false
  1125. });
  1126. // Hidden root class of the system.
  1127. // Effective superclass of all classes created with `nil subclass: ...`.
  1128. this.nilAsClass = {fn: SmalltalkRoot};
  1129. this.__init__ = function () {
  1130. var globals = brikz.smalltalkGlobals.globals;
  1131. var addCoupledClass = brikz.classes.addCoupledClass;
  1132. st.addPackage("Kernel-Objects");
  1133. addCoupledClass("ProtoObject", undefined, "Kernel-Objects", SmalltalkProtoObject);
  1134. addCoupledClass("Object", globals.ProtoObject, "Kernel-Objects", SmalltalkObject);
  1135. addCoupledClass("UndefinedObject", globals.Object, "Kernel-Objects", SmalltalkNil);
  1136. };
  1137. this.__init__.once = true;
  1138. }
  1139. OrganizeBrik.deps = ["augments", "root"];
  1140. function OrganizeBrik(brikz, st) {
  1141. var SmalltalkObject = brikz.root.Object;
  1142. function SmalltalkOrganizer() {
  1143. }
  1144. function SmalltalkPackageOrganizer() {
  1145. this.elements = [];
  1146. }
  1147. function SmalltalkClassOrganizer() {
  1148. this.elements = [];
  1149. }
  1150. inherits(SmalltalkOrganizer, SmalltalkObject);
  1151. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  1152. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  1153. this.__init__ = function () {
  1154. var globals = brikz.smalltalkGlobals.globals;
  1155. var addCoupledClass = brikz.classes.addCoupledClass;
  1156. st.addPackage("Kernel-Infrastructure");
  1157. addCoupledClass("Organizer", globals.Object, "Kernel-Infrastructure", SmalltalkOrganizer);
  1158. addCoupledClass("PackageOrganizer", globals.Organizer, "Kernel-Infrastructure", SmalltalkPackageOrganizer);
  1159. addCoupledClass("ClassOrganizer", globals.Organizer, "Kernel-Infrastructure", SmalltalkClassOrganizer);
  1160. };
  1161. this.__init__.once = true;
  1162. this.setupClassOrganization = function (klass) {
  1163. klass.organization = new SmalltalkClassOrganizer();
  1164. klass.organization.theClass = klass;
  1165. };
  1166. this.setupPackageOrganization = function (pkg) {
  1167. pkg.organization = new SmalltalkPackageOrganizer();
  1168. };
  1169. this.addOrganizationElement = function (owner, element) {
  1170. owner.organization.elements.addElement(element);
  1171. };
  1172. this.removeOrganizationElement = function (owner, element) {
  1173. owner.organization.elements.removeElement(element);
  1174. };
  1175. }
  1176. SelectorsBrik.deps = ["selectorConversion"];
  1177. function SelectorsBrik(brikz, st) {
  1178. var selectorSet = Object.create(null);
  1179. var selectors = this.selectors = [];
  1180. var selectorPairs = this.selectorPairs = [];
  1181. this.registerSelector = function (stSelector) {
  1182. if (selectorSet[stSelector]) return null;
  1183. var jsSelector = st.st2js(stSelector);
  1184. selectorSet[stSelector] = true;
  1185. selectors.push(stSelector);
  1186. var pair = {st: stSelector, js: jsSelector};
  1187. selectorPairs.push(pair);
  1188. return pair;
  1189. };
  1190. /* Answer all method selectors based on dnu handlers */
  1191. st.allSelectors = function () {
  1192. return selectors;
  1193. };
  1194. }
  1195. PackagesBrik.deps = ["organize", "root"];
  1196. function PackagesBrik(brikz, st) {
  1197. var setupPackageOrganization = brikz.organize.setupPackageOrganization;
  1198. var SmalltalkObject = brikz.root.Object;
  1199. function SmalltalkPackage() {
  1200. }
  1201. inherits(SmalltalkPackage, SmalltalkObject);
  1202. this.__init__ = function () {
  1203. var globals = brikz.smalltalkGlobals.globals;
  1204. var addCoupledClass = brikz.classes.addCoupledClass;
  1205. st.addPackage("Kernel-Infrastructure");
  1206. addCoupledClass("Package", globals.Object, "Kernel-Infrastructure", SmalltalkPackage);
  1207. };
  1208. this.__init__.once = true;
  1209. st.packages = {};
  1210. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  1211. function pkg(spec) {
  1212. var that = new SmalltalkPackage();
  1213. that.pkgName = spec.pkgName;
  1214. setupPackageOrganization(that);
  1215. that.properties = spec.properties || {};
  1216. return that;
  1217. }
  1218. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  1219. If pkgName is null or empty we return nil, which is an allowed package for a class.
  1220. If package already exists we still update the properties of it. */
  1221. st.addPackage = function (pkgName, properties) {
  1222. if (!pkgName) {
  1223. return null;
  1224. }
  1225. if (!(st.packages[pkgName])) {
  1226. st.packages[pkgName] = pkg({
  1227. pkgName: pkgName,
  1228. properties: properties
  1229. });
  1230. } else {
  1231. if (properties) {
  1232. st.packages[pkgName].properties = properties;
  1233. }
  1234. }
  1235. return st.packages[pkgName];
  1236. };
  1237. }
  1238. ClassesBrik.deps = ["organize", "root", "smalltalkGlobals"];
  1239. function ClassesBrik(brikz, st) {
  1240. var setupClassOrganization = brikz.organize.setupClassOrganization;
  1241. var addOrganizationElement = brikz.organize.addOrganizationElement;
  1242. var removeOrganizationElement = brikz.organize.removeOrganizationElement;
  1243. var globals = brikz.smalltalkGlobals.globals;
  1244. var nilAsClass = brikz.root.nilAsClass;
  1245. var SmalltalkObject = brikz.root.Object;
  1246. nilAsClass.klass = {fn: SmalltalkClass};
  1247. function SmalltalkBehavior() {
  1248. }
  1249. function SmalltalkClass() {
  1250. }
  1251. function SmalltalkMetaclass() {
  1252. }
  1253. inherits(SmalltalkBehavior, SmalltalkObject);
  1254. inherits(SmalltalkClass, SmalltalkBehavior);
  1255. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  1256. SmalltalkBehavior.prototype.toString = function () {
  1257. return 'Smalltalk ' + this.className;
  1258. };
  1259. SmalltalkMetaclass.prototype.meta = true;
  1260. this.__init__ = function () {
  1261. var globals = brikz.smalltalkGlobals.globals;
  1262. var addCoupledClass = brikz.classes.addCoupledClass;
  1263. st.addPackage("Kernel-Classes");
  1264. addCoupledClass("Behavior", globals.Object, "Kernel-Classes", SmalltalkBehavior);
  1265. addCoupledClass("Metaclass", globals.Behavior, "Kernel-Classes", SmalltalkMetaclass);
  1266. addCoupledClass("Class", globals.Behavior, "Kernel-Classes", SmalltalkClass);
  1267. // Manually bootstrap the metaclass hierarchy
  1268. globals.ProtoObject.klass.superclass = nilAsClass.klass = globals.Class;
  1269. addSubclass(globals.ProtoObject.klass);
  1270. };
  1271. this.__init__.once = true;
  1272. /* Smalltalk classes */
  1273. var classes = [];
  1274. /* Smalltalk class creation. A class is an instance of an automatically
  1275. created metaclass object. Newly created classes (not their metaclass)
  1276. should be added to the smalltalk object, see smalltalk.addClass().
  1277. Superclass linking is *not* handled here, see smalltalk.init() */
  1278. function klass(spec) {
  1279. var setSuperClass = spec.superclass;
  1280. if (!spec.superclass) {
  1281. spec.superclass = nilAsClass;
  1282. }
  1283. var meta = metaclass(spec);
  1284. var that = meta.instanceClass;
  1285. that.superclass = setSuperClass;
  1286. that.fn = spec.fn || inherits(function () {
  1287. }, spec.superclass.fn);
  1288. that.subclasses = [];
  1289. setupClass(that, spec);
  1290. that.className = spec.className;
  1291. meta.className = spec.className + ' class';
  1292. meta.superclass = spec.superclass.klass;
  1293. return that;
  1294. }
  1295. function metaclass(spec) {
  1296. var that = new SmalltalkMetaclass();
  1297. that.fn = inherits(function () {
  1298. }, spec.superclass.klass.fn);
  1299. wireKlass(that);
  1300. that.instanceClass = new that.fn();
  1301. setupClass(that, {});
  1302. return that;
  1303. }
  1304. function setupClass(klass, spec) {
  1305. klass.iVarNames = spec.iVarNames || [];
  1306. if (spec.pkg) {
  1307. klass.pkg = spec.pkg;
  1308. }
  1309. setupClassOrganization(klass);
  1310. Object.defineProperty(klass, "methods", {
  1311. value: Object.create(null),
  1312. enumerable: false, configurable: true, writable: true
  1313. });
  1314. }
  1315. function wireKlass(klass) {
  1316. Object.defineProperty(klass.fn.prototype, "klass", {
  1317. value: klass,
  1318. enumerable: false, configurable: true, writable: true
  1319. });
  1320. }
  1321. this.wireKlass = wireKlass;
  1322. /* Add a class to the smalltalk object, creating a new one if needed.
  1323. A Package is lazily created if it does not exist with given name. */
  1324. st.addClass = function (className, superclass, iVarNames, pkgName) {
  1325. // While subclassing nil is allowed, it might be an error, so
  1326. // warn about it.
  1327. if (typeof superclass == 'undefined' || superclass && superclass.isNil) {
  1328. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  1329. }
  1330. return rawAddClass(pkgName, className, superclass, iVarNames, null);
  1331. };
  1332. function rawAddClass(pkgName, className, superclass, iVarNames, fn) {
  1333. var pkg = st.packages[pkgName];
  1334. if (!pkg) {
  1335. throw new Error("Missing package " + pkgName);
  1336. }
  1337. if (superclass == null || superclass.isNil) {
  1338. superclass = null;
  1339. }
  1340. var theClass = globals.hasOwnProperty(className) && globals[className];
  1341. if (theClass && theClass.superclass == superclass && !fn) {
  1342. if (iVarNames) theClass.iVarNames = iVarNames;
  1343. if (pkg) theClass.pkg = pkg;
  1344. } else {
  1345. if (theClass) {
  1346. iVarNames = iVarNames || theClass.iVarNames;
  1347. st.removeClass(theClass);
  1348. }
  1349. theClass = globals[className] = klass({
  1350. className: className,
  1351. superclass: superclass,
  1352. pkg: pkg,
  1353. iVarNames: iVarNames,
  1354. fn: fn
  1355. });
  1356. addSubclass(theClass);
  1357. }
  1358. classes.addElement(theClass);
  1359. addOrganizationElement(pkg, theClass);
  1360. if (st._classAdded) st._classAdded(theClass);
  1361. return theClass;
  1362. }
  1363. st.removeClass = function (klass) {
  1364. removeOrganizationElement(klass.pkg, klass);
  1365. classes.removeElement(klass);
  1366. removeSubclass(klass);
  1367. delete globals[klass.className];
  1368. };
  1369. function addSubclass(klass) {
  1370. if (klass.superclass) {
  1371. klass.superclass.subclasses.addElement(klass);
  1372. }
  1373. }
  1374. function removeSubclass(klass) {
  1375. if (klass.superclass) {
  1376. klass.superclass.subclasses.removeElement(klass);
  1377. }
  1378. }
  1379. /* Create a new class coupling with a JavaScript constructor,
  1380. and add it to the global smalltalk object.*/
  1381. this.addCoupledClass = function (className, superclass, pkgName, fn) {
  1382. return rawAddClass(pkgName, className, superclass, null, fn);
  1383. };
  1384. /* Create an alias for an existing class */
  1385. st.alias = function (klass, alias) {
  1386. globals[alias] = klass;
  1387. };
  1388. /* Answer all registered Smalltalk classes */
  1389. //TODO: remove the function and make smalltalk.classes an array
  1390. st.classes = this.classes = function () {
  1391. return classes;
  1392. };
  1393. function metaSubclasses(metaclass) {
  1394. return metaclass.instanceClass.subclasses
  1395. .filter(function (each) {
  1396. return !each.meta;
  1397. })
  1398. .map(function (each) {
  1399. return each.klass;
  1400. });
  1401. }
  1402. st.metaSubclasses = metaSubclasses;
  1403. st.traverseClassTree = function (klass, fn) {
  1404. var queue = [klass];
  1405. for (var i = 0; i < queue.length; ++i) {
  1406. var item = queue[i];
  1407. fn(item);
  1408. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  1409. queue.push.apply(queue, subclasses);
  1410. }
  1411. };
  1412. }
  1413. MethodsBrik.deps = ["organize", "selectors", "root", "selectorConversion"];
  1414. function MethodsBrik(brikz, st) {
  1415. var addOrganizationElement = brikz.organize.addOrganizationElement;
  1416. var registerSelector = brikz.selectors.registerSelector;
  1417. var SmalltalkObject = brikz.root.Object;
  1418. function SmalltalkMethod() {
  1419. }
  1420. inherits(SmalltalkMethod, SmalltalkObject);
  1421. this.__init__ = function () {
  1422. var globals = brikz.smalltalkGlobals.globals;
  1423. var addCoupledClass = brikz.classes.addCoupledClass;
  1424. st.addPackage("Kernel-Methods");
  1425. addCoupledClass("CompiledMethod", globals.Object, "Kernel-Methods", SmalltalkMethod);
  1426. };
  1427. this.__init__.once = true;
  1428. /* Smalltalk method object. To add a method to a class,
  1429. use smalltalk.addMethod() */
  1430. st.method = function (spec) {
  1431. var that = new SmalltalkMethod();
  1432. var selector = spec.selector;
  1433. that.selector = selector;
  1434. that.jsSelector = st.st2js(selector);
  1435. that.args = spec.args || {};
  1436. that.protocol = spec.protocol;
  1437. that.source = spec.source;
  1438. that.messageSends = spec.messageSends || [];
  1439. that.referencedClasses = spec.referencedClasses || [];
  1440. that.fn = spec.fn;
  1441. return that;
  1442. };
  1443. /* Add/remove a method to/from a class */
  1444. st.addMethod = function (method, klass) {
  1445. klass.methods[method.selector] = method;
  1446. method.methodClass = klass;
  1447. // During the bootstrap, #addCompiledMethod is not used.
  1448. // Therefore we populate the organizer here too
  1449. addOrganizationElement(klass, method.protocol);
  1450. var newSelectors = [];
  1451. function selectorInUse(stSelector) {
  1452. var pair = registerSelector(stSelector);
  1453. if (pair) {
  1454. newSelectors.push(pair);
  1455. }
  1456. }
  1457. selectorInUse(method.selector);
  1458. method.messageSends.forEach(selectorInUse);
  1459. if (st._methodAdded) st._methodAdded(method, klass);
  1460. if (st._selectorsAdded) st._selectorsAdded(newSelectors);
  1461. };
  1462. st.removeMethod = function (method, klass) {
  1463. if (klass !== method.methodClass) {
  1464. throw new Error(
  1465. "Refusing to remove method " +
  1466. method.methodClass.className + ">>" + method.selector +
  1467. " from different class " +
  1468. klass.className);
  1469. }
  1470. delete klass.methods[method.selector];
  1471. if (st._methodRemoved) st._methodRemoved(method, klass);
  1472. // Do *not* delete protocols from here.
  1473. // This is handled by #removeCompiledMethod
  1474. };
  1475. }
  1476. function AugmentsBrik(brikz, st) {
  1477. /* Array extensions */
  1478. Array.prototype.addElement = function (el) {
  1479. if (typeof el === 'undefined') {
  1480. return;
  1481. }
  1482. if (this.indexOf(el) == -1) {
  1483. this.push(el);
  1484. }
  1485. };
  1486. Array.prototype.removeElement = function (el) {
  1487. var i = this.indexOf(el);
  1488. if (i !== -1) {
  1489. this.splice(i, 1);
  1490. }
  1491. };
  1492. }
  1493. SmalltalkInitBrik.deps = ["globals", "classes"];
  1494. function SmalltalkInitBrik(brikz, st) {
  1495. var globals = brikz.smalltalkGlobals.globals;
  1496. var initialized = false;
  1497. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  1498. require(['./kernel-runtime'], resolve, reject);
  1499. });
  1500. /* Smalltalk initialization. Called on page load */
  1501. st.initialize = function () {
  1502. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  1503. if (initialized) {
  1504. return;
  1505. }
  1506. configureWithRuntime(brikz);
  1507. /* Alias definitions */
  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 smalltalk object */
  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 -> nil,
  1589. * plain JS object -> wrapped JS object,
  1590. * otherwise unchanged
  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<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<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<\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< 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< 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<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<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<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<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<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<\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<\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: "throw:",
  2809. protocol: 'error handling',
  2810. fn: function (anObject){
  2811. var self=this;
  2812. return $core.withContext(function($ctx1) {
  2813. throw anObject ;
  2814. return self;
  2815. }, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},$globals.Object)});
  2816. },
  2817. args: ["anObject"],
  2818. source: "throw: anObject\x0a\x09< throw anObject >",
  2819. referencedClasses: [],
  2820. messageSends: []
  2821. }),
  2822. $globals.Object);
  2823. $core.addMethod(
  2824. $core.method({
  2825. selector: "value",
  2826. protocol: 'evaluating',
  2827. fn: function (){
  2828. var self=this;
  2829. return $core.withContext(function($ctx1) {
  2830. return self.valueOf();
  2831. return self;
  2832. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  2833. },
  2834. args: [],
  2835. source: "value\x0a\x09<return self.valueOf()>",
  2836. referencedClasses: [],
  2837. messageSends: []
  2838. }),
  2839. $globals.Object);
  2840. $core.addMethod(
  2841. $core.method({
  2842. selector: "accessorProtocolWith:",
  2843. protocol: 'helios',
  2844. fn: function (aGenerator){
  2845. var self=this;
  2846. return $core.withContext(function($ctx1) {
  2847. $recv(aGenerator)._accessorProtocolForObject();
  2848. return self;
  2849. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2850. },
  2851. args: ["aGenerator"],
  2852. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  2853. referencedClasses: [],
  2854. messageSends: ["accessorProtocolForObject"]
  2855. }),
  2856. $globals.Object.klass);
  2857. $core.addMethod(
  2858. $core.method({
  2859. selector: "accessorsSourceCodesWith:",
  2860. protocol: 'helios',
  2861. fn: function (aGenerator){
  2862. var self=this;
  2863. return $core.withContext(function($ctx1) {
  2864. $recv(aGenerator)._accessorsForObject();
  2865. return self;
  2866. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2867. },
  2868. args: ["aGenerator"],
  2869. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  2870. referencedClasses: [],
  2871. messageSends: ["accessorsForObject"]
  2872. }),
  2873. $globals.Object.klass);
  2874. $core.addMethod(
  2875. $core.method({
  2876. selector: "initialize",
  2877. protocol: 'initialization',
  2878. fn: function (){
  2879. var self=this;
  2880. return self;
  2881. },
  2882. args: [],
  2883. source: "initialize\x0a\x09\x22no op\x22",
  2884. referencedClasses: [],
  2885. messageSends: []
  2886. }),
  2887. $globals.Object.klass);
  2888. $core.addMethod(
  2889. $core.method({
  2890. selector: "initializeProtocolWith:",
  2891. protocol: 'helios',
  2892. fn: function (aGenerator){
  2893. var self=this;
  2894. return $core.withContext(function($ctx1) {
  2895. $recv(aGenerator)._initializeProtocolForObject();
  2896. return self;
  2897. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2898. },
  2899. args: ["aGenerator"],
  2900. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  2901. referencedClasses: [],
  2902. messageSends: ["initializeProtocolForObject"]
  2903. }),
  2904. $globals.Object.klass);
  2905. $core.addMethod(
  2906. $core.method({
  2907. selector: "initializeSourceCodesWith:",
  2908. protocol: 'helios',
  2909. fn: function (aGenerator){
  2910. var self=this;
  2911. return $core.withContext(function($ctx1) {
  2912. $recv(aGenerator)._initializeForObject();
  2913. return self;
  2914. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  2915. },
  2916. args: ["aGenerator"],
  2917. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  2918. referencedClasses: [],
  2919. messageSends: ["initializeForObject"]
  2920. }),
  2921. $globals.Object.klass);
  2922. $core.addClass('Boolean', $globals.Object, [], 'Kernel-Objects');
  2923. $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: [ ... ]";
  2924. $core.addMethod(
  2925. $core.method({
  2926. selector: "&",
  2927. protocol: 'controlling',
  2928. fn: function (aBoolean){
  2929. var self=this;
  2930. return $core.withContext(function($ctx1) {
  2931. if(self == true) {
  2932. return aBoolean;
  2933. } else {
  2934. return false;
  2935. }
  2936. ;
  2937. return self;
  2938. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  2939. },
  2940. args: ["aBoolean"],
  2941. source: "& aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBoolean;\x0a\x09\x09} else {\x0a\x09\x09return false;\x0a\x09\x09}\x0a\x09>",
  2942. referencedClasses: [],
  2943. messageSends: []
  2944. }),
  2945. $globals.Boolean);
  2946. $core.addMethod(
  2947. $core.method({
  2948. selector: "==",
  2949. protocol: 'comparing',
  2950. fn: function (aBoolean){
  2951. var self=this;
  2952. return $core.withContext(function($ctx1) {
  2953. if (typeof aBoolean === "boolean") return self.valueOf() === aBoolean;
  2954. else if (aBoolean != null && typeof aBoolean === "object") return self.valueOf() === aBoolean.valueOf();
  2955. else return false;;
  2956. return self;
  2957. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  2958. },
  2959. args: ["aBoolean"],
  2960. source: "== aBoolean\x0a<\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>",
  2961. referencedClasses: [],
  2962. messageSends: []
  2963. }),
  2964. $globals.Boolean);
  2965. $core.addMethod(
  2966. $core.method({
  2967. selector: "and:",
  2968. protocol: 'controlling',
  2969. fn: function (aBlock){
  2970. var self=this;
  2971. return $core.withContext(function($ctx1) {
  2972. var $1;
  2973. $1=self.__eq(true);
  2974. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  2975. return false;
  2976. }));
  2977. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  2978. },
  2979. args: ["aBlock"],
  2980. source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]",
  2981. referencedClasses: [],
  2982. messageSends: ["ifTrue:ifFalse:", "="]
  2983. }),
  2984. $globals.Boolean);
  2985. $core.addMethod(
  2986. $core.method({
  2987. selector: "asBit",
  2988. protocol: 'converting',
  2989. fn: function (){
  2990. var self=this;
  2991. return $core.withContext(function($ctx1) {
  2992. if($core.assert(self)){
  2993. return (1);
  2994. } else {
  2995. return (0);
  2996. };
  2997. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  2998. },
  2999. args: [],
  3000. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3001. referencedClasses: [],
  3002. messageSends: ["ifTrue:ifFalse:"]
  3003. }),
  3004. $globals.Boolean);
  3005. $core.addMethod(
  3006. $core.method({
  3007. selector: "asJSON",
  3008. protocol: 'converting',
  3009. fn: function (){
  3010. var self=this;
  3011. return self;
  3012. },
  3013. args: [],
  3014. source: "asJSON\x0a\x09^ self",
  3015. referencedClasses: [],
  3016. messageSends: []
  3017. }),
  3018. $globals.Boolean);
  3019. $core.addMethod(
  3020. $core.method({
  3021. selector: "asString",
  3022. protocol: 'converting',
  3023. fn: function (){
  3024. var self=this;
  3025. return $core.withContext(function($ctx1) {
  3026. return self.toString() ;
  3027. return self;
  3028. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3029. },
  3030. args: [],
  3031. source: "asString\x0a\x09< return self.toString() >",
  3032. referencedClasses: [],
  3033. messageSends: []
  3034. }),
  3035. $globals.Boolean);
  3036. $core.addMethod(
  3037. $core.method({
  3038. selector: "deepCopy",
  3039. protocol: 'copying',
  3040. fn: function (){
  3041. var self=this;
  3042. return self;
  3043. },
  3044. args: [],
  3045. source: "deepCopy\x0a\x09^ self",
  3046. referencedClasses: [],
  3047. messageSends: []
  3048. }),
  3049. $globals.Boolean);
  3050. $core.addMethod(
  3051. $core.method({
  3052. selector: "ifFalse:",
  3053. protocol: 'controlling',
  3054. fn: function (aBlock){
  3055. var self=this;
  3056. return $core.withContext(function($ctx1) {
  3057. return self._ifTrue_ifFalse_((function(){
  3058. }),aBlock);
  3059. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3060. },
  3061. args: ["aBlock"],
  3062. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3063. referencedClasses: [],
  3064. messageSends: ["ifTrue:ifFalse:"]
  3065. }),
  3066. $globals.Boolean);
  3067. $core.addMethod(
  3068. $core.method({
  3069. selector: "ifFalse:ifTrue:",
  3070. protocol: 'controlling',
  3071. fn: function (aBlock,anotherBlock){
  3072. var self=this;
  3073. return $core.withContext(function($ctx1) {
  3074. return self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3075. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3076. },
  3077. args: ["aBlock", "anotherBlock"],
  3078. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3079. referencedClasses: [],
  3080. messageSends: ["ifTrue:ifFalse:"]
  3081. }),
  3082. $globals.Boolean);
  3083. $core.addMethod(
  3084. $core.method({
  3085. selector: "ifTrue:",
  3086. protocol: 'controlling',
  3087. fn: function (aBlock){
  3088. var self=this;
  3089. return $core.withContext(function($ctx1) {
  3090. return self._ifTrue_ifFalse_(aBlock,(function(){
  3091. }));
  3092. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3093. },
  3094. args: ["aBlock"],
  3095. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3096. referencedClasses: [],
  3097. messageSends: ["ifTrue:ifFalse:"]
  3098. }),
  3099. $globals.Boolean);
  3100. $core.addMethod(
  3101. $core.method({
  3102. selector: "ifTrue:ifFalse:",
  3103. protocol: 'controlling',
  3104. fn: function (aBlock,anotherBlock){
  3105. var self=this;
  3106. return $core.withContext(function($ctx1) {
  3107. if(self == true) {
  3108. return aBlock._value();
  3109. } else {
  3110. return anotherBlock._value();
  3111. }
  3112. ;
  3113. return self;
  3114. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3115. },
  3116. args: ["aBlock", "anotherBlock"],
  3117. source: "ifTrue: aBlock ifFalse: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return aBlock._value();\x0a\x09\x09} else {\x0a\x09\x09return anotherBlock._value();\x0a\x09\x09}\x0a\x09>",
  3118. referencedClasses: [],
  3119. messageSends: []
  3120. }),
  3121. $globals.Boolean);
  3122. $core.addMethod(
  3123. $core.method({
  3124. selector: "isBoolean",
  3125. protocol: 'testing',
  3126. fn: function (){
  3127. var self=this;
  3128. return true;
  3129. },
  3130. args: [],
  3131. source: "isBoolean\x0a\x09^ true",
  3132. referencedClasses: [],
  3133. messageSends: []
  3134. }),
  3135. $globals.Boolean);
  3136. $core.addMethod(
  3137. $core.method({
  3138. selector: "isImmutable",
  3139. protocol: 'testing',
  3140. fn: function (){
  3141. var self=this;
  3142. return true;
  3143. },
  3144. args: [],
  3145. source: "isImmutable\x0a\x09^ true",
  3146. referencedClasses: [],
  3147. messageSends: []
  3148. }),
  3149. $globals.Boolean);
  3150. $core.addMethod(
  3151. $core.method({
  3152. selector: "not",
  3153. protocol: 'controlling',
  3154. fn: function (){
  3155. var self=this;
  3156. return $core.withContext(function($ctx1) {
  3157. return self.__eq(false);
  3158. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  3159. },
  3160. args: [],
  3161. source: "not\x0a\x09^ self = false",
  3162. referencedClasses: [],
  3163. messageSends: ["="]
  3164. }),
  3165. $globals.Boolean);
  3166. $core.addMethod(
  3167. $core.method({
  3168. selector: "or:",
  3169. protocol: 'controlling',
  3170. fn: function (aBlock){
  3171. var self=this;
  3172. return $core.withContext(function($ctx1) {
  3173. var $1;
  3174. $1=self.__eq(true);
  3175. return $recv($1)._ifTrue_ifFalse_((function(){
  3176. return true;
  3177. }),aBlock);
  3178. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  3179. },
  3180. args: ["aBlock"],
  3181. source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock",
  3182. referencedClasses: [],
  3183. messageSends: ["ifTrue:ifFalse:", "="]
  3184. }),
  3185. $globals.Boolean);
  3186. $core.addMethod(
  3187. $core.method({
  3188. selector: "printOn:",
  3189. protocol: 'printing',
  3190. fn: function (aStream){
  3191. var self=this;
  3192. return $core.withContext(function($ctx1) {
  3193. $recv(aStream)._nextPutAll_(self._asString());
  3194. return self;
  3195. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  3196. },
  3197. args: ["aStream"],
  3198. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3199. referencedClasses: [],
  3200. messageSends: ["nextPutAll:", "asString"]
  3201. }),
  3202. $globals.Boolean);
  3203. $core.addMethod(
  3204. $core.method({
  3205. selector: "shallowCopy",
  3206. protocol: 'copying',
  3207. fn: function (){
  3208. var self=this;
  3209. return self;
  3210. },
  3211. args: [],
  3212. source: "shallowCopy\x0a\x09^ self",
  3213. referencedClasses: [],
  3214. messageSends: []
  3215. }),
  3216. $globals.Boolean);
  3217. $core.addMethod(
  3218. $core.method({
  3219. selector: "|",
  3220. protocol: 'controlling',
  3221. fn: function (aBoolean){
  3222. var self=this;
  3223. return $core.withContext(function($ctx1) {
  3224. if(self == true) {
  3225. return true;
  3226. } else {
  3227. return aBoolean;
  3228. }
  3229. ;
  3230. return self;
  3231. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  3232. },
  3233. args: ["aBoolean"],
  3234. source: "| aBoolean\x0a\x09<\x0a\x09\x09if(self == true) {\x0a\x09\x09return true;\x0a\x09\x09} else {\x0a\x09\x09return aBoolean;\x0a\x09\x09}\x0a\x09>",
  3235. referencedClasses: [],
  3236. messageSends: []
  3237. }),
  3238. $globals.Boolean);
  3239. $core.addClass('Date', $globals.Object, [], 'Kernel-Objects');
  3240. $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.).";
  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<return self + aDate>",
  3254. referencedClasses: [],
  3255. messageSends: []
  3256. }),
  3257. $globals.Date);
  3258. $core.addMethod(
  3259. $core.method({
  3260. selector: "-",
  3261. protocol: 'arithmetic',
  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<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<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. return self <= aDate;
  3300. return self;
  3301. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  3302. },
  3303. args: ["aDate"],
  3304. source: "<= aDate\x0a\x09<return self <= aDate>",
  3305. referencedClasses: [],
  3306. messageSends: []
  3307. }),
  3308. $globals.Date);
  3309. $core.addMethod(
  3310. $core.method({
  3311. selector: "=",
  3312. protocol: 'comparing',
  3313. fn: function (aDate){
  3314. var self=this;
  3315. return $core.withContext(function($ctx1) {
  3316. var $2,$1,$3;
  3317. $2=$recv(aDate)._class();
  3318. $ctx1.sendIdx["class"]=1;
  3319. $1=$recv($2).__eq_eq(self._class());
  3320. $ctx1.sendIdx["=="]=1;
  3321. return $recv($1)._and_((function(){
  3322. return $core.withContext(function($ctx2) {
  3323. $3=self._asMilliseconds();
  3324. $ctx2.sendIdx["asMilliseconds"]=1;
  3325. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  3326. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3327. }));
  3328. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  3329. },
  3330. args: ["aDate"],
  3331. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  3332. referencedClasses: [],
  3333. messageSends: ["and:", "==", "class", "asMilliseconds"]
  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<return self >> aDate>",
  3349. referencedClasses: [],
  3350. messageSends: []
  3351. }),
  3352. $globals.Date);
  3353. $core.addMethod(
  3354. $core.method({
  3355. selector: ">=",
  3356. protocol: 'comparing',
  3357. fn: function (aDate){
  3358. var self=this;
  3359. return $core.withContext(function($ctx1) {
  3360. return self >= aDate;
  3361. return self;
  3362. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  3363. },
  3364. args: ["aDate"],
  3365. source: ">= aDate\x0a\x09<return self >>= aDate>",
  3366. referencedClasses: [],
  3367. messageSends: []
  3368. }),
  3369. $globals.Date);
  3370. $core.addMethod(
  3371. $core.method({
  3372. selector: "asDateString",
  3373. protocol: 'converting',
  3374. fn: function (){
  3375. var self=this;
  3376. return $core.withContext(function($ctx1) {
  3377. return self.toDateString();
  3378. return self;
  3379. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  3380. },
  3381. args: [],
  3382. source: "asDateString\x0a\x09<return self.toDateString()>",
  3383. referencedClasses: [],
  3384. messageSends: []
  3385. }),
  3386. $globals.Date);
  3387. $core.addMethod(
  3388. $core.method({
  3389. selector: "asLocaleString",
  3390. protocol: 'converting',
  3391. fn: function (){
  3392. var self=this;
  3393. return $core.withContext(function($ctx1) {
  3394. return self.toLocaleString();
  3395. return self;
  3396. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  3397. },
  3398. args: [],
  3399. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  3400. referencedClasses: [],
  3401. messageSends: []
  3402. }),
  3403. $globals.Date);
  3404. $core.addMethod(
  3405. $core.method({
  3406. selector: "asMilliseconds",
  3407. protocol: 'converting',
  3408. fn: function (){
  3409. var self=this;
  3410. return $core.withContext(function($ctx1) {
  3411. return self._time();
  3412. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  3413. },
  3414. args: [],
  3415. source: "asMilliseconds\x0a\x09^ self time",
  3416. referencedClasses: [],
  3417. messageSends: ["time"]
  3418. }),
  3419. $globals.Date);
  3420. $core.addMethod(
  3421. $core.method({
  3422. selector: "asNumber",
  3423. protocol: 'converting',
  3424. fn: function (){
  3425. var self=this;
  3426. return $core.withContext(function($ctx1) {
  3427. return self._asMilliseconds();
  3428. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  3429. },
  3430. args: [],
  3431. source: "asNumber\x0a\x09^ self asMilliseconds",
  3432. referencedClasses: [],
  3433. messageSends: ["asMilliseconds"]
  3434. }),
  3435. $globals.Date);
  3436. $core.addMethod(
  3437. $core.method({
  3438. selector: "asString",
  3439. protocol: 'converting',
  3440. fn: function (){
  3441. var self=this;
  3442. return $core.withContext(function($ctx1) {
  3443. return self.toString();
  3444. return self;
  3445. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  3446. },
  3447. args: [],
  3448. source: "asString\x0a\x09<return self.toString()>",
  3449. referencedClasses: [],
  3450. messageSends: []
  3451. }),
  3452. $globals.Date);
  3453. $core.addMethod(
  3454. $core.method({
  3455. selector: "asTimeString",
  3456. protocol: 'converting',
  3457. fn: function (){
  3458. var self=this;
  3459. return $core.withContext(function($ctx1) {
  3460. return self.toTimeString();
  3461. return self;
  3462. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  3463. },
  3464. args: [],
  3465. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  3466. referencedClasses: [],
  3467. messageSends: []
  3468. }),
  3469. $globals.Date);
  3470. $core.addMethod(
  3471. $core.method({
  3472. selector: "day",
  3473. protocol: 'accessing',
  3474. fn: function (){
  3475. var self=this;
  3476. return $core.withContext(function($ctx1) {
  3477. return self._dayOfWeek();
  3478. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  3479. },
  3480. args: [],
  3481. source: "day\x0a\x09^ self dayOfWeek",
  3482. referencedClasses: [],
  3483. messageSends: ["dayOfWeek"]
  3484. }),
  3485. $globals.Date);
  3486. $core.addMethod(
  3487. $core.method({
  3488. selector: "day:",
  3489. protocol: 'accessing',
  3490. fn: function (aNumber){
  3491. var self=this;
  3492. return $core.withContext(function($ctx1) {
  3493. self._dayOfWeek_(aNumber);
  3494. return self;
  3495. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  3496. },
  3497. args: ["aNumber"],
  3498. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  3499. referencedClasses: [],
  3500. messageSends: ["dayOfWeek:"]
  3501. }),
  3502. $globals.Date);
  3503. $core.addMethod(
  3504. $core.method({
  3505. selector: "dayOfMonth",
  3506. protocol: 'accessing',
  3507. fn: function (){
  3508. var self=this;
  3509. return $core.withContext(function($ctx1) {
  3510. return self.getDate();
  3511. return self;
  3512. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  3513. },
  3514. args: [],
  3515. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  3516. referencedClasses: [],
  3517. messageSends: []
  3518. }),
  3519. $globals.Date);
  3520. $core.addMethod(
  3521. $core.method({
  3522. selector: "dayOfMonth:",
  3523. protocol: 'accessing',
  3524. fn: function (aNumber){
  3525. var self=this;
  3526. return $core.withContext(function($ctx1) {
  3527. self.setDate(aNumber);
  3528. return self;
  3529. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  3530. },
  3531. args: ["aNumber"],
  3532. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  3533. referencedClasses: [],
  3534. messageSends: []
  3535. }),
  3536. $globals.Date);
  3537. $core.addMethod(
  3538. $core.method({
  3539. selector: "dayOfWeek",
  3540. protocol: 'accessing',
  3541. fn: function (){
  3542. var self=this;
  3543. return $core.withContext(function($ctx1) {
  3544. return self.getDay() + 1;
  3545. return self;
  3546. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  3547. },
  3548. args: [],
  3549. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  3550. referencedClasses: [],
  3551. messageSends: []
  3552. }),
  3553. $globals.Date);
  3554. $core.addMethod(
  3555. $core.method({
  3556. selector: "dayOfWeek:",
  3557. protocol: 'accessing',
  3558. fn: function (aNumber){
  3559. var self=this;
  3560. return $core.withContext(function($ctx1) {
  3561. return self.setDay(aNumber - 1);
  3562. return self;
  3563. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  3564. },
  3565. args: ["aNumber"],
  3566. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  3567. referencedClasses: [],
  3568. messageSends: []
  3569. }),
  3570. $globals.Date);
  3571. $core.addMethod(
  3572. $core.method({
  3573. selector: "hours",
  3574. protocol: 'accessing',
  3575. fn: function (){
  3576. var self=this;
  3577. return $core.withContext(function($ctx1) {
  3578. return self.getHours();
  3579. return self;
  3580. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  3581. },
  3582. args: [],
  3583. source: "hours\x0a\x09<return self.getHours()>",
  3584. referencedClasses: [],
  3585. messageSends: []
  3586. }),
  3587. $globals.Date);
  3588. $core.addMethod(
  3589. $core.method({
  3590. selector: "hours:",
  3591. protocol: 'accessing',
  3592. fn: function (aNumber){
  3593. var self=this;
  3594. return $core.withContext(function($ctx1) {
  3595. self.setHours(aNumber);
  3596. return self;
  3597. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  3598. },
  3599. args: ["aNumber"],
  3600. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  3601. referencedClasses: [],
  3602. messageSends: []
  3603. }),
  3604. $globals.Date);
  3605. $core.addMethod(
  3606. $core.method({
  3607. selector: "milliseconds",
  3608. protocol: 'accessing',
  3609. fn: function (){
  3610. var self=this;
  3611. return $core.withContext(function($ctx1) {
  3612. return self.getMilliseconds();
  3613. return self;
  3614. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  3615. },
  3616. args: [],
  3617. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  3618. referencedClasses: [],
  3619. messageSends: []
  3620. }),
  3621. $globals.Date);
  3622. $core.addMethod(
  3623. $core.method({
  3624. selector: "milliseconds:",
  3625. protocol: 'accessing',
  3626. fn: function (aNumber){
  3627. var self=this;
  3628. return $core.withContext(function($ctx1) {
  3629. self.setMilliseconds(aNumber);
  3630. return self;
  3631. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  3632. },
  3633. args: ["aNumber"],
  3634. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  3635. referencedClasses: [],
  3636. messageSends: []
  3637. }),
  3638. $globals.Date);
  3639. $core.addMethod(
  3640. $core.method({
  3641. selector: "minutes",
  3642. protocol: 'accessing',
  3643. fn: function (){
  3644. var self=this;
  3645. return $core.withContext(function($ctx1) {
  3646. return self.getMinutes();
  3647. return self;
  3648. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  3649. },
  3650. args: [],
  3651. source: "minutes\x0a\x09<return self.getMinutes()>",
  3652. referencedClasses: [],
  3653. messageSends: []
  3654. }),
  3655. $globals.Date);
  3656. $core.addMethod(
  3657. $core.method({
  3658. selector: "minutes:",
  3659. protocol: 'accessing',
  3660. fn: function (aNumber){
  3661. var self=this;
  3662. return $core.withContext(function($ctx1) {
  3663. self.setMinutes(aNumber);
  3664. return self;
  3665. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  3666. },
  3667. args: ["aNumber"],
  3668. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  3669. referencedClasses: [],
  3670. messageSends: []
  3671. }),
  3672. $globals.Date);
  3673. $core.addMethod(
  3674. $core.method({
  3675. selector: "month",
  3676. protocol: 'accessing',
  3677. fn: function (){
  3678. var self=this;
  3679. return $core.withContext(function($ctx1) {
  3680. return self.getMonth() + 1;
  3681. return self;
  3682. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  3683. },
  3684. args: [],
  3685. source: "month\x0a\x09<return self.getMonth() + 1>",
  3686. referencedClasses: [],
  3687. messageSends: []
  3688. }),
  3689. $globals.Date);
  3690. $core.addMethod(
  3691. $core.method({
  3692. selector: "month:",
  3693. protocol: 'accessing',
  3694. fn: function (aNumber){
  3695. var self=this;
  3696. return $core.withContext(function($ctx1) {
  3697. self.setMonth(aNumber - 1);
  3698. return self;
  3699. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  3700. },
  3701. args: ["aNumber"],
  3702. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  3703. referencedClasses: [],
  3704. messageSends: []
  3705. }),
  3706. $globals.Date);
  3707. $core.addMethod(
  3708. $core.method({
  3709. selector: "printOn:",
  3710. protocol: 'printing',
  3711. fn: function (aStream){
  3712. var self=this;
  3713. return $core.withContext(function($ctx1) {
  3714. $recv(aStream)._nextPutAll_(self._asString());
  3715. return self;
  3716. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  3717. },
  3718. args: ["aStream"],
  3719. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3720. referencedClasses: [],
  3721. messageSends: ["nextPutAll:", "asString"]
  3722. }),
  3723. $globals.Date);
  3724. $core.addMethod(
  3725. $core.method({
  3726. selector: "seconds",
  3727. protocol: 'accessing',
  3728. fn: function (){
  3729. var self=this;
  3730. return $core.withContext(function($ctx1) {
  3731. return self.getSeconds();
  3732. return self;
  3733. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  3734. },
  3735. args: [],
  3736. source: "seconds\x0a\x09<return self.getSeconds()>",
  3737. referencedClasses: [],
  3738. messageSends: []
  3739. }),
  3740. $globals.Date);
  3741. $core.addMethod(
  3742. $core.method({
  3743. selector: "seconds:",
  3744. protocol: 'accessing',
  3745. fn: function (aNumber){
  3746. var self=this;
  3747. return $core.withContext(function($ctx1) {
  3748. self.setSeconds(aNumber);
  3749. return self;
  3750. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  3751. },
  3752. args: ["aNumber"],
  3753. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  3754. referencedClasses: [],
  3755. messageSends: []
  3756. }),
  3757. $globals.Date);
  3758. $core.addMethod(
  3759. $core.method({
  3760. selector: "time",
  3761. protocol: 'accessing',
  3762. fn: function (){
  3763. var self=this;
  3764. return $core.withContext(function($ctx1) {
  3765. return self.getTime();
  3766. return self;
  3767. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  3768. },
  3769. args: [],
  3770. source: "time\x0a\x09<return self.getTime()>",
  3771. referencedClasses: [],
  3772. messageSends: []
  3773. }),
  3774. $globals.Date);
  3775. $core.addMethod(
  3776. $core.method({
  3777. selector: "time:",
  3778. protocol: 'accessing',
  3779. fn: function (aNumber){
  3780. var self=this;
  3781. return $core.withContext(function($ctx1) {
  3782. self.setTime(aNumber);
  3783. return self;
  3784. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  3785. },
  3786. args: ["aNumber"],
  3787. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  3788. referencedClasses: [],
  3789. messageSends: []
  3790. }),
  3791. $globals.Date);
  3792. $core.addMethod(
  3793. $core.method({
  3794. selector: "year",
  3795. protocol: 'accessing',
  3796. fn: function (){
  3797. var self=this;
  3798. return $core.withContext(function($ctx1) {
  3799. return self.getFullYear();
  3800. return self;
  3801. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  3802. },
  3803. args: [],
  3804. source: "year\x0a\x09<return self.getFullYear()>",
  3805. referencedClasses: [],
  3806. messageSends: []
  3807. }),
  3808. $globals.Date);
  3809. $core.addMethod(
  3810. $core.method({
  3811. selector: "year:",
  3812. protocol: 'accessing',
  3813. fn: function (aNumber){
  3814. var self=this;
  3815. return $core.withContext(function($ctx1) {
  3816. self.setFullYear(aNumber);
  3817. return self;
  3818. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  3819. },
  3820. args: ["aNumber"],
  3821. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  3822. referencedClasses: [],
  3823. messageSends: []
  3824. }),
  3825. $globals.Date);
  3826. $core.addMethod(
  3827. $core.method({
  3828. selector: "classTag",
  3829. protocol: 'accessing',
  3830. fn: function (){
  3831. var self=this;
  3832. return "magnitude";
  3833. },
  3834. args: [],
  3835. 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'",
  3836. referencedClasses: [],
  3837. messageSends: []
  3838. }),
  3839. $globals.Date.klass);
  3840. $core.addMethod(
  3841. $core.method({
  3842. selector: "fromMilliseconds:",
  3843. protocol: 'instance creation',
  3844. fn: function (aNumber){
  3845. var self=this;
  3846. return $core.withContext(function($ctx1) {
  3847. return self._new_(aNumber);
  3848. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.klass)});
  3849. },
  3850. args: ["aNumber"],
  3851. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  3852. referencedClasses: [],
  3853. messageSends: ["new:"]
  3854. }),
  3855. $globals.Date.klass);
  3856. $core.addMethod(
  3857. $core.method({
  3858. selector: "fromSeconds:",
  3859. protocol: 'instance creation',
  3860. fn: function (aNumber){
  3861. var self=this;
  3862. return $core.withContext(function($ctx1) {
  3863. return self._fromMilliseconds_($recv(aNumber).__star((1000)));
  3864. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.klass)});
  3865. },
  3866. args: ["aNumber"],
  3867. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  3868. referencedClasses: [],
  3869. messageSends: ["fromMilliseconds:", "*"]
  3870. }),
  3871. $globals.Date.klass);
  3872. $core.addMethod(
  3873. $core.method({
  3874. selector: "fromString:",
  3875. protocol: 'instance creation',
  3876. fn: function (aString){
  3877. var self=this;
  3878. return $core.withContext(function($ctx1) {
  3879. return self._new_(aString);
  3880. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.klass)});
  3881. },
  3882. args: ["aString"],
  3883. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  3884. referencedClasses: [],
  3885. messageSends: ["new:"]
  3886. }),
  3887. $globals.Date.klass);
  3888. $core.addMethod(
  3889. $core.method({
  3890. selector: "millisecondsToRun:",
  3891. protocol: 'instance creation',
  3892. fn: function (aBlock){
  3893. var self=this;
  3894. var t;
  3895. return $core.withContext(function($ctx1) {
  3896. t=$recv($globals.Date)._now();
  3897. $ctx1.sendIdx["now"]=1;
  3898. $recv(aBlock)._value();
  3899. return $recv($recv($globals.Date)._now()).__minus(t);
  3900. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.klass)});
  3901. },
  3902. args: ["aBlock"],
  3903. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  3904. referencedClasses: ["Date"],
  3905. messageSends: ["now", "value", "-"]
  3906. }),
  3907. $globals.Date.klass);
  3908. $core.addMethod(
  3909. $core.method({
  3910. selector: "new:",
  3911. protocol: 'instance creation',
  3912. fn: function (anObject){
  3913. var self=this;
  3914. return $core.withContext(function($ctx1) {
  3915. return new Date(anObject);
  3916. return self;
  3917. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.klass)});
  3918. },
  3919. args: ["anObject"],
  3920. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  3921. referencedClasses: [],
  3922. messageSends: []
  3923. }),
  3924. $globals.Date.klass);
  3925. $core.addMethod(
  3926. $core.method({
  3927. selector: "now",
  3928. protocol: 'instance creation',
  3929. fn: function (){
  3930. var self=this;
  3931. return $core.withContext(function($ctx1) {
  3932. return self._today();
  3933. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.klass)});
  3934. },
  3935. args: [],
  3936. source: "now\x0a\x09^ self today",
  3937. referencedClasses: [],
  3938. messageSends: ["today"]
  3939. }),
  3940. $globals.Date.klass);
  3941. $core.addMethod(
  3942. $core.method({
  3943. selector: "today",
  3944. protocol: 'instance creation',
  3945. fn: function (){
  3946. var self=this;
  3947. return $core.withContext(function($ctx1) {
  3948. return self._new();
  3949. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.klass)});
  3950. },
  3951. args: [],
  3952. source: "today\x0a\x09^ self new",
  3953. referencedClasses: [],
  3954. messageSends: ["new"]
  3955. }),
  3956. $globals.Date.klass);
  3957. $core.addClass('Number', $globals.Object, [], 'Kernel-Objects');
  3958. $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 ].";
  3959. $core.addMethod(
  3960. $core.method({
  3961. selector: "&",
  3962. protocol: 'converting',
  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<return self & aNumber>",
  3972. referencedClasses: [],
  3973. messageSends: []
  3974. }),
  3975. $globals.Number);
  3976. $core.addMethod(
  3977. $core.method({
  3978. selector: "*",
  3979. protocol: 'arithmetic',
  3980. fn: function (aNumber){
  3981. var self=this;
  3982. return $core.withContext(function($ctx1) {
  3983. return self * aNumber;
  3984. return self;
  3985. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  3986. },
  3987. args: ["aNumber"],
  3988. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  3989. referencedClasses: [],
  3990. messageSends: []
  3991. }),
  3992. $globals.Number);
  3993. $core.addMethod(
  3994. $core.method({
  3995. selector: "**",
  3996. protocol: 'mathematical functions',
  3997. fn: function (exponent){
  3998. var self=this;
  3999. return $core.withContext(function($ctx1) {
  4000. return self._raisedTo_(exponent);
  4001. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4002. },
  4003. args: ["exponent"],
  4004. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4005. referencedClasses: [],
  4006. messageSends: ["raisedTo:"]
  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<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<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 self / aNumber;
  4051. return self;
  4052. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4053. },
  4054. args: ["aNumber"],
  4055. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  4056. referencedClasses: [],
  4057. messageSends: []
  4058. }),
  4059. $globals.Number);
  4060. $core.addMethod(
  4061. $core.method({
  4062. selector: "//",
  4063. protocol: 'arithmetic',
  4064. fn: function (aNumber){
  4065. var self=this;
  4066. return $core.withContext(function($ctx1) {
  4067. return $recv(self.__slash(aNumber))._floor();
  4068. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4069. },
  4070. args: ["aNumber"],
  4071. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4072. referencedClasses: [],
  4073. messageSends: ["floor", "/"]
  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<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. return self <= aNumber;
  4101. return self;
  4102. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  4103. },
  4104. args: ["aNumber"],
  4105. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  4106. referencedClasses: [],
  4107. messageSends: []
  4108. }),
  4109. $globals.Number);
  4110. $core.addMethod(
  4111. $core.method({
  4112. selector: "==",
  4113. protocol: 'comparing',
  4114. fn: function (aNumber){
  4115. var self=this;
  4116. return $core.withContext(function($ctx1) {
  4117. if (typeof aNumber === "number") return Number(self) === aNumber;
  4118. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  4119. else return false;;
  4120. return self;
  4121. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  4122. },
  4123. args: ["aNumber"],
  4124. source: "== aNumber\x0a<\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>",
  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<return self >> aNumber>",
  4142. referencedClasses: [],
  4143. messageSends: []
  4144. }),
  4145. $globals.Number);
  4146. $core.addMethod(
  4147. $core.method({
  4148. selector: ">=",
  4149. protocol: 'comparing',
  4150. fn: function (aNumber){
  4151. var self=this;
  4152. return $core.withContext(function($ctx1) {
  4153. return self >= aNumber;
  4154. return self;
  4155. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  4156. },
  4157. args: ["aNumber"],
  4158. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  4159. referencedClasses: [],
  4160. messageSends: []
  4161. }),
  4162. $globals.Number);
  4163. $core.addMethod(
  4164. $core.method({
  4165. selector: "@",
  4166. protocol: 'converting',
  4167. fn: function (aNumber){
  4168. var self=this;
  4169. return $core.withContext(function($ctx1) {
  4170. return $recv($globals.Point)._x_y_(self,aNumber);
  4171. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  4172. },
  4173. args: ["aNumber"],
  4174. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  4175. referencedClasses: ["Point"],
  4176. messageSends: ["x:y:"]
  4177. }),
  4178. $globals.Number);
  4179. $core.addMethod(
  4180. $core.method({
  4181. selector: "\x5c\x5c",
  4182. protocol: 'arithmetic',
  4183. fn: function (aNumber){
  4184. var self=this;
  4185. return $core.withContext(function($ctx1) {
  4186. return self % aNumber;
  4187. return self;
  4188. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  4189. },
  4190. args: ["aNumber"],
  4191. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  4192. referencedClasses: [],
  4193. messageSends: []
  4194. }),
  4195. $globals.Number);
  4196. $core.addMethod(
  4197. $core.method({
  4198. selector: "abs",
  4199. protocol: 'arithmetic',
  4200. fn: function (){
  4201. var self=this;
  4202. return $core.withContext(function($ctx1) {
  4203. return Math.abs(self);;
  4204. return self;
  4205. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  4206. },
  4207. args: [],
  4208. source: "abs\x0a\x09<return Math.abs(self);>",
  4209. referencedClasses: [],
  4210. messageSends: []
  4211. }),
  4212. $globals.Number);
  4213. $core.addMethod(
  4214. $core.method({
  4215. selector: "arcCos",
  4216. protocol: 'mathematical functions',
  4217. fn: function (){
  4218. var self=this;
  4219. return $core.withContext(function($ctx1) {
  4220. return Math.acos(self);;
  4221. return self;
  4222. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  4223. },
  4224. args: [],
  4225. source: "arcCos\x0a\x09<return Math.acos(self);>",
  4226. referencedClasses: [],
  4227. messageSends: []
  4228. }),
  4229. $globals.Number);
  4230. $core.addMethod(
  4231. $core.method({
  4232. selector: "arcSin",
  4233. protocol: 'mathematical functions',
  4234. fn: function (){
  4235. var self=this;
  4236. return $core.withContext(function($ctx1) {
  4237. return Math.asin(self);;
  4238. return self;
  4239. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  4240. },
  4241. args: [],
  4242. source: "arcSin\x0a\x09<return Math.asin(self);>",
  4243. referencedClasses: [],
  4244. messageSends: []
  4245. }),
  4246. $globals.Number);
  4247. $core.addMethod(
  4248. $core.method({
  4249. selector: "arcTan",
  4250. protocol: 'mathematical functions',
  4251. fn: function (){
  4252. var self=this;
  4253. return $core.withContext(function($ctx1) {
  4254. return Math.atan(self);;
  4255. return self;
  4256. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  4257. },
  4258. args: [],
  4259. source: "arcTan\x0a\x09<return Math.atan(self);>",
  4260. referencedClasses: [],
  4261. messageSends: []
  4262. }),
  4263. $globals.Number);
  4264. $core.addMethod(
  4265. $core.method({
  4266. selector: "asJSON",
  4267. protocol: 'converting',
  4268. fn: function (){
  4269. var self=this;
  4270. return self;
  4271. },
  4272. args: [],
  4273. source: "asJSON\x0a\x09^ self",
  4274. referencedClasses: [],
  4275. messageSends: []
  4276. }),
  4277. $globals.Number);
  4278. $core.addMethod(
  4279. $core.method({
  4280. selector: "asJavascript",
  4281. protocol: 'converting',
  4282. fn: function (){
  4283. var self=this;
  4284. return $core.withContext(function($ctx1) {
  4285. var $1;
  4286. $1=$recv("(".__comma(self._printString())).__comma(")");
  4287. $ctx1.sendIdx[","]=1;
  4288. return $1;
  4289. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Number)});
  4290. },
  4291. args: [],
  4292. source: "asJavascript\x0a\x09^ '(', self printString, ')'",
  4293. referencedClasses: [],
  4294. messageSends: [",", "printString"]
  4295. }),
  4296. $globals.Number);
  4297. $core.addMethod(
  4298. $core.method({
  4299. selector: "asNumber",
  4300. protocol: 'converting',
  4301. fn: function (){
  4302. var self=this;
  4303. return self;
  4304. },
  4305. args: [],
  4306. source: "asNumber\x0a\x09^ self",
  4307. referencedClasses: [],
  4308. messageSends: []
  4309. }),
  4310. $globals.Number);
  4311. $core.addMethod(
  4312. $core.method({
  4313. selector: "asPoint",
  4314. protocol: 'converting',
  4315. fn: function (){
  4316. var self=this;
  4317. return $core.withContext(function($ctx1) {
  4318. return $recv($globals.Point)._x_y_(self,self);
  4319. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  4320. },
  4321. args: [],
  4322. source: "asPoint\x0a\x09^ Point x: self y: self",
  4323. referencedClasses: ["Point"],
  4324. messageSends: ["x:y:"]
  4325. }),
  4326. $globals.Number);
  4327. $core.addMethod(
  4328. $core.method({
  4329. selector: "asString",
  4330. protocol: 'converting',
  4331. fn: function (){
  4332. var self=this;
  4333. return $core.withContext(function($ctx1) {
  4334. return String(self) ;
  4335. return self;
  4336. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  4337. },
  4338. args: [],
  4339. source: "asString\x0a\x09< return String(self) >",
  4340. referencedClasses: [],
  4341. messageSends: []
  4342. }),
  4343. $globals.Number);
  4344. $core.addMethod(
  4345. $core.method({
  4346. selector: "atRandom",
  4347. protocol: 'converting',
  4348. fn: function (){
  4349. var self=this;
  4350. return $core.withContext(function($ctx1) {
  4351. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  4352. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  4353. },
  4354. args: [],
  4355. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  4356. referencedClasses: ["Random"],
  4357. messageSends: ["+", "truncated", "*", "next", "new"]
  4358. }),
  4359. $globals.Number);
  4360. $core.addMethod(
  4361. $core.method({
  4362. selector: "ceiling",
  4363. protocol: 'converting',
  4364. fn: function (){
  4365. var self=this;
  4366. return $core.withContext(function($ctx1) {
  4367. return Math.ceil(self);;
  4368. return self;
  4369. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  4370. },
  4371. args: [],
  4372. source: "ceiling\x0a\x09<return Math.ceil(self);>",
  4373. referencedClasses: [],
  4374. messageSends: []
  4375. }),
  4376. $globals.Number);
  4377. $core.addMethod(
  4378. $core.method({
  4379. selector: "copy",
  4380. protocol: 'copying',
  4381. fn: function (){
  4382. var self=this;
  4383. return self;
  4384. },
  4385. args: [],
  4386. source: "copy\x0a\x09^ self",
  4387. referencedClasses: [],
  4388. messageSends: []
  4389. }),
  4390. $globals.Number);
  4391. $core.addMethod(
  4392. $core.method({
  4393. selector: "cos",
  4394. protocol: 'mathematical functions',
  4395. fn: function (){
  4396. var self=this;
  4397. return $core.withContext(function($ctx1) {
  4398. return Math.cos(self);;
  4399. return self;
  4400. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  4401. },
  4402. args: [],
  4403. source: "cos\x0a\x09<return Math.cos(self);>",
  4404. referencedClasses: [],
  4405. messageSends: []
  4406. }),
  4407. $globals.Number);
  4408. $core.addMethod(
  4409. $core.method({
  4410. selector: "deepCopy",
  4411. protocol: 'copying',
  4412. fn: function (){
  4413. var self=this;
  4414. return $core.withContext(function($ctx1) {
  4415. return self._copy();
  4416. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  4417. },
  4418. args: [],
  4419. source: "deepCopy\x0a\x09^ self copy",
  4420. referencedClasses: [],
  4421. messageSends: ["copy"]
  4422. }),
  4423. $globals.Number);
  4424. $core.addMethod(
  4425. $core.method({
  4426. selector: "even",
  4427. protocol: 'testing',
  4428. fn: function (){
  4429. var self=this;
  4430. return $core.withContext(function($ctx1) {
  4431. return (0).__eq(self.__backslash_backslash((2)));
  4432. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  4433. },
  4434. args: [],
  4435. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  4436. referencedClasses: [],
  4437. messageSends: ["=", "\x5c\x5c"]
  4438. }),
  4439. $globals.Number);
  4440. $core.addMethod(
  4441. $core.method({
  4442. selector: "floor",
  4443. protocol: 'converting',
  4444. fn: function (){
  4445. var self=this;
  4446. return $core.withContext(function($ctx1) {
  4447. return Math.floor(self);;
  4448. return self;
  4449. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  4450. },
  4451. args: [],
  4452. source: "floor\x0a\x09<return Math.floor(self);>",
  4453. referencedClasses: [],
  4454. messageSends: []
  4455. }),
  4456. $globals.Number);
  4457. $core.addMethod(
  4458. $core.method({
  4459. selector: "isImmutable",
  4460. protocol: 'testing',
  4461. fn: function (){
  4462. var self=this;
  4463. return true;
  4464. },
  4465. args: [],
  4466. source: "isImmutable\x0a\x09^ true",
  4467. referencedClasses: [],
  4468. messageSends: []
  4469. }),
  4470. $globals.Number);
  4471. $core.addMethod(
  4472. $core.method({
  4473. selector: "isNumber",
  4474. protocol: 'testing',
  4475. fn: function (){
  4476. var self=this;
  4477. return true;
  4478. },
  4479. args: [],
  4480. source: "isNumber\x0a\x09^ true",
  4481. referencedClasses: [],
  4482. messageSends: []
  4483. }),
  4484. $globals.Number);
  4485. $core.addMethod(
  4486. $core.method({
  4487. selector: "isZero",
  4488. protocol: 'testing',
  4489. fn: function (){
  4490. var self=this;
  4491. return $core.withContext(function($ctx1) {
  4492. return self.__eq((0));
  4493. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  4494. },
  4495. args: [],
  4496. source: "isZero\x0a\x09^ self = 0",
  4497. referencedClasses: [],
  4498. messageSends: ["="]
  4499. }),
  4500. $globals.Number);
  4501. $core.addMethod(
  4502. $core.method({
  4503. selector: "ln",
  4504. protocol: 'mathematical functions',
  4505. fn: function (){
  4506. var self=this;
  4507. return $core.withContext(function($ctx1) {
  4508. return Math.log(self);;
  4509. return self;
  4510. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  4511. },
  4512. args: [],
  4513. source: "ln\x0a\x09<return Math.log(self);>",
  4514. referencedClasses: [],
  4515. messageSends: []
  4516. }),
  4517. $globals.Number);
  4518. $core.addMethod(
  4519. $core.method({
  4520. selector: "log",
  4521. protocol: 'mathematical functions',
  4522. fn: function (){
  4523. var self=this;
  4524. return $core.withContext(function($ctx1) {
  4525. return Math.log(self) / Math.LN10;;
  4526. return self;
  4527. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  4528. },
  4529. args: [],
  4530. source: "log\x0a\x09<return Math.log(self) / Math.LN10;>",
  4531. referencedClasses: [],
  4532. messageSends: []
  4533. }),
  4534. $globals.Number);
  4535. $core.addMethod(
  4536. $core.method({
  4537. selector: "log:",
  4538. protocol: 'mathematical functions',
  4539. fn: function (aNumber){
  4540. var self=this;
  4541. return $core.withContext(function($ctx1) {
  4542. return Math.log(self) / Math.log(aNumber);;
  4543. return self;
  4544. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  4545. },
  4546. args: ["aNumber"],
  4547. source: "log: aNumber\x0a\x09<return Math.log(self) / Math.log(aNumber);>",
  4548. referencedClasses: [],
  4549. messageSends: []
  4550. }),
  4551. $globals.Number);
  4552. $core.addMethod(
  4553. $core.method({
  4554. selector: "max:",
  4555. protocol: 'arithmetic',
  4556. fn: function (aNumber){
  4557. var self=this;
  4558. return $core.withContext(function($ctx1) {
  4559. return Math.max(self, aNumber);;
  4560. return self;
  4561. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  4562. },
  4563. args: ["aNumber"],
  4564. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  4565. referencedClasses: [],
  4566. messageSends: []
  4567. }),
  4568. $globals.Number);
  4569. $core.addMethod(
  4570. $core.method({
  4571. selector: "min:",
  4572. protocol: 'arithmetic',
  4573. fn: function (aNumber){
  4574. var self=this;
  4575. return $core.withContext(function($ctx1) {
  4576. return Math.min(self, aNumber);;
  4577. return self;
  4578. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  4579. },
  4580. args: ["aNumber"],
  4581. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  4582. referencedClasses: [],
  4583. messageSends: []
  4584. }),
  4585. $globals.Number);
  4586. $core.addMethod(
  4587. $core.method({
  4588. selector: "negated",
  4589. protocol: 'arithmetic',
  4590. fn: function (){
  4591. var self=this;
  4592. return $core.withContext(function($ctx1) {
  4593. return (0).__minus(self);
  4594. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  4595. },
  4596. args: [],
  4597. source: "negated\x0a\x09^ 0 - self",
  4598. referencedClasses: [],
  4599. messageSends: ["-"]
  4600. }),
  4601. $globals.Number);
  4602. $core.addMethod(
  4603. $core.method({
  4604. selector: "negative",
  4605. protocol: 'testing',
  4606. fn: function (){
  4607. var self=this;
  4608. return $core.withContext(function($ctx1) {
  4609. return self.__lt((0));
  4610. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  4611. },
  4612. args: [],
  4613. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  4614. referencedClasses: [],
  4615. messageSends: ["<"]
  4616. }),
  4617. $globals.Number);
  4618. $core.addMethod(
  4619. $core.method({
  4620. selector: "odd",
  4621. protocol: 'testing',
  4622. fn: function (){
  4623. var self=this;
  4624. return $core.withContext(function($ctx1) {
  4625. return $recv(self._even())._not();
  4626. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  4627. },
  4628. args: [],
  4629. source: "odd\x0a\x09^ self even not",
  4630. referencedClasses: [],
  4631. messageSends: ["not", "even"]
  4632. }),
  4633. $globals.Number);
  4634. $core.addMethod(
  4635. $core.method({
  4636. selector: "positive",
  4637. protocol: 'testing',
  4638. fn: function (){
  4639. var self=this;
  4640. return $core.withContext(function($ctx1) {
  4641. return self.__gt_eq((0));
  4642. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  4643. },
  4644. args: [],
  4645. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4646. referencedClasses: [],
  4647. messageSends: [">="]
  4648. }),
  4649. $globals.Number);
  4650. $core.addMethod(
  4651. $core.method({
  4652. selector: "printOn:",
  4653. protocol: 'printing',
  4654. fn: function (aStream){
  4655. var self=this;
  4656. return $core.withContext(function($ctx1) {
  4657. $recv(aStream)._nextPutAll_(self._asString());
  4658. return self;
  4659. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  4660. },
  4661. args: ["aStream"],
  4662. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4663. referencedClasses: [],
  4664. messageSends: ["nextPutAll:", "asString"]
  4665. }),
  4666. $globals.Number);
  4667. $core.addMethod(
  4668. $core.method({
  4669. selector: "printShowingDecimalPlaces:",
  4670. protocol: 'printing',
  4671. fn: function (placesDesired){
  4672. var self=this;
  4673. return $core.withContext(function($ctx1) {
  4674. return self.toFixed(placesDesired);
  4675. return self;
  4676. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  4677. },
  4678. args: ["placesDesired"],
  4679. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  4680. referencedClasses: [],
  4681. messageSends: []
  4682. }),
  4683. $globals.Number);
  4684. $core.addMethod(
  4685. $core.method({
  4686. selector: "raisedTo:",
  4687. protocol: 'mathematical functions',
  4688. fn: function (exponent){
  4689. var self=this;
  4690. return $core.withContext(function($ctx1) {
  4691. return Math.pow(self, exponent);;
  4692. return self;
  4693. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  4694. },
  4695. args: ["exponent"],
  4696. source: "raisedTo: exponent\x0a\x09<return Math.pow(self, exponent);>",
  4697. referencedClasses: [],
  4698. messageSends: []
  4699. }),
  4700. $globals.Number);
  4701. $core.addMethod(
  4702. $core.method({
  4703. selector: "rounded",
  4704. protocol: 'converting',
  4705. fn: function (){
  4706. var self=this;
  4707. return $core.withContext(function($ctx1) {
  4708. return Math.round(self);;
  4709. return self;
  4710. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  4711. },
  4712. args: [],
  4713. source: "rounded\x0a\x09<return Math.round(self);>",
  4714. referencedClasses: [],
  4715. messageSends: []
  4716. }),
  4717. $globals.Number);
  4718. $core.addMethod(
  4719. $core.method({
  4720. selector: "sign",
  4721. protocol: 'mathematical functions',
  4722. fn: function (){
  4723. var self=this;
  4724. return $core.withContext(function($ctx1) {
  4725. var $1,$2;
  4726. $1=self._isZero();
  4727. if($core.assert($1)){
  4728. return (0);
  4729. };
  4730. $2=self._positive();
  4731. if($core.assert($2)){
  4732. return (1);
  4733. } else {
  4734. return (-1);
  4735. };
  4736. return self;
  4737. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  4738. },
  4739. args: [],
  4740. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  4741. referencedClasses: [],
  4742. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  4743. }),
  4744. $globals.Number);
  4745. $core.addMethod(
  4746. $core.method({
  4747. selector: "sin",
  4748. protocol: 'mathematical functions',
  4749. fn: function (){
  4750. var self=this;
  4751. return $core.withContext(function($ctx1) {
  4752. return Math.sin(self);;
  4753. return self;
  4754. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  4755. },
  4756. args: [],
  4757. source: "sin\x0a\x09<return Math.sin(self);>",
  4758. referencedClasses: [],
  4759. messageSends: []
  4760. }),
  4761. $globals.Number);
  4762. $core.addMethod(
  4763. $core.method({
  4764. selector: "sqrt",
  4765. protocol: 'mathematical functions',
  4766. fn: function (){
  4767. var self=this;
  4768. return $core.withContext(function($ctx1) {
  4769. return Math.sqrt(self);
  4770. return self;
  4771. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  4772. },
  4773. args: [],
  4774. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  4775. referencedClasses: [],
  4776. messageSends: []
  4777. }),
  4778. $globals.Number);
  4779. $core.addMethod(
  4780. $core.method({
  4781. selector: "squared",
  4782. protocol: 'mathematical functions',
  4783. fn: function (){
  4784. var self=this;
  4785. return $core.withContext(function($ctx1) {
  4786. return self.__star(self);
  4787. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  4788. },
  4789. args: [],
  4790. source: "squared\x0a\x09^ self * self",
  4791. referencedClasses: [],
  4792. messageSends: ["*"]
  4793. }),
  4794. $globals.Number);
  4795. $core.addMethod(
  4796. $core.method({
  4797. selector: "tan",
  4798. protocol: 'mathematical functions',
  4799. fn: function (){
  4800. var self=this;
  4801. return $core.withContext(function($ctx1) {
  4802. return Math.tan(self);;
  4803. return self;
  4804. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  4805. },
  4806. args: [],
  4807. source: "tan\x0a\x09<return Math.tan(self);>",
  4808. referencedClasses: [],
  4809. messageSends: []
  4810. }),
  4811. $globals.Number);
  4812. $core.addMethod(
  4813. $core.method({
  4814. selector: "timesRepeat:",
  4815. protocol: 'enumerating',
  4816. fn: function (aBlock){
  4817. var self=this;
  4818. var count;
  4819. return $core.withContext(function($ctx1) {
  4820. count=(1);
  4821. $recv((function(){
  4822. return $core.withContext(function($ctx2) {
  4823. return $recv(count).__gt(self);
  4824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4825. }))._whileFalse_((function(){
  4826. return $core.withContext(function($ctx2) {
  4827. $recv(aBlock)._value();
  4828. count=$recv(count).__plus((1));
  4829. return count;
  4830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4831. }));
  4832. return self;
  4833. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  4834. },
  4835. args: ["aBlock"],
  4836. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  4837. referencedClasses: [],
  4838. messageSends: ["whileFalse:", ">", "value", "+"]
  4839. }),
  4840. $globals.Number);
  4841. $core.addMethod(
  4842. $core.method({
  4843. selector: "to:",
  4844. protocol: 'converting',
  4845. fn: function (aNumber){
  4846. var self=this;
  4847. var array,first,last,count;
  4848. return $core.withContext(function($ctx1) {
  4849. first=self._truncated();
  4850. $ctx1.sendIdx["truncated"]=1;
  4851. last=$recv($recv(aNumber)._truncated()).__plus((1));
  4852. $ctx1.sendIdx["+"]=1;
  4853. count=(1);
  4854. array=$recv($globals.Array)._new();
  4855. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  4856. return $core.withContext(function($ctx2) {
  4857. $recv(array)._at_put_(count,first);
  4858. count=$recv(count).__plus((1));
  4859. $ctx2.sendIdx["+"]=2;
  4860. count;
  4861. first=$recv(first).__plus((1));
  4862. return first;
  4863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4864. }));
  4865. return array;
  4866. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  4867. },
  4868. args: ["aNumber"],
  4869. 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",
  4870. referencedClasses: ["Array"],
  4871. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  4872. }),
  4873. $globals.Number);
  4874. $core.addMethod(
  4875. $core.method({
  4876. selector: "to:by:",
  4877. protocol: 'converting',
  4878. fn: function (stop,step){
  4879. var self=this;
  4880. var array,value,pos;
  4881. return $core.withContext(function($ctx1) {
  4882. var $1,$2;
  4883. value=self;
  4884. array=$recv($globals.Array)._new();
  4885. pos=(1);
  4886. $1=$recv(step).__eq((0));
  4887. if($core.assert($1)){
  4888. self._error_("step must be non-zero");
  4889. };
  4890. $2=$recv(step).__lt((0));
  4891. if($core.assert($2)){
  4892. $recv((function(){
  4893. return $core.withContext(function($ctx2) {
  4894. return $recv(value).__gt_eq(stop);
  4895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4896. }))._whileTrue_((function(){
  4897. return $core.withContext(function($ctx2) {
  4898. $recv(array)._at_put_(pos,value);
  4899. $ctx2.sendIdx["at:put:"]=1;
  4900. pos=$recv(pos).__plus((1));
  4901. $ctx2.sendIdx["+"]=1;
  4902. pos;
  4903. value=$recv(value).__plus(step);
  4904. $ctx2.sendIdx["+"]=2;
  4905. return value;
  4906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4907. }));
  4908. $ctx1.sendIdx["whileTrue:"]=1;
  4909. } else {
  4910. $recv((function(){
  4911. return $core.withContext(function($ctx2) {
  4912. return $recv(value).__lt_eq(stop);
  4913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4914. }))._whileTrue_((function(){
  4915. return $core.withContext(function($ctx2) {
  4916. $recv(array)._at_put_(pos,value);
  4917. pos=$recv(pos).__plus((1));
  4918. $ctx2.sendIdx["+"]=3;
  4919. pos;
  4920. value=$recv(value).__plus(step);
  4921. return value;
  4922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4923. }));
  4924. };
  4925. return array;
  4926. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  4927. },
  4928. args: ["stop", "step"],
  4929. 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",
  4930. referencedClasses: ["Array"],
  4931. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  4932. }),
  4933. $globals.Number);
  4934. $core.addMethod(
  4935. $core.method({
  4936. selector: "to:by:do:",
  4937. protocol: 'enumerating',
  4938. fn: function (stop,step,aBlock){
  4939. var self=this;
  4940. var value;
  4941. return $core.withContext(function($ctx1) {
  4942. var $1,$2;
  4943. value=self;
  4944. $1=$recv(step).__eq((0));
  4945. if($core.assert($1)){
  4946. self._error_("step must be non-zero");
  4947. };
  4948. $2=$recv(step).__lt((0));
  4949. if($core.assert($2)){
  4950. $recv((function(){
  4951. return $core.withContext(function($ctx2) {
  4952. return $recv(value).__gt_eq(stop);
  4953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  4954. }))._whileTrue_((function(){
  4955. return $core.withContext(function($ctx2) {
  4956. $recv(aBlock)._value_(value);
  4957. $ctx2.sendIdx["value:"]=1;
  4958. value=$recv(value).__plus(step);
  4959. $ctx2.sendIdx["+"]=1;
  4960. return value;
  4961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  4962. }));
  4963. $ctx1.sendIdx["whileTrue:"]=1;
  4964. } else {
  4965. $recv((function(){
  4966. return $core.withContext(function($ctx2) {
  4967. return $recv(value).__lt_eq(stop);
  4968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  4969. }))._whileTrue_((function(){
  4970. return $core.withContext(function($ctx2) {
  4971. $recv(aBlock)._value_(value);
  4972. value=$recv(value).__plus(step);
  4973. return value;
  4974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  4975. }));
  4976. };
  4977. return self;
  4978. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  4979. },
  4980. args: ["stop", "step", "aBlock"],
  4981. 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 ]]",
  4982. referencedClasses: [],
  4983. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  4984. }),
  4985. $globals.Number);
  4986. $core.addMethod(
  4987. $core.method({
  4988. selector: "to:do:",
  4989. protocol: 'enumerating',
  4990. fn: function (stop,aBlock){
  4991. var self=this;
  4992. var nextValue;
  4993. return $core.withContext(function($ctx1) {
  4994. nextValue=self;
  4995. $recv((function(){
  4996. return $core.withContext(function($ctx2) {
  4997. return $recv(nextValue).__lt_eq(stop);
  4998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4999. }))._whileTrue_((function(){
  5000. return $core.withContext(function($ctx2) {
  5001. $recv(aBlock)._value_(nextValue);
  5002. nextValue=$recv(nextValue).__plus((1));
  5003. return nextValue;
  5004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5005. }));
  5006. return self;
  5007. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  5008. },
  5009. args: ["stop", "aBlock"],
  5010. 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 ]",
  5011. referencedClasses: [],
  5012. messageSends: ["whileTrue:", "<=", "value:", "+"]
  5013. }),
  5014. $globals.Number);
  5015. $core.addMethod(
  5016. $core.method({
  5017. selector: "truncated",
  5018. protocol: 'converting',
  5019. fn: function (){
  5020. var self=this;
  5021. return $core.withContext(function($ctx1) {
  5022. if(self >= 0) {
  5023. return Math.floor(self);
  5024. } else {
  5025. return Math.floor(self * (-1)) * (-1);
  5026. };
  5027. ;
  5028. return self;
  5029. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  5030. },
  5031. args: [],
  5032. source: "truncated\x0a\x09<\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>",
  5033. referencedClasses: [],
  5034. messageSends: []
  5035. }),
  5036. $globals.Number);
  5037. $core.addMethod(
  5038. $core.method({
  5039. selector: "|",
  5040. protocol: 'converting',
  5041. fn: function (aNumber){
  5042. var self=this;
  5043. return $core.withContext(function($ctx1) {
  5044. return self | aNumber;
  5045. return self;
  5046. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  5047. },
  5048. args: ["aNumber"],
  5049. source: "| aNumber\x0a\x09<return self | aNumber>",
  5050. referencedClasses: [],
  5051. messageSends: []
  5052. }),
  5053. $globals.Number);
  5054. $core.addMethod(
  5055. $core.method({
  5056. selector: "classTag",
  5057. protocol: 'accessing',
  5058. fn: function (){
  5059. var self=this;
  5060. return "magnitude";
  5061. },
  5062. args: [],
  5063. 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'",
  5064. referencedClasses: [],
  5065. messageSends: []
  5066. }),
  5067. $globals.Number.klass);
  5068. $core.addMethod(
  5069. $core.method({
  5070. selector: "e",
  5071. protocol: 'instance creation',
  5072. fn: function (){
  5073. var self=this;
  5074. return $core.withContext(function($ctx1) {
  5075. return Math.E;;
  5076. return self;
  5077. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.klass)});
  5078. },
  5079. args: [],
  5080. source: "e\x0a\x09<return Math.E;>",
  5081. referencedClasses: [],
  5082. messageSends: []
  5083. }),
  5084. $globals.Number.klass);
  5085. $core.addMethod(
  5086. $core.method({
  5087. selector: "pi",
  5088. protocol: 'instance creation',
  5089. fn: function (){
  5090. var self=this;
  5091. return $core.withContext(function($ctx1) {
  5092. return Math.PI;
  5093. return self;
  5094. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.klass)});
  5095. },
  5096. args: [],
  5097. source: "pi\x0a\x09<return Math.PI>",
  5098. referencedClasses: [],
  5099. messageSends: []
  5100. }),
  5101. $globals.Number.klass);
  5102. $core.addClass('Point', $globals.Object, ['x', 'y'], 'Kernel-Objects');
  5103. $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";
  5104. $core.addMethod(
  5105. $core.method({
  5106. selector: "*",
  5107. protocol: 'arithmetic',
  5108. fn: function (aPoint){
  5109. var self=this;
  5110. return $core.withContext(function($ctx1) {
  5111. var $2,$4,$3,$1,$6,$5;
  5112. $2=self._x();
  5113. $ctx1.sendIdx["x"]=1;
  5114. $4=$recv(aPoint)._asPoint();
  5115. $ctx1.sendIdx["asPoint"]=1;
  5116. $3=$recv($4)._x();
  5117. $1=$recv($2).__star($3);
  5118. $ctx1.sendIdx["*"]=1;
  5119. $6=self._y();
  5120. $ctx1.sendIdx["y"]=1;
  5121. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  5122. return $recv($globals.Point)._x_y_($1,$5);
  5123. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  5124. },
  5125. args: ["aPoint"],
  5126. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  5127. referencedClasses: ["Point"],
  5128. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  5129. }),
  5130. $globals.Point);
  5131. $core.addMethod(
  5132. $core.method({
  5133. selector: "+",
  5134. protocol: 'arithmetic',
  5135. fn: function (aPoint){
  5136. var self=this;
  5137. return $core.withContext(function($ctx1) {
  5138. var $2,$4,$3,$1,$6,$5;
  5139. $2=self._x();
  5140. $ctx1.sendIdx["x"]=1;
  5141. $4=$recv(aPoint)._asPoint();
  5142. $ctx1.sendIdx["asPoint"]=1;
  5143. $3=$recv($4)._x();
  5144. $1=$recv($2).__plus($3);
  5145. $ctx1.sendIdx["+"]=1;
  5146. $6=self._y();
  5147. $ctx1.sendIdx["y"]=1;
  5148. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  5149. return $recv($globals.Point)._x_y_($1,$5);
  5150. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  5151. },
  5152. args: ["aPoint"],
  5153. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  5154. referencedClasses: ["Point"],
  5155. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  5156. }),
  5157. $globals.Point);
  5158. $core.addMethod(
  5159. $core.method({
  5160. selector: "-",
  5161. protocol: 'arithmetic',
  5162. fn: function (aPoint){
  5163. var self=this;
  5164. return $core.withContext(function($ctx1) {
  5165. var $2,$4,$3,$1,$6,$5;
  5166. $2=self._x();
  5167. $ctx1.sendIdx["x"]=1;
  5168. $4=$recv(aPoint)._asPoint();
  5169. $ctx1.sendIdx["asPoint"]=1;
  5170. $3=$recv($4)._x();
  5171. $1=$recv($2).__minus($3);
  5172. $ctx1.sendIdx["-"]=1;
  5173. $6=self._y();
  5174. $ctx1.sendIdx["y"]=1;
  5175. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  5176. return $recv($globals.Point)._x_y_($1,$5);
  5177. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  5178. },
  5179. args: ["aPoint"],
  5180. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  5181. referencedClasses: ["Point"],
  5182. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  5183. }),
  5184. $globals.Point);
  5185. $core.addMethod(
  5186. $core.method({
  5187. selector: "/",
  5188. protocol: 'arithmetic',
  5189. fn: function (aPoint){
  5190. var self=this;
  5191. return $core.withContext(function($ctx1) {
  5192. var $2,$4,$3,$1,$6,$5;
  5193. $2=self._x();
  5194. $ctx1.sendIdx["x"]=1;
  5195. $4=$recv(aPoint)._asPoint();
  5196. $ctx1.sendIdx["asPoint"]=1;
  5197. $3=$recv($4)._x();
  5198. $1=$recv($2).__slash($3);
  5199. $ctx1.sendIdx["/"]=1;
  5200. $6=self._y();
  5201. $ctx1.sendIdx["y"]=1;
  5202. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  5203. return $recv($globals.Point)._x_y_($1,$5);
  5204. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  5205. },
  5206. args: ["aPoint"],
  5207. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  5208. referencedClasses: ["Point"],
  5209. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  5210. }),
  5211. $globals.Point);
  5212. $core.addMethod(
  5213. $core.method({
  5214. selector: "<",
  5215. protocol: 'comparing',
  5216. fn: function (aPoint){
  5217. var self=this;
  5218. return $core.withContext(function($ctx1) {
  5219. var $2,$1,$3;
  5220. $2=self._x();
  5221. $ctx1.sendIdx["x"]=1;
  5222. $1=$recv($2).__lt($recv(aPoint)._x());
  5223. $ctx1.sendIdx["<"]=1;
  5224. return $recv($1)._and_((function(){
  5225. return $core.withContext(function($ctx2) {
  5226. $3=self._y();
  5227. $ctx2.sendIdx["y"]=1;
  5228. return $recv($3).__lt($recv(aPoint)._y());
  5229. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5230. }));
  5231. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  5232. },
  5233. args: ["aPoint"],
  5234. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  5235. referencedClasses: [],
  5236. messageSends: ["and:", "<", "x", "y"]
  5237. }),
  5238. $globals.Point);
  5239. $core.addMethod(
  5240. $core.method({
  5241. selector: "<=",
  5242. protocol: 'comparing',
  5243. fn: function (aPoint){
  5244. var self=this;
  5245. return $core.withContext(function($ctx1) {
  5246. var $2,$1,$3;
  5247. $2=self._x();
  5248. $ctx1.sendIdx["x"]=1;
  5249. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  5250. $ctx1.sendIdx["<="]=1;
  5251. return $recv($1)._and_((function(){
  5252. return $core.withContext(function($ctx2) {
  5253. $3=self._y();
  5254. $ctx2.sendIdx["y"]=1;
  5255. return $recv($3).__lt_eq($recv(aPoint)._y());
  5256. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5257. }));
  5258. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  5259. },
  5260. args: ["aPoint"],
  5261. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  5262. referencedClasses: [],
  5263. messageSends: ["and:", "<=", "x", "y"]
  5264. }),
  5265. $globals.Point);
  5266. $core.addMethod(
  5267. $core.method({
  5268. selector: "=",
  5269. protocol: 'comparing',
  5270. fn: function (aPoint){
  5271. var self=this;
  5272. return $core.withContext(function($ctx1) {
  5273. var $2,$1,$4,$3,$6,$5;
  5274. $2=$recv(aPoint)._class();
  5275. $ctx1.sendIdx["class"]=1;
  5276. $1=$recv($2).__eq(self._class());
  5277. $ctx1.sendIdx["="]=1;
  5278. return $recv($1)._and_((function(){
  5279. return $core.withContext(function($ctx2) {
  5280. $4=$recv(aPoint)._x();
  5281. $ctx2.sendIdx["x"]=1;
  5282. $3=$recv($4).__eq(self._x());
  5283. $ctx2.sendIdx["="]=2;
  5284. $6=$recv(aPoint)._y();
  5285. $ctx2.sendIdx["y"]=1;
  5286. $5=$recv($6).__eq(self._y());
  5287. return $recv($3).__and($5);
  5288. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5289. }));
  5290. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  5291. },
  5292. args: ["aPoint"],
  5293. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  5294. referencedClasses: [],
  5295. messageSends: ["and:", "=", "class", "&", "x", "y"]
  5296. }),
  5297. $globals.Point);
  5298. $core.addMethod(
  5299. $core.method({
  5300. selector: ">",
  5301. protocol: 'comparing',
  5302. fn: function (aPoint){
  5303. var self=this;
  5304. return $core.withContext(function($ctx1) {
  5305. var $2,$1,$3;
  5306. $2=self._x();
  5307. $ctx1.sendIdx["x"]=1;
  5308. $1=$recv($2).__gt($recv(aPoint)._x());
  5309. $ctx1.sendIdx[">"]=1;
  5310. return $recv($1)._and_((function(){
  5311. return $core.withContext(function($ctx2) {
  5312. $3=self._y();
  5313. $ctx2.sendIdx["y"]=1;
  5314. return $recv($3).__gt($recv(aPoint)._y());
  5315. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5316. }));
  5317. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  5318. },
  5319. args: ["aPoint"],
  5320. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  5321. referencedClasses: [],
  5322. messageSends: ["and:", ">", "x", "y"]
  5323. }),
  5324. $globals.Point);
  5325. $core.addMethod(
  5326. $core.method({
  5327. selector: ">=",
  5328. protocol: 'comparing',
  5329. fn: function (aPoint){
  5330. var self=this;
  5331. return $core.withContext(function($ctx1) {
  5332. var $2,$1,$3;
  5333. $2=self._x();
  5334. $ctx1.sendIdx["x"]=1;
  5335. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  5336. $ctx1.sendIdx[">="]=1;
  5337. return $recv($1)._and_((function(){
  5338. return $core.withContext(function($ctx2) {
  5339. $3=self._y();
  5340. $ctx2.sendIdx["y"]=1;
  5341. return $recv($3).__gt_eq($recv(aPoint)._y());
  5342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5343. }));
  5344. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  5345. },
  5346. args: ["aPoint"],
  5347. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  5348. referencedClasses: [],
  5349. messageSends: ["and:", ">=", "x", "y"]
  5350. }),
  5351. $globals.Point);
  5352. $core.addMethod(
  5353. $core.method({
  5354. selector: "asPoint",
  5355. protocol: 'converting',
  5356. fn: function (){
  5357. var self=this;
  5358. return self;
  5359. },
  5360. args: [],
  5361. source: "asPoint\x0a\x09^ self",
  5362. referencedClasses: [],
  5363. messageSends: []
  5364. }),
  5365. $globals.Point);
  5366. $core.addMethod(
  5367. $core.method({
  5368. selector: "dist:",
  5369. protocol: 'transforming',
  5370. fn: function (aPoint){
  5371. var self=this;
  5372. var dx,dy;
  5373. return $core.withContext(function($ctx1) {
  5374. var $2,$1;
  5375. dx=$recv($recv(aPoint)._x()).__minus(self["@x"]);
  5376. $ctx1.sendIdx["-"]=1;
  5377. dy=$recv($recv(aPoint)._y()).__minus(self["@y"]);
  5378. $2=$recv(dx).__star(dx);
  5379. $ctx1.sendIdx["*"]=1;
  5380. $1=$recv($2).__plus($recv(dy).__star(dy));
  5381. return $recv($1)._sqrt();
  5382. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  5383. },
  5384. args: ["aPoint"],
  5385. 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",
  5386. referencedClasses: [],
  5387. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  5388. }),
  5389. $globals.Point);
  5390. $core.addMethod(
  5391. $core.method({
  5392. selector: "printOn:",
  5393. protocol: 'printing',
  5394. fn: function (aStream){
  5395. var self=this;
  5396. return $core.withContext(function($ctx1) {
  5397. var $1;
  5398. $recv(self["@x"])._printOn_(aStream);
  5399. $ctx1.sendIdx["printOn:"]=1;
  5400. $recv(aStream)._nextPutAll_("@");
  5401. $1=$recv($recv(self["@y"])._notNil())._and_((function(){
  5402. return $core.withContext(function($ctx2) {
  5403. return $recv(self["@y"])._negative();
  5404. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5405. }));
  5406. if($core.assert($1)){
  5407. $recv(aStream)._space();
  5408. };
  5409. $recv(self["@y"])._printOn_(aStream);
  5410. return self;
  5411. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  5412. },
  5413. args: ["aStream"],
  5414. 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",
  5415. referencedClasses: [],
  5416. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  5417. }),
  5418. $globals.Point);
  5419. $core.addMethod(
  5420. $core.method({
  5421. selector: "translateBy:",
  5422. protocol: 'transforming',
  5423. fn: function (delta){
  5424. var self=this;
  5425. return $core.withContext(function($ctx1) {
  5426. var $1;
  5427. $1=$recv($recv(delta)._x()).__plus(self["@x"]);
  5428. $ctx1.sendIdx["+"]=1;
  5429. return $recv($1).__at($recv($recv(delta)._y()).__plus(self["@y"]));
  5430. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  5431. },
  5432. args: ["delta"],
  5433. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  5434. referencedClasses: [],
  5435. messageSends: ["@", "+", "x", "y"]
  5436. }),
  5437. $globals.Point);
  5438. $core.addMethod(
  5439. $core.method({
  5440. selector: "x",
  5441. protocol: 'accessing',
  5442. fn: function (){
  5443. var self=this;
  5444. return self["@x"];
  5445. },
  5446. args: [],
  5447. source: "x\x0a\x09^ x",
  5448. referencedClasses: [],
  5449. messageSends: []
  5450. }),
  5451. $globals.Point);
  5452. $core.addMethod(
  5453. $core.method({
  5454. selector: "x:",
  5455. protocol: 'accessing',
  5456. fn: function (aNumber){
  5457. var self=this;
  5458. self["@x"]=aNumber;
  5459. return self;
  5460. },
  5461. args: ["aNumber"],
  5462. source: "x: aNumber\x0a\x09x := aNumber",
  5463. referencedClasses: [],
  5464. messageSends: []
  5465. }),
  5466. $globals.Point);
  5467. $core.addMethod(
  5468. $core.method({
  5469. selector: "y",
  5470. protocol: 'accessing',
  5471. fn: function (){
  5472. var self=this;
  5473. return self["@y"];
  5474. },
  5475. args: [],
  5476. source: "y\x0a\x09^ y",
  5477. referencedClasses: [],
  5478. messageSends: []
  5479. }),
  5480. $globals.Point);
  5481. $core.addMethod(
  5482. $core.method({
  5483. selector: "y:",
  5484. protocol: 'accessing',
  5485. fn: function (aNumber){
  5486. var self=this;
  5487. self["@y"]=aNumber;
  5488. return self;
  5489. },
  5490. args: ["aNumber"],
  5491. source: "y: aNumber\x0a\x09y := aNumber",
  5492. referencedClasses: [],
  5493. messageSends: []
  5494. }),
  5495. $globals.Point);
  5496. $core.addMethod(
  5497. $core.method({
  5498. selector: "classTag",
  5499. protocol: 'accessing',
  5500. fn: function (){
  5501. var self=this;
  5502. return "magnitude";
  5503. },
  5504. args: [],
  5505. 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'",
  5506. referencedClasses: [],
  5507. messageSends: []
  5508. }),
  5509. $globals.Point.klass);
  5510. $core.addMethod(
  5511. $core.method({
  5512. selector: "x:y:",
  5513. protocol: 'instance creation',
  5514. fn: function (aNumber,anotherNumber){
  5515. var self=this;
  5516. return $core.withContext(function($ctx1) {
  5517. var $1;
  5518. $1=self._new();
  5519. $recv($1)._x_(aNumber);
  5520. $recv($1)._y_(anotherNumber);
  5521. return $recv($1)._yourself();
  5522. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.klass)});
  5523. },
  5524. args: ["aNumber", "anotherNumber"],
  5525. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  5526. referencedClasses: [],
  5527. messageSends: ["x:", "new", "y:", "yourself"]
  5528. }),
  5529. $globals.Point.klass);
  5530. $core.addClass('Random', $globals.Object, [], 'Kernel-Objects');
  5531. $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'`.";
  5532. $core.addMethod(
  5533. $core.method({
  5534. selector: "next",
  5535. protocol: 'accessing',
  5536. fn: function (){
  5537. var self=this;
  5538. return $core.withContext(function($ctx1) {
  5539. return Math.random();
  5540. return self;
  5541. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  5542. },
  5543. args: [],
  5544. source: "next\x0a\x09<return Math.random()>",
  5545. referencedClasses: [],
  5546. messageSends: []
  5547. }),
  5548. $globals.Random);
  5549. $core.addMethod(
  5550. $core.method({
  5551. selector: "next:",
  5552. protocol: 'accessing',
  5553. fn: function (anInteger){
  5554. var self=this;
  5555. return $core.withContext(function($ctx1) {
  5556. return $recv((1)._to_(anInteger))._collect_((function(each){
  5557. return $core.withContext(function($ctx2) {
  5558. return self._next();
  5559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5560. }));
  5561. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  5562. },
  5563. args: ["anInteger"],
  5564. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  5565. referencedClasses: [],
  5566. messageSends: ["collect:", "to:", "next"]
  5567. }),
  5568. $globals.Random);
  5569. $core.addClass('UndefinedObject', $globals.Object, [], 'Kernel-Objects');
  5570. $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`.";
  5571. $core.addMethod(
  5572. $core.method({
  5573. selector: "asJSON",
  5574. protocol: 'converting',
  5575. fn: function (){
  5576. var self=this;
  5577. return null;
  5578. },
  5579. args: [],
  5580. source: "asJSON\x0a\x09^ null",
  5581. referencedClasses: [],
  5582. messageSends: []
  5583. }),
  5584. $globals.UndefinedObject);
  5585. $core.addMethod(
  5586. $core.method({
  5587. selector: "deepCopy",
  5588. protocol: 'copying',
  5589. fn: function (){
  5590. var self=this;
  5591. return self;
  5592. },
  5593. args: [],
  5594. source: "deepCopy\x0a\x09^ self",
  5595. referencedClasses: [],
  5596. messageSends: []
  5597. }),
  5598. $globals.UndefinedObject);
  5599. $core.addMethod(
  5600. $core.method({
  5601. selector: "ifNil:",
  5602. protocol: 'testing',
  5603. fn: function (aBlock){
  5604. var self=this;
  5605. return $core.withContext(function($ctx1) {
  5606. return self._ifNil_ifNotNil_(aBlock,(function(){
  5607. }));
  5608. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  5609. },
  5610. args: ["aBlock"],
  5611. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  5612. referencedClasses: [],
  5613. messageSends: ["ifNil:ifNotNil:"]
  5614. }),
  5615. $globals.UndefinedObject);
  5616. $core.addMethod(
  5617. $core.method({
  5618. selector: "ifNil:ifNotNil:",
  5619. protocol: 'testing',
  5620. fn: function (aBlock,anotherBlock){
  5621. var self=this;
  5622. return $core.withContext(function($ctx1) {
  5623. return $recv(aBlock)._value();
  5624. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5625. },
  5626. args: ["aBlock", "anotherBlock"],
  5627. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  5628. referencedClasses: [],
  5629. messageSends: ["value"]
  5630. }),
  5631. $globals.UndefinedObject);
  5632. $core.addMethod(
  5633. $core.method({
  5634. selector: "ifNotNil:",
  5635. protocol: 'testing',
  5636. fn: function (aBlock){
  5637. var self=this;
  5638. return self;
  5639. },
  5640. args: ["aBlock"],
  5641. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  5642. referencedClasses: [],
  5643. messageSends: []
  5644. }),
  5645. $globals.UndefinedObject);
  5646. $core.addMethod(
  5647. $core.method({
  5648. selector: "ifNotNil:ifNil:",
  5649. protocol: 'testing',
  5650. fn: function (aBlock,anotherBlock){
  5651. var self=this;
  5652. return $core.withContext(function($ctx1) {
  5653. return $recv(anotherBlock)._value();
  5654. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5655. },
  5656. args: ["aBlock", "anotherBlock"],
  5657. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  5658. referencedClasses: [],
  5659. messageSends: ["value"]
  5660. }),
  5661. $globals.UndefinedObject);
  5662. $core.addMethod(
  5663. $core.method({
  5664. selector: "isImmutable",
  5665. protocol: 'testing',
  5666. fn: function (){
  5667. var self=this;
  5668. return true;
  5669. },
  5670. args: [],
  5671. source: "isImmutable\x0a\x09^ true",
  5672. referencedClasses: [],
  5673. messageSends: []
  5674. }),
  5675. $globals.UndefinedObject);
  5676. $core.addMethod(
  5677. $core.method({
  5678. selector: "isNil",
  5679. protocol: 'testing',
  5680. fn: function (){
  5681. var self=this;
  5682. return true;
  5683. },
  5684. args: [],
  5685. source: "isNil\x0a\x09^ true",
  5686. referencedClasses: [],
  5687. messageSends: []
  5688. }),
  5689. $globals.UndefinedObject);
  5690. $core.addMethod(
  5691. $core.method({
  5692. selector: "notNil",
  5693. protocol: 'testing',
  5694. fn: function (){
  5695. var self=this;
  5696. return false;
  5697. },
  5698. args: [],
  5699. source: "notNil\x0a\x09^ false",
  5700. referencedClasses: [],
  5701. messageSends: []
  5702. }),
  5703. $globals.UndefinedObject);
  5704. $core.addMethod(
  5705. $core.method({
  5706. selector: "printOn:",
  5707. protocol: 'printing',
  5708. fn: function (aStream){
  5709. var self=this;
  5710. return $core.withContext(function($ctx1) {
  5711. $recv(aStream)._nextPutAll_("nil");
  5712. return self;
  5713. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  5714. },
  5715. args: ["aStream"],
  5716. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  5717. referencedClasses: [],
  5718. messageSends: ["nextPutAll:"]
  5719. }),
  5720. $globals.UndefinedObject);
  5721. $core.addMethod(
  5722. $core.method({
  5723. selector: "shallowCopy",
  5724. protocol: 'copying',
  5725. fn: function (){
  5726. var self=this;
  5727. return self;
  5728. },
  5729. args: [],
  5730. source: "shallowCopy\x0a\x09^ self",
  5731. referencedClasses: [],
  5732. messageSends: []
  5733. }),
  5734. $globals.UndefinedObject);
  5735. $core.addMethod(
  5736. $core.method({
  5737. selector: "subclass:instanceVariableNames:",
  5738. protocol: 'class creation',
  5739. fn: function (aString,anotherString){
  5740. var self=this;
  5741. return $core.withContext(function($ctx1) {
  5742. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5743. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.UndefinedObject)});
  5744. },
  5745. args: ["aString", "anotherString"],
  5746. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  5747. referencedClasses: [],
  5748. messageSends: ["subclass:instanceVariableNames:package:"]
  5749. }),
  5750. $globals.UndefinedObject);
  5751. $core.addMethod(
  5752. $core.method({
  5753. selector: "subclass:instanceVariableNames:category:",
  5754. protocol: 'class creation',
  5755. fn: function (aString,aString2,aString3){
  5756. var self=this;
  5757. return $core.withContext(function($ctx1) {
  5758. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5759. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5760. },
  5761. args: ["aString", "aString2", "aString3"],
  5762. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  5763. referencedClasses: [],
  5764. messageSends: ["subclass:instanceVariableNames:package:"]
  5765. }),
  5766. $globals.UndefinedObject);
  5767. $core.addMethod(
  5768. $core.method({
  5769. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  5770. protocol: 'class creation',
  5771. fn: function (aString,aString2,classVars,pools,aString3){
  5772. var self=this;
  5773. return $core.withContext(function($ctx1) {
  5774. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5775. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
  5776. },
  5777. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  5778. 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",
  5779. referencedClasses: [],
  5780. messageSends: ["subclass:instanceVariableNames:package:"]
  5781. }),
  5782. $globals.UndefinedObject);
  5783. $core.addMethod(
  5784. $core.method({
  5785. selector: "subclass:instanceVariableNames:package:",
  5786. protocol: 'class creation',
  5787. fn: function (aString,aString2,aString3){
  5788. var self=this;
  5789. return $core.withContext(function($ctx1) {
  5790. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  5791. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5792. },
  5793. args: ["aString", "aString2", "aString3"],
  5794. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5795. referencedClasses: ["ClassBuilder"],
  5796. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  5797. }),
  5798. $globals.UndefinedObject);
  5799. $core.addMethod(
  5800. $core.method({
  5801. selector: "new",
  5802. protocol: 'instance creation',
  5803. fn: function (){
  5804. var self=this;
  5805. return $core.withContext(function($ctx1) {
  5806. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  5807. return self;
  5808. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.klass)});
  5809. },
  5810. args: [],
  5811. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  5812. referencedClasses: [],
  5813. messageSends: ["error:"]
  5814. }),
  5815. $globals.UndefinedObject.klass);
  5816. });
  5817. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  5818. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  5819. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  5820. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  5821. $core.addPackage('Kernel-Classes');
  5822. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  5823. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5824. $core.addClass('Behavior', $globals.Object, [], 'Kernel-Classes');
  5825. $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.";
  5826. $core.addMethod(
  5827. $core.method({
  5828. selector: ">>",
  5829. protocol: 'accessing',
  5830. fn: function (aString){
  5831. var self=this;
  5832. return $core.withContext(function($ctx1) {
  5833. return self._methodAt_(aString);
  5834. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.Behavior)});
  5835. },
  5836. args: ["aString"],
  5837. source: ">> aString\x0a\x09^ self methodAt: aString",
  5838. referencedClasses: [],
  5839. messageSends: ["methodAt:"]
  5840. }),
  5841. $globals.Behavior);
  5842. $core.addMethod(
  5843. $core.method({
  5844. selector: "addCompiledMethod:",
  5845. protocol: 'compiling',
  5846. fn: function (aMethod){
  5847. var self=this;
  5848. var oldMethod,announcement;
  5849. return $core.withContext(function($ctx1) {
  5850. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$receiver;
  5851. oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  5852. return nil;
  5853. }));
  5854. $2=self._protocols();
  5855. $3=$recv(aMethod)._protocol();
  5856. $ctx1.sendIdx["protocol"]=1;
  5857. $1=$recv($2)._includes_($3);
  5858. if(!$core.assert($1)){
  5859. $4=self._organization();
  5860. $5=$recv(aMethod)._protocol();
  5861. $ctx1.sendIdx["protocol"]=2;
  5862. $recv($4)._addElement_($5);
  5863. };
  5864. self._basicAddCompiledMethod_(aMethod);
  5865. $6=oldMethod;
  5866. if(($receiver = $6) == null || $receiver.isNil){
  5867. $6;
  5868. } else {
  5869. self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  5870. };
  5871. $7=oldMethod;
  5872. if(($receiver = $7) == null || $receiver.isNil){
  5873. $8=$recv($globals.MethodAdded)._new();
  5874. $ctx1.sendIdx["new"]=1;
  5875. $recv($8)._method_(aMethod);
  5876. $ctx1.sendIdx["method:"]=1;
  5877. $9=$recv($8)._yourself();
  5878. $ctx1.sendIdx["yourself"]=1;
  5879. announcement=$9;
  5880. } else {
  5881. $10=$recv($globals.MethodModified)._new();
  5882. $recv($10)._oldMethod_(oldMethod);
  5883. $recv($10)._method_(aMethod);
  5884. announcement=$recv($10)._yourself();
  5885. };
  5886. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  5887. return self;
  5888. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.Behavior)});
  5889. },
  5890. args: ["aMethod"],
  5891. 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",
  5892. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  5893. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  5894. }),
  5895. $globals.Behavior);
  5896. $core.addMethod(
  5897. $core.method({
  5898. selector: "allInstanceVariableNames",
  5899. protocol: 'accessing',
  5900. fn: function (){
  5901. var self=this;
  5902. var result;
  5903. return $core.withContext(function($ctx1) {
  5904. var $1,$receiver;
  5905. result=$recv(self._instanceVariableNames())._copy();
  5906. $1=self._superclass();
  5907. $ctx1.sendIdx["superclass"]=1;
  5908. if(($receiver = $1) == null || $receiver.isNil){
  5909. $1;
  5910. } else {
  5911. $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
  5912. };
  5913. return result;
  5914. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  5915. },
  5916. args: [],
  5917. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  5918. referencedClasses: [],
  5919. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  5920. }),
  5921. $globals.Behavior);
  5922. $core.addMethod(
  5923. $core.method({
  5924. selector: "allSelectors",
  5925. protocol: 'accessing',
  5926. fn: function (){
  5927. var self=this;
  5928. return $core.withContext(function($ctx1) {
  5929. var $1,$2;
  5930. $1=self._allSuperclasses();
  5931. $2=self._selectors();
  5932. $ctx1.sendIdx["selectors"]=1;
  5933. return $recv($1)._inject_into_($2,(function(acc,each){
  5934. return $core.withContext(function($ctx2) {
  5935. $recv(acc)._addAll_($recv(each)._selectors());
  5936. return $recv(acc)._yourself();
  5937. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  5938. }));
  5939. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  5940. },
  5941. args: [],
  5942. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  5943. referencedClasses: [],
  5944. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  5945. }),
  5946. $globals.Behavior);
  5947. $core.addMethod(
  5948. $core.method({
  5949. selector: "allSubclasses",
  5950. protocol: 'accessing',
  5951. fn: function (){
  5952. var self=this;
  5953. return $core.withContext(function($ctx1) {
  5954. return $recv($globals.Array)._streamContents_((function(str){
  5955. return $core.withContext(function($ctx2) {
  5956. return self._allSubclassesDo_((function(each){
  5957. return $core.withContext(function($ctx3) {
  5958. return $recv(str)._nextPut_(each);
  5959. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5960. }));
  5961. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  5962. }));
  5963. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  5964. },
  5965. args: [],
  5966. 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 ] ]",
  5967. referencedClasses: ["Array"],
  5968. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  5969. }),
  5970. $globals.Behavior);
  5971. $core.addMethod(
  5972. $core.method({
  5973. selector: "allSubclassesDo:",
  5974. protocol: 'enumerating',
  5975. fn: function (aBlock){
  5976. var self=this;
  5977. return $core.withContext(function($ctx1) {
  5978. $core.traverseClassTree(self, function(subclass) {
  5979. if (subclass !== self) aBlock._value_(subclass);
  5980. });
  5981. return self;
  5982. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  5983. },
  5984. args: ["aBlock"],
  5985. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a<$core.traverseClassTree(self, function(subclass) {\x0a\x09if (subclass !== self) aBlock._value_(subclass);\x0a})>",
  5986. referencedClasses: [],
  5987. messageSends: []
  5988. }),
  5989. $globals.Behavior);
  5990. $core.addMethod(
  5991. $core.method({
  5992. selector: "allSuperclasses",
  5993. protocol: 'accessing',
  5994. fn: function (){
  5995. var self=this;
  5996. return $core.withContext(function($ctx1) {
  5997. var $1,$3,$2,$receiver;
  5998. $1=self._superclass();
  5999. $ctx1.sendIdx["superclass"]=1;
  6000. if(($receiver = $1) == null || $receiver.isNil){
  6001. return [];
  6002. } else {
  6003. $1;
  6004. };
  6005. $3=self._superclass();
  6006. $ctx1.sendIdx["superclass"]=2;
  6007. $2=$recv($globals.OrderedCollection)._with_($3);
  6008. $recv($2)._addAll_($recv(self._superclass())._allSuperclasses());
  6009. return $recv($2)._yourself();
  6010. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  6011. },
  6012. args: [],
  6013. 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",
  6014. referencedClasses: ["OrderedCollection"],
  6015. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  6016. }),
  6017. $globals.Behavior);
  6018. $core.addMethod(
  6019. $core.method({
  6020. selector: "basicAddCompiledMethod:",
  6021. protocol: 'private',
  6022. fn: function (aMethod){
  6023. var self=this;
  6024. return $core.withContext(function($ctx1) {
  6025. $core.addMethod(aMethod, self);
  6026. return self;
  6027. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6028. },
  6029. args: ["aMethod"],
  6030. source: "basicAddCompiledMethod: aMethod\x0a\x09<$core.addMethod(aMethod, self)>",
  6031. referencedClasses: [],
  6032. messageSends: []
  6033. }),
  6034. $globals.Behavior);
  6035. $core.addMethod(
  6036. $core.method({
  6037. selector: "basicNew",
  6038. protocol: 'instance creation',
  6039. fn: function (){
  6040. var self=this;
  6041. return $core.withContext(function($ctx1) {
  6042. return new self.fn();
  6043. return self;
  6044. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  6045. },
  6046. args: [],
  6047. source: "basicNew\x0a\x09<return new self.fn()>",
  6048. referencedClasses: [],
  6049. messageSends: []
  6050. }),
  6051. $globals.Behavior);
  6052. $core.addMethod(
  6053. $core.method({
  6054. selector: "basicRemoveCompiledMethod:",
  6055. protocol: 'private',
  6056. fn: function (aMethod){
  6057. var self=this;
  6058. return $core.withContext(function($ctx1) {
  6059. $core.removeMethod(aMethod,self);
  6060. return self;
  6061. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6062. },
  6063. args: ["aMethod"],
  6064. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<$core.removeMethod(aMethod,self)>",
  6065. referencedClasses: [],
  6066. messageSends: []
  6067. }),
  6068. $globals.Behavior);
  6069. $core.addMethod(
  6070. $core.method({
  6071. selector: "canUnderstand:",
  6072. protocol: 'testing',
  6073. fn: function (aSelector){
  6074. var self=this;
  6075. return $core.withContext(function($ctx1) {
  6076. var $2,$1;
  6077. return $recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  6078. return $core.withContext(function($ctx2) {
  6079. $2=self._superclass();
  6080. $ctx2.sendIdx["superclass"]=1;
  6081. $1=$recv($2)._notNil();
  6082. return $recv($1)._and_((function(){
  6083. return $core.withContext(function($ctx3) {
  6084. return $recv(self._superclass())._canUnderstand_(aSelector);
  6085. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6086. }));
  6087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6088. }));
  6089. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  6090. },
  6091. args: ["aSelector"],
  6092. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  6093. referencedClasses: [],
  6094. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  6095. }),
  6096. $globals.Behavior);
  6097. $core.addMethod(
  6098. $core.method({
  6099. selector: "comment",
  6100. protocol: 'accessing',
  6101. fn: function (){
  6102. var self=this;
  6103. return $core.withContext(function($ctx1) {
  6104. var $1,$receiver;
  6105. $1=self._basicAt_("comment");
  6106. if(($receiver = $1) == null || $receiver.isNil){
  6107. return "";
  6108. } else {
  6109. return $1;
  6110. };
  6111. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.Behavior)});
  6112. },
  6113. args: [],
  6114. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  6115. referencedClasses: [],
  6116. messageSends: ["ifNil:", "basicAt:"]
  6117. }),
  6118. $globals.Behavior);
  6119. $core.addMethod(
  6120. $core.method({
  6121. selector: "comment:",
  6122. protocol: 'accessing',
  6123. fn: function (aString){
  6124. var self=this;
  6125. return $core.withContext(function($ctx1) {
  6126. var $1,$3,$2;
  6127. self._basicAt_put_("comment",aString);
  6128. $1=$recv($globals.SystemAnnouncer)._current();
  6129. $3=$recv($globals.ClassCommentChanged)._new();
  6130. $recv($3)._theClass_(self);
  6131. $2=$recv($3)._yourself();
  6132. $recv($1)._announce_($2);
  6133. return self;
  6134. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.Behavior)});
  6135. },
  6136. args: ["aString"],
  6137. 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)",
  6138. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  6139. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  6140. }),
  6141. $globals.Behavior);
  6142. $core.addMethod(
  6143. $core.method({
  6144. selector: "compile:protocol:",
  6145. protocol: 'compiling',
  6146. fn: function (aString,anotherString){
  6147. var self=this;
  6148. return $core.withContext(function($ctx1) {
  6149. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  6150. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.Behavior)});
  6151. },
  6152. args: ["aString", "anotherString"],
  6153. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  6154. referencedClasses: ["Compiler"],
  6155. messageSends: ["install:forClass:protocol:", "new"]
  6156. }),
  6157. $globals.Behavior);
  6158. $core.addMethod(
  6159. $core.method({
  6160. selector: "definition",
  6161. protocol: 'accessing',
  6162. fn: function (){
  6163. var self=this;
  6164. return "";
  6165. },
  6166. args: [],
  6167. source: "definition\x0a\x09^ ''",
  6168. referencedClasses: [],
  6169. messageSends: []
  6170. }),
  6171. $globals.Behavior);
  6172. $core.addMethod(
  6173. $core.method({
  6174. selector: "includesBehavior:",
  6175. protocol: 'testing',
  6176. fn: function (aClass){
  6177. var self=this;
  6178. return $core.withContext(function($ctx1) {
  6179. return $recv(self.__eq_eq(aClass))._or_((function(){
  6180. return $core.withContext(function($ctx2) {
  6181. return self._inheritsFrom_(aClass);
  6182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6183. }));
  6184. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  6185. },
  6186. args: ["aClass"],
  6187. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  6188. referencedClasses: [],
  6189. messageSends: ["or:", "==", "inheritsFrom:"]
  6190. }),
  6191. $globals.Behavior);
  6192. $core.addMethod(
  6193. $core.method({
  6194. selector: "includesSelector:",
  6195. protocol: 'testing',
  6196. fn: function (aString){
  6197. var self=this;
  6198. return $core.withContext(function($ctx1) {
  6199. return $recv(self._methodDictionary())._includesKey_(aString);
  6200. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.Behavior)});
  6201. },
  6202. args: ["aString"],
  6203. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  6204. referencedClasses: [],
  6205. messageSends: ["includesKey:", "methodDictionary"]
  6206. }),
  6207. $globals.Behavior);
  6208. $core.addMethod(
  6209. $core.method({
  6210. selector: "inheritsFrom:",
  6211. protocol: 'testing',
  6212. fn: function (aClass){
  6213. var self=this;
  6214. return $core.withContext(function($ctx1) {
  6215. var $1,$3,$2,$receiver;
  6216. $1=self._superclass();
  6217. $ctx1.sendIdx["superclass"]=1;
  6218. if(($receiver = $1) == null || $receiver.isNil){
  6219. return false;
  6220. } else {
  6221. $1;
  6222. };
  6223. $3=self._superclass();
  6224. $ctx1.sendIdx["superclass"]=2;
  6225. $2=$recv(aClass).__eq_eq($3);
  6226. return $recv($2)._or_((function(){
  6227. return $core.withContext(function($ctx2) {
  6228. return $recv(self._superclass())._inheritsFrom_(aClass);
  6229. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6230. }));
  6231. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  6232. },
  6233. args: ["aClass"],
  6234. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  6235. referencedClasses: [],
  6236. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  6237. }),
  6238. $globals.Behavior);
  6239. $core.addMethod(
  6240. $core.method({
  6241. selector: "instanceVariableNames",
  6242. protocol: 'accessing',
  6243. fn: function (){
  6244. var self=this;
  6245. return $core.withContext(function($ctx1) {
  6246. return self.iVarNames;
  6247. return self;
  6248. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  6249. },
  6250. args: [],
  6251. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  6252. referencedClasses: [],
  6253. messageSends: []
  6254. }),
  6255. $globals.Behavior);
  6256. $core.addMethod(
  6257. $core.method({
  6258. selector: "isBehavior",
  6259. protocol: 'testing',
  6260. fn: function (){
  6261. var self=this;
  6262. return true;
  6263. },
  6264. args: [],
  6265. source: "isBehavior\x0a\x09^ true",
  6266. referencedClasses: [],
  6267. messageSends: []
  6268. }),
  6269. $globals.Behavior);
  6270. $core.addMethod(
  6271. $core.method({
  6272. selector: "javascriptConstructor",
  6273. protocol: 'accessing',
  6274. fn: function (){
  6275. var self=this;
  6276. return $core.withContext(function($ctx1) {
  6277. return self.fn;
  6278. return self;
  6279. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  6280. },
  6281. args: [],
  6282. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
  6283. referencedClasses: [],
  6284. messageSends: []
  6285. }),
  6286. $globals.Behavior);
  6287. $core.addMethod(
  6288. $core.method({
  6289. selector: "javascriptConstructor:",
  6290. protocol: 'accessing',
  6291. fn: function (aJavaScriptFunction){
  6292. var self=this;
  6293. return $core.withContext(function($ctx1) {
  6294. $core.setClassConstructor(self, aJavaScriptFunction);;
  6295. return self;
  6296. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  6297. },
  6298. args: ["aJavaScriptFunction"],
  6299. 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<$core.setClassConstructor(self, aJavaScriptFunction);>",
  6300. referencedClasses: [],
  6301. messageSends: []
  6302. }),
  6303. $globals.Behavior);
  6304. $core.addMethod(
  6305. $core.method({
  6306. selector: "lookupSelector:",
  6307. protocol: 'accessing',
  6308. fn: function (selector){
  6309. var self=this;
  6310. var lookupClass;
  6311. return $core.withContext(function($ctx1) {
  6312. var $1;
  6313. var $early={};
  6314. try {
  6315. lookupClass=self;
  6316. $recv((function(){
  6317. return $core.withContext(function($ctx2) {
  6318. return $recv(lookupClass).__eq(nil);
  6319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6320. }))._whileFalse_((function(){
  6321. return $core.withContext(function($ctx2) {
  6322. $1=$recv(lookupClass)._includesSelector_(selector);
  6323. if($core.assert($1)){
  6324. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  6325. };
  6326. lookupClass=$recv(lookupClass)._superclass();
  6327. return lookupClass;
  6328. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6329. }));
  6330. return nil;
  6331. }
  6332. catch(e) {if(e===$early)return e[0]; throw e}
  6333. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  6334. },
  6335. args: ["selector"],
  6336. 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",
  6337. referencedClasses: [],
  6338. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  6339. }),
  6340. $globals.Behavior);
  6341. $core.addMethod(
  6342. $core.method({
  6343. selector: "methodAt:",
  6344. protocol: 'accessing',
  6345. fn: function (aString){
  6346. var self=this;
  6347. return $core.withContext(function($ctx1) {
  6348. return $recv(self._methodDictionary())._at_(aString);
  6349. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.Behavior)});
  6350. },
  6351. args: ["aString"],
  6352. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  6353. referencedClasses: [],
  6354. messageSends: ["at:", "methodDictionary"]
  6355. }),
  6356. $globals.Behavior);
  6357. $core.addMethod(
  6358. $core.method({
  6359. selector: "methodDictionary",
  6360. protocol: 'accessing',
  6361. fn: function (){
  6362. var self=this;
  6363. return $core.withContext(function($ctx1) {
  6364. var dict = $globals.HashedCollection._new();
  6365. var methods = self.methods;
  6366. Object.keys(methods).forEach(function(i) {
  6367. if(methods[i].selector) {
  6368. dict._at_put_(methods[i].selector, methods[i]);
  6369. }
  6370. });
  6371. return dict;
  6372. return self;
  6373. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.Behavior)});
  6374. },
  6375. args: [],
  6376. source: "methodDictionary\x0a\x09<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>",
  6377. referencedClasses: [],
  6378. messageSends: []
  6379. }),
  6380. $globals.Behavior);
  6381. $core.addMethod(
  6382. $core.method({
  6383. selector: "methodTemplate",
  6384. protocol: 'accessing',
  6385. fn: function (){
  6386. var self=this;
  6387. return $core.withContext(function($ctx1) {
  6388. var $2,$3,$1,$6,$7,$5,$8,$4;
  6389. return $recv($globals.String)._streamContents_((function(stream){
  6390. return $core.withContext(function($ctx2) {
  6391. $recv(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  6392. $ctx2.sendIdx["nextPutAll:"]=1;
  6393. $2=$recv($globals.String)._lf();
  6394. $ctx2.sendIdx["lf"]=1;
  6395. $3=$recv($globals.String)._tab();
  6396. $ctx2.sendIdx["tab"]=1;
  6397. $1=$recv($2).__comma($3);
  6398. $ctx2.sendIdx[","]=1;
  6399. $recv(stream)._nextPutAll_($1);
  6400. $ctx2.sendIdx["nextPutAll:"]=2;
  6401. $recv(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  6402. $ctx2.sendIdx["nextPutAll:"]=3;
  6403. $6=$recv($globals.String)._lf();
  6404. $ctx2.sendIdx["lf"]=2;
  6405. $7=$recv($globals.String)._lf();
  6406. $ctx2.sendIdx["lf"]=3;
  6407. $5=$recv($6).__comma($7);
  6408. $ctx2.sendIdx[","]=3;
  6409. $8=$recv($globals.String)._tab();
  6410. $ctx2.sendIdx["tab"]=2;
  6411. $4=$recv($5).__comma($8);
  6412. $ctx2.sendIdx[","]=2;
  6413. $recv(stream)._nextPutAll_($4);
  6414. $ctx2.sendIdx["nextPutAll:"]=4;
  6415. $recv(stream)._nextPutAll_("| temporary variable names |");
  6416. $ctx2.sendIdx["nextPutAll:"]=5;
  6417. $recv(stream)._nextPutAll_($recv($recv($globals.String)._lf()).__comma($recv($globals.String)._tab()));
  6418. $ctx2.sendIdx["nextPutAll:"]=6;
  6419. return $recv(stream)._nextPutAll_("statements");
  6420. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6421. }));
  6422. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.Behavior)});
  6423. },
  6424. args: [],
  6425. 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' ]",
  6426. referencedClasses: ["String"],
  6427. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
  6428. }),
  6429. $globals.Behavior);
  6430. $core.addMethod(
  6431. $core.method({
  6432. selector: "methods",
  6433. protocol: 'accessing',
  6434. fn: function (){
  6435. var self=this;
  6436. return $core.withContext(function($ctx1) {
  6437. return $recv(self._methodDictionary())._values();
  6438. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.Behavior)});
  6439. },
  6440. args: [],
  6441. source: "methods\x0a\x09^ self methodDictionary values",
  6442. referencedClasses: [],
  6443. messageSends: ["values", "methodDictionary"]
  6444. }),
  6445. $globals.Behavior);
  6446. $core.addMethod(
  6447. $core.method({
  6448. selector: "methodsInProtocol:",
  6449. protocol: 'accessing',
  6450. fn: function (aString){
  6451. var self=this;
  6452. return $core.withContext(function($ctx1) {
  6453. return $recv(self._methods())._select_((function(each){
  6454. return $core.withContext(function($ctx2) {
  6455. return $recv($recv(each)._protocol()).__eq(aString);
  6456. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6457. }));
  6458. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.Behavior)});
  6459. },
  6460. args: ["aString"],
  6461. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  6462. referencedClasses: [],
  6463. messageSends: ["select:", "methods", "=", "protocol"]
  6464. }),
  6465. $globals.Behavior);
  6466. $core.addMethod(
  6467. $core.method({
  6468. selector: "name",
  6469. protocol: 'accessing',
  6470. fn: function (){
  6471. var self=this;
  6472. return $core.withContext(function($ctx1) {
  6473. return self.className || nil;
  6474. return self;
  6475. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Behavior)});
  6476. },
  6477. args: [],
  6478. source: "name\x0a\x09<return self.className || nil>",
  6479. referencedClasses: [],
  6480. messageSends: []
  6481. }),
  6482. $globals.Behavior);
  6483. $core.addMethod(
  6484. $core.method({
  6485. selector: "new",
  6486. protocol: 'instance creation',
  6487. fn: function (){
  6488. var self=this;
  6489. return $core.withContext(function($ctx1) {
  6490. return $recv(self._basicNew())._initialize();
  6491. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  6492. },
  6493. args: [],
  6494. source: "new\x0a\x09^ self basicNew initialize",
  6495. referencedClasses: [],
  6496. messageSends: ["initialize", "basicNew"]
  6497. }),
  6498. $globals.Behavior);
  6499. $core.addMethod(
  6500. $core.method({
  6501. selector: "organization",
  6502. protocol: 'accessing',
  6503. fn: function (){
  6504. var self=this;
  6505. return $core.withContext(function($ctx1) {
  6506. return self._basicAt_("organization");
  6507. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Behavior)});
  6508. },
  6509. args: [],
  6510. source: "organization\x0a\x09^ self basicAt: 'organization'",
  6511. referencedClasses: [],
  6512. messageSends: ["basicAt:"]
  6513. }),
  6514. $globals.Behavior);
  6515. $core.addMethod(
  6516. $core.method({
  6517. selector: "ownMethods",
  6518. protocol: 'accessing',
  6519. fn: function (){
  6520. var self=this;
  6521. return $core.withContext(function($ctx1) {
  6522. var $1;
  6523. return $recv($recv(self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  6524. return $core.withContext(function($ctx2) {
  6525. return $recv(acc).__comma(self._methodsInProtocol_(each));
  6526. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  6527. })))._sorted_((function(a,b){
  6528. return $core.withContext(function($ctx2) {
  6529. $1=$recv(a)._selector();
  6530. $ctx2.sendIdx["selector"]=1;
  6531. return $recv($1).__lt_eq($recv(b)._selector());
  6532. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  6533. }));
  6534. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.Behavior)});
  6535. },
  6536. args: [],
  6537. 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 ]",
  6538. referencedClasses: ["OrderedCollection"],
  6539. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
  6540. }),
  6541. $globals.Behavior);
  6542. $core.addMethod(
  6543. $core.method({
  6544. selector: "ownProtocols",
  6545. protocol: 'accessing',
  6546. fn: function (){
  6547. var self=this;
  6548. return $core.withContext(function($ctx1) {
  6549. return $recv(self._protocols())._reject_((function(each){
  6550. return $core.withContext(function($ctx2) {
  6551. return $recv(each)._match_("^\x5c*");
  6552. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6553. }));
  6554. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.Behavior)});
  6555. },
  6556. args: [],
  6557. 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*' ]",
  6558. referencedClasses: [],
  6559. messageSends: ["reject:", "protocols", "match:"]
  6560. }),
  6561. $globals.Behavior);
  6562. $core.addMethod(
  6563. $core.method({
  6564. selector: "packageOfProtocol:",
  6565. protocol: 'accessing',
  6566. fn: function (aString){
  6567. var self=this;
  6568. return $core.withContext(function($ctx1) {
  6569. var $1;
  6570. $1=$recv(aString)._beginsWith_("*");
  6571. if(!$core.assert($1)){
  6572. return self._package();
  6573. };
  6574. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  6575. return nil;
  6576. }));
  6577. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.Behavior)});
  6578. },
  6579. args: ["aString"],
  6580. 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 ]",
  6581. referencedClasses: ["Package"],
  6582. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  6583. }),
  6584. $globals.Behavior);
  6585. $core.addMethod(
  6586. $core.method({
  6587. selector: "protocols",
  6588. protocol: 'accessing',
  6589. fn: function (){
  6590. var self=this;
  6591. return $core.withContext(function($ctx1) {
  6592. return $recv($recv(self._organization())._elements())._sorted();
  6593. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.Behavior)});
  6594. },
  6595. args: [],
  6596. source: "protocols\x0a\x09^ self organization elements sorted",
  6597. referencedClasses: [],
  6598. messageSends: ["sorted", "elements", "organization"]
  6599. }),
  6600. $globals.Behavior);
  6601. $core.addMethod(
  6602. $core.method({
  6603. selector: "protocolsDo:",
  6604. protocol: 'enumerating',
  6605. fn: function (aBlock){
  6606. var self=this;
  6607. var methodsByProtocol;
  6608. return $core.withContext(function($ctx1) {
  6609. methodsByProtocol=$recv($globals.HashedCollection)._new();
  6610. $ctx1.sendIdx["new"]=1;
  6611. $recv(self._methodDictionary())._valuesDo_((function(m){
  6612. return $core.withContext(function($ctx2) {
  6613. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  6614. return $core.withContext(function($ctx3) {
  6615. return $recv($globals.Array)._new();
  6616. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6617. })))._add_(m);
  6618. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  6619. }));
  6620. $recv(self._protocols())._do_((function(protocol){
  6621. return $core.withContext(function($ctx2) {
  6622. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  6623. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  6624. }));
  6625. return self;
  6626. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.Behavior)});
  6627. },
  6628. args: ["aBlock"],
  6629. 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) ]",
  6630. referencedClasses: ["HashedCollection", "Array"],
  6631. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  6632. }),
  6633. $globals.Behavior);
  6634. $core.addMethod(
  6635. $core.method({
  6636. selector: "prototype",
  6637. protocol: 'accessing',
  6638. fn: function (){
  6639. var self=this;
  6640. return $core.withContext(function($ctx1) {
  6641. return self.fn.prototype;
  6642. return self;
  6643. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  6644. },
  6645. args: [],
  6646. source: "prototype\x0a\x09<return self.fn.prototype>",
  6647. referencedClasses: [],
  6648. messageSends: []
  6649. }),
  6650. $globals.Behavior);
  6651. $core.addMethod(
  6652. $core.method({
  6653. selector: "recompile",
  6654. protocol: 'compiling',
  6655. fn: function (){
  6656. var self=this;
  6657. return $core.withContext(function($ctx1) {
  6658. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  6659. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.Behavior)});
  6660. },
  6661. args: [],
  6662. source: "recompile\x0a\x09^ Compiler new recompile: self",
  6663. referencedClasses: ["Compiler"],
  6664. messageSends: ["recompile:", "new"]
  6665. }),
  6666. $globals.Behavior);
  6667. $core.addMethod(
  6668. $core.method({
  6669. selector: "removeCompiledMethod:",
  6670. protocol: 'compiling',
  6671. fn: function (aMethod){
  6672. var self=this;
  6673. return $core.withContext(function($ctx1) {
  6674. var $1,$3,$2;
  6675. self._basicRemoveCompiledMethod_(aMethod);
  6676. self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  6677. $1=$recv($globals.SystemAnnouncer)._current();
  6678. $3=$recv($globals.MethodRemoved)._new();
  6679. $recv($3)._method_(aMethod);
  6680. $2=$recv($3)._yourself();
  6681. $recv($1)._announce_($2);
  6682. return self;
  6683. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6684. },
  6685. args: ["aMethod"],
  6686. 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)",
  6687. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  6688. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  6689. }),
  6690. $globals.Behavior);
  6691. $core.addMethod(
  6692. $core.method({
  6693. selector: "removeProtocolIfEmpty:",
  6694. protocol: 'accessing',
  6695. fn: function (aString){
  6696. var self=this;
  6697. return $core.withContext(function($ctx1) {
  6698. $recv(self._methods())._detect_ifNone_((function(each){
  6699. return $core.withContext(function($ctx2) {
  6700. return $recv($recv(each)._protocol()).__eq(aString);
  6701. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6702. }),(function(){
  6703. return $core.withContext(function($ctx2) {
  6704. return $recv(self._organization())._removeElement_(aString);
  6705. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6706. }));
  6707. return self;
  6708. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.Behavior)});
  6709. },
  6710. args: ["aString"],
  6711. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  6712. referencedClasses: [],
  6713. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  6714. }),
  6715. $globals.Behavior);
  6716. $core.addMethod(
  6717. $core.method({
  6718. selector: "selectors",
  6719. protocol: 'accessing',
  6720. fn: function (){
  6721. var self=this;
  6722. return $core.withContext(function($ctx1) {
  6723. return $recv(self._methodDictionary())._keys();
  6724. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.Behavior)});
  6725. },
  6726. args: [],
  6727. source: "selectors\x0a\x09^ self methodDictionary keys",
  6728. referencedClasses: [],
  6729. messageSends: ["keys", "methodDictionary"]
  6730. }),
  6731. $globals.Behavior);
  6732. $core.addMethod(
  6733. $core.method({
  6734. selector: "subclasses",
  6735. protocol: 'accessing',
  6736. fn: function (){
  6737. var self=this;
  6738. return $core.withContext(function($ctx1) {
  6739. self._subclassResponsibility();
  6740. return self;
  6741. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  6742. },
  6743. args: [],
  6744. source: "subclasses\x0a\x09self subclassResponsibility",
  6745. referencedClasses: [],
  6746. messageSends: ["subclassResponsibility"]
  6747. }),
  6748. $globals.Behavior);
  6749. $core.addMethod(
  6750. $core.method({
  6751. selector: "superclass",
  6752. protocol: 'accessing',
  6753. fn: function (){
  6754. var self=this;
  6755. return $core.withContext(function($ctx1) {
  6756. return self.superclass;
  6757. return self;
  6758. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  6759. },
  6760. args: [],
  6761. source: "superclass\x0a\x09<return self.superclass>",
  6762. referencedClasses: [],
  6763. messageSends: []
  6764. }),
  6765. $globals.Behavior);
  6766. $core.addMethod(
  6767. $core.method({
  6768. selector: "theMetaClass",
  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,"theMetaClass",{},$globals.Behavior)});
  6776. },
  6777. args: [],
  6778. source: "theMetaClass\x0a\x09self subclassResponsibility",
  6779. referencedClasses: [],
  6780. messageSends: ["subclassResponsibility"]
  6781. }),
  6782. $globals.Behavior);
  6783. $core.addMethod(
  6784. $core.method({
  6785. selector: "theNonMetaClass",
  6786. protocol: 'accessing',
  6787. fn: function (){
  6788. var self=this;
  6789. return $core.withContext(function($ctx1) {
  6790. self._subclassResponsibility();
  6791. return self;
  6792. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  6793. },
  6794. args: [],
  6795. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  6796. referencedClasses: [],
  6797. messageSends: ["subclassResponsibility"]
  6798. }),
  6799. $globals.Behavior);
  6800. $core.addMethod(
  6801. $core.method({
  6802. selector: "withAllSubclasses",
  6803. protocol: 'accessing',
  6804. fn: function (){
  6805. var self=this;
  6806. return $core.withContext(function($ctx1) {
  6807. var $1;
  6808. $1=$recv($globals.Array)._with_(self);
  6809. $recv($1)._addAll_(self._allSubclasses());
  6810. return $recv($1)._yourself();
  6811. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  6812. },
  6813. args: [],
  6814. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  6815. referencedClasses: ["Array"],
  6816. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  6817. }),
  6818. $globals.Behavior);
  6819. $core.addClass('Class', $globals.Behavior, [], 'Kernel-Classes');
  6820. $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.";
  6821. $core.addMethod(
  6822. $core.method({
  6823. selector: "asJavascript",
  6824. protocol: 'converting',
  6825. fn: function (){
  6826. var self=this;
  6827. return $core.withContext(function($ctx1) {
  6828. return "$globals.".__comma(self._name());
  6829. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Class)});
  6830. },
  6831. args: [],
  6832. source: "asJavascript\x0a\x09^ '$globals.', self name",
  6833. referencedClasses: [],
  6834. messageSends: [",", "name"]
  6835. }),
  6836. $globals.Class);
  6837. $core.addMethod(
  6838. $core.method({
  6839. selector: "browse",
  6840. protocol: 'browsing',
  6841. fn: function (){
  6842. var self=this;
  6843. return $core.withContext(function($ctx1) {
  6844. $recv($globals.Finder)._findClass_(self);
  6845. return self;
  6846. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)});
  6847. },
  6848. args: [],
  6849. source: "browse\x0a\x09Finder findClass: self",
  6850. referencedClasses: ["Finder"],
  6851. messageSends: ["findClass:"]
  6852. }),
  6853. $globals.Class);
  6854. $core.addMethod(
  6855. $core.method({
  6856. selector: "category",
  6857. protocol: 'accessing',
  6858. fn: function (){
  6859. var self=this;
  6860. return $core.withContext(function($ctx1) {
  6861. var $1,$receiver;
  6862. $1=self._package();
  6863. $ctx1.sendIdx["package"]=1;
  6864. if(($receiver = $1) == null || $receiver.isNil){
  6865. return "Unclassified";
  6866. } else {
  6867. return $recv(self._package())._name();
  6868. };
  6869. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)});
  6870. },
  6871. args: [],
  6872. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  6873. referencedClasses: [],
  6874. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  6875. }),
  6876. $globals.Class);
  6877. $core.addMethod(
  6878. $core.method({
  6879. selector: "classTag",
  6880. protocol: 'accessing',
  6881. fn: function (){
  6882. var self=this;
  6883. return "class";
  6884. },
  6885. args: [],
  6886. 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'",
  6887. referencedClasses: [],
  6888. messageSends: []
  6889. }),
  6890. $globals.Class);
  6891. $core.addMethod(
  6892. $core.method({
  6893. selector: "definition",
  6894. protocol: 'accessing',
  6895. fn: function (){
  6896. var self=this;
  6897. return $core.withContext(function($ctx1) {
  6898. var $2,$3,$1,$4,$5;
  6899. return $recv($globals.String)._streamContents_((function(stream){
  6900. return $core.withContext(function($ctx2) {
  6901. $recv(stream)._nextPutAll_($recv(self._superclass())._asString());
  6902. $ctx2.sendIdx["nextPutAll:"]=1;
  6903. $recv(stream)._nextPutAll_(" subclass: #");
  6904. $ctx2.sendIdx["nextPutAll:"]=2;
  6905. $recv(stream)._nextPutAll_(self._name());
  6906. $ctx2.sendIdx["nextPutAll:"]=3;
  6907. $2=$recv($globals.String)._lf();
  6908. $ctx2.sendIdx["lf"]=1;
  6909. $3=$recv($globals.String)._tab();
  6910. $ctx2.sendIdx["tab"]=1;
  6911. $1=$recv($2).__comma($3);
  6912. $ctx2.sendIdx[","]=1;
  6913. $recv(stream)._nextPutAll_($1);
  6914. $ctx2.sendIdx["nextPutAll:"]=4;
  6915. $4=$recv(stream)._nextPutAll_("instanceVariableNames: '");
  6916. $ctx2.sendIdx["nextPutAll:"]=5;
  6917. $4;
  6918. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  6919. return $core.withContext(function($ctx3) {
  6920. return $recv(stream)._nextPutAll_(each);
  6921. $ctx3.sendIdx["nextPutAll:"]=6;
  6922. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6923. }),(function(){
  6924. return $core.withContext(function($ctx3) {
  6925. return $recv(stream)._nextPutAll_(" ");
  6926. $ctx3.sendIdx["nextPutAll:"]=7;
  6927. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6928. }));
  6929. $5=$recv("'".__comma($recv($globals.String)._lf())).__comma($recv($globals.String)._tab());
  6930. $ctx2.sendIdx[","]=2;
  6931. $recv(stream)._nextPutAll_($5);
  6932. $ctx2.sendIdx["nextPutAll:"]=8;
  6933. $recv(stream)._nextPutAll_("package: '");
  6934. $ctx2.sendIdx["nextPutAll:"]=9;
  6935. $recv(stream)._nextPutAll_(self._category());
  6936. $ctx2.sendIdx["nextPutAll:"]=10;
  6937. return $recv(stream)._nextPutAll_("'");
  6938. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6939. }));
  6940. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  6941. },
  6942. args: [],
  6943. 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: '''' ]",
  6944. referencedClasses: ["String"],
  6945. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"]
  6946. }),
  6947. $globals.Class);
  6948. $core.addMethod(
  6949. $core.method({
  6950. selector: "isClass",
  6951. protocol: 'testing',
  6952. fn: function (){
  6953. var self=this;
  6954. return true;
  6955. },
  6956. args: [],
  6957. source: "isClass\x0a\x09^ true",
  6958. referencedClasses: [],
  6959. messageSends: []
  6960. }),
  6961. $globals.Class);
  6962. $core.addMethod(
  6963. $core.method({
  6964. selector: "package",
  6965. protocol: 'accessing',
  6966. fn: function (){
  6967. var self=this;
  6968. return $core.withContext(function($ctx1) {
  6969. return self._basicAt_("pkg");
  6970. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)});
  6971. },
  6972. args: [],
  6973. source: "package\x0a\x09^ self basicAt: 'pkg'",
  6974. referencedClasses: [],
  6975. messageSends: ["basicAt:"]
  6976. }),
  6977. $globals.Class);
  6978. $core.addMethod(
  6979. $core.method({
  6980. selector: "package:",
  6981. protocol: 'accessing',
  6982. fn: function (aPackage){
  6983. var self=this;
  6984. var oldPackage;
  6985. return $core.withContext(function($ctx1) {
  6986. var $2,$1,$3,$4,$6,$5;
  6987. $2=self._package();
  6988. $ctx1.sendIdx["package"]=1;
  6989. $1=$recv($2).__eq(aPackage);
  6990. if($core.assert($1)){
  6991. return self;
  6992. };
  6993. oldPackage=self._package();
  6994. self._basicAt_put_("pkg",aPackage);
  6995. $3=$recv(oldPackage)._organization();
  6996. $ctx1.sendIdx["organization"]=1;
  6997. $recv($3)._removeElement_(self);
  6998. $recv($recv(aPackage)._organization())._addElement_(self);
  6999. $4=$recv($globals.SystemAnnouncer)._current();
  7000. $6=$recv($globals.ClassMoved)._new();
  7001. $recv($6)._theClass_(self);
  7002. $recv($6)._oldPackage_(oldPackage);
  7003. $5=$recv($6)._yourself();
  7004. $recv($4)._announce_($5);
  7005. return self;
  7006. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)});
  7007. },
  7008. args: ["aPackage"],
  7009. 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)",
  7010. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  7011. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  7012. }),
  7013. $globals.Class);
  7014. $core.addMethod(
  7015. $core.method({
  7016. selector: "printOn:",
  7017. protocol: 'printing',
  7018. fn: function (aStream){
  7019. var self=this;
  7020. return $core.withContext(function($ctx1) {
  7021. $recv(aStream)._nextPutAll_(self._name());
  7022. return self;
  7023. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Class)});
  7024. },
  7025. args: ["aStream"],
  7026. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  7027. referencedClasses: [],
  7028. messageSends: ["nextPutAll:", "name"]
  7029. }),
  7030. $globals.Class);
  7031. $core.addMethod(
  7032. $core.method({
  7033. selector: "rename:",
  7034. protocol: 'accessing',
  7035. fn: function (aString){
  7036. var self=this;
  7037. return $core.withContext(function($ctx1) {
  7038. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  7039. return self;
  7040. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  7041. },
  7042. args: ["aString"],
  7043. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  7044. referencedClasses: ["ClassBuilder"],
  7045. messageSends: ["renameClass:to:", "new"]
  7046. }),
  7047. $globals.Class);
  7048. $core.addMethod(
  7049. $core.method({
  7050. selector: "subclass:instanceVariableNames:",
  7051. protocol: 'class creation',
  7052. fn: function (aString,anotherString){
  7053. var self=this;
  7054. return $core.withContext(function($ctx1) {
  7055. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  7056. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)});
  7057. },
  7058. args: ["aString", "anotherString"],
  7059. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  7060. referencedClasses: [],
  7061. messageSends: ["subclass:instanceVariableNames:package:"]
  7062. }),
  7063. $globals.Class);
  7064. $core.addMethod(
  7065. $core.method({
  7066. selector: "subclass:instanceVariableNames:category:",
  7067. protocol: 'class creation',
  7068. fn: function (aString,aString2,aString3){
  7069. var self=this;
  7070. return $core.withContext(function($ctx1) {
  7071. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  7072. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  7073. },
  7074. args: ["aString", "aString2", "aString3"],
  7075. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  7076. referencedClasses: [],
  7077. messageSends: ["subclass:instanceVariableNames:package:"]
  7078. }),
  7079. $globals.Class);
  7080. $core.addMethod(
  7081. $core.method({
  7082. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  7083. protocol: 'class creation',
  7084. fn: function (aString,aString2,classVars,pools,aString3){
  7085. var self=this;
  7086. return $core.withContext(function($ctx1) {
  7087. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  7088. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  7089. },
  7090. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  7091. 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",
  7092. referencedClasses: [],
  7093. messageSends: ["subclass:instanceVariableNames:package:"]
  7094. }),
  7095. $globals.Class);
  7096. $core.addMethod(
  7097. $core.method({
  7098. selector: "subclass:instanceVariableNames:package:",
  7099. protocol: 'class creation',
  7100. fn: function (aString,aString2,aString3){
  7101. var self=this;
  7102. return $core.withContext(function($ctx1) {
  7103. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  7104. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  7105. },
  7106. args: ["aString", "aString2", "aString3"],
  7107. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  7108. referencedClasses: ["ClassBuilder"],
  7109. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  7110. }),
  7111. $globals.Class);
  7112. $core.addMethod(
  7113. $core.method({
  7114. selector: "subclasses",
  7115. protocol: 'accessing',
  7116. fn: function (){
  7117. var self=this;
  7118. return $core.withContext(function($ctx1) {
  7119. return self.subclasses._copy();
  7120. return self;
  7121. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  7122. },
  7123. args: [],
  7124. source: "subclasses\x0a\x09<return self.subclasses._copy()>",
  7125. referencedClasses: [],
  7126. messageSends: []
  7127. }),
  7128. $globals.Class);
  7129. $core.addMethod(
  7130. $core.method({
  7131. selector: "theMetaClass",
  7132. protocol: 'accessing',
  7133. fn: function (){
  7134. var self=this;
  7135. return $core.withContext(function($ctx1) {
  7136. return self._class();
  7137. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  7138. },
  7139. args: [],
  7140. source: "theMetaClass\x0a\x09^ self class",
  7141. referencedClasses: [],
  7142. messageSends: ["class"]
  7143. }),
  7144. $globals.Class);
  7145. $core.addMethod(
  7146. $core.method({
  7147. selector: "theNonMetaClass",
  7148. protocol: 'accessing',
  7149. fn: function (){
  7150. var self=this;
  7151. return self;
  7152. },
  7153. args: [],
  7154. source: "theNonMetaClass\x0a\x09^ self",
  7155. referencedClasses: [],
  7156. messageSends: []
  7157. }),
  7158. $globals.Class);
  7159. $core.addClass('Metaclass', $globals.Behavior, [], 'Kernel-Classes');
  7160. $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.";
  7161. $core.addMethod(
  7162. $core.method({
  7163. selector: "asJavascript",
  7164. protocol: 'converting',
  7165. fn: function (){
  7166. var self=this;
  7167. return $core.withContext(function($ctx1) {
  7168. var $1;
  7169. $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass");
  7170. $ctx1.sendIdx[","]=1;
  7171. return $1;
  7172. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Metaclass)});
  7173. },
  7174. args: [],
  7175. source: "asJavascript\x0a\x09^ '$globals.', self instanceClass name, '.klass'",
  7176. referencedClasses: [],
  7177. messageSends: [",", "name", "instanceClass"]
  7178. }),
  7179. $globals.Metaclass);
  7180. $core.addMethod(
  7181. $core.method({
  7182. selector: "definition",
  7183. protocol: 'accessing',
  7184. fn: function (){
  7185. var self=this;
  7186. return $core.withContext(function($ctx1) {
  7187. var $1;
  7188. return $recv($globals.String)._streamContents_((function(stream){
  7189. return $core.withContext(function($ctx2) {
  7190. $recv(stream)._nextPutAll_(self._asString());
  7191. $ctx2.sendIdx["nextPutAll:"]=1;
  7192. $1=$recv(stream)._nextPutAll_(" instanceVariableNames: '");
  7193. $ctx2.sendIdx["nextPutAll:"]=2;
  7194. $1;
  7195. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  7196. return $core.withContext(function($ctx3) {
  7197. return $recv(stream)._nextPutAll_(each);
  7198. $ctx3.sendIdx["nextPutAll:"]=3;
  7199. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  7200. }),(function(){
  7201. return $core.withContext(function($ctx3) {
  7202. return $recv(stream)._nextPutAll_(" ");
  7203. $ctx3.sendIdx["nextPutAll:"]=4;
  7204. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  7205. }));
  7206. return $recv(stream)._nextPutAll_("'");
  7207. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  7208. }));
  7209. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  7210. },
  7211. args: [],
  7212. 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: '''' ]",
  7213. referencedClasses: ["String"],
  7214. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"]
  7215. }),
  7216. $globals.Metaclass);
  7217. $core.addMethod(
  7218. $core.method({
  7219. selector: "instanceClass",
  7220. protocol: 'accessing',
  7221. fn: function (){
  7222. var self=this;
  7223. return $core.withContext(function($ctx1) {
  7224. return self.instanceClass;
  7225. return self;
  7226. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  7227. },
  7228. args: [],
  7229. source: "instanceClass\x0a\x09<return self.instanceClass>",
  7230. referencedClasses: [],
  7231. messageSends: []
  7232. }),
  7233. $globals.Metaclass);
  7234. $core.addMethod(
  7235. $core.method({
  7236. selector: "instanceVariableNames:",
  7237. protocol: 'accessing',
  7238. fn: function (aCollection){
  7239. var self=this;
  7240. return $core.withContext(function($ctx1) {
  7241. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  7242. return self;
  7243. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  7244. },
  7245. args: ["aCollection"],
  7246. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  7247. referencedClasses: ["ClassBuilder"],
  7248. messageSends: ["class:instanceVariableNames:", "new"]
  7249. }),
  7250. $globals.Metaclass);
  7251. $core.addMethod(
  7252. $core.method({
  7253. selector: "isMetaclass",
  7254. protocol: 'testing',
  7255. fn: function (){
  7256. var self=this;
  7257. return true;
  7258. },
  7259. args: [],
  7260. source: "isMetaclass\x0a\x09^ true",
  7261. referencedClasses: [],
  7262. messageSends: []
  7263. }),
  7264. $globals.Metaclass);
  7265. $core.addMethod(
  7266. $core.method({
  7267. selector: "package",
  7268. protocol: 'accessing',
  7269. fn: function (){
  7270. var self=this;
  7271. return $core.withContext(function($ctx1) {
  7272. return $recv(self._instanceClass())._package();
  7273. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  7274. },
  7275. args: [],
  7276. source: "package\x0a\x09^ self instanceClass package",
  7277. referencedClasses: [],
  7278. messageSends: ["package", "instanceClass"]
  7279. }),
  7280. $globals.Metaclass);
  7281. $core.addMethod(
  7282. $core.method({
  7283. selector: "printOn:",
  7284. protocol: 'printing',
  7285. fn: function (aStream){
  7286. var self=this;
  7287. return $core.withContext(function($ctx1) {
  7288. $recv(aStream)._nextPutAll_($recv(self._instanceClass())._name());
  7289. $ctx1.sendIdx["nextPutAll:"]=1;
  7290. $recv(aStream)._nextPutAll_(" class");
  7291. return self;
  7292. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Metaclass)});
  7293. },
  7294. args: ["aStream"],
  7295. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  7296. referencedClasses: [],
  7297. messageSends: ["nextPutAll:", "name", "instanceClass"]
  7298. }),
  7299. $globals.Metaclass);
  7300. $core.addMethod(
  7301. $core.method({
  7302. selector: "subclasses",
  7303. protocol: 'accessing',
  7304. fn: function (){
  7305. var self=this;
  7306. return $core.withContext(function($ctx1) {
  7307. return $core.metaSubclasses(self);
  7308. return self;
  7309. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  7310. },
  7311. args: [],
  7312. source: "subclasses\x0a\x09<return $core.metaSubclasses(self)>",
  7313. referencedClasses: [],
  7314. messageSends: []
  7315. }),
  7316. $globals.Metaclass);
  7317. $core.addMethod(
  7318. $core.method({
  7319. selector: "theMetaClass",
  7320. protocol: 'accessing',
  7321. fn: function (){
  7322. var self=this;
  7323. return self;
  7324. },
  7325. args: [],
  7326. source: "theMetaClass\x0a\x09^ self",
  7327. referencedClasses: [],
  7328. messageSends: []
  7329. }),
  7330. $globals.Metaclass);
  7331. $core.addMethod(
  7332. $core.method({
  7333. selector: "theNonMetaClass",
  7334. protocol: 'accessing',
  7335. fn: function (){
  7336. var self=this;
  7337. return $core.withContext(function($ctx1) {
  7338. return self._instanceClass();
  7339. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  7340. },
  7341. args: [],
  7342. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  7343. referencedClasses: [],
  7344. messageSends: ["instanceClass"]
  7345. }),
  7346. $globals.Metaclass);
  7347. $core.addClass('ClassBuilder', $globals.Object, [], 'Kernel-Classes');
  7348. $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:`.";
  7349. $core.addMethod(
  7350. $core.method({
  7351. selector: "addSubclassOf:named:instanceVariableNames:package:",
  7352. protocol: 'class definition',
  7353. fn: function (aClass,className,aCollection,packageName){
  7354. var self=this;
  7355. var theClass,thePackage;
  7356. return $core.withContext(function($ctx1) {
  7357. var $1,$2,$receiver;
  7358. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  7359. thePackage=$recv($globals.Package)._named_(packageName);
  7360. $1=theClass;
  7361. if(($receiver = $1) == null || $receiver.isNil){
  7362. $1;
  7363. } else {
  7364. $recv(theClass)._package_(thePackage);
  7365. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  7366. if(!$core.assert($2)){
  7367. return self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  7368. };
  7369. };
  7370. return self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  7371. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  7372. },
  7373. args: ["aClass", "className", "aCollection", "packageName"],
  7374. 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",
  7375. referencedClasses: ["Smalltalk", "Package"],
  7376. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"]
  7377. }),
  7378. $globals.ClassBuilder);
  7379. $core.addMethod(
  7380. $core.method({
  7381. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  7382. protocol: 'private',
  7383. fn: function (aClass,aString,aCollection,packageName){
  7384. var self=this;
  7385. return $core.withContext(function($ctx1) {
  7386. return $core.addClass(aString, aClass, aCollection, packageName);
  7387. ;
  7388. return self;
  7389. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  7390. },
  7391. args: ["aClass", "aString", "aCollection", "packageName"],
  7392. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09>",
  7393. referencedClasses: [],
  7394. messageSends: []
  7395. }),
  7396. $globals.ClassBuilder);
  7397. $core.addMethod(
  7398. $core.method({
  7399. selector: "basicClass:instanceVariableNames:",
  7400. protocol: 'private',
  7401. fn: function (aClass,aString){
  7402. var self=this;
  7403. return $core.withContext(function($ctx1) {
  7404. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  7405. return self;
  7406. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7407. },
  7408. args: ["aClass", "aString"],
  7409. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  7410. referencedClasses: [],
  7411. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  7412. }),
  7413. $globals.ClassBuilder);
  7414. $core.addMethod(
  7415. $core.method({
  7416. selector: "basicClass:instanceVariables:",
  7417. protocol: 'private',
  7418. fn: function (aClass,aCollection){
  7419. var self=this;
  7420. return $core.withContext(function($ctx1) {
  7421. var $1;
  7422. $1=$recv(aClass)._isMetaclass();
  7423. if(!$core.assert($1)){
  7424. self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  7425. };
  7426. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  7427. return self;
  7428. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  7429. },
  7430. args: ["aClass", "aCollection"],
  7431. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  7432. referencedClasses: [],
  7433. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  7434. }),
  7435. $globals.ClassBuilder);
  7436. $core.addMethod(
  7437. $core.method({
  7438. selector: "basicRemoveClass:",
  7439. protocol: 'private',
  7440. fn: function (aClass){
  7441. var self=this;
  7442. return $core.withContext(function($ctx1) {
  7443. $core.removeClass(aClass);
  7444. return self;
  7445. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  7446. },
  7447. args: ["aClass"],
  7448. source: "basicRemoveClass: aClass\x0a\x09<$core.removeClass(aClass)>",
  7449. referencedClasses: [],
  7450. messageSends: []
  7451. }),
  7452. $globals.ClassBuilder);
  7453. $core.addMethod(
  7454. $core.method({
  7455. selector: "basicRenameClass:to:",
  7456. protocol: 'private',
  7457. fn: function (aClass,aString){
  7458. var self=this;
  7459. return $core.withContext(function($ctx1) {
  7460. $globals[aString] = aClass;
  7461. delete $globals[aClass.className];
  7462. aClass.className = aString;
  7463. ;
  7464. return self;
  7465. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7466. },
  7467. args: ["aClass", "aString"],
  7468. source: "basicRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.className];\x0a\x09\x09aClass.className = aString;\x0a\x09>",
  7469. referencedClasses: [],
  7470. messageSends: []
  7471. }),
  7472. $globals.ClassBuilder);
  7473. $core.addMethod(
  7474. $core.method({
  7475. selector: "basicSwapClassNames:with:",
  7476. protocol: 'private',
  7477. fn: function (aClass,anotherClass){
  7478. var self=this;
  7479. return $core.withContext(function($ctx1) {
  7480. var tmp = aClass.className;
  7481. aClass.className = anotherClass.className;
  7482. anotherClass.className = tmp;
  7483. ;
  7484. return self;
  7485. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7486. },
  7487. args: ["aClass", "anotherClass"],
  7488. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<\x0a\x09\x09var tmp = aClass.className;\x0a\x09\x09aClass.className = anotherClass.className;\x0a\x09\x09anotherClass.className = tmp;\x0a\x09>",
  7489. referencedClasses: [],
  7490. messageSends: []
  7491. }),
  7492. $globals.ClassBuilder);
  7493. $core.addMethod(
  7494. $core.method({
  7495. selector: "class:instanceVariableNames:",
  7496. protocol: 'class definition',
  7497. fn: function (aClass,ivarNames){
  7498. var self=this;
  7499. return $core.withContext(function($ctx1) {
  7500. var $1,$3,$2;
  7501. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  7502. $1=$recv($globals.SystemAnnouncer)._current();
  7503. $3=$recv($globals.ClassDefinitionChanged)._new();
  7504. $recv($3)._theClass_(aClass);
  7505. $2=$recv($3)._yourself();
  7506. $recv($1)._announce_($2);
  7507. return self;
  7508. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  7509. },
  7510. args: ["aClass", "ivarNames"],
  7511. 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)",
  7512. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  7513. messageSends: ["basicClass:instanceVariableNames:", "announce:", "current", "theClass:", "new", "yourself"]
  7514. }),
  7515. $globals.ClassBuilder);
  7516. $core.addMethod(
  7517. $core.method({
  7518. selector: "copyClass:named:",
  7519. protocol: 'copying',
  7520. fn: function (aClass,className){
  7521. var self=this;
  7522. var newClass;
  7523. return $core.withContext(function($ctx1) {
  7524. var $1,$3,$2;
  7525. newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7526. self._copyClass_to_(aClass,newClass);
  7527. $1=$recv($globals.SystemAnnouncer)._current();
  7528. $3=$recv($globals.ClassAdded)._new();
  7529. $recv($3)._theClass_(newClass);
  7530. $2=$recv($3)._yourself();
  7531. $recv($1)._announce_($2);
  7532. return newClass;
  7533. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  7534. },
  7535. args: ["aClass", "className"],
  7536. 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",
  7537. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7538. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  7539. }),
  7540. $globals.ClassBuilder);
  7541. $core.addMethod(
  7542. $core.method({
  7543. selector: "copyClass:to:",
  7544. protocol: 'copying',
  7545. fn: function (aClass,anotherClass){
  7546. var self=this;
  7547. return $core.withContext(function($ctx1) {
  7548. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  7549. $recv(anotherClass)._comment_($recv(aClass)._comment());
  7550. $1=$recv(aClass)._methodDictionary();
  7551. $ctx1.sendIdx["methodDictionary"]=1;
  7552. $recv($1)._valuesDo_((function(each){
  7553. return $core.withContext(function($ctx2) {
  7554. $2=$recv($globals.Compiler)._new();
  7555. $ctx2.sendIdx["new"]=1;
  7556. $3=$recv(each)._source();
  7557. $ctx2.sendIdx["source"]=1;
  7558. $4=$recv(each)._protocol();
  7559. $ctx2.sendIdx["protocol"]=1;
  7560. return $recv($2)._install_forClass_protocol_($3,anotherClass,$4);
  7561. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  7562. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7563. }));
  7564. $ctx1.sendIdx["valuesDo:"]=1;
  7565. $5=$recv(anotherClass)._class();
  7566. $ctx1.sendIdx["class"]=1;
  7567. $7=$recv(aClass)._class();
  7568. $ctx1.sendIdx["class"]=2;
  7569. $6=$recv($7)._instanceVariableNames();
  7570. self._basicClass_instanceVariables_($5,$6);
  7571. $9=$recv(aClass)._class();
  7572. $ctx1.sendIdx["class"]=3;
  7573. $8=$recv($9)._methodDictionary();
  7574. $recv($8)._valuesDo_((function(each){
  7575. return $core.withContext(function($ctx2) {
  7576. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_($recv(each)._source(),$recv(anotherClass)._class(),$recv(each)._protocol());
  7577. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7578. }));
  7579. return self;
  7580. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7581. },
  7582. args: ["aClass", "anotherClass"],
  7583. 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 ]",
  7584. referencedClasses: ["Compiler"],
  7585. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  7586. }),
  7587. $globals.ClassBuilder);
  7588. $core.addMethod(
  7589. $core.method({
  7590. selector: "installMethod:forClass:protocol:",
  7591. protocol: 'method definition',
  7592. fn: function (aCompiledMethod,aBehavior,aString){
  7593. var self=this;
  7594. return $core.withContext(function($ctx1) {
  7595. $recv(aCompiledMethod)._protocol_(aString);
  7596. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  7597. return aCompiledMethod;
  7598. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  7599. },
  7600. args: ["aCompiledMethod", "aBehavior", "aString"],
  7601. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  7602. referencedClasses: [],
  7603. messageSends: ["protocol:", "addCompiledMethod:"]
  7604. }),
  7605. $globals.ClassBuilder);
  7606. $core.addMethod(
  7607. $core.method({
  7608. selector: "instanceVariableNamesFor:",
  7609. protocol: 'accessing',
  7610. fn: function (aString){
  7611. var self=this;
  7612. return $core.withContext(function($ctx1) {
  7613. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  7614. return $core.withContext(function($ctx2) {
  7615. return $recv(each)._isEmpty();
  7616. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7617. }));
  7618. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  7619. },
  7620. args: ["aString"],
  7621. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  7622. referencedClasses: [],
  7623. messageSends: ["reject:", "tokenize:", "isEmpty"]
  7624. }),
  7625. $globals.ClassBuilder);
  7626. $core.addMethod(
  7627. $core.method({
  7628. selector: "migrateClass:superclass:",
  7629. protocol: 'class migration',
  7630. fn: function (aClass,anotherClass){
  7631. var self=this;
  7632. return $core.withContext(function($ctx1) {
  7633. var $1;
  7634. $1=$recv(aClass)._name();
  7635. $ctx1.sendIdx["name"]=1;
  7636. return self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7637. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7638. },
  7639. args: ["aClass", "anotherClass"],
  7640. 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",
  7641. referencedClasses: [],
  7642. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  7643. }),
  7644. $globals.ClassBuilder);
  7645. $core.addMethod(
  7646. $core.method({
  7647. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  7648. protocol: 'class migration',
  7649. fn: function (className,aClass,aCollection,packageName){
  7650. var self=this;
  7651. var oldClass,newClass,tmp;
  7652. return $core.withContext(function($ctx1) {
  7653. var $1,$2,$4,$3;
  7654. tmp="new*".__comma(className);
  7655. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  7656. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  7657. self._basicSwapClassNames_with_(oldClass,newClass);
  7658. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  7659. $recv((function(){
  7660. return $core.withContext(function($ctx2) {
  7661. return self._copyClass_to_(oldClass,newClass);
  7662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7663. }))._on_do_($globals.Error,(function(exception){
  7664. return $core.withContext(function($ctx2) {
  7665. self._basicSwapClassNames_with_(oldClass,newClass);
  7666. $1=self._basicRemoveClass_(newClass);
  7667. $ctx2.sendIdx["basicRemoveClass:"]=1;
  7668. $1;
  7669. return $recv(exception)._resignal();
  7670. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  7671. }));
  7672. self._rawRenameClass_to_(oldClass,tmp);
  7673. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  7674. self._rawRenameClass_to_(newClass,className);
  7675. $recv($recv(oldClass)._subclasses())._do_((function(each){
  7676. return $core.withContext(function($ctx2) {
  7677. return self._migrateClass_superclass_(each,newClass);
  7678. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7679. }));
  7680. self._basicRemoveClass_(oldClass);
  7681. $2=$recv($globals.SystemAnnouncer)._current();
  7682. $4=$recv($globals.ClassMigrated)._new();
  7683. $recv($4)._theClass_(newClass);
  7684. $recv($4)._oldClass_(oldClass);
  7685. $3=$recv($4)._yourself();
  7686. $recv($2)._announce_($3);
  7687. return newClass;
  7688. }, 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)});
  7689. },
  7690. args: ["className", "aClass", "aCollection", "packageName"],
  7691. 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",
  7692. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  7693. 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"]
  7694. }),
  7695. $globals.ClassBuilder);
  7696. $core.addMethod(
  7697. $core.method({
  7698. selector: "rawRenameClass:to:",
  7699. protocol: 'private',
  7700. fn: function (aClass,aString){
  7701. var self=this;
  7702. return $core.withContext(function($ctx1) {
  7703. $globals[aString] = aClass;
  7704. ;
  7705. return self;
  7706. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7707. },
  7708. args: ["aClass", "aString"],
  7709. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09>",
  7710. referencedClasses: [],
  7711. messageSends: []
  7712. }),
  7713. $globals.ClassBuilder);
  7714. $core.addMethod(
  7715. $core.method({
  7716. selector: "renameClass:to:",
  7717. protocol: 'class migration',
  7718. fn: function (aClass,className){
  7719. var self=this;
  7720. return $core.withContext(function($ctx1) {
  7721. var $1,$3,$2;
  7722. self._basicRenameClass_to_(aClass,className);
  7723. $recv(aClass)._recompile();
  7724. $1=$recv($globals.SystemAnnouncer)._current();
  7725. $3=$recv($globals.ClassRenamed)._new();
  7726. $recv($3)._theClass_(aClass);
  7727. $2=$recv($3)._yourself();
  7728. $recv($1)._announce_($2);
  7729. return self;
  7730. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7731. },
  7732. args: ["aClass", "className"],
  7733. 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)",
  7734. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  7735. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  7736. }),
  7737. $globals.ClassBuilder);
  7738. $core.addMethod(
  7739. $core.method({
  7740. selector: "setupClass:",
  7741. protocol: 'public',
  7742. fn: function (aClass){
  7743. var self=this;
  7744. return $core.withContext(function($ctx1) {
  7745. self._deprecatedAPI_("Classes are now auto-inited.");
  7746. return self;
  7747. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  7748. },
  7749. args: ["aClass"],
  7750. source: "setupClass: aClass\x0a\x09self deprecatedAPI: 'Classes are now auto-inited.'",
  7751. referencedClasses: [],
  7752. messageSends: ["deprecatedAPI:"]
  7753. }),
  7754. $globals.ClassBuilder);
  7755. $core.addMethod(
  7756. $core.method({
  7757. selector: "superclass:subclass:",
  7758. protocol: 'class definition',
  7759. fn: function (aClass,className){
  7760. var self=this;
  7761. return $core.withContext(function($ctx1) {
  7762. return self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  7763. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7764. },
  7765. args: ["aClass", "className"],
  7766. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  7767. referencedClasses: [],
  7768. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  7769. }),
  7770. $globals.ClassBuilder);
  7771. $core.addMethod(
  7772. $core.method({
  7773. selector: "superclass:subclass:instanceVariableNames:package:",
  7774. protocol: 'class definition',
  7775. fn: function (aClass,className,ivarNames,packageName){
  7776. var self=this;
  7777. var newClass;
  7778. return $core.withContext(function($ctx1) {
  7779. var $1,$2,$3,$5,$4,$receiver;
  7780. $1=self._instanceVariableNamesFor_(ivarNames);
  7781. if(($receiver = packageName) == null || $receiver.isNil){
  7782. $2="unclassified";
  7783. } else {
  7784. $2=packageName;
  7785. };
  7786. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  7787. $3=$recv($globals.SystemAnnouncer)._current();
  7788. $5=$recv($globals.ClassAdded)._new();
  7789. $recv($5)._theClass_(newClass);
  7790. $4=$recv($5)._yourself();
  7791. $recv($3)._announce_($4);
  7792. return newClass;
  7793. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  7794. },
  7795. args: ["aClass", "className", "ivarNames", "packageName"],
  7796. 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",
  7797. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7798. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  7799. }),
  7800. $globals.ClassBuilder);
  7801. $core.addClass('ClassSorterNode', $globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  7802. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  7803. $core.addMethod(
  7804. $core.method({
  7805. selector: "getNodesFrom:",
  7806. protocol: 'accessing',
  7807. fn: function (aCollection){
  7808. var self=this;
  7809. var children,others;
  7810. return $core.withContext(function($ctx1) {
  7811. var $1;
  7812. children=[];
  7813. others=[];
  7814. $recv(aCollection)._do_((function(each){
  7815. return $core.withContext(function($ctx2) {
  7816. $1=$recv($recv(each)._superclass()).__eq(self._theClass());
  7817. if($core.assert($1)){
  7818. return $recv(children)._add_(each);
  7819. $ctx2.sendIdx["add:"]=1;
  7820. } else {
  7821. return $recv(others)._add_(each);
  7822. };
  7823. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7824. }));
  7825. self["@nodes"]=$recv(children)._collect_((function(each){
  7826. return $core.withContext(function($ctx2) {
  7827. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv(self._level()).__plus((1)));
  7828. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  7829. }));
  7830. return self;
  7831. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  7832. },
  7833. args: ["aCollection"],
  7834. 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 ]",
  7835. referencedClasses: ["ClassSorterNode"],
  7836. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  7837. }),
  7838. $globals.ClassSorterNode);
  7839. $core.addMethod(
  7840. $core.method({
  7841. selector: "level",
  7842. protocol: 'accessing',
  7843. fn: function (){
  7844. var self=this;
  7845. return self["@level"];
  7846. },
  7847. args: [],
  7848. source: "level\x0a\x09^ level",
  7849. referencedClasses: [],
  7850. messageSends: []
  7851. }),
  7852. $globals.ClassSorterNode);
  7853. $core.addMethod(
  7854. $core.method({
  7855. selector: "level:",
  7856. protocol: 'accessing',
  7857. fn: function (anInteger){
  7858. var self=this;
  7859. self["@level"]=anInteger;
  7860. return self;
  7861. },
  7862. args: ["anInteger"],
  7863. source: "level: anInteger\x0a\x09level := anInteger",
  7864. referencedClasses: [],
  7865. messageSends: []
  7866. }),
  7867. $globals.ClassSorterNode);
  7868. $core.addMethod(
  7869. $core.method({
  7870. selector: "nodes",
  7871. protocol: 'accessing',
  7872. fn: function (){
  7873. var self=this;
  7874. return self["@nodes"];
  7875. },
  7876. args: [],
  7877. source: "nodes\x0a\x09^ nodes",
  7878. referencedClasses: [],
  7879. messageSends: []
  7880. }),
  7881. $globals.ClassSorterNode);
  7882. $core.addMethod(
  7883. $core.method({
  7884. selector: "theClass",
  7885. protocol: 'accessing',
  7886. fn: function (){
  7887. var self=this;
  7888. return self["@theClass"];
  7889. },
  7890. args: [],
  7891. source: "theClass\x0a\x09^ theClass",
  7892. referencedClasses: [],
  7893. messageSends: []
  7894. }),
  7895. $globals.ClassSorterNode);
  7896. $core.addMethod(
  7897. $core.method({
  7898. selector: "theClass:",
  7899. protocol: 'accessing',
  7900. fn: function (aClass){
  7901. var self=this;
  7902. self["@theClass"]=aClass;
  7903. return self;
  7904. },
  7905. args: ["aClass"],
  7906. source: "theClass: aClass\x0a\x09theClass := aClass",
  7907. referencedClasses: [],
  7908. messageSends: []
  7909. }),
  7910. $globals.ClassSorterNode);
  7911. $core.addMethod(
  7912. $core.method({
  7913. selector: "traverseClassesWith:",
  7914. protocol: 'visiting',
  7915. fn: function (aCollection){
  7916. var self=this;
  7917. return $core.withContext(function($ctx1) {
  7918. var $1,$3,$2;
  7919. $1=self._theClass();
  7920. $ctx1.sendIdx["theClass"]=1;
  7921. $recv(aCollection)._add_($1);
  7922. $recv($recv(self._nodes())._sorted_((function(a,b){
  7923. return $core.withContext(function($ctx2) {
  7924. $3=$recv(a)._theClass();
  7925. $ctx2.sendIdx["theClass"]=2;
  7926. $2=$recv($3)._name();
  7927. $ctx2.sendIdx["name"]=1;
  7928. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  7929. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  7930. })))._do_((function(aNode){
  7931. return $core.withContext(function($ctx2) {
  7932. return $recv(aNode)._traverseClassesWith_(aCollection);
  7933. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  7934. }));
  7935. return self;
  7936. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  7937. },
  7938. args: ["aCollection"],
  7939. 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 ].",
  7940. referencedClasses: [],
  7941. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  7942. }),
  7943. $globals.ClassSorterNode);
  7944. $core.addMethod(
  7945. $core.method({
  7946. selector: "on:classes:level:",
  7947. protocol: 'instance creation',
  7948. fn: function (aClass,aCollection,anInteger){
  7949. var self=this;
  7950. return $core.withContext(function($ctx1) {
  7951. var $1;
  7952. $1=self._new();
  7953. $recv($1)._theClass_(aClass);
  7954. $recv($1)._level_(anInteger);
  7955. $recv($1)._getNodesFrom_(aCollection);
  7956. return $recv($1)._yourself();
  7957. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)});
  7958. },
  7959. args: ["aClass", "aCollection", "anInteger"],
  7960. 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",
  7961. referencedClasses: [],
  7962. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  7963. }),
  7964. $globals.ClassSorterNode.klass);
  7965. });
  7966. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7967. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  7968. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7969. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  7970. $core.addPackage('Kernel-Methods');
  7971. $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  7972. $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7973. $core.addClass('BlockClosure', $globals.Object, [], 'Kernel-Methods');
  7974. $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 | ... ] `";
  7975. $core.addMethod(
  7976. $core.method({
  7977. selector: "applyTo:arguments:",
  7978. protocol: 'evaluating',
  7979. fn: function (anObject,aCollection){
  7980. var self=this;
  7981. return $core.withContext(function($ctx1) {
  7982. return self.apply(anObject, aCollection);
  7983. return self;
  7984. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  7985. },
  7986. args: ["anObject", "aCollection"],
  7987. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  7988. referencedClasses: [],
  7989. messageSends: []
  7990. }),
  7991. $globals.BlockClosure);
  7992. $core.addMethod(
  7993. $core.method({
  7994. selector: "asCompiledMethod:",
  7995. protocol: 'converting',
  7996. fn: function (aString){
  7997. var self=this;
  7998. return $core.withContext(function($ctx1) {
  7999. return $core.method({selector:aString, fn:self});;
  8000. return self;
  8001. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  8002. },
  8003. args: ["aString"],
  8004. source: "asCompiledMethod: aString\x0a\x09<return $core.method({selector:aString, fn:self});>",
  8005. referencedClasses: [],
  8006. messageSends: []
  8007. }),
  8008. $globals.BlockClosure);
  8009. $core.addMethod(
  8010. $core.method({
  8011. selector: "compiledSource",
  8012. protocol: 'accessing',
  8013. fn: function (){
  8014. var self=this;
  8015. return $core.withContext(function($ctx1) {
  8016. return self.toString();
  8017. return self;
  8018. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  8019. },
  8020. args: [],
  8021. source: "compiledSource\x0a\x09<return self.toString()>",
  8022. referencedClasses: [],
  8023. messageSends: []
  8024. }),
  8025. $globals.BlockClosure);
  8026. $core.addMethod(
  8027. $core.method({
  8028. selector: "currySelf",
  8029. protocol: 'converting',
  8030. fn: function (){
  8031. var self=this;
  8032. return $core.withContext(function($ctx1) {
  8033. return function () {
  8034. var args = [ this ];
  8035. args.push.apply(args, arguments);
  8036. return self.apply(null, args);
  8037. }
  8038. ;
  8039. return self;
  8040. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  8041. },
  8042. args: [],
  8043. 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<\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>",
  8044. referencedClasses: [],
  8045. messageSends: []
  8046. }),
  8047. $globals.BlockClosure);
  8048. $core.addMethod(
  8049. $core.method({
  8050. selector: "ensure:",
  8051. protocol: 'evaluating',
  8052. fn: function (aBlock){
  8053. var self=this;
  8054. return $core.withContext(function($ctx1) {
  8055. try{return self._value()}finally{aBlock._value()};
  8056. return self;
  8057. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  8058. },
  8059. args: ["aBlock"],
  8060. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  8061. referencedClasses: [],
  8062. messageSends: []
  8063. }),
  8064. $globals.BlockClosure);
  8065. $core.addMethod(
  8066. $core.method({
  8067. selector: "fork",
  8068. protocol: 'timeout/interval',
  8069. fn: function (){
  8070. var self=this;
  8071. return $core.withContext(function($ctx1) {
  8072. $recv($recv($globals.ForkPool)._default())._fork_(self);
  8073. return self;
  8074. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  8075. },
  8076. args: [],
  8077. source: "fork\x0a\x09ForkPool default fork: self",
  8078. referencedClasses: ["ForkPool"],
  8079. messageSends: ["fork:", "default"]
  8080. }),
  8081. $globals.BlockClosure);
  8082. $core.addMethod(
  8083. $core.method({
  8084. selector: "new",
  8085. protocol: 'evaluating',
  8086. fn: function (){
  8087. var self=this;
  8088. return $core.withContext(function($ctx1) {
  8089. return new self();
  8090. return self;
  8091. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  8092. },
  8093. args: [],
  8094. 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<return new self()>",
  8095. referencedClasses: [],
  8096. messageSends: []
  8097. }),
  8098. $globals.BlockClosure);
  8099. $core.addMethod(
  8100. $core.method({
  8101. selector: "newValue:",
  8102. protocol: 'evaluating',
  8103. fn: function (anObject){
  8104. var self=this;
  8105. return $core.withContext(function($ctx1) {
  8106. return self._newWithValues_([anObject]);
  8107. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  8108. },
  8109. args: ["anObject"],
  8110. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  8111. referencedClasses: [],
  8112. messageSends: ["newWithValues:"]
  8113. }),
  8114. $globals.BlockClosure);
  8115. $core.addMethod(
  8116. $core.method({
  8117. selector: "newValue:value:",
  8118. protocol: 'evaluating',
  8119. fn: function (anObject,anObject2){
  8120. var self=this;
  8121. return $core.withContext(function($ctx1) {
  8122. return self._newWithValues_([anObject,anObject2]);
  8123. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  8124. },
  8125. args: ["anObject", "anObject2"],
  8126. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  8127. referencedClasses: [],
  8128. messageSends: ["newWithValues:"]
  8129. }),
  8130. $globals.BlockClosure);
  8131. $core.addMethod(
  8132. $core.method({
  8133. selector: "newValue:value:value:",
  8134. protocol: 'evaluating',
  8135. fn: function (anObject,anObject2,anObject3){
  8136. var self=this;
  8137. return $core.withContext(function($ctx1) {
  8138. return self._newWithValues_([anObject,anObject2,anObject3]);
  8139. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  8140. },
  8141. args: ["anObject", "anObject2", "anObject3"],
  8142. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  8143. referencedClasses: [],
  8144. messageSends: ["newWithValues:"]
  8145. }),
  8146. $globals.BlockClosure);
  8147. $core.addMethod(
  8148. $core.method({
  8149. selector: "newWithValues:",
  8150. protocol: 'evaluating',
  8151. fn: function (aCollection){
  8152. var self=this;
  8153. return $core.withContext(function($ctx1) {
  8154. var object = Object.create(self.prototype);
  8155. var result = self.apply(object, aCollection);
  8156. return typeof result === "object" ? result : object;
  8157. ;
  8158. return self;
  8159. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  8160. },
  8161. args: ["aCollection"],
  8162. source: "newWithValues: aCollection\x0a\x09\x22Simulates JS new operator by combination of Object.create and .apply\x22\x0a\x09<\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>",
  8163. referencedClasses: [],
  8164. messageSends: []
  8165. }),
  8166. $globals.BlockClosure);
  8167. $core.addMethod(
  8168. $core.method({
  8169. selector: "numArgs",
  8170. protocol: 'accessing',
  8171. fn: function (){
  8172. var self=this;
  8173. return $core.withContext(function($ctx1) {
  8174. return self.length;
  8175. return self;
  8176. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  8177. },
  8178. args: [],
  8179. source: "numArgs\x0a\x09<return self.length>",
  8180. referencedClasses: [],
  8181. messageSends: []
  8182. }),
  8183. $globals.BlockClosure);
  8184. $core.addMethod(
  8185. $core.method({
  8186. selector: "on:do:",
  8187. protocol: 'error handling',
  8188. fn: function (anErrorClass,aBlock){
  8189. var self=this;
  8190. return $core.withContext(function($ctx1) {
  8191. var $1;
  8192. return self._tryCatch_((function(error){
  8193. var smalltalkError;
  8194. return $core.withContext(function($ctx2) {
  8195. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  8196. smalltalkError;
  8197. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  8198. if($core.assert($1)){
  8199. return $recv(aBlock)._value_(smalltalkError);
  8200. } else {
  8201. return $recv(smalltalkError)._resignal();
  8202. };
  8203. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  8204. }));
  8205. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  8206. },
  8207. args: ["anErrorClass", "aBlock"],
  8208. 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 ] ]",
  8209. referencedClasses: ["Smalltalk"],
  8210. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  8211. }),
  8212. $globals.BlockClosure);
  8213. $core.addMethod(
  8214. $core.method({
  8215. selector: "receiver",
  8216. protocol: 'accessing',
  8217. fn: function (){
  8218. var self=this;
  8219. return nil;
  8220. },
  8221. args: [],
  8222. source: "receiver\x0a\x09^ nil",
  8223. referencedClasses: [],
  8224. messageSends: []
  8225. }),
  8226. $globals.BlockClosure);
  8227. $core.addMethod(
  8228. $core.method({
  8229. selector: "timeToRun",
  8230. protocol: 'evaluating',
  8231. fn: function (){
  8232. var self=this;
  8233. return $core.withContext(function($ctx1) {
  8234. return $recv($globals.Date)._millisecondsToRun_(self);
  8235. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  8236. },
  8237. args: [],
  8238. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  8239. referencedClasses: ["Date"],
  8240. messageSends: ["millisecondsToRun:"]
  8241. }),
  8242. $globals.BlockClosure);
  8243. $core.addMethod(
  8244. $core.method({
  8245. selector: "tryCatch:",
  8246. protocol: 'error handling',
  8247. fn: function (aBlock){
  8248. var self=this;
  8249. return $core.withContext(function($ctx1) {
  8250. try {
  8251. return self._value();
  8252. } catch(error) {
  8253. // pass non-local returns undetected
  8254. if (Array.isArray(error) && error.length === 1) throw error;
  8255. return aBlock._value_(error);
  8256. }
  8257. ;
  8258. return self;
  8259. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  8260. },
  8261. args: ["aBlock"],
  8262. source: "tryCatch: aBlock\x0a\x09<\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>",
  8263. referencedClasses: [],
  8264. messageSends: []
  8265. }),
  8266. $globals.BlockClosure);
  8267. $core.addMethod(
  8268. $core.method({
  8269. selector: "value",
  8270. protocol: 'evaluating',
  8271. fn: function (){
  8272. var self=this;
  8273. return $core.withContext(function($ctx1) {
  8274. return self();;
  8275. return self;
  8276. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  8277. },
  8278. args: [],
  8279. source: "value\x0a\x09<return self();>",
  8280. referencedClasses: [],
  8281. messageSends: []
  8282. }),
  8283. $globals.BlockClosure);
  8284. $core.addMethod(
  8285. $core.method({
  8286. selector: "value:",
  8287. protocol: 'evaluating',
  8288. fn: function (anArg){
  8289. var self=this;
  8290. return $core.withContext(function($ctx1) {
  8291. return self(anArg);;
  8292. return self;
  8293. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  8294. },
  8295. args: ["anArg"],
  8296. source: "value: anArg\x0a\x09<return self(anArg);>",
  8297. referencedClasses: [],
  8298. messageSends: []
  8299. }),
  8300. $globals.BlockClosure);
  8301. $core.addMethod(
  8302. $core.method({
  8303. selector: "value:value:",
  8304. protocol: 'evaluating',
  8305. fn: function (firstArg,secondArg){
  8306. var self=this;
  8307. return $core.withContext(function($ctx1) {
  8308. return self(firstArg, secondArg);;
  8309. return self;
  8310. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  8311. },
  8312. args: ["firstArg", "secondArg"],
  8313. source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
  8314. referencedClasses: [],
  8315. messageSends: []
  8316. }),
  8317. $globals.BlockClosure);
  8318. $core.addMethod(
  8319. $core.method({
  8320. selector: "value:value:value:",
  8321. protocol: 'evaluating',
  8322. fn: function (firstArg,secondArg,thirdArg){
  8323. var self=this;
  8324. return $core.withContext(function($ctx1) {
  8325. return self(firstArg, secondArg, thirdArg);;
  8326. return self;
  8327. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  8328. },
  8329. args: ["firstArg", "secondArg", "thirdArg"],
  8330. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  8331. referencedClasses: [],
  8332. messageSends: []
  8333. }),
  8334. $globals.BlockClosure);
  8335. $core.addMethod(
  8336. $core.method({
  8337. selector: "valueWithInterval:",
  8338. protocol: 'timeout/interval',
  8339. fn: function (aNumber){
  8340. var self=this;
  8341. return $core.withContext(function($ctx1) {
  8342. var interval = setInterval(self, aNumber);
  8343. return $globals.Timeout._on_(interval);
  8344. ;
  8345. return self;
  8346. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  8347. },
  8348. args: ["aNumber"],
  8349. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09>",
  8350. referencedClasses: [],
  8351. messageSends: []
  8352. }),
  8353. $globals.BlockClosure);
  8354. $core.addMethod(
  8355. $core.method({
  8356. selector: "valueWithPossibleArguments:",
  8357. protocol: 'evaluating',
  8358. fn: function (aCollection){
  8359. var self=this;
  8360. return $core.withContext(function($ctx1) {
  8361. return self.apply(null, aCollection);;
  8362. return self;
  8363. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  8364. },
  8365. args: ["aCollection"],
  8366. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  8367. referencedClasses: [],
  8368. messageSends: []
  8369. }),
  8370. $globals.BlockClosure);
  8371. $core.addMethod(
  8372. $core.method({
  8373. selector: "valueWithTimeout:",
  8374. protocol: 'timeout/interval',
  8375. fn: function (aNumber){
  8376. var self=this;
  8377. return $core.withContext(function($ctx1) {
  8378. var timeout = setTimeout(self, aNumber);
  8379. return $globals.Timeout._on_(timeout);
  8380. ;
  8381. return self;
  8382. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  8383. },
  8384. args: ["aNumber"],
  8385. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09>",
  8386. referencedClasses: [],
  8387. messageSends: []
  8388. }),
  8389. $globals.BlockClosure);
  8390. $core.addMethod(
  8391. $core.method({
  8392. selector: "whileFalse",
  8393. protocol: 'controlling',
  8394. fn: function (){
  8395. var self=this;
  8396. return $core.withContext(function($ctx1) {
  8397. self._whileFalse_((function(){
  8398. }));
  8399. return self;
  8400. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  8401. },
  8402. args: [],
  8403. source: "whileFalse\x0a\x09self whileFalse: []",
  8404. referencedClasses: [],
  8405. messageSends: ["whileFalse:"]
  8406. }),
  8407. $globals.BlockClosure);
  8408. $core.addMethod(
  8409. $core.method({
  8410. selector: "whileFalse:",
  8411. protocol: 'controlling',
  8412. fn: function (aBlock){
  8413. var self=this;
  8414. return $core.withContext(function($ctx1) {
  8415. while(!$core.assert(self._value())) {aBlock._value()};
  8416. return self;
  8417. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  8418. },
  8419. args: ["aBlock"],
  8420. source: "whileFalse: aBlock\x0a\x09<while(!$core.assert(self._value())) {aBlock._value()}>",
  8421. referencedClasses: [],
  8422. messageSends: []
  8423. }),
  8424. $globals.BlockClosure);
  8425. $core.addMethod(
  8426. $core.method({
  8427. selector: "whileTrue",
  8428. protocol: 'controlling',
  8429. fn: function (){
  8430. var self=this;
  8431. return $core.withContext(function($ctx1) {
  8432. self._whileTrue_((function(){
  8433. }));
  8434. return self;
  8435. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  8436. },
  8437. args: [],
  8438. source: "whileTrue\x0a\x09self whileTrue: []",
  8439. referencedClasses: [],
  8440. messageSends: ["whileTrue:"]
  8441. }),
  8442. $globals.BlockClosure);
  8443. $core.addMethod(
  8444. $core.method({
  8445. selector: "whileTrue:",
  8446. protocol: 'controlling',
  8447. fn: function (aBlock){
  8448. var self=this;
  8449. return $core.withContext(function($ctx1) {
  8450. while($core.assert(self._value())) {aBlock._value()};
  8451. return self;
  8452. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  8453. },
  8454. args: ["aBlock"],
  8455. source: "whileTrue: aBlock\x0a\x09<while($core.assert(self._value())) {aBlock._value()}>",
  8456. referencedClasses: [],
  8457. messageSends: []
  8458. }),
  8459. $globals.BlockClosure);
  8460. $core.addClass('CompiledMethod', $globals.Object, [], 'Kernel-Methods');
  8461. $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";
  8462. $core.addMethod(
  8463. $core.method({
  8464. selector: "arguments",
  8465. protocol: 'accessing',
  8466. fn: function (){
  8467. var self=this;
  8468. return $core.withContext(function($ctx1) {
  8469. return self.args || [];
  8470. return self;
  8471. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  8472. },
  8473. args: [],
  8474. source: "arguments\x0a\x09<return self.args || []>",
  8475. referencedClasses: [],
  8476. messageSends: []
  8477. }),
  8478. $globals.CompiledMethod);
  8479. $core.addMethod(
  8480. $core.method({
  8481. selector: "browse",
  8482. protocol: 'browsing',
  8483. fn: function (){
  8484. var self=this;
  8485. return $core.withContext(function($ctx1) {
  8486. $recv($globals.Finder)._findMethod_(self);
  8487. return self;
  8488. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  8489. },
  8490. args: [],
  8491. source: "browse\x0a\x09Finder findMethod: self",
  8492. referencedClasses: ["Finder"],
  8493. messageSends: ["findMethod:"]
  8494. }),
  8495. $globals.CompiledMethod);
  8496. $core.addMethod(
  8497. $core.method({
  8498. selector: "category",
  8499. protocol: 'accessing',
  8500. fn: function (){
  8501. var self=this;
  8502. return $core.withContext(function($ctx1) {
  8503. return self._protocol();
  8504. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  8505. },
  8506. args: [],
  8507. source: "category\x0a\x09^ self protocol",
  8508. referencedClasses: [],
  8509. messageSends: ["protocol"]
  8510. }),
  8511. $globals.CompiledMethod);
  8512. $core.addMethod(
  8513. $core.method({
  8514. selector: "defaultProtocol",
  8515. protocol: 'defaults',
  8516. fn: function (){
  8517. var self=this;
  8518. return "as yet unclassified";
  8519. },
  8520. args: [],
  8521. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  8522. referencedClasses: [],
  8523. messageSends: []
  8524. }),
  8525. $globals.CompiledMethod);
  8526. $core.addMethod(
  8527. $core.method({
  8528. selector: "fn",
  8529. protocol: 'accessing',
  8530. fn: function (){
  8531. var self=this;
  8532. return $core.withContext(function($ctx1) {
  8533. return self._basicAt_("fn");
  8534. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  8535. },
  8536. args: [],
  8537. source: "fn\x0a\x09^ self basicAt: 'fn'",
  8538. referencedClasses: [],
  8539. messageSends: ["basicAt:"]
  8540. }),
  8541. $globals.CompiledMethod);
  8542. $core.addMethod(
  8543. $core.method({
  8544. selector: "fn:",
  8545. protocol: 'accessing',
  8546. fn: function (aBlock){
  8547. var self=this;
  8548. return $core.withContext(function($ctx1) {
  8549. self._basicAt_put_("fn",aBlock);
  8550. return self;
  8551. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  8552. },
  8553. args: ["aBlock"],
  8554. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  8555. referencedClasses: [],
  8556. messageSends: ["basicAt:put:"]
  8557. }),
  8558. $globals.CompiledMethod);
  8559. $core.addMethod(
  8560. $core.method({
  8561. selector: "isCompiledMethod",
  8562. protocol: 'testing',
  8563. fn: function (){
  8564. var self=this;
  8565. return true;
  8566. },
  8567. args: [],
  8568. source: "isCompiledMethod\x0a\x09^ true",
  8569. referencedClasses: [],
  8570. messageSends: []
  8571. }),
  8572. $globals.CompiledMethod);
  8573. $core.addMethod(
  8574. $core.method({
  8575. selector: "isOverridden",
  8576. protocol: 'testing',
  8577. fn: function (){
  8578. var self=this;
  8579. var selector;
  8580. return $core.withContext(function($ctx1) {
  8581. var $1;
  8582. var $early={};
  8583. try {
  8584. selector=self._selector();
  8585. $recv(self._methodClass())._allSubclassesDo_((function(each){
  8586. return $core.withContext(function($ctx2) {
  8587. $1=$recv(each)._includesSelector_(selector);
  8588. if($core.assert($1)){
  8589. throw $early=[true];
  8590. };
  8591. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8592. }));
  8593. return false;
  8594. }
  8595. catch(e) {if(e===$early)return e[0]; throw e}
  8596. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  8597. },
  8598. args: [],
  8599. 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",
  8600. referencedClasses: [],
  8601. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  8602. }),
  8603. $globals.CompiledMethod);
  8604. $core.addMethod(
  8605. $core.method({
  8606. selector: "isOverride",
  8607. protocol: 'testing',
  8608. fn: function (){
  8609. var self=this;
  8610. var superclass;
  8611. return $core.withContext(function($ctx1) {
  8612. var $1,$2,$receiver;
  8613. $1=self._methodClass();
  8614. $ctx1.sendIdx["methodClass"]=1;
  8615. superclass=$recv($1)._superclass();
  8616. $ctx1.sendIdx["superclass"]=1;
  8617. $2=superclass;
  8618. if(($receiver = $2) == null || $receiver.isNil){
  8619. return false;
  8620. } else {
  8621. $2;
  8622. };
  8623. return $recv($recv($recv(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  8624. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  8625. },
  8626. args: [],
  8627. 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",
  8628. referencedClasses: [],
  8629. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  8630. }),
  8631. $globals.CompiledMethod);
  8632. $core.addMethod(
  8633. $core.method({
  8634. selector: "messageSends",
  8635. protocol: 'accessing',
  8636. fn: function (){
  8637. var self=this;
  8638. return $core.withContext(function($ctx1) {
  8639. return self._basicAt_("messageSends");
  8640. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  8641. },
  8642. args: [],
  8643. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  8644. referencedClasses: [],
  8645. messageSends: ["basicAt:"]
  8646. }),
  8647. $globals.CompiledMethod);
  8648. $core.addMethod(
  8649. $core.method({
  8650. selector: "methodClass",
  8651. protocol: 'accessing',
  8652. fn: function (){
  8653. var self=this;
  8654. return $core.withContext(function($ctx1) {
  8655. return self._basicAt_("methodClass");
  8656. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  8657. },
  8658. args: [],
  8659. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  8660. referencedClasses: [],
  8661. messageSends: ["basicAt:"]
  8662. }),
  8663. $globals.CompiledMethod);
  8664. $core.addMethod(
  8665. $core.method({
  8666. selector: "package",
  8667. protocol: 'accessing',
  8668. fn: function (){
  8669. var self=this;
  8670. return $core.withContext(function($ctx1) {
  8671. var $1,$receiver;
  8672. $1=self._methodClass();
  8673. if(($receiver = $1) == null || $receiver.isNil){
  8674. return $1;
  8675. } else {
  8676. var class_;
  8677. class_=$receiver;
  8678. return $recv(class_)._packageOfProtocol_(self._protocol());
  8679. };
  8680. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  8681. },
  8682. args: [],
  8683. 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 ]",
  8684. referencedClasses: [],
  8685. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  8686. }),
  8687. $globals.CompiledMethod);
  8688. $core.addMethod(
  8689. $core.method({
  8690. selector: "protocol",
  8691. protocol: 'accessing',
  8692. fn: function (){
  8693. var self=this;
  8694. return $core.withContext(function($ctx1) {
  8695. var $1,$receiver;
  8696. $1=self._basicAt_("protocol");
  8697. if(($receiver = $1) == null || $receiver.isNil){
  8698. return self._defaultProtocol();
  8699. } else {
  8700. return $1;
  8701. };
  8702. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  8703. },
  8704. args: [],
  8705. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  8706. referencedClasses: [],
  8707. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  8708. }),
  8709. $globals.CompiledMethod);
  8710. $core.addMethod(
  8711. $core.method({
  8712. selector: "protocol:",
  8713. protocol: 'accessing',
  8714. fn: function (aString){
  8715. var self=this;
  8716. var oldProtocol;
  8717. return $core.withContext(function($ctx1) {
  8718. var $1,$3,$2,$4,$receiver;
  8719. oldProtocol=self._protocol();
  8720. self._basicAt_put_("protocol",aString);
  8721. $1=$recv($globals.SystemAnnouncer)._current();
  8722. $3=$recv($globals.MethodMoved)._new();
  8723. $recv($3)._method_(self);
  8724. $recv($3)._oldProtocol_(oldProtocol);
  8725. $2=$recv($3)._yourself();
  8726. $recv($1)._announce_($2);
  8727. $4=self._methodClass();
  8728. if(($receiver = $4) == null || $receiver.isNil){
  8729. $4;
  8730. } else {
  8731. var methodClass;
  8732. methodClass=$receiver;
  8733. $recv($recv(methodClass)._organization())._addElement_(aString);
  8734. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  8735. };
  8736. return self;
  8737. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  8738. },
  8739. args: ["aString"],
  8740. 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 ]",
  8741. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  8742. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  8743. }),
  8744. $globals.CompiledMethod);
  8745. $core.addMethod(
  8746. $core.method({
  8747. selector: "referencedClasses",
  8748. protocol: 'accessing',
  8749. fn: function (){
  8750. var self=this;
  8751. return $core.withContext(function($ctx1) {
  8752. return self._basicAt_("referencedClasses");
  8753. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  8754. },
  8755. args: [],
  8756. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  8757. referencedClasses: [],
  8758. messageSends: ["basicAt:"]
  8759. }),
  8760. $globals.CompiledMethod);
  8761. $core.addMethod(
  8762. $core.method({
  8763. selector: "selector",
  8764. protocol: 'accessing',
  8765. fn: function (){
  8766. var self=this;
  8767. return $core.withContext(function($ctx1) {
  8768. return self._basicAt_("selector");
  8769. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  8770. },
  8771. args: [],
  8772. source: "selector\x0a\x09^ self basicAt: 'selector'",
  8773. referencedClasses: [],
  8774. messageSends: ["basicAt:"]
  8775. }),
  8776. $globals.CompiledMethod);
  8777. $core.addMethod(
  8778. $core.method({
  8779. selector: "selector:",
  8780. protocol: 'accessing',
  8781. fn: function (aString){
  8782. var self=this;
  8783. return $core.withContext(function($ctx1) {
  8784. self._basicAt_put_("selector",aString);
  8785. return self;
  8786. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  8787. },
  8788. args: ["aString"],
  8789. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  8790. referencedClasses: [],
  8791. messageSends: ["basicAt:put:"]
  8792. }),
  8793. $globals.CompiledMethod);
  8794. $core.addMethod(
  8795. $core.method({
  8796. selector: "sendTo:arguments:",
  8797. protocol: 'evaluating',
  8798. fn: function (anObject,aCollection){
  8799. var self=this;
  8800. return $core.withContext(function($ctx1) {
  8801. return $recv(self._fn())._applyTo_arguments_(anObject,aCollection);
  8802. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  8803. },
  8804. args: ["anObject", "aCollection"],
  8805. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  8806. referencedClasses: [],
  8807. messageSends: ["applyTo:arguments:", "fn"]
  8808. }),
  8809. $globals.CompiledMethod);
  8810. $core.addMethod(
  8811. $core.method({
  8812. selector: "source",
  8813. protocol: 'accessing',
  8814. fn: function (){
  8815. var self=this;
  8816. return $core.withContext(function($ctx1) {
  8817. var $1,$receiver;
  8818. $1=self._basicAt_("source");
  8819. if(($receiver = $1) == null || $receiver.isNil){
  8820. return "";
  8821. } else {
  8822. return $1;
  8823. };
  8824. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  8825. },
  8826. args: [],
  8827. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  8828. referencedClasses: [],
  8829. messageSends: ["ifNil:", "basicAt:"]
  8830. }),
  8831. $globals.CompiledMethod);
  8832. $core.addMethod(
  8833. $core.method({
  8834. selector: "source:",
  8835. protocol: 'accessing',
  8836. fn: function (aString){
  8837. var self=this;
  8838. return $core.withContext(function($ctx1) {
  8839. self._basicAt_put_("source",aString);
  8840. return self;
  8841. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  8842. },
  8843. args: ["aString"],
  8844. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  8845. referencedClasses: [],
  8846. messageSends: ["basicAt:put:"]
  8847. }),
  8848. $globals.CompiledMethod);
  8849. $core.addClass('ForkPool', $globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  8850. $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`";
  8851. $core.addMethod(
  8852. $core.method({
  8853. selector: "addWorker",
  8854. protocol: 'private',
  8855. fn: function (){
  8856. var self=this;
  8857. return $core.withContext(function($ctx1) {
  8858. $recv(self["@worker"])._valueWithTimeout_((0));
  8859. self["@poolSize"]=$recv(self["@poolSize"]).__plus((1));
  8860. return self;
  8861. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  8862. },
  8863. args: [],
  8864. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  8865. referencedClasses: [],
  8866. messageSends: ["valueWithTimeout:", "+"]
  8867. }),
  8868. $globals.ForkPool);
  8869. $core.addMethod(
  8870. $core.method({
  8871. selector: "defaultMaxPoolSize",
  8872. protocol: 'defaults',
  8873. fn: function (){
  8874. var self=this;
  8875. return $core.withContext(function($ctx1) {
  8876. return $recv(self._class())._defaultMaxPoolSize();
  8877. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  8878. },
  8879. args: [],
  8880. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  8881. referencedClasses: [],
  8882. messageSends: ["defaultMaxPoolSize", "class"]
  8883. }),
  8884. $globals.ForkPool);
  8885. $core.addMethod(
  8886. $core.method({
  8887. selector: "fork:",
  8888. protocol: 'actions',
  8889. fn: function (aBlock){
  8890. var self=this;
  8891. return $core.withContext(function($ctx1) {
  8892. var $1;
  8893. $1=$recv(self["@poolSize"]).__lt(self._maxPoolSize());
  8894. if($core.assert($1)){
  8895. self._addWorker();
  8896. };
  8897. $recv(self["@queue"])._nextPut_(aBlock);
  8898. return self;
  8899. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  8900. },
  8901. args: ["aBlock"],
  8902. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  8903. referencedClasses: [],
  8904. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  8905. }),
  8906. $globals.ForkPool);
  8907. $core.addMethod(
  8908. $core.method({
  8909. selector: "initialize",
  8910. protocol: 'initialization',
  8911. fn: function (){
  8912. var self=this;
  8913. return $core.withContext(function($ctx1) {
  8914. (
  8915. $ctx1.supercall = true,
  8916. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  8917. $ctx1.supercall = false;
  8918. self["@poolSize"]=(0);
  8919. self["@queue"]=$recv($globals.Queue)._new();
  8920. self["@worker"]=self._makeWorker();
  8921. return self;
  8922. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  8923. },
  8924. args: [],
  8925. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  8926. referencedClasses: ["Queue"],
  8927. messageSends: ["initialize", "new", "makeWorker"]
  8928. }),
  8929. $globals.ForkPool);
  8930. $core.addMethod(
  8931. $core.method({
  8932. selector: "makeWorker",
  8933. protocol: 'initialization',
  8934. fn: function (){
  8935. var self=this;
  8936. var sentinel;
  8937. return $core.withContext(function($ctx1) {
  8938. var $1;
  8939. sentinel=$recv($globals.Object)._new();
  8940. return (function(){
  8941. var block;
  8942. return $core.withContext(function($ctx2) {
  8943. self["@poolSize"]=$recv(self["@poolSize"]).__minus((1));
  8944. self["@poolSize"];
  8945. block=$recv(self["@queue"])._nextIfAbsent_((function(){
  8946. return sentinel;
  8947. }));
  8948. block;
  8949. $1=$recv(block).__eq_eq(sentinel);
  8950. if(!$core.assert($1)){
  8951. return $recv((function(){
  8952. return $core.withContext(function($ctx3) {
  8953. return $recv(block)._value();
  8954. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  8955. }))._ensure_((function(){
  8956. return $core.withContext(function($ctx3) {
  8957. return self._addWorker();
  8958. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  8959. }));
  8960. };
  8961. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  8962. });
  8963. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  8964. },
  8965. args: [],
  8966. 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 ] ]]",
  8967. referencedClasses: ["Object"],
  8968. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  8969. }),
  8970. $globals.ForkPool);
  8971. $core.addMethod(
  8972. $core.method({
  8973. selector: "maxPoolSize",
  8974. protocol: 'accessing',
  8975. fn: function (){
  8976. var self=this;
  8977. return $core.withContext(function($ctx1) {
  8978. var $1,$receiver;
  8979. $1=self["@maxPoolSize"];
  8980. if(($receiver = $1) == null || $receiver.isNil){
  8981. return self._defaultMaxPoolSize();
  8982. } else {
  8983. return $1;
  8984. };
  8985. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  8986. },
  8987. args: [],
  8988. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  8989. referencedClasses: [],
  8990. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  8991. }),
  8992. $globals.ForkPool);
  8993. $core.addMethod(
  8994. $core.method({
  8995. selector: "maxPoolSize:",
  8996. protocol: 'accessing',
  8997. fn: function (anInteger){
  8998. var self=this;
  8999. self["@maxPoolSize"]=anInteger;
  9000. return self;
  9001. },
  9002. args: ["anInteger"],
  9003. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  9004. referencedClasses: [],
  9005. messageSends: []
  9006. }),
  9007. $globals.ForkPool);
  9008. $globals.ForkPool.klass.iVarNames = ['default'];
  9009. $core.addMethod(
  9010. $core.method({
  9011. selector: "default",
  9012. protocol: 'accessing',
  9013. fn: function (){
  9014. var self=this;
  9015. return $core.withContext(function($ctx1) {
  9016. var $1,$receiver;
  9017. $1=self["@default"];
  9018. if(($receiver = $1) == null || $receiver.isNil){
  9019. self["@default"]=self._new();
  9020. return self["@default"];
  9021. } else {
  9022. return $1;
  9023. };
  9024. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.klass)});
  9025. },
  9026. args: [],
  9027. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  9028. referencedClasses: [],
  9029. messageSends: ["ifNil:", "new"]
  9030. }),
  9031. $globals.ForkPool.klass);
  9032. $core.addMethod(
  9033. $core.method({
  9034. selector: "defaultMaxPoolSize",
  9035. protocol: 'accessing',
  9036. fn: function (){
  9037. var self=this;
  9038. return (100);
  9039. },
  9040. args: [],
  9041. source: "defaultMaxPoolSize\x0a\x09^ 100",
  9042. referencedClasses: [],
  9043. messageSends: []
  9044. }),
  9045. $globals.ForkPool.klass);
  9046. $core.addMethod(
  9047. $core.method({
  9048. selector: "resetDefault",
  9049. protocol: 'accessing',
  9050. fn: function (){
  9051. var self=this;
  9052. self["@default"]=nil;
  9053. return self;
  9054. },
  9055. args: [],
  9056. source: "resetDefault\x0a\x09default := nil",
  9057. referencedClasses: [],
  9058. messageSends: []
  9059. }),
  9060. $globals.ForkPool.klass);
  9061. $core.addClass('Message', $globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
  9062. $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.";
  9063. $core.addMethod(
  9064. $core.method({
  9065. selector: "arguments",
  9066. protocol: 'accessing',
  9067. fn: function (){
  9068. var self=this;
  9069. return self["@arguments"];
  9070. },
  9071. args: [],
  9072. source: "arguments\x0a\x09^ arguments",
  9073. referencedClasses: [],
  9074. messageSends: []
  9075. }),
  9076. $globals.Message);
  9077. $core.addMethod(
  9078. $core.method({
  9079. selector: "arguments:",
  9080. protocol: 'accessing',
  9081. fn: function (anArray){
  9082. var self=this;
  9083. self["@arguments"]=anArray;
  9084. return self;
  9085. },
  9086. args: ["anArray"],
  9087. source: "arguments: anArray\x0a\x09arguments := anArray",
  9088. referencedClasses: [],
  9089. messageSends: []
  9090. }),
  9091. $globals.Message);
  9092. $core.addMethod(
  9093. $core.method({
  9094. selector: "printOn:",
  9095. protocol: 'printing',
  9096. fn: function (aStream){
  9097. var self=this;
  9098. return $core.withContext(function($ctx1) {
  9099. (
  9100. $ctx1.supercall = true,
  9101. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9102. $ctx1.supercall = false;
  9103. $recv(aStream)._nextPutAll_("(");
  9104. $ctx1.sendIdx["nextPutAll:"]=1;
  9105. $recv(aStream)._nextPutAll_(self._selector());
  9106. $ctx1.sendIdx["nextPutAll:"]=2;
  9107. $recv(aStream)._nextPutAll_(")");
  9108. return self;
  9109. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  9110. },
  9111. args: ["aStream"],
  9112. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  9113. referencedClasses: [],
  9114. messageSends: ["printOn:", "nextPutAll:", "selector"]
  9115. }),
  9116. $globals.Message);
  9117. $core.addMethod(
  9118. $core.method({
  9119. selector: "selector",
  9120. protocol: 'accessing',
  9121. fn: function (){
  9122. var self=this;
  9123. return self["@selector"];
  9124. },
  9125. args: [],
  9126. source: "selector\x0a\x09^ selector",
  9127. referencedClasses: [],
  9128. messageSends: []
  9129. }),
  9130. $globals.Message);
  9131. $core.addMethod(
  9132. $core.method({
  9133. selector: "selector:",
  9134. protocol: 'accessing',
  9135. fn: function (aString){
  9136. var self=this;
  9137. self["@selector"]=aString;
  9138. return self;
  9139. },
  9140. args: ["aString"],
  9141. source: "selector: aString\x0a\x09selector := aString",
  9142. referencedClasses: [],
  9143. messageSends: []
  9144. }),
  9145. $globals.Message);
  9146. $core.addMethod(
  9147. $core.method({
  9148. selector: "sendTo:",
  9149. protocol: 'actions',
  9150. fn: function (anObject){
  9151. var self=this;
  9152. return $core.withContext(function($ctx1) {
  9153. return $recv(anObject)._perform_withArguments_(self._selector(),self._arguments());
  9154. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  9155. },
  9156. args: ["anObject"],
  9157. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  9158. referencedClasses: [],
  9159. messageSends: ["perform:withArguments:", "selector", "arguments"]
  9160. }),
  9161. $globals.Message);
  9162. $core.addMethod(
  9163. $core.method({
  9164. selector: "selector:arguments:",
  9165. protocol: 'instance creation',
  9166. fn: function (aString,anArray){
  9167. var self=this;
  9168. return $core.withContext(function($ctx1) {
  9169. var $1;
  9170. $1=self._new();
  9171. $recv($1)._selector_(aString);
  9172. $recv($1)._arguments_(anArray);
  9173. return $recv($1)._yourself();
  9174. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.klass)});
  9175. },
  9176. args: ["aString", "anArray"],
  9177. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  9178. referencedClasses: [],
  9179. messageSends: ["selector:", "new", "arguments:", "yourself"]
  9180. }),
  9181. $globals.Message.klass);
  9182. $core.addClass('MessageSend', $globals.Object, ['receiver', 'message'], 'Kernel-Methods');
  9183. $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.";
  9184. $core.addMethod(
  9185. $core.method({
  9186. selector: "arguments",
  9187. protocol: 'accessing',
  9188. fn: function (){
  9189. var self=this;
  9190. return $core.withContext(function($ctx1) {
  9191. return $recv(self["@message"])._arguments();
  9192. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  9193. },
  9194. args: [],
  9195. source: "arguments\x0a\x09^ message arguments",
  9196. referencedClasses: [],
  9197. messageSends: ["arguments"]
  9198. }),
  9199. $globals.MessageSend);
  9200. $core.addMethod(
  9201. $core.method({
  9202. selector: "arguments:",
  9203. protocol: 'accessing',
  9204. fn: function (aCollection){
  9205. var self=this;
  9206. return $core.withContext(function($ctx1) {
  9207. $recv(self["@message"])._arguments_(aCollection);
  9208. return self;
  9209. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  9210. },
  9211. args: ["aCollection"],
  9212. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  9213. referencedClasses: [],
  9214. messageSends: ["arguments:"]
  9215. }),
  9216. $globals.MessageSend);
  9217. $core.addMethod(
  9218. $core.method({
  9219. selector: "initialize",
  9220. protocol: 'initialization',
  9221. fn: function (){
  9222. var self=this;
  9223. return $core.withContext(function($ctx1) {
  9224. (
  9225. $ctx1.supercall = true,
  9226. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  9227. $ctx1.supercall = false;
  9228. self["@message"]=$recv($globals.Message)._new();
  9229. return self;
  9230. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  9231. },
  9232. args: [],
  9233. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  9234. referencedClasses: ["Message"],
  9235. messageSends: ["initialize", "new"]
  9236. }),
  9237. $globals.MessageSend);
  9238. $core.addMethod(
  9239. $core.method({
  9240. selector: "printOn:",
  9241. protocol: 'printing',
  9242. fn: function (aStream){
  9243. var self=this;
  9244. return $core.withContext(function($ctx1) {
  9245. (
  9246. $ctx1.supercall = true,
  9247. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9248. $ctx1.supercall = false;
  9249. $recv(aStream)._nextPutAll_("(");
  9250. $ctx1.sendIdx["nextPutAll:"]=1;
  9251. $recv(aStream)._nextPutAll_(self._receiver());
  9252. $ctx1.sendIdx["nextPutAll:"]=2;
  9253. $recv(aStream)._nextPutAll_(" >> ");
  9254. $ctx1.sendIdx["nextPutAll:"]=3;
  9255. $recv(aStream)._nextPutAll_(self._selector());
  9256. $ctx1.sendIdx["nextPutAll:"]=4;
  9257. $recv(aStream)._nextPutAll_(")");
  9258. return self;
  9259. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  9260. },
  9261. args: ["aStream"],
  9262. 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: ')'",
  9263. referencedClasses: [],
  9264. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  9265. }),
  9266. $globals.MessageSend);
  9267. $core.addMethod(
  9268. $core.method({
  9269. selector: "receiver",
  9270. protocol: 'accessing',
  9271. fn: function (){
  9272. var self=this;
  9273. return self["@receiver"];
  9274. },
  9275. args: [],
  9276. source: "receiver\x0a\x09^ receiver",
  9277. referencedClasses: [],
  9278. messageSends: []
  9279. }),
  9280. $globals.MessageSend);
  9281. $core.addMethod(
  9282. $core.method({
  9283. selector: "receiver:",
  9284. protocol: 'accessing',
  9285. fn: function (anObject){
  9286. var self=this;
  9287. self["@receiver"]=anObject;
  9288. return self;
  9289. },
  9290. args: ["anObject"],
  9291. source: "receiver: anObject\x0a\x09receiver := anObject",
  9292. referencedClasses: [],
  9293. messageSends: []
  9294. }),
  9295. $globals.MessageSend);
  9296. $core.addMethod(
  9297. $core.method({
  9298. selector: "selector",
  9299. protocol: 'accessing',
  9300. fn: function (){
  9301. var self=this;
  9302. return $core.withContext(function($ctx1) {
  9303. return $recv(self["@message"])._selector();
  9304. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  9305. },
  9306. args: [],
  9307. source: "selector\x0a\x09^ message selector",
  9308. referencedClasses: [],
  9309. messageSends: ["selector"]
  9310. }),
  9311. $globals.MessageSend);
  9312. $core.addMethod(
  9313. $core.method({
  9314. selector: "selector:",
  9315. protocol: 'accessing',
  9316. fn: function (aString){
  9317. var self=this;
  9318. return $core.withContext(function($ctx1) {
  9319. $recv(self["@message"])._selector_(aString);
  9320. return self;
  9321. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  9322. },
  9323. args: ["aString"],
  9324. source: "selector: aString\x0a\x09message selector: aString",
  9325. referencedClasses: [],
  9326. messageSends: ["selector:"]
  9327. }),
  9328. $globals.MessageSend);
  9329. $core.addMethod(
  9330. $core.method({
  9331. selector: "value",
  9332. protocol: 'evaluating',
  9333. fn: function (){
  9334. var self=this;
  9335. return $core.withContext(function($ctx1) {
  9336. return $recv(self["@message"])._sendTo_(self._receiver());
  9337. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  9338. },
  9339. args: [],
  9340. source: "value\x0a\x09^ message sendTo: self receiver",
  9341. referencedClasses: [],
  9342. messageSends: ["sendTo:", "receiver"]
  9343. }),
  9344. $globals.MessageSend);
  9345. $core.addMethod(
  9346. $core.method({
  9347. selector: "value:",
  9348. protocol: 'evaluating',
  9349. fn: function (anObject){
  9350. var self=this;
  9351. return $core.withContext(function($ctx1) {
  9352. var $1;
  9353. $1=self["@message"];
  9354. $recv($1)._arguments_([anObject]);
  9355. return $recv($1)._sendTo_(self._receiver());
  9356. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  9357. },
  9358. args: ["anObject"],
  9359. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  9360. referencedClasses: [],
  9361. messageSends: ["arguments:", "sendTo:", "receiver"]
  9362. }),
  9363. $globals.MessageSend);
  9364. $core.addMethod(
  9365. $core.method({
  9366. selector: "value:value:",
  9367. protocol: 'evaluating',
  9368. fn: function (firstArgument,secondArgument){
  9369. var self=this;
  9370. return $core.withContext(function($ctx1) {
  9371. var $1;
  9372. $1=self["@message"];
  9373. $recv($1)._arguments_([firstArgument,secondArgument]);
  9374. return $recv($1)._sendTo_(self._receiver());
  9375. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  9376. },
  9377. args: ["firstArgument", "secondArgument"],
  9378. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  9379. referencedClasses: [],
  9380. messageSends: ["arguments:", "sendTo:", "receiver"]
  9381. }),
  9382. $globals.MessageSend);
  9383. $core.addMethod(
  9384. $core.method({
  9385. selector: "value:value:value:",
  9386. protocol: 'evaluating',
  9387. fn: function (firstArgument,secondArgument,thirdArgument){
  9388. var self=this;
  9389. return $core.withContext(function($ctx1) {
  9390. var $1;
  9391. $1=self["@message"];
  9392. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  9393. return $recv($1)._sendTo_(self._receiver());
  9394. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  9395. },
  9396. args: ["firstArgument", "secondArgument", "thirdArgument"],
  9397. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  9398. referencedClasses: [],
  9399. messageSends: ["arguments:", "sendTo:", "receiver"]
  9400. }),
  9401. $globals.MessageSend);
  9402. $core.addMethod(
  9403. $core.method({
  9404. selector: "valueWithPossibleArguments:",
  9405. protocol: 'evaluating',
  9406. fn: function (aCollection){
  9407. var self=this;
  9408. return $core.withContext(function($ctx1) {
  9409. self._arguments_(aCollection);
  9410. return self._value();
  9411. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  9412. },
  9413. args: ["aCollection"],
  9414. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  9415. referencedClasses: [],
  9416. messageSends: ["arguments:", "value"]
  9417. }),
  9418. $globals.MessageSend);
  9419. $core.addClass('MethodContext', $globals.Object, [], 'Kernel-Methods');
  9420. $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`.";
  9421. $core.addMethod(
  9422. $core.method({
  9423. selector: "asString",
  9424. protocol: 'converting',
  9425. fn: function (){
  9426. var self=this;
  9427. return $core.withContext(function($ctx1) {
  9428. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  9429. $2=self._isBlockContext();
  9430. if($core.assert($2)){
  9431. $3="a block (in ".__comma($recv(self._methodContext())._asString());
  9432. $ctx1.sendIdx[","]=2;
  9433. $1=$recv($3).__comma(")");
  9434. $ctx1.sendIdx[","]=1;
  9435. } else {
  9436. var methodClass;
  9437. methodClass=$recv(self._method())._methodClass();
  9438. methodClass;
  9439. $5=methodClass;
  9440. $7=self._receiver();
  9441. $ctx1.sendIdx["receiver"]=1;
  9442. $6=$recv($7)._class();
  9443. $ctx1.sendIdx["class"]=1;
  9444. $4=$recv($5).__eq($6);
  9445. if($core.assert($4)){
  9446. $11=self._receiver();
  9447. $ctx1.sendIdx["receiver"]=2;
  9448. $10=$recv($11)._class();
  9449. $ctx1.sendIdx["class"]=2;
  9450. $9=$recv($10)._name();
  9451. $ctx1.sendIdx["name"]=1;
  9452. $8=$recv($9).__comma(" >> ");
  9453. $ctx1.sendIdx[","]=4;
  9454. $12=self._selector();
  9455. $ctx1.sendIdx["selector"]=1;
  9456. $1=$recv($8).__comma($12);
  9457. $ctx1.sendIdx[","]=3;
  9458. } else {
  9459. $16=$recv($recv(self._receiver())._class())._name();
  9460. $ctx1.sendIdx["name"]=2;
  9461. $15=$recv($16).__comma("(");
  9462. $14=$recv($15).__comma($recv(methodClass)._name());
  9463. $ctx1.sendIdx[","]=7;
  9464. $13=$recv($14).__comma(") >> ");
  9465. $ctx1.sendIdx[","]=6;
  9466. $1=$recv($13).__comma(self._selector());
  9467. $ctx1.sendIdx[","]=5;
  9468. };
  9469. };
  9470. return $1;
  9471. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  9472. },
  9473. args: [],
  9474. 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 ] ]",
  9475. referencedClasses: [],
  9476. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  9477. }),
  9478. $globals.MethodContext);
  9479. $core.addMethod(
  9480. $core.method({
  9481. selector: "basicReceiver",
  9482. protocol: 'accessing',
  9483. fn: function (){
  9484. var self=this;
  9485. return $core.withContext(function($ctx1) {
  9486. return self.receiver;
  9487. return self;
  9488. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  9489. },
  9490. args: [],
  9491. source: "basicReceiver\x0a\x09<return self.receiver>",
  9492. referencedClasses: [],
  9493. messageSends: []
  9494. }),
  9495. $globals.MethodContext);
  9496. $core.addMethod(
  9497. $core.method({
  9498. selector: "evaluatedSelector",
  9499. protocol: 'accessing',
  9500. fn: function (){
  9501. var self=this;
  9502. return $core.withContext(function($ctx1) {
  9503. return self.evaluatedSelector;
  9504. return self;
  9505. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  9506. },
  9507. args: [],
  9508. source: "evaluatedSelector\x0a\x09<return self.evaluatedSelector>",
  9509. referencedClasses: [],
  9510. messageSends: []
  9511. }),
  9512. $globals.MethodContext);
  9513. $core.addMethod(
  9514. $core.method({
  9515. selector: "findContextSuchThat:",
  9516. protocol: 'accessing',
  9517. fn: function (testBlock){
  9518. var self=this;
  9519. var context;
  9520. return $core.withContext(function($ctx1) {
  9521. var $1;
  9522. var $early={};
  9523. try {
  9524. context=self;
  9525. $recv((function(){
  9526. return $core.withContext(function($ctx2) {
  9527. return $recv(context)._isNil();
  9528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9529. }))._whileFalse_((function(){
  9530. return $core.withContext(function($ctx2) {
  9531. $1=$recv(testBlock)._value_(context);
  9532. if($core.assert($1)){
  9533. throw $early=[context];
  9534. };
  9535. context=$recv(context)._outerContext();
  9536. return context;
  9537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9538. }));
  9539. return nil;
  9540. }
  9541. catch(e) {if(e===$early)return e[0]; throw e}
  9542. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  9543. },
  9544. args: ["testBlock"],
  9545. 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",
  9546. referencedClasses: [],
  9547. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  9548. }),
  9549. $globals.MethodContext);
  9550. $core.addMethod(
  9551. $core.method({
  9552. selector: "home",
  9553. protocol: 'accessing',
  9554. fn: function (){
  9555. var self=this;
  9556. return $core.withContext(function($ctx1) {
  9557. return self.homeContext;
  9558. return self;
  9559. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  9560. },
  9561. args: [],
  9562. source: "home\x0a\x09<return self.homeContext>",
  9563. referencedClasses: [],
  9564. messageSends: []
  9565. }),
  9566. $globals.MethodContext);
  9567. $core.addMethod(
  9568. $core.method({
  9569. selector: "index",
  9570. protocol: 'accessing',
  9571. fn: function (){
  9572. var self=this;
  9573. return $core.withContext(function($ctx1) {
  9574. return self.index || 0;
  9575. return self;
  9576. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  9577. },
  9578. args: [],
  9579. source: "index\x0a\x09<return self.index || 0>",
  9580. referencedClasses: [],
  9581. messageSends: []
  9582. }),
  9583. $globals.MethodContext);
  9584. $core.addMethod(
  9585. $core.method({
  9586. selector: "isBlockContext",
  9587. protocol: 'testing',
  9588. fn: function (){
  9589. var self=this;
  9590. return $core.withContext(function($ctx1) {
  9591. return $recv(self._selector())._isNil();
  9592. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  9593. },
  9594. args: [],
  9595. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  9596. referencedClasses: [],
  9597. messageSends: ["isNil", "selector"]
  9598. }),
  9599. $globals.MethodContext);
  9600. $core.addMethod(
  9601. $core.method({
  9602. selector: "locals",
  9603. protocol: 'accessing',
  9604. fn: function (){
  9605. var self=this;
  9606. return $core.withContext(function($ctx1) {
  9607. return self.locals || {};
  9608. return self;
  9609. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  9610. },
  9611. args: [],
  9612. source: "locals\x0a\x09<return self.locals || {}>",
  9613. referencedClasses: [],
  9614. messageSends: []
  9615. }),
  9616. $globals.MethodContext);
  9617. $core.addMethod(
  9618. $core.method({
  9619. selector: "method",
  9620. protocol: 'accessing',
  9621. fn: function (){
  9622. var self=this;
  9623. var method,lookupClass,receiverClass,supercall;
  9624. return $core.withContext(function($ctx1) {
  9625. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  9626. $1=self._methodContext();
  9627. $ctx1.sendIdx["methodContext"]=1;
  9628. if(($receiver = $1) == null || $receiver.isNil){
  9629. return nil;
  9630. } else {
  9631. $1;
  9632. };
  9633. $3=self._methodContext();
  9634. $ctx1.sendIdx["methodContext"]=2;
  9635. $2=$recv($3)._receiver();
  9636. receiverClass=$recv($2)._class();
  9637. $4=receiverClass;
  9638. $6=self._methodContext();
  9639. $ctx1.sendIdx["methodContext"]=3;
  9640. $5=$recv($6)._selector();
  9641. $ctx1.sendIdx["selector"]=1;
  9642. method=$recv($4)._lookupSelector_($5);
  9643. $ctx1.sendIdx["lookupSelector:"]=1;
  9644. $7=self._outerContext();
  9645. if(($receiver = $7) == null || $receiver.isNil){
  9646. supercall=false;
  9647. } else {
  9648. var outer;
  9649. outer=$receiver;
  9650. supercall=$recv(outer)._supercall();
  9651. };
  9652. $8=supercall;
  9653. if($core.assert($8)){
  9654. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv(self._methodContext())._selector());
  9655. } else {
  9656. return method;
  9657. };
  9658. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  9659. },
  9660. args: [],
  9661. 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 ]",
  9662. referencedClasses: [],
  9663. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  9664. }),
  9665. $globals.MethodContext);
  9666. $core.addMethod(
  9667. $core.method({
  9668. selector: "methodContext",
  9669. protocol: 'accessing',
  9670. fn: function (){
  9671. var self=this;
  9672. return $core.withContext(function($ctx1) {
  9673. var $1,$2,$receiver;
  9674. $1=self._isBlockContext();
  9675. if(!$core.assert($1)){
  9676. return self;
  9677. };
  9678. $2=self._outerContext();
  9679. if(($receiver = $2) == null || $receiver.isNil){
  9680. return $2;
  9681. } else {
  9682. var outer;
  9683. outer=$receiver;
  9684. return $recv(outer)._methodContext();
  9685. };
  9686. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  9687. },
  9688. args: [],
  9689. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  9690. referencedClasses: [],
  9691. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  9692. }),
  9693. $globals.MethodContext);
  9694. $core.addMethod(
  9695. $core.method({
  9696. selector: "outerContext",
  9697. protocol: 'accessing',
  9698. fn: function (){
  9699. var self=this;
  9700. return $core.withContext(function($ctx1) {
  9701. return self.outerContext || self.homeContext;
  9702. return self;
  9703. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  9704. },
  9705. args: [],
  9706. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  9707. referencedClasses: [],
  9708. messageSends: []
  9709. }),
  9710. $globals.MethodContext);
  9711. $core.addMethod(
  9712. $core.method({
  9713. selector: "printOn:",
  9714. protocol: 'printing',
  9715. fn: function (aStream){
  9716. var self=this;
  9717. return $core.withContext(function($ctx1) {
  9718. (
  9719. $ctx1.supercall = true,
  9720. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9721. $ctx1.supercall = false;
  9722. $recv(aStream)._nextPutAll_("(");
  9723. $ctx1.sendIdx["nextPutAll:"]=1;
  9724. $recv(aStream)._nextPutAll_(self._asString());
  9725. $ctx1.sendIdx["nextPutAll:"]=2;
  9726. $recv(aStream)._nextPutAll_(")");
  9727. return self;
  9728. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  9729. },
  9730. args: ["aStream"],
  9731. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  9732. referencedClasses: [],
  9733. messageSends: ["printOn:", "nextPutAll:", "asString"]
  9734. }),
  9735. $globals.MethodContext);
  9736. $core.addMethod(
  9737. $core.method({
  9738. selector: "receiver",
  9739. protocol: 'accessing',
  9740. fn: function (){
  9741. var self=this;
  9742. return $core.withContext(function($ctx1) {
  9743. var $2,$1;
  9744. $1=$recv(self._isBlockContext())._and_((function(){
  9745. return $core.withContext(function($ctx2) {
  9746. $2=self._outerContext();
  9747. $ctx2.sendIdx["outerContext"]=1;
  9748. return $recv($2)._notNil();
  9749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9750. }));
  9751. if($core.assert($1)){
  9752. return $recv(self._outerContext())._receiver();
  9753. } else {
  9754. return self._basicReceiver();
  9755. };
  9756. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  9757. },
  9758. args: [],
  9759. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  9760. referencedClasses: [],
  9761. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  9762. }),
  9763. $globals.MethodContext);
  9764. $core.addMethod(
  9765. $core.method({
  9766. selector: "selector",
  9767. protocol: 'accessing',
  9768. fn: function (){
  9769. var self=this;
  9770. return $core.withContext(function($ctx1) {
  9771. if(self.selector) {
  9772. return $core.js2st(self.selector);
  9773. } else {
  9774. return nil;
  9775. }
  9776. ;
  9777. return self;
  9778. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  9779. },
  9780. args: [],
  9781. source: "selector\x0a\x09<\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>",
  9782. referencedClasses: [],
  9783. messageSends: []
  9784. }),
  9785. $globals.MethodContext);
  9786. $core.addMethod(
  9787. $core.method({
  9788. selector: "sendIndexAt:",
  9789. protocol: 'accessing',
  9790. fn: function (aSelector){
  9791. var self=this;
  9792. return $core.withContext(function($ctx1) {
  9793. return self.sendIdx[aSelector] || 0;
  9794. return self;
  9795. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  9796. },
  9797. args: ["aSelector"],
  9798. source: "sendIndexAt: aSelector\x0a\x09<return self.sendIdx[aSelector] || 0>",
  9799. referencedClasses: [],
  9800. messageSends: []
  9801. }),
  9802. $globals.MethodContext);
  9803. $core.addMethod(
  9804. $core.method({
  9805. selector: "sendIndexes",
  9806. protocol: 'accessing',
  9807. fn: function (){
  9808. var self=this;
  9809. return $core.withContext(function($ctx1) {
  9810. return self.sendIdx;
  9811. return self;
  9812. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  9813. },
  9814. args: [],
  9815. source: "sendIndexes\x0a\x09<return self.sendIdx>",
  9816. referencedClasses: [],
  9817. messageSends: []
  9818. }),
  9819. $globals.MethodContext);
  9820. $core.addMethod(
  9821. $core.method({
  9822. selector: "supercall",
  9823. protocol: 'accessing',
  9824. fn: function (){
  9825. var self=this;
  9826. return $core.withContext(function($ctx1) {
  9827. return self.supercall == true;
  9828. return self;
  9829. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  9830. },
  9831. args: [],
  9832. source: "supercall\x0a\x09<return self.supercall == true>",
  9833. referencedClasses: [],
  9834. messageSends: []
  9835. }),
  9836. $globals.MethodContext);
  9837. $core.addClass('NativeFunction', $globals.Object, [], 'Kernel-Methods');
  9838. $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' ]";
  9839. $core.addMethod(
  9840. $core.method({
  9841. selector: "constructorNamed:",
  9842. protocol: 'instance creation',
  9843. fn: function (aString){
  9844. var self=this;
  9845. return $core.withContext(function($ctx1) {
  9846. var nativeFunc=(new Function('return this'))()[aString];
  9847. return new nativeFunc();
  9848. ;
  9849. return self;
  9850. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.klass)});
  9851. },
  9852. args: ["aString"],
  9853. source: "constructorNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9854. referencedClasses: [],
  9855. messageSends: []
  9856. }),
  9857. $globals.NativeFunction.klass);
  9858. $core.addMethod(
  9859. $core.method({
  9860. selector: "constructorNamed:value:",
  9861. protocol: 'instance creation',
  9862. fn: function (aString,anObject){
  9863. var self=this;
  9864. return $core.withContext(function($ctx1) {
  9865. var nativeFunc=(new Function('return this'))()[aString];
  9866. return new nativeFunc(anObject);
  9867. ;
  9868. return self;
  9869. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  9870. },
  9871. args: ["aString", "anObject"],
  9872. source: "constructorNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9873. referencedClasses: [],
  9874. messageSends: []
  9875. }),
  9876. $globals.NativeFunction.klass);
  9877. $core.addMethod(
  9878. $core.method({
  9879. selector: "constructorNamed:value:value:",
  9880. protocol: 'instance creation',
  9881. fn: function (aString,anObject,anObject2){
  9882. var self=this;
  9883. return $core.withContext(function($ctx1) {
  9884. var nativeFunc=(new Function('return this'))()[aString];
  9885. return new nativeFunc(anObject,anObject2);
  9886. ;
  9887. return self;
  9888. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9889. },
  9890. args: ["aString", "anObject", "anObject2"],
  9891. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9892. referencedClasses: [],
  9893. messageSends: []
  9894. }),
  9895. $globals.NativeFunction.klass);
  9896. $core.addMethod(
  9897. $core.method({
  9898. selector: "constructorNamed:value:value:value:",
  9899. protocol: 'instance creation',
  9900. fn: function (aString,anObject,anObject2,anObject3){
  9901. var self=this;
  9902. return $core.withContext(function($ctx1) {
  9903. var nativeFunc=(new Function('return this'))()[aString];
  9904. return new nativeFunc(anObject,anObject2, anObject3);
  9905. ;
  9906. return self;
  9907. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9908. },
  9909. args: ["aString", "anObject", "anObject2", "anObject3"],
  9910. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9911. referencedClasses: [],
  9912. messageSends: []
  9913. }),
  9914. $globals.NativeFunction.klass);
  9915. $core.addMethod(
  9916. $core.method({
  9917. selector: "constructorOf:",
  9918. protocol: 'instance creation',
  9919. fn: function (nativeFunc){
  9920. var self=this;
  9921. return $core.withContext(function($ctx1) {
  9922. return new nativeFunc();
  9923. ;
  9924. return self;
  9925. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  9926. },
  9927. args: ["nativeFunc"],
  9928. source: "constructorOf: nativeFunc\x0a\x09<\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  9929. referencedClasses: [],
  9930. messageSends: []
  9931. }),
  9932. $globals.NativeFunction.klass);
  9933. $core.addMethod(
  9934. $core.method({
  9935. selector: "constructorOf:value:",
  9936. protocol: 'instance creation',
  9937. fn: function (nativeFunc,anObject){
  9938. var self=this;
  9939. return $core.withContext(function($ctx1) {
  9940. return new nativeFunc(anObject);
  9941. ;
  9942. return self;
  9943. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  9944. },
  9945. args: ["nativeFunc", "anObject"],
  9946. source: "constructorOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  9947. referencedClasses: [],
  9948. messageSends: []
  9949. }),
  9950. $globals.NativeFunction.klass);
  9951. $core.addMethod(
  9952. $core.method({
  9953. selector: "constructorOf:value:value:",
  9954. protocol: 'instance creation',
  9955. fn: function (nativeFunc,anObject,anObject2){
  9956. var self=this;
  9957. return $core.withContext(function($ctx1) {
  9958. return new nativeFunc(anObject,anObject2);
  9959. ;
  9960. return self;
  9961. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  9962. },
  9963. args: ["nativeFunc", "anObject", "anObject2"],
  9964. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  9965. referencedClasses: [],
  9966. messageSends: []
  9967. }),
  9968. $globals.NativeFunction.klass);
  9969. $core.addMethod(
  9970. $core.method({
  9971. selector: "constructorOf:value:value:value:",
  9972. protocol: 'instance creation',
  9973. fn: function (nativeFunc,anObject,anObject2,anObject3){
  9974. var self=this;
  9975. return $core.withContext(function($ctx1) {
  9976. return new nativeFunc(anObject,anObject2, anObject3);
  9977. ;
  9978. return self;
  9979. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  9980. },
  9981. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  9982. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  9983. referencedClasses: [],
  9984. messageSends: []
  9985. }),
  9986. $globals.NativeFunction.klass);
  9987. $core.addMethod(
  9988. $core.method({
  9989. selector: "exists:",
  9990. protocol: 'testing',
  9991. fn: function (aString){
  9992. var self=this;
  9993. return $core.withContext(function($ctx1) {
  9994. return $recv($globals.Smalltalk)._existsJsGlobal_(aString);
  9995. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.klass)});
  9996. },
  9997. args: ["aString"],
  9998. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  9999. referencedClasses: ["Smalltalk"],
  10000. messageSends: ["existsJsGlobal:"]
  10001. }),
  10002. $globals.NativeFunction.klass);
  10003. $core.addMethod(
  10004. $core.method({
  10005. selector: "functionNamed:",
  10006. protocol: 'function calling',
  10007. fn: function (aString){
  10008. var self=this;
  10009. return $core.withContext(function($ctx1) {
  10010. var nativeFunc=(new Function('return this'))()[aString];
  10011. return nativeFunc();
  10012. ;
  10013. return self;
  10014. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.klass)});
  10015. },
  10016. args: ["aString"],
  10017. source: "functionNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09>",
  10018. referencedClasses: [],
  10019. messageSends: []
  10020. }),
  10021. $globals.NativeFunction.klass);
  10022. $core.addMethod(
  10023. $core.method({
  10024. selector: "functionNamed:value:",
  10025. protocol: 'function calling',
  10026. fn: function (aString,anObject){
  10027. var self=this;
  10028. return $core.withContext(function($ctx1) {
  10029. var nativeFunc=(new Function('return this'))()[aString];
  10030. return nativeFunc(anObject);
  10031. ;
  10032. return self;
  10033. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  10034. },
  10035. args: ["aString", "anObject"],
  10036. source: "functionNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  10037. referencedClasses: [],
  10038. messageSends: []
  10039. }),
  10040. $globals.NativeFunction.klass);
  10041. $core.addMethod(
  10042. $core.method({
  10043. selector: "functionNamed:value:value:",
  10044. protocol: 'function calling',
  10045. fn: function (aString,anObject,anObject2){
  10046. var self=this;
  10047. return $core.withContext(function($ctx1) {
  10048. var nativeFunc=(new Function('return this'))()[aString];
  10049. return nativeFunc(anObject,anObject2);
  10050. ;
  10051. return self;
  10052. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10053. },
  10054. args: ["aString", "anObject", "anObject2"],
  10055. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>",
  10056. referencedClasses: [],
  10057. messageSends: []
  10058. }),
  10059. $globals.NativeFunction.klass);
  10060. $core.addMethod(
  10061. $core.method({
  10062. selector: "functionNamed:value:value:value:",
  10063. protocol: 'function calling',
  10064. fn: function (aString,anObject,anObject2,anObject3){
  10065. var self=this;
  10066. return $core.withContext(function($ctx1) {
  10067. var nativeFunc=(new Function('return this'))()[aString];
  10068. return nativeFunc(anObject,anObject2, anObject3);
  10069. ;
  10070. return self;
  10071. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10072. },
  10073. args: ["aString", "anObject", "anObject2", "anObject3"],
  10074. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  10075. referencedClasses: [],
  10076. messageSends: []
  10077. }),
  10078. $globals.NativeFunction.klass);
  10079. $core.addMethod(
  10080. $core.method({
  10081. selector: "functionNamed:valueWithArgs:",
  10082. protocol: 'function calling',
  10083. fn: function (aString,args){
  10084. var self=this;
  10085. return $core.withContext(function($ctx1) {
  10086. var nativeFunc=(new Function('return this'))()[aString];
  10087. return Function.prototype.apply.call(nativeFunc, null, args);
  10088. ;
  10089. return self;
  10090. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.klass)});
  10091. },
  10092. args: ["aString", "args"],
  10093. source: "functionNamed: aString valueWithArgs: args\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>",
  10094. referencedClasses: [],
  10095. messageSends: []
  10096. }),
  10097. $globals.NativeFunction.klass);
  10098. $core.addMethod(
  10099. $core.method({
  10100. selector: "functionOf:",
  10101. protocol: 'function calling',
  10102. fn: function (nativeFunc){
  10103. var self=this;
  10104. return $core.withContext(function($ctx1) {
  10105. return nativeFunc();
  10106. ;
  10107. return self;
  10108. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  10109. },
  10110. args: ["nativeFunc"],
  10111. source: "functionOf: nativeFunc\x0a\x09<\x0a\x09\x09return nativeFunc();\x0a\x09>",
  10112. referencedClasses: [],
  10113. messageSends: []
  10114. }),
  10115. $globals.NativeFunction.klass);
  10116. $core.addMethod(
  10117. $core.method({
  10118. selector: "functionOf:value:",
  10119. protocol: 'function calling',
  10120. fn: function (nativeFunc,anObject){
  10121. var self=this;
  10122. return $core.withContext(function($ctx1) {
  10123. return nativeFunc(anObject);
  10124. ;
  10125. return self;
  10126. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  10127. },
  10128. args: ["nativeFunc", "anObject"],
  10129. source: "functionOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  10130. referencedClasses: [],
  10131. messageSends: []
  10132. }),
  10133. $globals.NativeFunction.klass);
  10134. $core.addMethod(
  10135. $core.method({
  10136. selector: "functionOf:value:value:",
  10137. protocol: 'function calling',
  10138. fn: function (nativeFunc,anObject,anObject2){
  10139. var self=this;
  10140. return $core.withContext(function($ctx1) {
  10141. return nativeFunc(anObject,anObject2);
  10142. ;
  10143. return self;
  10144. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10145. },
  10146. args: ["nativeFunc", "anObject", "anObject2"],
  10147. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>",
  10148. referencedClasses: [],
  10149. messageSends: []
  10150. }),
  10151. $globals.NativeFunction.klass);
  10152. $core.addMethod(
  10153. $core.method({
  10154. selector: "functionOf:value:value:value:",
  10155. protocol: 'function calling',
  10156. fn: function (nativeFunc,anObject,anObject2,anObject3){
  10157. var self=this;
  10158. return $core.withContext(function($ctx1) {
  10159. return nativeFunc(anObject,anObject2, anObject3);
  10160. ;
  10161. return self;
  10162. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10163. },
  10164. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  10165. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  10166. referencedClasses: [],
  10167. messageSends: []
  10168. }),
  10169. $globals.NativeFunction.klass);
  10170. $core.addMethod(
  10171. $core.method({
  10172. selector: "functionOf:valueWithArgs:",
  10173. protocol: 'function calling',
  10174. fn: function (nativeFunc,args){
  10175. var self=this;
  10176. return $core.withContext(function($ctx1) {
  10177. return Function.prototype.apply.call(nativeFunc, null, args);
  10178. ;
  10179. return self;
  10180. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.klass)});
  10181. },
  10182. args: ["nativeFunc", "args"],
  10183. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>",
  10184. referencedClasses: [],
  10185. messageSends: []
  10186. }),
  10187. $globals.NativeFunction.klass);
  10188. $core.addMethod(
  10189. $core.method({
  10190. selector: "methodOf:this:",
  10191. protocol: 'method calling',
  10192. fn: function (nativeFunc,thisObject){
  10193. var self=this;
  10194. return $core.withContext(function($ctx1) {
  10195. return Function.prototype.call.call(nativeFunc, thisObject);
  10196. ;
  10197. return self;
  10198. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.klass)});
  10199. },
  10200. args: ["nativeFunc", "thisObject"],
  10201. source: "methodOf: nativeFunc this: thisObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09>",
  10202. referencedClasses: [],
  10203. messageSends: []
  10204. }),
  10205. $globals.NativeFunction.klass);
  10206. $core.addMethod(
  10207. $core.method({
  10208. selector: "methodOf:this:value:",
  10209. protocol: 'method calling',
  10210. fn: function (nativeFunc,thisObject,anObject){
  10211. var self=this;
  10212. return $core.withContext(function($ctx1) {
  10213. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  10214. ;
  10215. return self;
  10216. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.klass)});
  10217. },
  10218. args: ["nativeFunc", "thisObject", "anObject"],
  10219. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09>",
  10220. referencedClasses: [],
  10221. messageSends: []
  10222. }),
  10223. $globals.NativeFunction.klass);
  10224. $core.addMethod(
  10225. $core.method({
  10226. selector: "methodOf:this:value:value:",
  10227. protocol: 'method calling',
  10228. fn: function (nativeFunc,thisObject,anObject,anObject2){
  10229. var self=this;
  10230. return $core.withContext(function($ctx1) {
  10231. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  10232. ;
  10233. return self;
  10234. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10235. },
  10236. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  10237. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09>",
  10238. referencedClasses: [],
  10239. messageSends: []
  10240. }),
  10241. $globals.NativeFunction.klass);
  10242. $core.addMethod(
  10243. $core.method({
  10244. selector: "methodOf:this:value:value:value:",
  10245. protocol: 'method calling',
  10246. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  10247. var self=this;
  10248. return $core.withContext(function($ctx1) {
  10249. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  10250. ;
  10251. return self;
  10252. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10253. },
  10254. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  10255. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);\x0a\x09>",
  10256. referencedClasses: [],
  10257. messageSends: []
  10258. }),
  10259. $globals.NativeFunction.klass);
  10260. $core.addMethod(
  10261. $core.method({
  10262. selector: "methodOf:this:valueWithArgs:",
  10263. protocol: 'method calling',
  10264. fn: function (nativeFunc,thisObject,args){
  10265. var self=this;
  10266. return $core.withContext(function($ctx1) {
  10267. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  10268. ;
  10269. return self;
  10270. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.klass)});
  10271. },
  10272. args: ["nativeFunc", "thisObject", "args"],
  10273. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09>",
  10274. referencedClasses: [],
  10275. messageSends: []
  10276. }),
  10277. $globals.NativeFunction.klass);
  10278. $core.addClass('Timeout', $globals.Object, ['rawTimeout'], 'Kernel-Methods');
  10279. $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.";
  10280. $core.addMethod(
  10281. $core.method({
  10282. selector: "clearInterval",
  10283. protocol: 'timeout/interval',
  10284. fn: function (){
  10285. var self=this;
  10286. return $core.withContext(function($ctx1) {
  10287. var interval = self["@rawTimeout"];
  10288. clearInterval(interval);
  10289. ;
  10290. return self;
  10291. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  10292. },
  10293. args: [],
  10294. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  10295. referencedClasses: [],
  10296. messageSends: []
  10297. }),
  10298. $globals.Timeout);
  10299. $core.addMethod(
  10300. $core.method({
  10301. selector: "clearTimeout",
  10302. protocol: 'timeout/interval',
  10303. fn: function (){
  10304. var self=this;
  10305. return $core.withContext(function($ctx1) {
  10306. var timeout = self["@rawTimeout"];
  10307. clearTimeout(timeout);
  10308. ;
  10309. return self;
  10310. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  10311. },
  10312. args: [],
  10313. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  10314. referencedClasses: [],
  10315. messageSends: []
  10316. }),
  10317. $globals.Timeout);
  10318. $core.addMethod(
  10319. $core.method({
  10320. selector: "rawTimeout:",
  10321. protocol: 'accessing',
  10322. fn: function (anObject){
  10323. var self=this;
  10324. self["@rawTimeout"]=anObject;
  10325. return self;
  10326. },
  10327. args: ["anObject"],
  10328. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  10329. referencedClasses: [],
  10330. messageSends: []
  10331. }),
  10332. $globals.Timeout);
  10333. $core.addMethod(
  10334. $core.method({
  10335. selector: "on:",
  10336. protocol: 'instance creation',
  10337. fn: function (anObject){
  10338. var self=this;
  10339. return $core.withContext(function($ctx1) {
  10340. var $1;
  10341. $1=self._new();
  10342. $recv($1)._rawTimeout_(anObject);
  10343. return $recv($1)._yourself();
  10344. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.klass)});
  10345. },
  10346. args: ["anObject"],
  10347. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  10348. referencedClasses: [],
  10349. messageSends: ["rawTimeout:", "new", "yourself"]
  10350. }),
  10351. $globals.Timeout.klass);
  10352. });
  10353. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  10354. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  10355. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  10356. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  10357. $core.addPackage('Kernel-Collections');
  10358. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  10359. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  10360. $core.addClass('Association', $globals.Object, ['key', 'value'], 'Kernel-Collections');
  10361. $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:`";
  10362. $core.addMethod(
  10363. $core.method({
  10364. selector: "=",
  10365. protocol: 'comparing',
  10366. fn: function (anAssociation){
  10367. var self=this;
  10368. return $core.withContext(function($ctx1) {
  10369. var $3,$2,$5,$4,$6,$1;
  10370. $3=self._class();
  10371. $ctx1.sendIdx["class"]=1;
  10372. $2=$recv($3).__eq($recv(anAssociation)._class());
  10373. $ctx1.sendIdx["="]=1;
  10374. $1=$recv($2)._and_((function(){
  10375. return $core.withContext(function($ctx2) {
  10376. $5=self._key();
  10377. $ctx2.sendIdx["key"]=1;
  10378. $4=$recv($5).__eq($recv(anAssociation)._key());
  10379. $ctx2.sendIdx["="]=2;
  10380. return $recv($4)._and_((function(){
  10381. return $core.withContext(function($ctx3) {
  10382. $6=self._value();
  10383. $ctx3.sendIdx["value"]=1;
  10384. return $recv($6).__eq($recv(anAssociation)._value());
  10385. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  10386. }));
  10387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10388. }));
  10389. $ctx1.sendIdx["and:"]=1;
  10390. return $1;
  10391. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  10392. },
  10393. args: ["anAssociation"],
  10394. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  10395. referencedClasses: [],
  10396. messageSends: ["and:", "=", "class", "key", "value"]
  10397. }),
  10398. $globals.Association);
  10399. $core.addMethod(
  10400. $core.method({
  10401. selector: "key",
  10402. protocol: 'accessing',
  10403. fn: function (){
  10404. var self=this;
  10405. return self["@key"];
  10406. },
  10407. args: [],
  10408. source: "key\x0a\x09^ key",
  10409. referencedClasses: [],
  10410. messageSends: []
  10411. }),
  10412. $globals.Association);
  10413. $core.addMethod(
  10414. $core.method({
  10415. selector: "key:",
  10416. protocol: 'accessing',
  10417. fn: function (aKey){
  10418. var self=this;
  10419. self["@key"]=aKey;
  10420. return self;
  10421. },
  10422. args: ["aKey"],
  10423. source: "key: aKey\x0a\x09key := aKey",
  10424. referencedClasses: [],
  10425. messageSends: []
  10426. }),
  10427. $globals.Association);
  10428. $core.addMethod(
  10429. $core.method({
  10430. selector: "printOn:",
  10431. protocol: 'printing',
  10432. fn: function (aStream){
  10433. var self=this;
  10434. return $core.withContext(function($ctx1) {
  10435. $recv(self._key())._printOn_(aStream);
  10436. $ctx1.sendIdx["printOn:"]=1;
  10437. $recv(aStream)._nextPutAll_(" -> ");
  10438. $recv(self._value())._printOn_(aStream);
  10439. return self;
  10440. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  10441. },
  10442. args: ["aStream"],
  10443. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  10444. referencedClasses: [],
  10445. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  10446. }),
  10447. $globals.Association);
  10448. $core.addMethod(
  10449. $core.method({
  10450. selector: "value",
  10451. protocol: 'accessing',
  10452. fn: function (){
  10453. var self=this;
  10454. return self["@value"];
  10455. },
  10456. args: [],
  10457. source: "value\x0a\x09^ value",
  10458. referencedClasses: [],
  10459. messageSends: []
  10460. }),
  10461. $globals.Association);
  10462. $core.addMethod(
  10463. $core.method({
  10464. selector: "value:",
  10465. protocol: 'accessing',
  10466. fn: function (aValue){
  10467. var self=this;
  10468. self["@value"]=aValue;
  10469. return self;
  10470. },
  10471. args: ["aValue"],
  10472. source: "value: aValue\x0a\x09value := aValue",
  10473. referencedClasses: [],
  10474. messageSends: []
  10475. }),
  10476. $globals.Association);
  10477. $core.addMethod(
  10478. $core.method({
  10479. selector: "key:value:",
  10480. protocol: 'instance creation',
  10481. fn: function (aKey,aValue){
  10482. var self=this;
  10483. return $core.withContext(function($ctx1) {
  10484. var $1;
  10485. $1=self._new();
  10486. $recv($1)._key_(aKey);
  10487. $recv($1)._value_(aValue);
  10488. return $recv($1)._yourself();
  10489. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  10490. },
  10491. args: ["aKey", "aValue"],
  10492. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  10493. referencedClasses: [],
  10494. messageSends: ["key:", "new", "value:", "yourself"]
  10495. }),
  10496. $globals.Association.klass);
  10497. $core.addClass('BucketStore', $globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  10498. $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`.";
  10499. $core.addMethod(
  10500. $core.method({
  10501. selector: "bucketOfElement:",
  10502. protocol: 'accessing',
  10503. fn: function (anObject){
  10504. var self=this;
  10505. return $core.withContext(function($ctx1) {
  10506. var hash = self['@hashBlock'](anObject);
  10507. if (!hash) return null;
  10508. var buckets = self['@buckets'],
  10509. bucket = buckets[hash];
  10510. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  10511. return bucket;
  10512. ;
  10513. return self;
  10514. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  10515. },
  10516. args: ["anObject"],
  10517. source: "bucketOfElement: anObject\x0a\x09<\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>",
  10518. referencedClasses: [],
  10519. messageSends: []
  10520. }),
  10521. $globals.BucketStore);
  10522. $core.addMethod(
  10523. $core.method({
  10524. selector: "do:",
  10525. protocol: 'enumerating',
  10526. fn: function (aBlock){
  10527. var self=this;
  10528. return $core.withContext(function($ctx1) {
  10529. var buckets = self['@buckets'];
  10530. var keys = Object.keys(buckets);
  10531. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  10532. ;
  10533. return self;
  10534. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  10535. },
  10536. args: ["aBlock"],
  10537. source: "do: aBlock\x0a\x09<\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>",
  10538. referencedClasses: [],
  10539. messageSends: []
  10540. }),
  10541. $globals.BucketStore);
  10542. $core.addMethod(
  10543. $core.method({
  10544. selector: "hashBlock:",
  10545. protocol: 'accessing',
  10546. fn: function (aBlock){
  10547. var self=this;
  10548. self["@hashBlock"]=aBlock;
  10549. return self;
  10550. },
  10551. args: ["aBlock"],
  10552. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  10553. referencedClasses: [],
  10554. messageSends: []
  10555. }),
  10556. $globals.BucketStore);
  10557. $core.addMethod(
  10558. $core.method({
  10559. selector: "initialize",
  10560. protocol: 'initialization',
  10561. fn: function (){
  10562. var self=this;
  10563. return $core.withContext(function($ctx1) {
  10564. (
  10565. $ctx1.supercall = true,
  10566. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  10567. $ctx1.supercall = false;
  10568. self._removeAll();
  10569. return self;
  10570. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  10571. },
  10572. args: [],
  10573. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  10574. referencedClasses: [],
  10575. messageSends: ["initialize", "removeAll"]
  10576. }),
  10577. $globals.BucketStore);
  10578. $core.addMethod(
  10579. $core.method({
  10580. selector: "newBucket",
  10581. protocol: 'private',
  10582. fn: function (){
  10583. var self=this;
  10584. return $core.withContext(function($ctx1) {
  10585. self._subclassResponsibility();
  10586. return self;
  10587. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  10588. },
  10589. args: [],
  10590. source: "newBucket\x0a\x09self subclassResponsibility",
  10591. referencedClasses: [],
  10592. messageSends: ["subclassResponsibility"]
  10593. }),
  10594. $globals.BucketStore);
  10595. $core.addMethod(
  10596. $core.method({
  10597. selector: "removeAll",
  10598. protocol: 'adding/removing',
  10599. fn: function (){
  10600. var self=this;
  10601. return $core.withContext(function($ctx1) {
  10602. self['@buckets'] = Object.create(null);;
  10603. return self;
  10604. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  10605. },
  10606. args: [],
  10607. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  10608. referencedClasses: [],
  10609. messageSends: []
  10610. }),
  10611. $globals.BucketStore);
  10612. $core.addMethod(
  10613. $core.method({
  10614. selector: "hashBlock:",
  10615. protocol: 'instance creation',
  10616. fn: function (aBlock){
  10617. var self=this;
  10618. return $core.withContext(function($ctx1) {
  10619. var $1;
  10620. $1=self._new();
  10621. $recv($1)._hashBlock_(aBlock);
  10622. return $recv($1)._yourself();
  10623. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  10624. },
  10625. args: ["aBlock"],
  10626. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  10627. referencedClasses: [],
  10628. messageSends: ["hashBlock:", "new", "yourself"]
  10629. }),
  10630. $globals.BucketStore.klass);
  10631. $core.addClass('ArrayBucketStore', $globals.BucketStore, [], 'Kernel-Collections');
  10632. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  10633. $core.addMethod(
  10634. $core.method({
  10635. selector: "newBucket",
  10636. protocol: 'private',
  10637. fn: function (){
  10638. var self=this;
  10639. return [];
  10640. },
  10641. args: [],
  10642. source: "newBucket\x0a\x09^ #()",
  10643. referencedClasses: [],
  10644. messageSends: []
  10645. }),
  10646. $globals.ArrayBucketStore);
  10647. $core.addClass('Collection', $globals.Object, [], 'Kernel-Collections');
  10648. $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.";
  10649. $core.addMethod(
  10650. $core.method({
  10651. selector: ",",
  10652. protocol: 'copying',
  10653. fn: function (aCollection){
  10654. var self=this;
  10655. return $core.withContext(function($ctx1) {
  10656. var $1;
  10657. $1=self._copy();
  10658. $recv($1)._addAll_(aCollection);
  10659. return $recv($1)._yourself();
  10660. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  10661. },
  10662. args: ["aCollection"],
  10663. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10664. referencedClasses: [],
  10665. messageSends: ["addAll:", "copy", "yourself"]
  10666. }),
  10667. $globals.Collection);
  10668. $core.addMethod(
  10669. $core.method({
  10670. selector: "add:",
  10671. protocol: 'adding/removing',
  10672. fn: function (anObject){
  10673. var self=this;
  10674. return $core.withContext(function($ctx1) {
  10675. self._subclassResponsibility();
  10676. return self;
  10677. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  10678. },
  10679. args: ["anObject"],
  10680. source: "add: anObject\x0a\x09self subclassResponsibility",
  10681. referencedClasses: [],
  10682. messageSends: ["subclassResponsibility"]
  10683. }),
  10684. $globals.Collection);
  10685. $core.addMethod(
  10686. $core.method({
  10687. selector: "addAll:",
  10688. protocol: 'adding/removing',
  10689. fn: function (aCollection){
  10690. var self=this;
  10691. return $core.withContext(function($ctx1) {
  10692. $recv(aCollection)._do_((function(each){
  10693. return $core.withContext(function($ctx2) {
  10694. return self._add_(each);
  10695. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10696. }));
  10697. return aCollection;
  10698. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  10699. },
  10700. args: ["aCollection"],
  10701. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  10702. referencedClasses: [],
  10703. messageSends: ["do:", "add:"]
  10704. }),
  10705. $globals.Collection);
  10706. $core.addMethod(
  10707. $core.method({
  10708. selector: "allSatisfy:",
  10709. protocol: 'enumerating',
  10710. fn: function (aBlock){
  10711. var self=this;
  10712. return $core.withContext(function($ctx1) {
  10713. var $1;
  10714. var $early={};
  10715. try {
  10716. self._do_((function(each){
  10717. return $core.withContext(function($ctx2) {
  10718. $1=$recv(aBlock)._value_(each);
  10719. if(!$core.assert($1)){
  10720. throw $early=[false];
  10721. };
  10722. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10723. }));
  10724. return true;
  10725. }
  10726. catch(e) {if(e===$early)return e[0]; throw e}
  10727. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  10728. },
  10729. args: ["aBlock"],
  10730. 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",
  10731. referencedClasses: [],
  10732. messageSends: ["do:", "ifFalse:", "value:"]
  10733. }),
  10734. $globals.Collection);
  10735. $core.addMethod(
  10736. $core.method({
  10737. selector: "anyOne",
  10738. protocol: 'accessing',
  10739. fn: function (){
  10740. var self=this;
  10741. return $core.withContext(function($ctx1) {
  10742. var $early={};
  10743. try {
  10744. self._ifEmpty_((function(){
  10745. return $core.withContext(function($ctx2) {
  10746. return self._error_("Collection is empty");
  10747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10748. }));
  10749. self._do_((function(each){
  10750. throw $early=[each];
  10751. }));
  10752. return self;
  10753. }
  10754. catch(e) {if(e===$early)return e[0]; throw e}
  10755. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  10756. },
  10757. args: [],
  10758. 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 ]",
  10759. referencedClasses: [],
  10760. messageSends: ["ifEmpty:", "error:", "do:"]
  10761. }),
  10762. $globals.Collection);
  10763. $core.addMethod(
  10764. $core.method({
  10765. selector: "anySatisfy:",
  10766. protocol: 'enumerating',
  10767. fn: function (aBlock){
  10768. var self=this;
  10769. return $core.withContext(function($ctx1) {
  10770. var $1;
  10771. var $early={};
  10772. try {
  10773. self._do_((function(each){
  10774. return $core.withContext(function($ctx2) {
  10775. $1=$recv(aBlock)._value_(each);
  10776. if($core.assert($1)){
  10777. throw $early=[true];
  10778. };
  10779. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10780. }));
  10781. return false;
  10782. }
  10783. catch(e) {if(e===$early)return e[0]; throw e}
  10784. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  10785. },
  10786. args: ["aBlock"],
  10787. 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",
  10788. referencedClasses: [],
  10789. messageSends: ["do:", "ifTrue:", "value:"]
  10790. }),
  10791. $globals.Collection);
  10792. $core.addMethod(
  10793. $core.method({
  10794. selector: "asArray",
  10795. protocol: 'converting',
  10796. fn: function (){
  10797. var self=this;
  10798. return $core.withContext(function($ctx1) {
  10799. return $recv($globals.Array)._withAll_(self);
  10800. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  10801. },
  10802. args: [],
  10803. source: "asArray\x0a\x09^ Array withAll: self",
  10804. referencedClasses: ["Array"],
  10805. messageSends: ["withAll:"]
  10806. }),
  10807. $globals.Collection);
  10808. $core.addMethod(
  10809. $core.method({
  10810. selector: "asJSON",
  10811. protocol: 'converting',
  10812. fn: function (){
  10813. var self=this;
  10814. return $core.withContext(function($ctx1) {
  10815. return $recv(self._asArray())._collect_((function(each){
  10816. return $core.withContext(function($ctx2) {
  10817. return $recv(each)._asJSON();
  10818. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10819. }));
  10820. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)});
  10821. },
  10822. args: [],
  10823. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  10824. referencedClasses: [],
  10825. messageSends: ["collect:", "asArray", "asJSON"]
  10826. }),
  10827. $globals.Collection);
  10828. $core.addMethod(
  10829. $core.method({
  10830. selector: "asOrderedCollection",
  10831. protocol: 'converting',
  10832. fn: function (){
  10833. var self=this;
  10834. return $core.withContext(function($ctx1) {
  10835. return self._asArray();
  10836. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  10837. },
  10838. args: [],
  10839. source: "asOrderedCollection\x0a\x09^ self asArray",
  10840. referencedClasses: [],
  10841. messageSends: ["asArray"]
  10842. }),
  10843. $globals.Collection);
  10844. $core.addMethod(
  10845. $core.method({
  10846. selector: "asSet",
  10847. protocol: 'converting',
  10848. fn: function (){
  10849. var self=this;
  10850. return $core.withContext(function($ctx1) {
  10851. return $recv($globals.Set)._withAll_(self);
  10852. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  10853. },
  10854. args: [],
  10855. source: "asSet\x0a\x09^ Set withAll: self",
  10856. referencedClasses: ["Set"],
  10857. messageSends: ["withAll:"]
  10858. }),
  10859. $globals.Collection);
  10860. $core.addMethod(
  10861. $core.method({
  10862. selector: "collect:",
  10863. protocol: 'enumerating',
  10864. fn: function (aBlock){
  10865. var self=this;
  10866. var stream;
  10867. return $core.withContext(function($ctx1) {
  10868. stream=$recv($recv(self._class())._new())._writeStream();
  10869. self._do_((function(each){
  10870. return $core.withContext(function($ctx2) {
  10871. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  10872. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10873. }));
  10874. return $recv(stream)._contents();
  10875. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  10876. },
  10877. args: ["aBlock"],
  10878. 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",
  10879. referencedClasses: [],
  10880. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  10881. }),
  10882. $globals.Collection);
  10883. $core.addMethod(
  10884. $core.method({
  10885. selector: "copyWith:",
  10886. protocol: 'copying',
  10887. fn: function (anObject){
  10888. var self=this;
  10889. return $core.withContext(function($ctx1) {
  10890. var $1;
  10891. $1=self._copy();
  10892. $recv($1)._add_(anObject);
  10893. return $recv($1)._yourself();
  10894. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  10895. },
  10896. args: ["anObject"],
  10897. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  10898. referencedClasses: [],
  10899. messageSends: ["add:", "copy", "yourself"]
  10900. }),
  10901. $globals.Collection);
  10902. $core.addMethod(
  10903. $core.method({
  10904. selector: "copyWithAll:",
  10905. protocol: 'copying',
  10906. fn: function (aCollection){
  10907. var self=this;
  10908. return $core.withContext(function($ctx1) {
  10909. var $1;
  10910. $1=self._copy();
  10911. $recv($1)._addAll_(aCollection);
  10912. return $recv($1)._yourself();
  10913. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  10914. },
  10915. args: ["aCollection"],
  10916. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  10917. referencedClasses: [],
  10918. messageSends: ["addAll:", "copy", "yourself"]
  10919. }),
  10920. $globals.Collection);
  10921. $core.addMethod(
  10922. $core.method({
  10923. selector: "copyWithoutAll:",
  10924. protocol: 'copying',
  10925. fn: function (aCollection){
  10926. var self=this;
  10927. return $core.withContext(function($ctx1) {
  10928. return self._reject_((function(each){
  10929. return $core.withContext(function($ctx2) {
  10930. return $recv(aCollection)._includes_(each);
  10931. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10932. }));
  10933. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  10934. },
  10935. args: ["aCollection"],
  10936. 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 ]",
  10937. referencedClasses: [],
  10938. messageSends: ["reject:", "includes:"]
  10939. }),
  10940. $globals.Collection);
  10941. $core.addMethod(
  10942. $core.method({
  10943. selector: "deepCopy",
  10944. protocol: 'copying',
  10945. fn: function (){
  10946. var self=this;
  10947. return $core.withContext(function($ctx1) {
  10948. return self._collect_((function(each){
  10949. return $core.withContext(function($ctx2) {
  10950. return $recv(each)._deepCopy();
  10951. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10952. }));
  10953. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  10954. },
  10955. args: [],
  10956. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  10957. referencedClasses: [],
  10958. messageSends: ["collect:", "deepCopy"]
  10959. }),
  10960. $globals.Collection);
  10961. $core.addMethod(
  10962. $core.method({
  10963. selector: "detect:",
  10964. protocol: 'enumerating',
  10965. fn: function (aBlock){
  10966. var self=this;
  10967. return $core.withContext(function($ctx1) {
  10968. return self._detect_ifNone_(aBlock,(function(){
  10969. return $core.withContext(function($ctx2) {
  10970. return self._errorNotFound();
  10971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10972. }));
  10973. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  10974. },
  10975. args: ["aBlock"],
  10976. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  10977. referencedClasses: [],
  10978. messageSends: ["detect:ifNone:", "errorNotFound"]
  10979. }),
  10980. $globals.Collection);
  10981. $core.addMethod(
  10982. $core.method({
  10983. selector: "detect:ifNone:",
  10984. protocol: 'enumerating',
  10985. fn: function (aBlock,anotherBlock){
  10986. var self=this;
  10987. return $core.withContext(function($ctx1) {
  10988. self._subclassResponsibility();
  10989. return self;
  10990. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  10991. },
  10992. args: ["aBlock", "anotherBlock"],
  10993. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  10994. referencedClasses: [],
  10995. messageSends: ["subclassResponsibility"]
  10996. }),
  10997. $globals.Collection);
  10998. $core.addMethod(
  10999. $core.method({
  11000. selector: "do:",
  11001. protocol: 'enumerating',
  11002. fn: function (aBlock){
  11003. var self=this;
  11004. return $core.withContext(function($ctx1) {
  11005. self._subclassResponsibility();
  11006. return self;
  11007. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  11008. },
  11009. args: ["aBlock"],
  11010. source: "do: aBlock\x0a\x09self subclassResponsibility",
  11011. referencedClasses: [],
  11012. messageSends: ["subclassResponsibility"]
  11013. }),
  11014. $globals.Collection);
  11015. $core.addMethod(
  11016. $core.method({
  11017. selector: "do:separatedBy:",
  11018. protocol: 'enumerating',
  11019. fn: function (aBlock,anotherBlock){
  11020. var self=this;
  11021. var actionBeforeElement;
  11022. return $core.withContext(function($ctx1) {
  11023. actionBeforeElement=(function(){
  11024. actionBeforeElement=anotherBlock;
  11025. return actionBeforeElement;
  11026. });
  11027. self._do_((function(each){
  11028. return $core.withContext(function($ctx2) {
  11029. $recv(actionBeforeElement)._value();
  11030. return $recv(aBlock)._value_(each);
  11031. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  11032. }));
  11033. return self;
  11034. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  11035. },
  11036. args: ["aBlock", "anotherBlock"],
  11037. 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 ]",
  11038. referencedClasses: [],
  11039. messageSends: ["do:", "value", "value:"]
  11040. }),
  11041. $globals.Collection);
  11042. $core.addMethod(
  11043. $core.method({
  11044. selector: "errorNotFound",
  11045. protocol: 'error handling',
  11046. fn: function (){
  11047. var self=this;
  11048. return $core.withContext(function($ctx1) {
  11049. self._error_("Object is not in the collection");
  11050. return self;
  11051. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  11052. },
  11053. args: [],
  11054. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  11055. referencedClasses: [],
  11056. messageSends: ["error:"]
  11057. }),
  11058. $globals.Collection);
  11059. $core.addMethod(
  11060. $core.method({
  11061. selector: "ifEmpty:",
  11062. protocol: 'testing',
  11063. fn: function (aBlock){
  11064. var self=this;
  11065. return $core.withContext(function($ctx1) {
  11066. var $1;
  11067. $1=self._isEmpty();
  11068. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  11069. return self;
  11070. }));
  11071. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  11072. },
  11073. args: ["aBlock"],
  11074. 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: aBlock\x0a\x09\x09ifFalse: [ self ]",
  11075. referencedClasses: [],
  11076. messageSends: ["ifTrue:ifFalse:", "isEmpty"]
  11077. }),
  11078. $globals.Collection);
  11079. $core.addMethod(
  11080. $core.method({
  11081. selector: "ifEmpty:ifNotEmpty:",
  11082. protocol: 'testing',
  11083. fn: function (aBlock,anotherBlock){
  11084. var self=this;
  11085. return $core.withContext(function($ctx1) {
  11086. var $1;
  11087. $1=self._isEmpty();
  11088. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  11089. return $core.withContext(function($ctx2) {
  11090. return $recv(anotherBlock)._value_(self);
  11091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11092. }));
  11093. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  11094. },
  11095. args: ["aBlock", "anotherBlock"],
  11096. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  11097. referencedClasses: [],
  11098. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"]
  11099. }),
  11100. $globals.Collection);
  11101. $core.addMethod(
  11102. $core.method({
  11103. selector: "ifNotEmpty:",
  11104. protocol: 'testing',
  11105. fn: function (aBlock){
  11106. var self=this;
  11107. return $core.withContext(function($ctx1) {
  11108. var $1;
  11109. $1=self._notEmpty();
  11110. if($core.assert($1)){
  11111. return $recv(aBlock)._value_(self);
  11112. } else {
  11113. return self;
  11114. };
  11115. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  11116. },
  11117. args: ["aBlock"],
  11118. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  11119. referencedClasses: [],
  11120. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  11121. }),
  11122. $globals.Collection);
  11123. $core.addMethod(
  11124. $core.method({
  11125. selector: "ifNotEmpty:ifEmpty:",
  11126. protocol: 'testing',
  11127. fn: function (aBlock,anotherBlock){
  11128. var self=this;
  11129. return $core.withContext(function($ctx1) {
  11130. var $1;
  11131. $1=self._notEmpty();
  11132. return $recv($1)._ifTrue_ifFalse_((function(){
  11133. return $core.withContext(function($ctx2) {
  11134. return $recv(aBlock)._value_(self);
  11135. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11136. }),anotherBlock);
  11137. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  11138. },
  11139. args: ["aBlock", "anotherBlock"],
  11140. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock",
  11141. referencedClasses: [],
  11142. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  11143. }),
  11144. $globals.Collection);
  11145. $core.addMethod(
  11146. $core.method({
  11147. selector: "includes:",
  11148. protocol: 'testing',
  11149. fn: function (anObject){
  11150. var self=this;
  11151. return $core.withContext(function($ctx1) {
  11152. return self._anySatisfy_((function(each){
  11153. return $core.withContext(function($ctx2) {
  11154. return $recv(each).__eq(anObject);
  11155. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11156. }));
  11157. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  11158. },
  11159. args: ["anObject"],
  11160. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  11161. referencedClasses: [],
  11162. messageSends: ["anySatisfy:", "="]
  11163. }),
  11164. $globals.Collection);
  11165. $core.addMethod(
  11166. $core.method({
  11167. selector: "inject:into:",
  11168. protocol: 'enumerating',
  11169. fn: function (anObject,aBlock){
  11170. var self=this;
  11171. var result;
  11172. return $core.withContext(function($ctx1) {
  11173. result=anObject;
  11174. self._do_((function(each){
  11175. return $core.withContext(function($ctx2) {
  11176. result=$recv(aBlock)._value_value_(result,each);
  11177. return result;
  11178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11179. }));
  11180. return result;
  11181. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  11182. },
  11183. args: ["anObject", "aBlock"],
  11184. 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",
  11185. referencedClasses: [],
  11186. messageSends: ["do:", "value:value:"]
  11187. }),
  11188. $globals.Collection);
  11189. $core.addMethod(
  11190. $core.method({
  11191. selector: "intersection:",
  11192. protocol: 'enumerating',
  11193. fn: function (aCollection){
  11194. var self=this;
  11195. var set,outputSet;
  11196. return $core.withContext(function($ctx1) {
  11197. var $2,$1;
  11198. set=self._asSet();
  11199. outputSet=$recv($globals.Set)._new();
  11200. $recv(aCollection)._do_((function(each){
  11201. return $core.withContext(function($ctx2) {
  11202. $2=$recv(set)._includes_(each);
  11203. $ctx2.sendIdx["includes:"]=1;
  11204. $1=$recv($2)._and_((function(){
  11205. return $core.withContext(function($ctx3) {
  11206. return $recv($recv(outputSet)._includes_(each))._not();
  11207. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  11208. }));
  11209. if($core.assert($1)){
  11210. return $recv(outputSet)._add_(each);
  11211. };
  11212. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11213. }));
  11214. return $recv(self._class())._withAll_($recv(outputSet)._asArray());
  11215. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  11216. },
  11217. args: ["aCollection"],
  11218. 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",
  11219. referencedClasses: ["Set"],
  11220. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  11221. }),
  11222. $globals.Collection);
  11223. $core.addMethod(
  11224. $core.method({
  11225. selector: "isEmpty",
  11226. protocol: 'testing',
  11227. fn: function (){
  11228. var self=this;
  11229. return $core.withContext(function($ctx1) {
  11230. return $recv(self._size()).__eq((0));
  11231. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  11232. },
  11233. args: [],
  11234. source: "isEmpty\x0a\x09^ self size = 0",
  11235. referencedClasses: [],
  11236. messageSends: ["=", "size"]
  11237. }),
  11238. $globals.Collection);
  11239. $core.addMethod(
  11240. $core.method({
  11241. selector: "noneSatisfy:",
  11242. protocol: 'enumerating',
  11243. fn: function (aBlock){
  11244. var self=this;
  11245. return $core.withContext(function($ctx1) {
  11246. var $1;
  11247. var $early={};
  11248. try {
  11249. self._do_((function(item){
  11250. return $core.withContext(function($ctx2) {
  11251. $1=$recv(aBlock)._value_(item);
  11252. if($core.assert($1)){
  11253. throw $early=[false];
  11254. };
  11255. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  11256. }));
  11257. return true;
  11258. }
  11259. catch(e) {if(e===$early)return e[0]; throw e}
  11260. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  11261. },
  11262. args: ["aBlock"],
  11263. 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",
  11264. referencedClasses: [],
  11265. messageSends: ["do:", "ifTrue:", "value:"]
  11266. }),
  11267. $globals.Collection);
  11268. $core.addMethod(
  11269. $core.method({
  11270. selector: "notEmpty",
  11271. protocol: 'testing',
  11272. fn: function (){
  11273. var self=this;
  11274. return $core.withContext(function($ctx1) {
  11275. return $recv(self._isEmpty())._not();
  11276. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  11277. },
  11278. args: [],
  11279. source: "notEmpty\x0a\x09^ self isEmpty not",
  11280. referencedClasses: [],
  11281. messageSends: ["not", "isEmpty"]
  11282. }),
  11283. $globals.Collection);
  11284. $core.addMethod(
  11285. $core.method({
  11286. selector: "occurrencesOf:",
  11287. protocol: 'accessing',
  11288. fn: function (anObject){
  11289. var self=this;
  11290. var tally;
  11291. return $core.withContext(function($ctx1) {
  11292. var $1;
  11293. tally=(0);
  11294. self._do_((function(each){
  11295. return $core.withContext(function($ctx2) {
  11296. $1=$recv(anObject).__eq(each);
  11297. if($core.assert($1)){
  11298. tally=$recv(tally).__plus((1));
  11299. return tally;
  11300. };
  11301. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11302. }));
  11303. return tally;
  11304. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  11305. },
  11306. args: ["anObject"],
  11307. 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",
  11308. referencedClasses: [],
  11309. messageSends: ["do:", "ifTrue:", "=", "+"]
  11310. }),
  11311. $globals.Collection);
  11312. $core.addMethod(
  11313. $core.method({
  11314. selector: "putOn:",
  11315. protocol: 'streaming',
  11316. fn: function (aStream){
  11317. var self=this;
  11318. return $core.withContext(function($ctx1) {
  11319. self._do_((function(each){
  11320. return $core.withContext(function($ctx2) {
  11321. return $recv(each)._putOn_(aStream);
  11322. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11323. }));
  11324. return self;
  11325. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  11326. },
  11327. args: ["aStream"],
  11328. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  11329. referencedClasses: [],
  11330. messageSends: ["do:", "putOn:"]
  11331. }),
  11332. $globals.Collection);
  11333. $core.addMethod(
  11334. $core.method({
  11335. selector: "reject:",
  11336. protocol: 'enumerating',
  11337. fn: function (aBlock){
  11338. var self=this;
  11339. return $core.withContext(function($ctx1) {
  11340. return self._select_((function(each){
  11341. return $core.withContext(function($ctx2) {
  11342. return $recv($recv(aBlock)._value_(each)).__eq(false);
  11343. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11344. }));
  11345. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  11346. },
  11347. args: ["aBlock"],
  11348. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  11349. referencedClasses: [],
  11350. messageSends: ["select:", "=", "value:"]
  11351. }),
  11352. $globals.Collection);
  11353. $core.addMethod(
  11354. $core.method({
  11355. selector: "remove:",
  11356. protocol: 'adding/removing',
  11357. fn: function (anObject){
  11358. var self=this;
  11359. return $core.withContext(function($ctx1) {
  11360. return self._remove_ifAbsent_(anObject,(function(){
  11361. return $core.withContext(function($ctx2) {
  11362. return self._errorNotFound();
  11363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11364. }));
  11365. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  11366. },
  11367. args: ["anObject"],
  11368. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  11369. referencedClasses: [],
  11370. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  11371. }),
  11372. $globals.Collection);
  11373. $core.addMethod(
  11374. $core.method({
  11375. selector: "remove:ifAbsent:",
  11376. protocol: 'adding/removing',
  11377. fn: function (anObject,aBlock){
  11378. var self=this;
  11379. return $core.withContext(function($ctx1) {
  11380. self._subclassResponsibility();
  11381. return self;
  11382. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  11383. },
  11384. args: ["anObject", "aBlock"],
  11385. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  11386. referencedClasses: [],
  11387. messageSends: ["subclassResponsibility"]
  11388. }),
  11389. $globals.Collection);
  11390. $core.addMethod(
  11391. $core.method({
  11392. selector: "removeAll",
  11393. protocol: 'adding/removing',
  11394. fn: function (){
  11395. var self=this;
  11396. return $core.withContext(function($ctx1) {
  11397. self._subclassResponsibility();
  11398. return self;
  11399. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  11400. },
  11401. args: [],
  11402. source: "removeAll\x0a\x09self subclassResponsibility",
  11403. referencedClasses: [],
  11404. messageSends: ["subclassResponsibility"]
  11405. }),
  11406. $globals.Collection);
  11407. $core.addMethod(
  11408. $core.method({
  11409. selector: "select:",
  11410. protocol: 'enumerating',
  11411. fn: function (aBlock){
  11412. var self=this;
  11413. var stream;
  11414. return $core.withContext(function($ctx1) {
  11415. var $1;
  11416. stream=$recv($recv(self._class())._new())._writeStream();
  11417. self._do_((function(each){
  11418. return $core.withContext(function($ctx2) {
  11419. $1=$recv(aBlock)._value_(each);
  11420. if($core.assert($1)){
  11421. return $recv(stream)._nextPut_(each);
  11422. };
  11423. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11424. }));
  11425. return $recv(stream)._contents();
  11426. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  11427. },
  11428. args: ["aBlock"],
  11429. 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",
  11430. referencedClasses: [],
  11431. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11432. }),
  11433. $globals.Collection);
  11434. $core.addMethod(
  11435. $core.method({
  11436. selector: "select:thenCollect:",
  11437. protocol: 'enumerating',
  11438. fn: function (selectBlock,collectBlock){
  11439. var self=this;
  11440. var stream;
  11441. return $core.withContext(function($ctx1) {
  11442. var $1;
  11443. stream=$recv($recv(self._class())._new())._writeStream();
  11444. self._do_((function(each){
  11445. return $core.withContext(function($ctx2) {
  11446. $1=$recv(selectBlock)._value_(each);
  11447. $ctx2.sendIdx["value:"]=1;
  11448. if($core.assert($1)){
  11449. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  11450. };
  11451. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11452. }));
  11453. return $recv(stream)._contents();
  11454. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  11455. },
  11456. args: ["selectBlock", "collectBlock"],
  11457. 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",
  11458. referencedClasses: [],
  11459. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11460. }),
  11461. $globals.Collection);
  11462. $core.addMethod(
  11463. $core.method({
  11464. selector: "shallowCopy",
  11465. protocol: 'copying',
  11466. fn: function (){
  11467. var self=this;
  11468. return $core.withContext(function($ctx1) {
  11469. return self._collect_((function(each){
  11470. return each;
  11471. }));
  11472. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  11473. },
  11474. args: [],
  11475. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  11476. referencedClasses: [],
  11477. messageSends: ["collect:"]
  11478. }),
  11479. $globals.Collection);
  11480. $core.addMethod(
  11481. $core.method({
  11482. selector: "single",
  11483. protocol: 'accessing',
  11484. fn: function (){
  11485. var self=this;
  11486. return $core.withContext(function($ctx1) {
  11487. var $1;
  11488. self._ifEmpty_((function(){
  11489. return $core.withContext(function($ctx2) {
  11490. return self._error_("Collection is empty");
  11491. $ctx2.sendIdx["error:"]=1;
  11492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11493. }));
  11494. $1=$recv(self._size()).__gt((1));
  11495. if($core.assert($1)){
  11496. self._error_("Collection holds more than one element");
  11497. };
  11498. return self._anyOne();
  11499. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  11500. },
  11501. args: [],
  11502. 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",
  11503. referencedClasses: [],
  11504. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  11505. }),
  11506. $globals.Collection);
  11507. $core.addMethod(
  11508. $core.method({
  11509. selector: "size",
  11510. protocol: 'accessing',
  11511. fn: function (){
  11512. var self=this;
  11513. return $core.withContext(function($ctx1) {
  11514. self._subclassResponsibility();
  11515. return self;
  11516. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  11517. },
  11518. args: [],
  11519. source: "size\x0a\x09self subclassResponsibility",
  11520. referencedClasses: [],
  11521. messageSends: ["subclassResponsibility"]
  11522. }),
  11523. $globals.Collection);
  11524. $core.addMethod(
  11525. $core.method({
  11526. selector: "classTag",
  11527. protocol: 'accessing',
  11528. fn: function (){
  11529. var self=this;
  11530. return "collection";
  11531. },
  11532. args: [],
  11533. 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'",
  11534. referencedClasses: [],
  11535. messageSends: []
  11536. }),
  11537. $globals.Collection.klass);
  11538. $core.addMethod(
  11539. $core.method({
  11540. selector: "new:",
  11541. protocol: 'instance creation',
  11542. fn: function (anInteger){
  11543. var self=this;
  11544. return $core.withContext(function($ctx1) {
  11545. return self._new();
  11546. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  11547. },
  11548. args: ["anInteger"],
  11549. source: "new: anInteger\x0a\x09^ self new",
  11550. referencedClasses: [],
  11551. messageSends: ["new"]
  11552. }),
  11553. $globals.Collection.klass);
  11554. $core.addMethod(
  11555. $core.method({
  11556. selector: "with:",
  11557. protocol: 'instance creation',
  11558. fn: function (anObject){
  11559. var self=this;
  11560. return $core.withContext(function($ctx1) {
  11561. var $1;
  11562. $1=self._new();
  11563. $recv($1)._add_(anObject);
  11564. return $recv($1)._yourself();
  11565. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  11566. },
  11567. args: ["anObject"],
  11568. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  11569. referencedClasses: [],
  11570. messageSends: ["add:", "new", "yourself"]
  11571. }),
  11572. $globals.Collection.klass);
  11573. $core.addMethod(
  11574. $core.method({
  11575. selector: "with:with:",
  11576. protocol: 'instance creation',
  11577. fn: function (anObject,anotherObject){
  11578. var self=this;
  11579. return $core.withContext(function($ctx1) {
  11580. var $1;
  11581. $1=self._new();
  11582. $recv($1)._add_(anObject);
  11583. $ctx1.sendIdx["add:"]=1;
  11584. $recv($1)._add_(anotherObject);
  11585. return $recv($1)._yourself();
  11586. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  11587. },
  11588. args: ["anObject", "anotherObject"],
  11589. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  11590. referencedClasses: [],
  11591. messageSends: ["add:", "new", "yourself"]
  11592. }),
  11593. $globals.Collection.klass);
  11594. $core.addMethod(
  11595. $core.method({
  11596. selector: "with:with:with:",
  11597. protocol: 'instance creation',
  11598. fn: function (firstObject,secondObject,thirdObject){
  11599. var self=this;
  11600. return $core.withContext(function($ctx1) {
  11601. var $1;
  11602. $1=self._new();
  11603. $recv($1)._add_(firstObject);
  11604. $ctx1.sendIdx["add:"]=1;
  11605. $recv($1)._add_(secondObject);
  11606. $ctx1.sendIdx["add:"]=2;
  11607. $recv($1)._add_(thirdObject);
  11608. return $recv($1)._yourself();
  11609. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  11610. },
  11611. args: ["firstObject", "secondObject", "thirdObject"],
  11612. 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",
  11613. referencedClasses: [],
  11614. messageSends: ["add:", "new", "yourself"]
  11615. }),
  11616. $globals.Collection.klass);
  11617. $core.addMethod(
  11618. $core.method({
  11619. selector: "withAll:",
  11620. protocol: 'instance creation',
  11621. fn: function (aCollection){
  11622. var self=this;
  11623. return $core.withContext(function($ctx1) {
  11624. var $1;
  11625. $1=self._new();
  11626. $recv($1)._addAll_(aCollection);
  11627. return $recv($1)._yourself();
  11628. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  11629. },
  11630. args: ["aCollection"],
  11631. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  11632. referencedClasses: [],
  11633. messageSends: ["addAll:", "new", "yourself"]
  11634. }),
  11635. $globals.Collection.klass);
  11636. $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections');
  11637. $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.";
  11638. $core.addMethod(
  11639. $core.method({
  11640. selector: "at:",
  11641. protocol: 'accessing',
  11642. fn: function (anIndex){
  11643. var self=this;
  11644. return $core.withContext(function($ctx1) {
  11645. return self._at_ifAbsent_(anIndex,(function(){
  11646. return $core.withContext(function($ctx2) {
  11647. return self._errorNotFound();
  11648. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11649. }));
  11650. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  11651. },
  11652. args: ["anIndex"],
  11653. 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 ]",
  11654. referencedClasses: [],
  11655. messageSends: ["at:ifAbsent:", "errorNotFound"]
  11656. }),
  11657. $globals.IndexableCollection);
  11658. $core.addMethod(
  11659. $core.method({
  11660. selector: "at:ifAbsent:",
  11661. protocol: 'accessing',
  11662. fn: function (anIndex,aBlock){
  11663. var self=this;
  11664. return $core.withContext(function($ctx1) {
  11665. self._subclassResponsibility();
  11666. return self;
  11667. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11668. },
  11669. args: ["anIndex", "aBlock"],
  11670. 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",
  11671. referencedClasses: [],
  11672. messageSends: ["subclassResponsibility"]
  11673. }),
  11674. $globals.IndexableCollection);
  11675. $core.addMethod(
  11676. $core.method({
  11677. selector: "at:ifAbsentPut:",
  11678. protocol: 'accessing',
  11679. fn: function (aKey,aBlock){
  11680. var self=this;
  11681. return $core.withContext(function($ctx1) {
  11682. return self._at_ifAbsent_(aKey,(function(){
  11683. return $core.withContext(function($ctx2) {
  11684. return self._at_put_(aKey,$recv(aBlock)._value());
  11685. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11686. }));
  11687. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  11688. },
  11689. args: ["aKey", "aBlock"],
  11690. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  11691. referencedClasses: [],
  11692. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  11693. }),
  11694. $globals.IndexableCollection);
  11695. $core.addMethod(
  11696. $core.method({
  11697. selector: "at:ifPresent:",
  11698. protocol: 'accessing',
  11699. fn: function (anIndex,aBlock){
  11700. var self=this;
  11701. return $core.withContext(function($ctx1) {
  11702. return self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  11703. return nil;
  11704. }));
  11705. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11706. },
  11707. args: ["anIndex", "aBlock"],
  11708. 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 ]",
  11709. referencedClasses: [],
  11710. messageSends: ["at:ifPresent:ifAbsent:"]
  11711. }),
  11712. $globals.IndexableCollection);
  11713. $core.addMethod(
  11714. $core.method({
  11715. selector: "at:ifPresent:ifAbsent:",
  11716. protocol: 'accessing',
  11717. fn: function (anIndex,aBlock,anotherBlock){
  11718. var self=this;
  11719. return $core.withContext(function($ctx1) {
  11720. self._subclassResponsibility();
  11721. return self;
  11722. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  11723. },
  11724. args: ["anIndex", "aBlock", "anotherBlock"],
  11725. 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",
  11726. referencedClasses: [],
  11727. messageSends: ["subclassResponsibility"]
  11728. }),
  11729. $globals.IndexableCollection);
  11730. $core.addMethod(
  11731. $core.method({
  11732. selector: "at:put:",
  11733. protocol: 'accessing',
  11734. fn: function (anIndex,anObject){
  11735. var self=this;
  11736. return $core.withContext(function($ctx1) {
  11737. self._subclassResponsibility();
  11738. return self;
  11739. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  11740. },
  11741. args: ["anIndex", "anObject"],
  11742. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  11743. referencedClasses: [],
  11744. messageSends: ["subclassResponsibility"]
  11745. }),
  11746. $globals.IndexableCollection);
  11747. $core.addMethod(
  11748. $core.method({
  11749. selector: "indexOf:",
  11750. protocol: 'accessing',
  11751. fn: function (anObject){
  11752. var self=this;
  11753. return $core.withContext(function($ctx1) {
  11754. return self._indexOf_ifAbsent_(anObject,(function(){
  11755. return $core.withContext(function($ctx2) {
  11756. return self._errorNotFound();
  11757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11758. }));
  11759. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  11760. },
  11761. args: ["anObject"],
  11762. 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 ]",
  11763. referencedClasses: [],
  11764. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  11765. }),
  11766. $globals.IndexableCollection);
  11767. $core.addMethod(
  11768. $core.method({
  11769. selector: "indexOf:ifAbsent:",
  11770. protocol: 'accessing',
  11771. fn: function (anObject,aBlock){
  11772. var self=this;
  11773. return $core.withContext(function($ctx1) {
  11774. self._subclassResponsibility();
  11775. return self;
  11776. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  11777. },
  11778. args: ["anObject", "aBlock"],
  11779. 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",
  11780. referencedClasses: [],
  11781. messageSends: ["subclassResponsibility"]
  11782. }),
  11783. $globals.IndexableCollection);
  11784. $core.addMethod(
  11785. $core.method({
  11786. selector: "with:do:",
  11787. protocol: 'enumerating',
  11788. fn: function (anotherCollection,aBlock){
  11789. var self=this;
  11790. return $core.withContext(function($ctx1) {
  11791. self._withIndexDo_((function(each,index){
  11792. return $core.withContext(function($ctx2) {
  11793. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  11794. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  11795. }));
  11796. return self;
  11797. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  11798. },
  11799. args: ["anotherCollection", "aBlock"],
  11800. 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) ]",
  11801. referencedClasses: [],
  11802. messageSends: ["withIndexDo:", "value:value:", "at:"]
  11803. }),
  11804. $globals.IndexableCollection);
  11805. $core.addMethod(
  11806. $core.method({
  11807. selector: "withIndexDo:",
  11808. protocol: 'enumerating',
  11809. fn: function (aBlock){
  11810. var self=this;
  11811. return $core.withContext(function($ctx1) {
  11812. self._subclassResponsibility();
  11813. return self;
  11814. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  11815. },
  11816. args: ["aBlock"],
  11817. 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",
  11818. referencedClasses: [],
  11819. messageSends: ["subclassResponsibility"]
  11820. }),
  11821. $globals.IndexableCollection);
  11822. $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  11823. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  11824. $core.addMethod(
  11825. $core.method({
  11826. selector: "=",
  11827. protocol: 'comparing',
  11828. fn: function (anAssocitativeCollection){
  11829. var self=this;
  11830. return $core.withContext(function($ctx1) {
  11831. var $2,$1,$4,$3,$5;
  11832. $2=self._class();
  11833. $ctx1.sendIdx["class"]=1;
  11834. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  11835. $ctx1.sendIdx["="]=1;
  11836. if(!$core.assert($1)){
  11837. return false;
  11838. };
  11839. $4=self._size();
  11840. $ctx1.sendIdx["size"]=1;
  11841. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  11842. $ctx1.sendIdx["="]=2;
  11843. if(!$core.assert($3)){
  11844. return false;
  11845. };
  11846. $5=self._associations();
  11847. $ctx1.sendIdx["associations"]=1;
  11848. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  11849. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  11850. },
  11851. args: ["anAssocitativeCollection"],
  11852. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  11853. referencedClasses: [],
  11854. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  11855. }),
  11856. $globals.AssociativeCollection);
  11857. $core.addMethod(
  11858. $core.method({
  11859. selector: "add:",
  11860. protocol: 'adding/removing',
  11861. fn: function (anAssociation){
  11862. var self=this;
  11863. return $core.withContext(function($ctx1) {
  11864. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  11865. return self;
  11866. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  11867. },
  11868. args: ["anAssociation"],
  11869. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  11870. referencedClasses: [],
  11871. messageSends: ["at:put:", "key", "value"]
  11872. }),
  11873. $globals.AssociativeCollection);
  11874. $core.addMethod(
  11875. $core.method({
  11876. selector: "addAll:",
  11877. protocol: 'adding/removing',
  11878. fn: function (anAssociativeCollection){
  11879. var self=this;
  11880. return $core.withContext(function($ctx1) {
  11881. (
  11882. $ctx1.supercall = true,
  11883. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  11884. $ctx1.supercall = false;
  11885. return anAssociativeCollection;
  11886. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  11887. },
  11888. args: ["anAssociativeCollection"],
  11889. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  11890. referencedClasses: [],
  11891. messageSends: ["addAll:", "associations"]
  11892. }),
  11893. $globals.AssociativeCollection);
  11894. $core.addMethod(
  11895. $core.method({
  11896. selector: "asDictionary",
  11897. protocol: 'converting',
  11898. fn: function (){
  11899. var self=this;
  11900. return $core.withContext(function($ctx1) {
  11901. return $recv($globals.Dictionary)._from_(self._associations());
  11902. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  11903. },
  11904. args: [],
  11905. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  11906. referencedClasses: ["Dictionary"],
  11907. messageSends: ["from:", "associations"]
  11908. }),
  11909. $globals.AssociativeCollection);
  11910. $core.addMethod(
  11911. $core.method({
  11912. selector: "asHashedCollection",
  11913. protocol: 'converting',
  11914. fn: function (){
  11915. var self=this;
  11916. return $core.withContext(function($ctx1) {
  11917. return $recv($globals.HashedCollection)._from_(self._associations());
  11918. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  11919. },
  11920. args: [],
  11921. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  11922. referencedClasses: ["HashedCollection"],
  11923. messageSends: ["from:", "associations"]
  11924. }),
  11925. $globals.AssociativeCollection);
  11926. $core.addMethod(
  11927. $core.method({
  11928. selector: "asJSON",
  11929. protocol: 'converting',
  11930. fn: function (){
  11931. var self=this;
  11932. var hash;
  11933. return $core.withContext(function($ctx1) {
  11934. hash=$recv($globals.HashedCollection)._new();
  11935. self._keysAndValuesDo_((function(key,value){
  11936. return $core.withContext(function($ctx2) {
  11937. return $recv(hash)._at_put_(key,$recv(value)._asJSON());
  11938. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11939. }));
  11940. return hash;
  11941. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
  11942. },
  11943. args: [],
  11944. 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",
  11945. referencedClasses: ["HashedCollection"],
  11946. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  11947. }),
  11948. $globals.AssociativeCollection);
  11949. $core.addMethod(
  11950. $core.method({
  11951. selector: "associations",
  11952. protocol: 'accessing',
  11953. fn: function (){
  11954. var self=this;
  11955. var associations;
  11956. return $core.withContext(function($ctx1) {
  11957. associations=[];
  11958. self._associationsDo_((function(each){
  11959. return $core.withContext(function($ctx2) {
  11960. return $recv(associations)._add_(each);
  11961. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11962. }));
  11963. return associations;
  11964. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  11965. },
  11966. args: [],
  11967. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  11968. referencedClasses: [],
  11969. messageSends: ["associationsDo:", "add:"]
  11970. }),
  11971. $globals.AssociativeCollection);
  11972. $core.addMethod(
  11973. $core.method({
  11974. selector: "associationsDo:",
  11975. protocol: 'enumerating',
  11976. fn: function (aBlock){
  11977. var self=this;
  11978. return $core.withContext(function($ctx1) {
  11979. self._keysAndValuesDo_((function(key,value){
  11980. return $core.withContext(function($ctx2) {
  11981. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  11982. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  11983. }));
  11984. return self;
  11985. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  11986. },
  11987. args: ["aBlock"],
  11988. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  11989. referencedClasses: ["Association"],
  11990. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  11991. }),
  11992. $globals.AssociativeCollection);
  11993. $core.addMethod(
  11994. $core.method({
  11995. selector: "at:ifPresent:ifAbsent:",
  11996. protocol: 'accessing',
  11997. fn: function (aKey,aBlock,anotherBlock){
  11998. var self=this;
  11999. return $core.withContext(function($ctx1) {
  12000. var $1;
  12001. $1=self._includesKey_(aKey);
  12002. if($core.assert($1)){
  12003. return $recv(aBlock)._value_(self._at_(aKey));
  12004. } else {
  12005. return $recv(anotherBlock)._value();
  12006. };
  12007. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  12008. },
  12009. args: ["aKey", "aBlock", "anotherBlock"],
  12010. 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 ]",
  12011. referencedClasses: [],
  12012. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  12013. }),
  12014. $globals.AssociativeCollection);
  12015. $core.addMethod(
  12016. $core.method({
  12017. selector: "collect:",
  12018. protocol: 'enumerating',
  12019. fn: function (aBlock){
  12020. var self=this;
  12021. var newDict;
  12022. return $core.withContext(function($ctx1) {
  12023. newDict=$recv(self._class())._new();
  12024. self._keysAndValuesDo_((function(key,value){
  12025. return $core.withContext(function($ctx2) {
  12026. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  12027. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12028. }));
  12029. return newDict;
  12030. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12031. },
  12032. args: ["aBlock"],
  12033. 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",
  12034. referencedClasses: [],
  12035. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  12036. }),
  12037. $globals.AssociativeCollection);
  12038. $core.addMethod(
  12039. $core.method({
  12040. selector: "deepCopy",
  12041. protocol: 'copying',
  12042. fn: function (){
  12043. var self=this;
  12044. var copy;
  12045. return $core.withContext(function($ctx1) {
  12046. copy=$recv(self._class())._new();
  12047. self._keysAndValuesDo_((function(key,value){
  12048. return $core.withContext(function($ctx2) {
  12049. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  12050. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12051. }));
  12052. return copy;
  12053. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  12054. },
  12055. args: [],
  12056. 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",
  12057. referencedClasses: [],
  12058. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  12059. }),
  12060. $globals.AssociativeCollection);
  12061. $core.addMethod(
  12062. $core.method({
  12063. selector: "detect:ifNone:",
  12064. protocol: 'enumerating',
  12065. fn: function (aBlock,anotherBlock){
  12066. var self=this;
  12067. return $core.withContext(function($ctx1) {
  12068. return $recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  12069. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  12070. },
  12071. args: ["aBlock", "anotherBlock"],
  12072. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  12073. referencedClasses: [],
  12074. messageSends: ["detect:ifNone:", "values"]
  12075. }),
  12076. $globals.AssociativeCollection);
  12077. $core.addMethod(
  12078. $core.method({
  12079. selector: "do:",
  12080. protocol: 'enumerating',
  12081. fn: function (aBlock){
  12082. var self=this;
  12083. return $core.withContext(function($ctx1) {
  12084. self._valuesDo_(aBlock);
  12085. return self;
  12086. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12087. },
  12088. args: ["aBlock"],
  12089. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  12090. referencedClasses: [],
  12091. messageSends: ["valuesDo:"]
  12092. }),
  12093. $globals.AssociativeCollection);
  12094. $core.addMethod(
  12095. $core.method({
  12096. selector: "includes:",
  12097. protocol: 'enumerating',
  12098. fn: function (anObject){
  12099. var self=this;
  12100. return $core.withContext(function($ctx1) {
  12101. return $recv(self._values())._includes_(anObject);
  12102. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  12103. },
  12104. args: ["anObject"],
  12105. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  12106. referencedClasses: [],
  12107. messageSends: ["includes:", "values"]
  12108. }),
  12109. $globals.AssociativeCollection);
  12110. $core.addMethod(
  12111. $core.method({
  12112. selector: "includesKey:",
  12113. protocol: 'testing',
  12114. fn: function (aKey){
  12115. var self=this;
  12116. return $core.withContext(function($ctx1) {
  12117. self._subclassResponsibility();
  12118. return self;
  12119. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12120. },
  12121. args: ["aKey"],
  12122. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  12123. referencedClasses: [],
  12124. messageSends: ["subclassResponsibility"]
  12125. }),
  12126. $globals.AssociativeCollection);
  12127. $core.addMethod(
  12128. $core.method({
  12129. selector: "indexOf:ifAbsent:",
  12130. protocol: 'accessing',
  12131. fn: function (anObject,aBlock){
  12132. var self=this;
  12133. return $core.withContext(function($ctx1) {
  12134. return $recv(self._keys())._detect_ifNone_((function(each){
  12135. return $core.withContext(function($ctx2) {
  12136. return $recv(self._at_(each)).__eq(anObject);
  12137. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12138. }),aBlock);
  12139. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12140. },
  12141. args: ["anObject", "aBlock"],
  12142. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  12143. referencedClasses: [],
  12144. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  12145. }),
  12146. $globals.AssociativeCollection);
  12147. $core.addMethod(
  12148. $core.method({
  12149. selector: "keyAtValue:",
  12150. protocol: 'accessing',
  12151. fn: function (anObject){
  12152. var self=this;
  12153. return $core.withContext(function($ctx1) {
  12154. return self._keyAtValue_ifAbsent_(anObject,(function(){
  12155. return $core.withContext(function($ctx2) {
  12156. return self._errorNotFound();
  12157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12158. }));
  12159. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  12160. },
  12161. args: ["anObject"],
  12162. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  12163. referencedClasses: [],
  12164. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  12165. }),
  12166. $globals.AssociativeCollection);
  12167. $core.addMethod(
  12168. $core.method({
  12169. selector: "keyAtValue:ifAbsent:",
  12170. protocol: 'accessing',
  12171. fn: function (anObject,aBlock){
  12172. var self=this;
  12173. return $core.withContext(function($ctx1) {
  12174. return self._indexOf_ifAbsent_(anObject,aBlock);
  12175. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12176. },
  12177. args: ["anObject", "aBlock"],
  12178. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  12179. referencedClasses: [],
  12180. messageSends: ["indexOf:ifAbsent:"]
  12181. }),
  12182. $globals.AssociativeCollection);
  12183. $core.addMethod(
  12184. $core.method({
  12185. selector: "keys",
  12186. protocol: 'accessing',
  12187. fn: function (){
  12188. var self=this;
  12189. return $core.withContext(function($ctx1) {
  12190. self._subclassResponsibility();
  12191. return self;
  12192. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  12193. },
  12194. args: [],
  12195. source: "keys\x0a\x09self subclassResponsibility",
  12196. referencedClasses: [],
  12197. messageSends: ["subclassResponsibility"]
  12198. }),
  12199. $globals.AssociativeCollection);
  12200. $core.addMethod(
  12201. $core.method({
  12202. selector: "keysAndValuesDo:",
  12203. protocol: 'enumerating',
  12204. fn: function (aBlock){
  12205. var self=this;
  12206. return $core.withContext(function($ctx1) {
  12207. self._keysDo_((function(each){
  12208. return $core.withContext(function($ctx2) {
  12209. return $recv(aBlock)._value_value_(each,self._at_(each));
  12210. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12211. }));
  12212. return self;
  12213. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12214. },
  12215. args: ["aBlock"],
  12216. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  12217. referencedClasses: [],
  12218. messageSends: ["keysDo:", "value:value:", "at:"]
  12219. }),
  12220. $globals.AssociativeCollection);
  12221. $core.addMethod(
  12222. $core.method({
  12223. selector: "keysDo:",
  12224. protocol: 'enumerating',
  12225. fn: function (aBlock){
  12226. var self=this;
  12227. return $core.withContext(function($ctx1) {
  12228. self._subclassResponsibility();
  12229. return self;
  12230. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12231. },
  12232. args: ["aBlock"],
  12233. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  12234. referencedClasses: [],
  12235. messageSends: ["subclassResponsibility"]
  12236. }),
  12237. $globals.AssociativeCollection);
  12238. $core.addMethod(
  12239. $core.method({
  12240. selector: "printOn:",
  12241. protocol: 'printing',
  12242. fn: function (aStream){
  12243. var self=this;
  12244. return $core.withContext(function($ctx1) {
  12245. (
  12246. $ctx1.supercall = true,
  12247. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  12248. $ctx1.supercall = false;
  12249. $ctx1.sendIdx["printOn:"]=1;
  12250. $recv(aStream)._nextPutAll_(" (");
  12251. $ctx1.sendIdx["nextPutAll:"]=1;
  12252. $recv(self._associations())._do_separatedBy_((function(each){
  12253. return $core.withContext(function($ctx2) {
  12254. return $recv(each)._printOn_(aStream);
  12255. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12256. }),(function(){
  12257. return $core.withContext(function($ctx2) {
  12258. return $recv(aStream)._nextPutAll_(" , ");
  12259. $ctx2.sendIdx["nextPutAll:"]=2;
  12260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12261. }));
  12262. $recv(aStream)._nextPutAll_(")");
  12263. return self;
  12264. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  12265. },
  12266. args: ["aStream"],
  12267. 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: ')'",
  12268. referencedClasses: [],
  12269. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  12270. }),
  12271. $globals.AssociativeCollection);
  12272. $core.addMethod(
  12273. $core.method({
  12274. selector: "remove:ifAbsent:",
  12275. protocol: 'adding/removing',
  12276. fn: function (aKey,aBlock){
  12277. var self=this;
  12278. return $core.withContext(function($ctx1) {
  12279. return self._removeKey_ifAbsent_(aKey,aBlock);
  12280. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12281. },
  12282. args: ["aKey", "aBlock"],
  12283. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  12284. referencedClasses: [],
  12285. messageSends: ["removeKey:ifAbsent:"]
  12286. }),
  12287. $globals.AssociativeCollection);
  12288. $core.addMethod(
  12289. $core.method({
  12290. selector: "removeAll",
  12291. protocol: 'adding/removing',
  12292. fn: function (){
  12293. var self=this;
  12294. return $core.withContext(function($ctx1) {
  12295. return $recv(self._keys())._do_((function(each){
  12296. return $core.withContext(function($ctx2) {
  12297. return self._removeKey_(each);
  12298. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12299. }));
  12300. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  12301. },
  12302. args: [],
  12303. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  12304. referencedClasses: [],
  12305. messageSends: ["do:", "keys", "removeKey:"]
  12306. }),
  12307. $globals.AssociativeCollection);
  12308. $core.addMethod(
  12309. $core.method({
  12310. selector: "removeKey:",
  12311. protocol: 'adding/removing',
  12312. fn: function (aKey){
  12313. var self=this;
  12314. return $core.withContext(function($ctx1) {
  12315. return self._remove_(aKey);
  12316. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12317. },
  12318. args: ["aKey"],
  12319. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  12320. referencedClasses: [],
  12321. messageSends: ["remove:"]
  12322. }),
  12323. $globals.AssociativeCollection);
  12324. $core.addMethod(
  12325. $core.method({
  12326. selector: "removeKey:ifAbsent:",
  12327. protocol: 'adding/removing',
  12328. fn: function (aKey,aBlock){
  12329. var self=this;
  12330. return $core.withContext(function($ctx1) {
  12331. self._subclassResponsibility();
  12332. return self;
  12333. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12334. },
  12335. args: ["aKey", "aBlock"],
  12336. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  12337. referencedClasses: [],
  12338. messageSends: ["subclassResponsibility"]
  12339. }),
  12340. $globals.AssociativeCollection);
  12341. $core.addMethod(
  12342. $core.method({
  12343. selector: "select:",
  12344. protocol: 'enumerating',
  12345. fn: function (aBlock){
  12346. var self=this;
  12347. var newDict;
  12348. return $core.withContext(function($ctx1) {
  12349. var $1;
  12350. newDict=$recv(self._class())._new();
  12351. self._keysAndValuesDo_((function(key,value){
  12352. return $core.withContext(function($ctx2) {
  12353. $1=$recv(aBlock)._value_(value);
  12354. if($core.assert($1)){
  12355. return $recv(newDict)._at_put_(key,value);
  12356. };
  12357. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12358. }));
  12359. return newDict;
  12360. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12361. },
  12362. args: ["aBlock"],
  12363. 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",
  12364. referencedClasses: [],
  12365. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  12366. }),
  12367. $globals.AssociativeCollection);
  12368. $core.addMethod(
  12369. $core.method({
  12370. selector: "shallowCopy",
  12371. protocol: 'copying',
  12372. fn: function (){
  12373. var self=this;
  12374. var copy;
  12375. return $core.withContext(function($ctx1) {
  12376. copy=$recv(self._class())._new();
  12377. self._keysAndValuesDo_((function(key,value){
  12378. return $core.withContext(function($ctx2) {
  12379. return $recv(copy)._at_put_(key,value);
  12380. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12381. }));
  12382. return copy;
  12383. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  12384. },
  12385. args: [],
  12386. 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",
  12387. referencedClasses: [],
  12388. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  12389. }),
  12390. $globals.AssociativeCollection);
  12391. $core.addMethod(
  12392. $core.method({
  12393. selector: "size",
  12394. protocol: 'accessing',
  12395. fn: function (){
  12396. var self=this;
  12397. return $core.withContext(function($ctx1) {
  12398. return $recv(self._keys())._size();
  12399. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  12400. },
  12401. args: [],
  12402. source: "size\x0a\x09^ self keys size",
  12403. referencedClasses: [],
  12404. messageSends: ["size", "keys"]
  12405. }),
  12406. $globals.AssociativeCollection);
  12407. $core.addMethod(
  12408. $core.method({
  12409. selector: "values",
  12410. protocol: 'accessing',
  12411. fn: function (){
  12412. var self=this;
  12413. return $core.withContext(function($ctx1) {
  12414. self._subclassResponsibility();
  12415. return self;
  12416. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  12417. },
  12418. args: [],
  12419. source: "values\x0a\x09self subclassResponsibility",
  12420. referencedClasses: [],
  12421. messageSends: ["subclassResponsibility"]
  12422. }),
  12423. $globals.AssociativeCollection);
  12424. $core.addMethod(
  12425. $core.method({
  12426. selector: "valuesDo:",
  12427. protocol: 'enumerating',
  12428. fn: function (aBlock){
  12429. var self=this;
  12430. return $core.withContext(function($ctx1) {
  12431. self._subclassResponsibility();
  12432. return self;
  12433. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12434. },
  12435. args: ["aBlock"],
  12436. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  12437. referencedClasses: [],
  12438. messageSends: ["subclassResponsibility"]
  12439. }),
  12440. $globals.AssociativeCollection);
  12441. $core.addMethod(
  12442. $core.method({
  12443. selector: "withIndexDo:",
  12444. protocol: 'enumerating',
  12445. fn: function (aBlock){
  12446. var self=this;
  12447. return $core.withContext(function($ctx1) {
  12448. self._keysAndValuesDo_((function(key,value){
  12449. return $core.withContext(function($ctx2) {
  12450. return $recv(aBlock)._value_value_(value,key);
  12451. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12452. }));
  12453. return self;
  12454. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12455. },
  12456. args: ["aBlock"],
  12457. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  12458. referencedClasses: [],
  12459. messageSends: ["keysAndValuesDo:", "value:value:"]
  12460. }),
  12461. $globals.AssociativeCollection);
  12462. $core.addMethod(
  12463. $core.method({
  12464. selector: "from:",
  12465. protocol: 'instance creation',
  12466. fn: function (aCollection){
  12467. var self=this;
  12468. var newCollection;
  12469. return $core.withContext(function($ctx1) {
  12470. newCollection=self._new();
  12471. $recv(aCollection)._do_((function(each){
  12472. return $core.withContext(function($ctx2) {
  12473. return $recv(newCollection)._add_(each);
  12474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12475. }));
  12476. return newCollection;
  12477. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12478. },
  12479. args: ["aCollection"],
  12480. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  12481. referencedClasses: [],
  12482. messageSends: ["new", "do:", "add:"]
  12483. }),
  12484. $globals.AssociativeCollection.klass);
  12485. $core.addMethod(
  12486. $core.method({
  12487. selector: "fromPairs:",
  12488. protocol: 'instance creation',
  12489. fn: function (aCollection){
  12490. var self=this;
  12491. return $core.withContext(function($ctx1) {
  12492. return self._from_(aCollection);
  12493. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  12494. },
  12495. args: ["aCollection"],
  12496. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  12497. referencedClasses: [],
  12498. messageSends: ["from:"]
  12499. }),
  12500. $globals.AssociativeCollection.klass);
  12501. $core.addMethod(
  12502. $core.method({
  12503. selector: "newFromPairs:",
  12504. protocol: 'instance creation',
  12505. fn: function (aCollection){
  12506. var self=this;
  12507. var newCollection;
  12508. return $core.withContext(function($ctx1) {
  12509. var $2,$1,$3,$4;
  12510. $2=$recv(aCollection)._size();
  12511. $ctx1.sendIdx["size"]=1;
  12512. $1=$recv($2)._even();
  12513. if(!$core.assert($1)){
  12514. self._error_("#newFromPairs only accepts arrays of an even length");
  12515. };
  12516. newCollection=self._new();
  12517. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  12518. return $core.withContext(function($ctx2) {
  12519. $3=newCollection;
  12520. $4=$recv(aCollection)._at_(each);
  12521. $ctx2.sendIdx["at:"]=1;
  12522. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  12523. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  12524. }));
  12525. return newCollection;
  12526. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12527. },
  12528. args: ["aCollection"],
  12529. 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",
  12530. referencedClasses: [],
  12531. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  12532. }),
  12533. $globals.AssociativeCollection.klass);
  12534. $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  12535. $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.";
  12536. $core.addMethod(
  12537. $core.method({
  12538. selector: "at:ifAbsent:",
  12539. protocol: 'accessing',
  12540. fn: function (aKey,aBlock){
  12541. var self=this;
  12542. return $core.withContext(function($ctx1) {
  12543. var index = self._positionOfKey_(aKey);
  12544. return index >=0 ? self['@values'][index] : aBlock._value();
  12545. ;
  12546. return self;
  12547. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12548. },
  12549. args: ["aKey", "aBlock"],
  12550. source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09return index >>=0 ? self['@values'][index] : aBlock._value();\x0a\x09>",
  12551. referencedClasses: [],
  12552. messageSends: []
  12553. }),
  12554. $globals.Dictionary);
  12555. $core.addMethod(
  12556. $core.method({
  12557. selector: "at:put:",
  12558. protocol: 'accessing',
  12559. fn: function (aKey,aValue){
  12560. var self=this;
  12561. return $core.withContext(function($ctx1) {
  12562. var index = self._positionOfKey_(aKey);
  12563. if(index === -1) {
  12564. var keys = self['@keys'];
  12565. index = keys.length;
  12566. keys.push(aKey);
  12567. }
  12568. return self['@values'][index] = aValue;
  12569. ;
  12570. return self;
  12571. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  12572. },
  12573. args: ["aKey", "aValue"],
  12574. source: "at: aKey put: aValue\x0a\x09<\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>",
  12575. referencedClasses: [],
  12576. messageSends: []
  12577. }),
  12578. $globals.Dictionary);
  12579. $core.addMethod(
  12580. $core.method({
  12581. selector: "includesKey:",
  12582. protocol: 'testing',
  12583. fn: function (aKey){
  12584. var self=this;
  12585. return $core.withContext(function($ctx1) {
  12586. return self._positionOfKey_(aKey) >= 0; ;
  12587. return self;
  12588. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  12589. },
  12590. args: ["aKey"],
  12591. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  12592. referencedClasses: [],
  12593. messageSends: []
  12594. }),
  12595. $globals.Dictionary);
  12596. $core.addMethod(
  12597. $core.method({
  12598. selector: "indexOf:ifAbsent:",
  12599. protocol: 'accessing',
  12600. fn: function (anObject,aBlock){
  12601. var self=this;
  12602. var index;
  12603. return $core.withContext(function($ctx1) {
  12604. var $1;
  12605. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  12606. return (0);
  12607. }));
  12608. $1=$recv(index).__eq((0));
  12609. if($core.assert($1)){
  12610. return $recv(aBlock)._value();
  12611. } else {
  12612. return $recv(self["@keys"])._at_(index);
  12613. };
  12614. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  12615. },
  12616. args: ["anObject", "aBlock"],
  12617. 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 ]",
  12618. referencedClasses: [],
  12619. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  12620. }),
  12621. $globals.Dictionary);
  12622. $core.addMethod(
  12623. $core.method({
  12624. selector: "initialize",
  12625. protocol: 'initialization',
  12626. fn: function (){
  12627. var self=this;
  12628. return $core.withContext(function($ctx1) {
  12629. (
  12630. $ctx1.supercall = true,
  12631. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  12632. $ctx1.supercall = false;
  12633. self["@keys"]=[];
  12634. self["@values"]=[];
  12635. return self;
  12636. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  12637. },
  12638. args: [],
  12639. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  12640. referencedClasses: [],
  12641. messageSends: ["initialize"]
  12642. }),
  12643. $globals.Dictionary);
  12644. $core.addMethod(
  12645. $core.method({
  12646. selector: "keys",
  12647. protocol: 'accessing',
  12648. fn: function (){
  12649. var self=this;
  12650. return $core.withContext(function($ctx1) {
  12651. return $recv(self["@keys"])._copy();
  12652. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  12653. },
  12654. args: [],
  12655. source: "keys\x0a\x09^ keys copy",
  12656. referencedClasses: [],
  12657. messageSends: ["copy"]
  12658. }),
  12659. $globals.Dictionary);
  12660. $core.addMethod(
  12661. $core.method({
  12662. selector: "keysAndValuesDo:",
  12663. protocol: 'enumerating',
  12664. fn: function (aBlock){
  12665. var self=this;
  12666. return $core.withContext(function($ctx1) {
  12667. return $recv(self["@keys"])._with_do_(self["@values"],aBlock);
  12668. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12669. },
  12670. args: ["aBlock"],
  12671. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  12672. referencedClasses: [],
  12673. messageSends: ["with:do:"]
  12674. }),
  12675. $globals.Dictionary);
  12676. $core.addMethod(
  12677. $core.method({
  12678. selector: "keysDo:",
  12679. protocol: 'enumerating',
  12680. fn: function (aBlock){
  12681. var self=this;
  12682. return $core.withContext(function($ctx1) {
  12683. return $recv(self["@keys"])._do_(aBlock);
  12684. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  12685. },
  12686. args: ["aBlock"],
  12687. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  12688. referencedClasses: [],
  12689. messageSends: ["do:"]
  12690. }),
  12691. $globals.Dictionary);
  12692. $core.addMethod(
  12693. $core.method({
  12694. selector: "positionOfKey:",
  12695. protocol: 'private',
  12696. fn: function (anObject){
  12697. var self=this;
  12698. return $core.withContext(function($ctx1) {
  12699. var keys = self['@keys'];
  12700. for(var i=0;i<keys.length;i++){
  12701. if(keys[i].__eq(anObject)) { return i;}
  12702. }
  12703. return -1;
  12704. ;
  12705. return self;
  12706. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  12707. },
  12708. args: ["anObject"],
  12709. source: "positionOfKey: anObject\x0a\x09<\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>",
  12710. referencedClasses: [],
  12711. messageSends: []
  12712. }),
  12713. $globals.Dictionary);
  12714. $core.addMethod(
  12715. $core.method({
  12716. selector: "removeAll",
  12717. protocol: 'adding/removing',
  12718. fn: function (){
  12719. var self=this;
  12720. return $core.withContext(function($ctx1) {
  12721. $recv(self["@keys"])._removeAll();
  12722. $ctx1.sendIdx["removeAll"]=1;
  12723. $recv(self["@values"])._removeAll();
  12724. return self;
  12725. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  12726. },
  12727. args: [],
  12728. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  12729. referencedClasses: [],
  12730. messageSends: ["removeAll"]
  12731. }),
  12732. $globals.Dictionary);
  12733. $core.addMethod(
  12734. $core.method({
  12735. selector: "removeKey:ifAbsent:",
  12736. protocol: 'adding/removing',
  12737. fn: function (aKey,aBlock){
  12738. var self=this;
  12739. return $core.withContext(function($ctx1) {
  12740. var index = self._positionOfKey_(aKey);
  12741. if(index === -1) {
  12742. return aBlock._value()
  12743. } else {
  12744. var keys = self['@keys'], values = self['@values'];
  12745. var value = values[index], l = keys.length;
  12746. keys[index] = keys[l-1];
  12747. keys.pop();
  12748. values[index] = values[l-1];
  12749. values.pop();
  12750. return value;
  12751. }
  12752. ;
  12753. return self;
  12754. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12755. },
  12756. args: ["aKey", "aBlock"],
  12757. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<\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>",
  12758. referencedClasses: [],
  12759. messageSends: []
  12760. }),
  12761. $globals.Dictionary);
  12762. $core.addMethod(
  12763. $core.method({
  12764. selector: "values",
  12765. protocol: 'accessing',
  12766. fn: function (){
  12767. var self=this;
  12768. return self["@values"];
  12769. },
  12770. args: [],
  12771. source: "values\x0a\x09^ values",
  12772. referencedClasses: [],
  12773. messageSends: []
  12774. }),
  12775. $globals.Dictionary);
  12776. $core.addMethod(
  12777. $core.method({
  12778. selector: "valuesDo:",
  12779. protocol: 'enumerating',
  12780. fn: function (aBlock){
  12781. var self=this;
  12782. return $core.withContext(function($ctx1) {
  12783. return $recv(self["@values"])._do_(aBlock);
  12784. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12785. },
  12786. args: ["aBlock"],
  12787. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  12788. referencedClasses: [],
  12789. messageSends: ["do:"]
  12790. }),
  12791. $globals.Dictionary);
  12792. $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections');
  12793. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  12794. $core.addMethod(
  12795. $core.method({
  12796. selector: "at:ifAbsent:",
  12797. protocol: 'accessing',
  12798. fn: function (aKey,aBlock){
  12799. var self=this;
  12800. return $core.withContext(function($ctx1) {
  12801. var $1;
  12802. $1=self._includesKey_(aKey);
  12803. if($core.assert($1)){
  12804. return self._basicAt_(aKey);
  12805. } else {
  12806. return $recv(aBlock)._value();
  12807. };
  12808. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12809. },
  12810. args: ["aKey", "aBlock"],
  12811. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  12812. referencedClasses: [],
  12813. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  12814. }),
  12815. $globals.HashedCollection);
  12816. $core.addMethod(
  12817. $core.method({
  12818. selector: "at:put:",
  12819. protocol: 'accessing',
  12820. fn: function (aKey,aValue){
  12821. var self=this;
  12822. return $core.withContext(function($ctx1) {
  12823. return self._basicAt_put_(aKey,aValue);
  12824. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  12825. },
  12826. args: ["aKey", "aValue"],
  12827. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  12828. referencedClasses: [],
  12829. messageSends: ["basicAt:put:"]
  12830. }),
  12831. $globals.HashedCollection);
  12832. $core.addMethod(
  12833. $core.method({
  12834. selector: "includesKey:",
  12835. protocol: 'testing',
  12836. fn: function (aKey){
  12837. var self=this;
  12838. return $core.withContext(function($ctx1) {
  12839. return self.hasOwnProperty(aKey);
  12840. return self;
  12841. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  12842. },
  12843. args: ["aKey"],
  12844. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  12845. referencedClasses: [],
  12846. messageSends: []
  12847. }),
  12848. $globals.HashedCollection);
  12849. $core.addMethod(
  12850. $core.method({
  12851. selector: "keys",
  12852. protocol: 'accessing',
  12853. fn: function (){
  12854. var self=this;
  12855. return $core.withContext(function($ctx1) {
  12856. return Object.keys(self);
  12857. return self;
  12858. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  12859. },
  12860. args: [],
  12861. source: "keys\x0a\x09<return Object.keys(self)>",
  12862. referencedClasses: [],
  12863. messageSends: []
  12864. }),
  12865. $globals.HashedCollection);
  12866. $core.addMethod(
  12867. $core.method({
  12868. selector: "keysDo:",
  12869. protocol: 'enumerating',
  12870. fn: function (aBlock){
  12871. var self=this;
  12872. return $core.withContext(function($ctx1) {
  12873. $recv(self._keys())._do_(aBlock);
  12874. return self;
  12875. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12876. },
  12877. args: ["aBlock"],
  12878. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  12879. referencedClasses: [],
  12880. messageSends: ["do:", "keys"]
  12881. }),
  12882. $globals.HashedCollection);
  12883. $core.addMethod(
  12884. $core.method({
  12885. selector: "removeKey:ifAbsent:",
  12886. protocol: 'adding/removing',
  12887. fn: function (aKey,aBlock){
  12888. var self=this;
  12889. return $core.withContext(function($ctx1) {
  12890. return self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  12891. return $core.withContext(function($ctx2) {
  12892. self._basicDelete_(aKey);
  12893. return removed;
  12894. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  12895. }),(function(){
  12896. return $core.withContext(function($ctx2) {
  12897. return $recv(aBlock)._value();
  12898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12899. }));
  12900. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  12901. },
  12902. args: ["aKey", "aBlock"],
  12903. 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 ]",
  12904. referencedClasses: [],
  12905. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  12906. }),
  12907. $globals.HashedCollection);
  12908. $core.addMethod(
  12909. $core.method({
  12910. selector: "values",
  12911. protocol: 'accessing',
  12912. fn: function (){
  12913. var self=this;
  12914. return $core.withContext(function($ctx1) {
  12915. return self._keys().map(function(key){
  12916. return self._at_(key);
  12917. });
  12918. ;
  12919. return self;
  12920. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  12921. },
  12922. args: [],
  12923. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  12924. referencedClasses: [],
  12925. messageSends: []
  12926. }),
  12927. $globals.HashedCollection);
  12928. $core.addMethod(
  12929. $core.method({
  12930. selector: "valuesDo:",
  12931. protocol: 'enumerating',
  12932. fn: function (aBlock){
  12933. var self=this;
  12934. return $core.withContext(function($ctx1) {
  12935. $recv(self._values())._do_(aBlock);
  12936. return self;
  12937. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  12938. },
  12939. args: ["aBlock"],
  12940. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  12941. referencedClasses: [],
  12942. messageSends: ["do:", "values"]
  12943. }),
  12944. $globals.HashedCollection);
  12945. $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  12946. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  12947. $core.addMethod(
  12948. $core.method({
  12949. selector: "=",
  12950. protocol: 'comparing',
  12951. fn: function (aCollection){
  12952. var self=this;
  12953. return $core.withContext(function($ctx1) {
  12954. var $3,$2,$4,$1,$5;
  12955. var $early={};
  12956. try {
  12957. $3=self._class();
  12958. $ctx1.sendIdx["class"]=1;
  12959. $2=$recv($3).__eq($recv(aCollection)._class());
  12960. $ctx1.sendIdx["="]=1;
  12961. $1=$recv($2)._and_((function(){
  12962. return $core.withContext(function($ctx2) {
  12963. $4=self._size();
  12964. $ctx2.sendIdx["size"]=1;
  12965. return $recv($4).__eq($recv(aCollection)._size());
  12966. $ctx2.sendIdx["="]=2;
  12967. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12968. }));
  12969. if(!$core.assert($1)){
  12970. return false;
  12971. };
  12972. self._withIndexDo_((function(each,i){
  12973. return $core.withContext(function($ctx2) {
  12974. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  12975. if(!$core.assert($5)){
  12976. throw $early=[false];
  12977. };
  12978. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  12979. }));
  12980. return true;
  12981. }
  12982. catch(e) {if(e===$early)return e[0]; throw e}
  12983. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  12984. },
  12985. args: ["aCollection"],
  12986. 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",
  12987. referencedClasses: [],
  12988. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  12989. }),
  12990. $globals.SequenceableCollection);
  12991. $core.addMethod(
  12992. $core.method({
  12993. selector: "addLast:",
  12994. protocol: 'adding/removing',
  12995. fn: function (anObject){
  12996. var self=this;
  12997. return $core.withContext(function($ctx1) {
  12998. self._add_(anObject);
  12999. return self;
  13000. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  13001. },
  13002. args: ["anObject"],
  13003. source: "addLast: anObject\x0a\x09self add: anObject",
  13004. referencedClasses: [],
  13005. messageSends: ["add:"]
  13006. }),
  13007. $globals.SequenceableCollection);
  13008. $core.addMethod(
  13009. $core.method({
  13010. selector: "allButFirst",
  13011. protocol: 'accessing',
  13012. fn: function (){
  13013. var self=this;
  13014. return $core.withContext(function($ctx1) {
  13015. return self._copyFrom_to_((2),self._size());
  13016. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  13017. },
  13018. args: [],
  13019. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  13020. referencedClasses: [],
  13021. messageSends: ["copyFrom:to:", "size"]
  13022. }),
  13023. $globals.SequenceableCollection);
  13024. $core.addMethod(
  13025. $core.method({
  13026. selector: "allButLast",
  13027. protocol: 'accessing',
  13028. fn: function (){
  13029. var self=this;
  13030. return $core.withContext(function($ctx1) {
  13031. return self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  13032. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  13033. },
  13034. args: [],
  13035. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  13036. referencedClasses: [],
  13037. messageSends: ["copyFrom:to:", "-", "size"]
  13038. }),
  13039. $globals.SequenceableCollection);
  13040. $core.addMethod(
  13041. $core.method({
  13042. selector: "anyOne",
  13043. protocol: 'accessing',
  13044. fn: function (){
  13045. var self=this;
  13046. return $core.withContext(function($ctx1) {
  13047. return self._at_((1));
  13048. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  13049. },
  13050. args: [],
  13051. source: "anyOne\x0a\x09^ self at: 1",
  13052. referencedClasses: [],
  13053. messageSends: ["at:"]
  13054. }),
  13055. $globals.SequenceableCollection);
  13056. $core.addMethod(
  13057. $core.method({
  13058. selector: "atRandom",
  13059. protocol: 'accessing',
  13060. fn: function (){
  13061. var self=this;
  13062. return $core.withContext(function($ctx1) {
  13063. return self._at_($recv(self._size())._atRandom());
  13064. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  13065. },
  13066. args: [],
  13067. source: "atRandom\x0a\x09^ self at: self size atRandom",
  13068. referencedClasses: [],
  13069. messageSends: ["at:", "atRandom", "size"]
  13070. }),
  13071. $globals.SequenceableCollection);
  13072. $core.addMethod(
  13073. $core.method({
  13074. selector: "beginsWith:",
  13075. protocol: 'testing',
  13076. fn: function (prefix){
  13077. var self=this;
  13078. return $core.withContext(function($ctx1) {
  13079. var $2,$3,$1;
  13080. $2=self._size();
  13081. $ctx1.sendIdx["size"]=1;
  13082. $3=$recv(prefix)._size();
  13083. $ctx1.sendIdx["size"]=2;
  13084. $1=$recv($2).__lt($3);
  13085. if($core.assert($1)){
  13086. return false;
  13087. };
  13088. return $recv(self._first_($recv(prefix)._size())).__eq(prefix);
  13089. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  13090. },
  13091. args: ["prefix"],
  13092. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  13093. referencedClasses: [],
  13094. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  13095. }),
  13096. $globals.SequenceableCollection);
  13097. $core.addMethod(
  13098. $core.method({
  13099. selector: "copyFrom:to:",
  13100. protocol: 'copying',
  13101. fn: function (anIndex,anotherIndex){
  13102. var self=this;
  13103. return $core.withContext(function($ctx1) {
  13104. self._subclassResponsibility();
  13105. return self;
  13106. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  13107. },
  13108. args: ["anIndex", "anotherIndex"],
  13109. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  13110. referencedClasses: [],
  13111. messageSends: ["subclassResponsibility"]
  13112. }),
  13113. $globals.SequenceableCollection);
  13114. $core.addMethod(
  13115. $core.method({
  13116. selector: "detect:ifNone:",
  13117. protocol: 'enumerating',
  13118. fn: function (aBlock,anotherBlock){
  13119. var self=this;
  13120. return $core.withContext(function($ctx1) {
  13121. self = self._numericallyIndexable();
  13122. for(var i = 0; i < self.length; i++)
  13123. if(aBlock._value_(self[i]))
  13124. return self[i];
  13125. return anotherBlock._value();
  13126. ;
  13127. return self;
  13128. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  13129. },
  13130. args: ["aBlock", "anotherBlock"],
  13131. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\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>",
  13132. referencedClasses: [],
  13133. messageSends: []
  13134. }),
  13135. $globals.SequenceableCollection);
  13136. $core.addMethod(
  13137. $core.method({
  13138. selector: "do:",
  13139. protocol: 'enumerating',
  13140. fn: function (aBlock){
  13141. var self=this;
  13142. return $core.withContext(function($ctx1) {
  13143. self = self._numericallyIndexable();
  13144. for(var i=0; i < self.length; i++) {
  13145. aBlock._value_(self[i]);
  13146. }
  13147. ;
  13148. return self;
  13149. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13150. },
  13151. args: ["aBlock"],
  13152. source: "do: aBlock\x0a\x09<\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>",
  13153. referencedClasses: [],
  13154. messageSends: []
  13155. }),
  13156. $globals.SequenceableCollection);
  13157. $core.addMethod(
  13158. $core.method({
  13159. selector: "endsWith:",
  13160. protocol: 'testing',
  13161. fn: function (suffix){
  13162. var self=this;
  13163. return $core.withContext(function($ctx1) {
  13164. var $2,$3,$1;
  13165. $2=self._size();
  13166. $ctx1.sendIdx["size"]=1;
  13167. $3=$recv(suffix)._size();
  13168. $ctx1.sendIdx["size"]=2;
  13169. $1=$recv($2).__lt($3);
  13170. if($core.assert($1)){
  13171. return false;
  13172. };
  13173. return $recv(self._last_($recv(suffix)._size())).__eq(suffix);
  13174. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  13175. },
  13176. args: ["suffix"],
  13177. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  13178. referencedClasses: [],
  13179. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  13180. }),
  13181. $globals.SequenceableCollection);
  13182. $core.addMethod(
  13183. $core.method({
  13184. selector: "first",
  13185. protocol: 'accessing',
  13186. fn: function (){
  13187. var self=this;
  13188. return $core.withContext(function($ctx1) {
  13189. return self._at_((1));
  13190. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  13191. },
  13192. args: [],
  13193. source: "first\x0a\x09^ self at: 1",
  13194. referencedClasses: [],
  13195. messageSends: ["at:"]
  13196. }),
  13197. $globals.SequenceableCollection);
  13198. $core.addMethod(
  13199. $core.method({
  13200. selector: "first:",
  13201. protocol: 'accessing',
  13202. fn: function (aNumber){
  13203. var self=this;
  13204. return $core.withContext(function($ctx1) {
  13205. var $1;
  13206. $1=$recv(self._size()).__lt(aNumber);
  13207. if($core.assert($1)){
  13208. self._error_("Invalid number of elements");
  13209. };
  13210. return self._copyFrom_to_((1),aNumber);
  13211. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13212. },
  13213. args: ["aNumber"],
  13214. 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",
  13215. referencedClasses: [],
  13216. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  13217. }),
  13218. $globals.SequenceableCollection);
  13219. $core.addMethod(
  13220. $core.method({
  13221. selector: "fourth",
  13222. protocol: 'accessing',
  13223. fn: function (){
  13224. var self=this;
  13225. return $core.withContext(function($ctx1) {
  13226. return self._at_((4));
  13227. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  13228. },
  13229. args: [],
  13230. source: "fourth\x0a\x09^ self at: 4",
  13231. referencedClasses: [],
  13232. messageSends: ["at:"]
  13233. }),
  13234. $globals.SequenceableCollection);
  13235. $core.addMethod(
  13236. $core.method({
  13237. selector: "includes:",
  13238. protocol: 'testing',
  13239. fn: function (anObject){
  13240. var self=this;
  13241. return $core.withContext(function($ctx1) {
  13242. return $recv(self._indexOf_ifAbsent_(anObject,(function(){
  13243. return nil;
  13244. })))._notNil();
  13245. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  13246. },
  13247. args: ["anObject"],
  13248. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  13249. referencedClasses: [],
  13250. messageSends: ["notNil", "indexOf:ifAbsent:"]
  13251. }),
  13252. $globals.SequenceableCollection);
  13253. $core.addMethod(
  13254. $core.method({
  13255. selector: "indexOf:ifAbsent:",
  13256. protocol: 'accessing',
  13257. fn: function (anObject,aBlock){
  13258. var self=this;
  13259. return $core.withContext(function($ctx1) {
  13260. self = self._numericallyIndexable();
  13261. for(var i=0; i < self.length; i++) {
  13262. if($recv(self[i]).__eq(anObject)) {return i+1}
  13263. };
  13264. return aBlock._value();
  13265. ;
  13266. return self;
  13267. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  13268. },
  13269. args: ["anObject", "aBlock"],
  13270. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\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>",
  13271. referencedClasses: [],
  13272. messageSends: []
  13273. }),
  13274. $globals.SequenceableCollection);
  13275. $core.addMethod(
  13276. $core.method({
  13277. selector: "indexOf:startingAt:",
  13278. protocol: 'accessing',
  13279. fn: function (anObject,start){
  13280. var self=this;
  13281. return $core.withContext(function($ctx1) {
  13282. return self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  13283. return (0);
  13284. }));
  13285. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  13286. },
  13287. args: ["anObject", "start"],
  13288. 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 ]",
  13289. referencedClasses: [],
  13290. messageSends: ["indexOf:startingAt:ifAbsent:"]
  13291. }),
  13292. $globals.SequenceableCollection);
  13293. $core.addMethod(
  13294. $core.method({
  13295. selector: "indexOf:startingAt:ifAbsent:",
  13296. protocol: 'accessing',
  13297. fn: function (anObject,start,aBlock){
  13298. var self=this;
  13299. return $core.withContext(function($ctx1) {
  13300. self = self._numericallyIndexable();
  13301. for(var i=start - 1; i < self.length; i++){
  13302. if($recv(self[i]).__eq(anObject)) {return i+1}
  13303. }
  13304. return aBlock._value();
  13305. ;
  13306. return self;
  13307. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  13308. },
  13309. args: ["anObject", "start", "aBlock"],
  13310. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<\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>",
  13311. referencedClasses: [],
  13312. messageSends: []
  13313. }),
  13314. $globals.SequenceableCollection);
  13315. $core.addMethod(
  13316. $core.method({
  13317. selector: "last",
  13318. protocol: 'accessing',
  13319. fn: function (){
  13320. var self=this;
  13321. return $core.withContext(function($ctx1) {
  13322. return self._at_(self._size());
  13323. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  13324. },
  13325. args: [],
  13326. source: "last\x0a\x09^ self at: self size",
  13327. referencedClasses: [],
  13328. messageSends: ["at:", "size"]
  13329. }),
  13330. $globals.SequenceableCollection);
  13331. $core.addMethod(
  13332. $core.method({
  13333. selector: "last:",
  13334. protocol: 'accessing',
  13335. fn: function (aNumber){
  13336. var self=this;
  13337. return $core.withContext(function($ctx1) {
  13338. var $2,$1,$5,$4,$3;
  13339. $2=self._size();
  13340. $ctx1.sendIdx["size"]=1;
  13341. $1=$recv($2).__lt(aNumber);
  13342. if($core.assert($1)){
  13343. self._error_("Invalid number of elements");
  13344. };
  13345. $5=self._size();
  13346. $ctx1.sendIdx["size"]=2;
  13347. $4=$recv($5).__minus(aNumber);
  13348. $3=$recv($4).__plus((1));
  13349. return self._copyFrom_to_($3,self._size());
  13350. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13351. },
  13352. args: ["aNumber"],
  13353. 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",
  13354. referencedClasses: [],
  13355. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  13356. }),
  13357. $globals.SequenceableCollection);
  13358. $core.addMethod(
  13359. $core.method({
  13360. selector: "newStream",
  13361. protocol: 'streaming',
  13362. fn: function (){
  13363. var self=this;
  13364. return $core.withContext(function($ctx1) {
  13365. return $recv(self._streamClass())._on_(self);
  13366. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  13367. },
  13368. args: [],
  13369. source: "newStream\x0a\x09^ self streamClass on: self",
  13370. referencedClasses: [],
  13371. messageSends: ["on:", "streamClass"]
  13372. }),
  13373. $globals.SequenceableCollection);
  13374. $core.addMethod(
  13375. $core.method({
  13376. selector: "numericallyIndexable",
  13377. protocol: 'private',
  13378. fn: function (){
  13379. var self=this;
  13380. return $core.withContext(function($ctx1) {
  13381. self._subclassResponsibility();
  13382. return self;
  13383. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  13384. },
  13385. args: [],
  13386. 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",
  13387. referencedClasses: [],
  13388. messageSends: ["subclassResponsibility"]
  13389. }),
  13390. $globals.SequenceableCollection);
  13391. $core.addMethod(
  13392. $core.method({
  13393. selector: "readStream",
  13394. protocol: 'streaming',
  13395. fn: function (){
  13396. var self=this;
  13397. return $core.withContext(function($ctx1) {
  13398. return self._stream();
  13399. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  13400. },
  13401. args: [],
  13402. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13403. referencedClasses: [],
  13404. messageSends: ["stream"]
  13405. }),
  13406. $globals.SequenceableCollection);
  13407. $core.addMethod(
  13408. $core.method({
  13409. selector: "removeLast",
  13410. protocol: 'adding/removing',
  13411. fn: function (){
  13412. var self=this;
  13413. return $core.withContext(function($ctx1) {
  13414. return self._remove_(self._last());
  13415. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  13416. },
  13417. args: [],
  13418. source: "removeLast\x0a\x09^ self remove: self last",
  13419. referencedClasses: [],
  13420. messageSends: ["remove:", "last"]
  13421. }),
  13422. $globals.SequenceableCollection);
  13423. $core.addMethod(
  13424. $core.method({
  13425. selector: "reversed",
  13426. protocol: 'converting',
  13427. fn: function (){
  13428. var self=this;
  13429. return $core.withContext(function($ctx1) {
  13430. self._subclassResponsibility();
  13431. return self;
  13432. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  13433. },
  13434. args: [],
  13435. source: "reversed\x0a\x09self subclassResponsibility",
  13436. referencedClasses: [],
  13437. messageSends: ["subclassResponsibility"]
  13438. }),
  13439. $globals.SequenceableCollection);
  13440. $core.addMethod(
  13441. $core.method({
  13442. selector: "second",
  13443. protocol: 'accessing',
  13444. fn: function (){
  13445. var self=this;
  13446. return $core.withContext(function($ctx1) {
  13447. return self._at_((2));
  13448. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  13449. },
  13450. args: [],
  13451. source: "second\x0a\x09^ self at: 2",
  13452. referencedClasses: [],
  13453. messageSends: ["at:"]
  13454. }),
  13455. $globals.SequenceableCollection);
  13456. $core.addMethod(
  13457. $core.method({
  13458. selector: "single",
  13459. protocol: 'accessing',
  13460. fn: function (){
  13461. var self=this;
  13462. return $core.withContext(function($ctx1) {
  13463. if (self.length == 0) throw new Error("Collection is empty");
  13464. if (self.length > 1) throw new Error("Collection holds more than one element.");
  13465. return self[0];;
  13466. return self;
  13467. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  13468. },
  13469. args: [],
  13470. source: "single\x0a<\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>",
  13471. referencedClasses: [],
  13472. messageSends: []
  13473. }),
  13474. $globals.SequenceableCollection);
  13475. $core.addMethod(
  13476. $core.method({
  13477. selector: "stream",
  13478. protocol: 'streaming',
  13479. fn: function (){
  13480. var self=this;
  13481. return $core.withContext(function($ctx1) {
  13482. return self._newStream();
  13483. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  13484. },
  13485. args: [],
  13486. source: "stream\x0a\x09^ self newStream",
  13487. referencedClasses: [],
  13488. messageSends: ["newStream"]
  13489. }),
  13490. $globals.SequenceableCollection);
  13491. $core.addMethod(
  13492. $core.method({
  13493. selector: "streamClass",
  13494. protocol: 'streaming',
  13495. fn: function (){
  13496. var self=this;
  13497. return $core.withContext(function($ctx1) {
  13498. return $recv(self._class())._streamClass();
  13499. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  13500. },
  13501. args: [],
  13502. source: "streamClass\x0a\x09^ self class streamClass",
  13503. referencedClasses: [],
  13504. messageSends: ["streamClass", "class"]
  13505. }),
  13506. $globals.SequenceableCollection);
  13507. $core.addMethod(
  13508. $core.method({
  13509. selector: "third",
  13510. protocol: 'accessing',
  13511. fn: function (){
  13512. var self=this;
  13513. return $core.withContext(function($ctx1) {
  13514. return self._at_((3));
  13515. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  13516. },
  13517. args: [],
  13518. source: "third\x0a\x09^ self at: 3",
  13519. referencedClasses: [],
  13520. messageSends: ["at:"]
  13521. }),
  13522. $globals.SequenceableCollection);
  13523. $core.addMethod(
  13524. $core.method({
  13525. selector: "with:do:",
  13526. protocol: 'enumerating',
  13527. fn: function (anotherCollection,aBlock){
  13528. var self=this;
  13529. return $core.withContext(function($ctx1) {
  13530. self = self._numericallyIndexable();
  13531. anotherCollection = anotherCollection._numericallyIndexable();
  13532. for(var i=0; i<self.length; i++) {
  13533. aBlock._value_value_(self[i], anotherCollection[i]);
  13534. }
  13535. ;
  13536. return self;
  13537. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  13538. },
  13539. args: ["anotherCollection", "aBlock"],
  13540. source: "with: anotherCollection do: aBlock\x0a\x09<\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>",
  13541. referencedClasses: [],
  13542. messageSends: []
  13543. }),
  13544. $globals.SequenceableCollection);
  13545. $core.addMethod(
  13546. $core.method({
  13547. selector: "withIndexDo:",
  13548. protocol: 'enumerating',
  13549. fn: function (aBlock){
  13550. var self=this;
  13551. return $core.withContext(function($ctx1) {
  13552. self = self._numericallyIndexable();
  13553. for(var i=0; i < self.length; i++) {
  13554. aBlock._value_value_(self[i], i+1);
  13555. }
  13556. ;
  13557. return self;
  13558. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13559. },
  13560. args: ["aBlock"],
  13561. source: "withIndexDo: aBlock\x0a\x09<\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>",
  13562. referencedClasses: [],
  13563. messageSends: []
  13564. }),
  13565. $globals.SequenceableCollection);
  13566. $core.addMethod(
  13567. $core.method({
  13568. selector: "writeStream",
  13569. protocol: 'streaming',
  13570. fn: function (){
  13571. var self=this;
  13572. return $core.withContext(function($ctx1) {
  13573. return self._stream();
  13574. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  13575. },
  13576. args: [],
  13577. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13578. referencedClasses: [],
  13579. messageSends: ["stream"]
  13580. }),
  13581. $globals.SequenceableCollection);
  13582. $core.addMethod(
  13583. $core.method({
  13584. selector: "streamClass",
  13585. protocol: 'accessing',
  13586. fn: function (){
  13587. var self=this;
  13588. return $globals.Stream;
  13589. },
  13590. args: [],
  13591. source: "streamClass\x0a\x09\x09^ Stream",
  13592. referencedClasses: ["Stream"],
  13593. messageSends: []
  13594. }),
  13595. $globals.SequenceableCollection.klass);
  13596. $core.addMethod(
  13597. $core.method({
  13598. selector: "streamContents:",
  13599. protocol: 'streaming',
  13600. fn: function (aBlock){
  13601. var self=this;
  13602. var stream;
  13603. return $core.withContext(function($ctx1) {
  13604. stream=$recv(self._streamClass())._on_(self._new());
  13605. $recv(aBlock)._value_(stream);
  13606. return $recv(stream)._contents();
  13607. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  13608. },
  13609. args: ["aBlock"],
  13610. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  13611. referencedClasses: [],
  13612. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  13613. }),
  13614. $globals.SequenceableCollection.klass);
  13615. $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections');
  13616. $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`.";
  13617. $core.addMethod(
  13618. $core.method({
  13619. selector: "add:",
  13620. protocol: 'adding/removing',
  13621. fn: function (anObject){
  13622. var self=this;
  13623. return $core.withContext(function($ctx1) {
  13624. self.push(anObject); return anObject;;
  13625. return self;
  13626. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  13627. },
  13628. args: ["anObject"],
  13629. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  13630. referencedClasses: [],
  13631. messageSends: []
  13632. }),
  13633. $globals.Array);
  13634. $core.addMethod(
  13635. $core.method({
  13636. selector: "addAll:",
  13637. protocol: 'adding/removing',
  13638. fn: function (aCollection){
  13639. var self=this;
  13640. return $core.withContext(function($ctx1) {
  13641. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  13642. else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);
  13643. return aCollection;;
  13644. return self;
  13645. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  13646. },
  13647. args: ["aCollection"],
  13648. source: "addAll: aCollection\x0a<\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>",
  13649. referencedClasses: [],
  13650. messageSends: []
  13651. }),
  13652. $globals.Array);
  13653. $core.addMethod(
  13654. $core.method({
  13655. selector: "addFirst:",
  13656. protocol: 'adding/removing',
  13657. fn: function (anObject){
  13658. var self=this;
  13659. return $core.withContext(function($ctx1) {
  13660. self.unshift(anObject); return anObject;;
  13661. return self;
  13662. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  13663. },
  13664. args: ["anObject"],
  13665. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  13666. referencedClasses: [],
  13667. messageSends: []
  13668. }),
  13669. $globals.Array);
  13670. $core.addMethod(
  13671. $core.method({
  13672. selector: "asJavascript",
  13673. protocol: 'converting',
  13674. fn: function (){
  13675. var self=this;
  13676. return $core.withContext(function($ctx1) {
  13677. var $1;
  13678. $1=$recv("[".__comma($recv(self._collect_((function(each){
  13679. return $core.withContext(function($ctx2) {
  13680. return $recv(each)._asJavascript();
  13681. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13682. })))._join_(", "))).__comma("]");
  13683. $ctx1.sendIdx[","]=1;
  13684. return $1;
  13685. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
  13686. },
  13687. args: [],
  13688. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  13689. referencedClasses: [],
  13690. messageSends: [",", "join:", "collect:", "asJavascript"]
  13691. }),
  13692. $globals.Array);
  13693. $core.addMethod(
  13694. $core.method({
  13695. selector: "at:ifAbsent:",
  13696. protocol: 'accessing',
  13697. fn: function (anIndex,aBlock){
  13698. var self=this;
  13699. return $core.withContext(function($ctx1) {
  13700. return anIndex >= 1 && anIndex <= self.length
  13701. ? self[anIndex - 1]
  13702. : aBlock._value()
  13703. ;
  13704. return self;
  13705. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  13706. },
  13707. args: ["anIndex", "aBlock"],
  13708. source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09>",
  13709. referencedClasses: [],
  13710. messageSends: []
  13711. }),
  13712. $globals.Array);
  13713. $core.addMethod(
  13714. $core.method({
  13715. selector: "at:ifPresent:ifAbsent:",
  13716. protocol: 'accessing',
  13717. fn: function (anIndex,aBlock,anotherBlock){
  13718. var self=this;
  13719. return $core.withContext(function($ctx1) {
  13720. return anIndex >= 1 && anIndex <= self.length
  13721. ? aBlock._value_(self[anIndex - 1])
  13722. : anotherBlock._value()
  13723. ;
  13724. return self;
  13725. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  13726. },
  13727. args: ["anIndex", "aBlock", "anotherBlock"],
  13728. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\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>",
  13729. referencedClasses: [],
  13730. messageSends: []
  13731. }),
  13732. $globals.Array);
  13733. $core.addMethod(
  13734. $core.method({
  13735. selector: "at:put:",
  13736. protocol: 'accessing',
  13737. fn: function (anIndex,anObject){
  13738. var self=this;
  13739. return $core.withContext(function($ctx1) {
  13740. return self[anIndex - 1] = anObject;
  13741. return self;
  13742. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  13743. },
  13744. args: ["anIndex", "anObject"],
  13745. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  13746. referencedClasses: [],
  13747. messageSends: []
  13748. }),
  13749. $globals.Array);
  13750. $core.addMethod(
  13751. $core.method({
  13752. selector: "collect:",
  13753. protocol: 'enumerating',
  13754. fn: function (aBlock){
  13755. var self=this;
  13756. return $core.withContext(function($ctx1) {
  13757. return self.map(function(each) {return aBlock._value_(each)});
  13758. return self;
  13759. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  13760. },
  13761. args: ["aBlock"],
  13762. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  13763. referencedClasses: [],
  13764. messageSends: []
  13765. }),
  13766. $globals.Array);
  13767. $core.addMethod(
  13768. $core.method({
  13769. selector: "copyFrom:to:",
  13770. protocol: 'copying',
  13771. fn: function (anIndex,anotherIndex){
  13772. var self=this;
  13773. return $core.withContext(function($ctx1) {
  13774. if (anIndex >= 1 && anotherIndex <= self.length) {
  13775. return self.slice(anIndex - 1, anotherIndex);
  13776. } else {
  13777. self._at_(anIndex);
  13778. self._at_(self.length + 1);
  13779. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  13780. };
  13781. return self;
  13782. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  13783. },
  13784. args: ["anIndex", "anotherIndex"],
  13785. source: "copyFrom: anIndex to: anotherIndex\x0a<\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>",
  13786. referencedClasses: [],
  13787. messageSends: []
  13788. }),
  13789. $globals.Array);
  13790. $core.addMethod(
  13791. $core.method({
  13792. selector: "join:",
  13793. protocol: 'enumerating',
  13794. fn: function (aString){
  13795. var self=this;
  13796. return $core.withContext(function($ctx1) {
  13797. return self.join(aString);
  13798. return self;
  13799. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  13800. },
  13801. args: ["aString"],
  13802. source: "join: aString\x0a\x09<return self.join(aString)>",
  13803. referencedClasses: [],
  13804. messageSends: []
  13805. }),
  13806. $globals.Array);
  13807. $core.addMethod(
  13808. $core.method({
  13809. selector: "numericallyIndexable",
  13810. protocol: 'private',
  13811. fn: function (){
  13812. var self=this;
  13813. return self;
  13814. },
  13815. args: [],
  13816. source: "numericallyIndexable\x0a\x09^ self",
  13817. referencedClasses: [],
  13818. messageSends: []
  13819. }),
  13820. $globals.Array);
  13821. $core.addMethod(
  13822. $core.method({
  13823. selector: "printOn:",
  13824. protocol: 'printing',
  13825. fn: function (aStream){
  13826. var self=this;
  13827. return $core.withContext(function($ctx1) {
  13828. (
  13829. $ctx1.supercall = true,
  13830. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  13831. $ctx1.supercall = false;
  13832. $ctx1.sendIdx["printOn:"]=1;
  13833. $recv(aStream)._nextPutAll_(" (");
  13834. $ctx1.sendIdx["nextPutAll:"]=1;
  13835. self._do_separatedBy_((function(each){
  13836. return $core.withContext(function($ctx2) {
  13837. return $recv(each)._printOn_(aStream);
  13838. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13839. }),(function(){
  13840. return $core.withContext(function($ctx2) {
  13841. return $recv(aStream)._nextPutAll_(" ");
  13842. $ctx2.sendIdx["nextPutAll:"]=2;
  13843. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13844. }));
  13845. $recv(aStream)._nextPutAll_(")");
  13846. return self;
  13847. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  13848. },
  13849. args: ["aStream"],
  13850. 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: ')'",
  13851. referencedClasses: [],
  13852. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13853. }),
  13854. $globals.Array);
  13855. $core.addMethod(
  13856. $core.method({
  13857. selector: "remove:ifAbsent:",
  13858. protocol: 'adding/removing',
  13859. fn: function (anObject,aBlock){
  13860. var self=this;
  13861. var index;
  13862. return $core.withContext(function($ctx1) {
  13863. var $1;
  13864. index=self._indexOf_ifAbsent_(anObject,(function(){
  13865. return (0);
  13866. }));
  13867. $1=$recv(index).__eq((0));
  13868. if($core.assert($1)){
  13869. return $recv(aBlock)._value();
  13870. } else {
  13871. self._removeIndex_(index);
  13872. return anObject;
  13873. };
  13874. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  13875. },
  13876. args: ["anObject", "aBlock"],
  13877. 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 ]",
  13878. referencedClasses: [],
  13879. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  13880. }),
  13881. $globals.Array);
  13882. $core.addMethod(
  13883. $core.method({
  13884. selector: "removeAll",
  13885. protocol: 'adding/removing',
  13886. fn: function (){
  13887. var self=this;
  13888. return $core.withContext(function($ctx1) {
  13889. self.length = 0;
  13890. return self;
  13891. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  13892. },
  13893. args: [],
  13894. source: "removeAll\x0a\x09<self.length = 0>",
  13895. referencedClasses: [],
  13896. messageSends: []
  13897. }),
  13898. $globals.Array);
  13899. $core.addMethod(
  13900. $core.method({
  13901. selector: "removeFrom:to:",
  13902. protocol: 'adding/removing',
  13903. fn: function (aNumber,anotherNumber){
  13904. var self=this;
  13905. return $core.withContext(function($ctx1) {
  13906. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  13907. return self;
  13908. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  13909. },
  13910. args: ["aNumber", "anotherNumber"],
  13911. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  13912. referencedClasses: [],
  13913. messageSends: []
  13914. }),
  13915. $globals.Array);
  13916. $core.addMethod(
  13917. $core.method({
  13918. selector: "removeIndex:",
  13919. protocol: 'adding/removing',
  13920. fn: function (anInteger){
  13921. var self=this;
  13922. return $core.withContext(function($ctx1) {
  13923. self.splice(anInteger - 1, 1);
  13924. return self;
  13925. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  13926. },
  13927. args: ["anInteger"],
  13928. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  13929. referencedClasses: [],
  13930. messageSends: []
  13931. }),
  13932. $globals.Array);
  13933. $core.addMethod(
  13934. $core.method({
  13935. selector: "removeLast",
  13936. protocol: 'adding/removing',
  13937. fn: function (){
  13938. var self=this;
  13939. return $core.withContext(function($ctx1) {
  13940. return self.pop();;
  13941. return self;
  13942. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  13943. },
  13944. args: [],
  13945. source: "removeLast\x0a\x09<return self.pop();>",
  13946. referencedClasses: [],
  13947. messageSends: []
  13948. }),
  13949. $globals.Array);
  13950. $core.addMethod(
  13951. $core.method({
  13952. selector: "reversed",
  13953. protocol: 'converting',
  13954. fn: function (){
  13955. var self=this;
  13956. return $core.withContext(function($ctx1) {
  13957. return self.slice().reverse();
  13958. return self;
  13959. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  13960. },
  13961. args: [],
  13962. source: "reversed\x0a\x09<return self.slice().reverse()>",
  13963. referencedClasses: [],
  13964. messageSends: []
  13965. }),
  13966. $globals.Array);
  13967. $core.addMethod(
  13968. $core.method({
  13969. selector: "select:",
  13970. protocol: 'enumerating',
  13971. fn: function (aBlock){
  13972. var self=this;
  13973. return $core.withContext(function($ctx1) {
  13974. return self.filter(function(each) {return aBlock._value_(each)});
  13975. return self;
  13976. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  13977. },
  13978. args: ["aBlock"],
  13979. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.filter(function(each) {return aBlock._value_(each)})>",
  13980. referencedClasses: [],
  13981. messageSends: []
  13982. }),
  13983. $globals.Array);
  13984. $core.addMethod(
  13985. $core.method({
  13986. selector: "shallowCopy",
  13987. protocol: 'copying',
  13988. fn: function (){
  13989. var self=this;
  13990. return $core.withContext(function($ctx1) {
  13991. return self.slice();
  13992. return self;
  13993. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  13994. },
  13995. args: [],
  13996. source: "shallowCopy\x0a\x09<return self.slice()>",
  13997. referencedClasses: [],
  13998. messageSends: []
  13999. }),
  14000. $globals.Array);
  14001. $core.addMethod(
  14002. $core.method({
  14003. selector: "size",
  14004. protocol: 'accessing',
  14005. fn: function (){
  14006. var self=this;
  14007. return $core.withContext(function($ctx1) {
  14008. return self.length;
  14009. return self;
  14010. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  14011. },
  14012. args: [],
  14013. source: "size\x0a\x09<return self.length>",
  14014. referencedClasses: [],
  14015. messageSends: []
  14016. }),
  14017. $globals.Array);
  14018. $core.addMethod(
  14019. $core.method({
  14020. selector: "sort",
  14021. protocol: 'enumerating',
  14022. fn: function (){
  14023. var self=this;
  14024. return $core.withContext(function($ctx1) {
  14025. return self._sort_((function(a,b){
  14026. return $core.withContext(function($ctx2) {
  14027. return $recv(a).__lt(b);
  14028. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  14029. }));
  14030. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  14031. },
  14032. args: [],
  14033. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  14034. referencedClasses: [],
  14035. messageSends: ["sort:", "<"]
  14036. }),
  14037. $globals.Array);
  14038. $core.addMethod(
  14039. $core.method({
  14040. selector: "sort:",
  14041. protocol: 'enumerating',
  14042. fn: function (aBlock){
  14043. var self=this;
  14044. return $core.withContext(function($ctx1) {
  14045. return self.sort(function(a, b) {
  14046. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  14047. })
  14048. ;
  14049. return self;
  14050. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  14051. },
  14052. args: ["aBlock"],
  14053. source: "sort: aBlock\x0a\x09<\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>",
  14054. referencedClasses: [],
  14055. messageSends: []
  14056. }),
  14057. $globals.Array);
  14058. $core.addMethod(
  14059. $core.method({
  14060. selector: "sorted",
  14061. protocol: 'enumerating',
  14062. fn: function (){
  14063. var self=this;
  14064. return $core.withContext(function($ctx1) {
  14065. return $recv(self._copy())._sort();
  14066. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  14067. },
  14068. args: [],
  14069. source: "sorted\x0a\x09^ self copy sort",
  14070. referencedClasses: [],
  14071. messageSends: ["sort", "copy"]
  14072. }),
  14073. $globals.Array);
  14074. $core.addMethod(
  14075. $core.method({
  14076. selector: "sorted:",
  14077. protocol: 'enumerating',
  14078. fn: function (aBlock){
  14079. var self=this;
  14080. return $core.withContext(function($ctx1) {
  14081. return $recv(self._copy())._sort_(aBlock);
  14082. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  14083. },
  14084. args: ["aBlock"],
  14085. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  14086. referencedClasses: [],
  14087. messageSends: ["sort:", "copy"]
  14088. }),
  14089. $globals.Array);
  14090. $core.addMethod(
  14091. $core.method({
  14092. selector: "new:",
  14093. protocol: 'instance creation',
  14094. fn: function (anInteger){
  14095. var self=this;
  14096. return $core.withContext(function($ctx1) {
  14097. return new Array(anInteger);
  14098. return self;
  14099. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  14100. },
  14101. args: ["anInteger"],
  14102. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  14103. referencedClasses: [],
  14104. messageSends: []
  14105. }),
  14106. $globals.Array.klass);
  14107. $core.addMethod(
  14108. $core.method({
  14109. selector: "with:",
  14110. protocol: 'instance creation',
  14111. fn: function (anObject){
  14112. var self=this;
  14113. return $core.withContext(function($ctx1) {
  14114. var $1;
  14115. $1=self._new_((1));
  14116. $recv($1)._at_put_((1),anObject);
  14117. return $recv($1)._yourself();
  14118. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  14119. },
  14120. args: ["anObject"],
  14121. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  14122. referencedClasses: [],
  14123. messageSends: ["at:put:", "new:", "yourself"]
  14124. }),
  14125. $globals.Array.klass);
  14126. $core.addMethod(
  14127. $core.method({
  14128. selector: "with:with:",
  14129. protocol: 'instance creation',
  14130. fn: function (anObject,anObject2){
  14131. var self=this;
  14132. return $core.withContext(function($ctx1) {
  14133. var $1;
  14134. $1=self._new_((2));
  14135. $recv($1)._at_put_((1),anObject);
  14136. $ctx1.sendIdx["at:put:"]=1;
  14137. $recv($1)._at_put_((2),anObject2);
  14138. return $recv($1)._yourself();
  14139. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  14140. },
  14141. args: ["anObject", "anObject2"],
  14142. 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",
  14143. referencedClasses: [],
  14144. messageSends: ["at:put:", "new:", "yourself"]
  14145. }),
  14146. $globals.Array.klass);
  14147. $core.addMethod(
  14148. $core.method({
  14149. selector: "with:with:with:",
  14150. protocol: 'instance creation',
  14151. fn: function (anObject,anObject2,anObject3){
  14152. var self=this;
  14153. return $core.withContext(function($ctx1) {
  14154. var $1;
  14155. $1=self._new_((3));
  14156. $recv($1)._at_put_((1),anObject);
  14157. $ctx1.sendIdx["at:put:"]=1;
  14158. $recv($1)._at_put_((2),anObject2);
  14159. $ctx1.sendIdx["at:put:"]=2;
  14160. $recv($1)._at_put_((3),anObject3);
  14161. return $recv($1)._yourself();
  14162. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  14163. },
  14164. args: ["anObject", "anObject2", "anObject3"],
  14165. 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",
  14166. referencedClasses: [],
  14167. messageSends: ["at:put:", "new:", "yourself"]
  14168. }),
  14169. $globals.Array.klass);
  14170. $core.addMethod(
  14171. $core.method({
  14172. selector: "withAll:",
  14173. protocol: 'instance creation',
  14174. fn: function (aCollection){
  14175. var self=this;
  14176. var instance,index;
  14177. return $core.withContext(function($ctx1) {
  14178. index=(1);
  14179. instance=self._new_($recv(aCollection)._size());
  14180. $recv(aCollection)._do_((function(each){
  14181. return $core.withContext(function($ctx2) {
  14182. $recv(instance)._at_put_(index,each);
  14183. index=$recv(index).__plus((1));
  14184. return index;
  14185. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14186. }));
  14187. return instance;
  14188. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  14189. },
  14190. args: ["aCollection"],
  14191. 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",
  14192. referencedClasses: [],
  14193. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  14194. }),
  14195. $globals.Array.klass);
  14196. $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections');
  14197. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  14198. $core.addMethod(
  14199. $core.method({
  14200. selector: ",",
  14201. protocol: 'copying',
  14202. fn: function (aString){
  14203. var self=this;
  14204. return $core.withContext(function($ctx1) {
  14205. var $1;
  14206. $1=self._asString();
  14207. $ctx1.sendIdx["asString"]=1;
  14208. return $recv($1).__comma($recv(aString)._asString());
  14209. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  14210. },
  14211. args: ["aString"],
  14212. source: ", aString\x0a\x09^ self asString, aString asString",
  14213. referencedClasses: [],
  14214. messageSends: [",", "asString"]
  14215. }),
  14216. $globals.CharacterArray);
  14217. $core.addMethod(
  14218. $core.method({
  14219. selector: "add:",
  14220. protocol: 'adding/removing',
  14221. fn: function (anObject){
  14222. var self=this;
  14223. return $core.withContext(function($ctx1) {
  14224. self._errorReadOnly();
  14225. return self;
  14226. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  14227. },
  14228. args: ["anObject"],
  14229. source: "add: anObject\x0a\x09self errorReadOnly",
  14230. referencedClasses: [],
  14231. messageSends: ["errorReadOnly"]
  14232. }),
  14233. $globals.CharacterArray);
  14234. $core.addMethod(
  14235. $core.method({
  14236. selector: "asLowercase",
  14237. protocol: 'converting',
  14238. fn: function (){
  14239. var self=this;
  14240. return $core.withContext(function($ctx1) {
  14241. return $recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  14242. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  14243. },
  14244. args: [],
  14245. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  14246. referencedClasses: [],
  14247. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  14248. }),
  14249. $globals.CharacterArray);
  14250. $core.addMethod(
  14251. $core.method({
  14252. selector: "asNumber",
  14253. protocol: 'converting',
  14254. fn: function (){
  14255. var self=this;
  14256. return $core.withContext(function($ctx1) {
  14257. return $recv(self._asString())._asNumber();
  14258. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  14259. },
  14260. args: [],
  14261. source: "asNumber\x0a\x09^ self asString asNumber",
  14262. referencedClasses: [],
  14263. messageSends: ["asNumber", "asString"]
  14264. }),
  14265. $globals.CharacterArray);
  14266. $core.addMethod(
  14267. $core.method({
  14268. selector: "asString",
  14269. protocol: 'converting',
  14270. fn: function (){
  14271. var self=this;
  14272. return $core.withContext(function($ctx1) {
  14273. return self._subclassResponsibility();
  14274. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  14275. },
  14276. args: [],
  14277. source: "asString\x0a\x09^ self subclassResponsibility",
  14278. referencedClasses: [],
  14279. messageSends: ["subclassResponsibility"]
  14280. }),
  14281. $globals.CharacterArray);
  14282. $core.addMethod(
  14283. $core.method({
  14284. selector: "asSymbol",
  14285. protocol: 'converting',
  14286. fn: function (){
  14287. var self=this;
  14288. return $core.withContext(function($ctx1) {
  14289. return self._asString();
  14290. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  14291. },
  14292. args: [],
  14293. source: "asSymbol\x0a\x09^ self asString",
  14294. referencedClasses: [],
  14295. messageSends: ["asString"]
  14296. }),
  14297. $globals.CharacterArray);
  14298. $core.addMethod(
  14299. $core.method({
  14300. selector: "asUppercase",
  14301. protocol: 'converting',
  14302. fn: function (){
  14303. var self=this;
  14304. return $core.withContext(function($ctx1) {
  14305. return $recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  14306. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  14307. },
  14308. args: [],
  14309. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  14310. referencedClasses: [],
  14311. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  14312. }),
  14313. $globals.CharacterArray);
  14314. $core.addMethod(
  14315. $core.method({
  14316. selector: "at:put:",
  14317. protocol: 'accessing',
  14318. fn: function (anIndex,anObject){
  14319. var self=this;
  14320. return $core.withContext(function($ctx1) {
  14321. self._errorReadOnly();
  14322. return self;
  14323. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  14324. },
  14325. args: ["anIndex", "anObject"],
  14326. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  14327. referencedClasses: [],
  14328. messageSends: ["errorReadOnly"]
  14329. }),
  14330. $globals.CharacterArray);
  14331. $core.addMethod(
  14332. $core.method({
  14333. selector: "errorReadOnly",
  14334. protocol: 'error handling',
  14335. fn: function (){
  14336. var self=this;
  14337. return $core.withContext(function($ctx1) {
  14338. self._error_("Object is read-only");
  14339. return self;
  14340. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  14341. },
  14342. args: [],
  14343. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  14344. referencedClasses: [],
  14345. messageSends: ["error:"]
  14346. }),
  14347. $globals.CharacterArray);
  14348. $core.addMethod(
  14349. $core.method({
  14350. selector: "printOn:",
  14351. protocol: 'printing',
  14352. fn: function (aStream){
  14353. var self=this;
  14354. return $core.withContext(function($ctx1) {
  14355. $recv(self._asString())._printOn_(aStream);
  14356. return self;
  14357. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  14358. },
  14359. args: ["aStream"],
  14360. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  14361. referencedClasses: [],
  14362. messageSends: ["printOn:", "asString"]
  14363. }),
  14364. $globals.CharacterArray);
  14365. $core.addMethod(
  14366. $core.method({
  14367. selector: "putOn:",
  14368. protocol: 'streaming',
  14369. fn: function (aStream){
  14370. var self=this;
  14371. return $core.withContext(function($ctx1) {
  14372. $recv(aStream)._nextPutString_(self);
  14373. return self;
  14374. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  14375. },
  14376. args: ["aStream"],
  14377. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  14378. referencedClasses: [],
  14379. messageSends: ["nextPutString:"]
  14380. }),
  14381. $globals.CharacterArray);
  14382. $core.addMethod(
  14383. $core.method({
  14384. selector: "remove:",
  14385. protocol: 'adding/removing',
  14386. fn: function (anObject){
  14387. var self=this;
  14388. return $core.withContext(function($ctx1) {
  14389. self._errorReadOnly();
  14390. return self;
  14391. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  14392. },
  14393. args: ["anObject"],
  14394. source: "remove: anObject\x0a\x09self errorReadOnly",
  14395. referencedClasses: [],
  14396. messageSends: ["errorReadOnly"]
  14397. }),
  14398. $globals.CharacterArray);
  14399. $core.addMethod(
  14400. $core.method({
  14401. selector: "fromString:",
  14402. protocol: 'instance creation',
  14403. fn: function (aString){
  14404. var self=this;
  14405. return $core.withContext(function($ctx1) {
  14406. self._subclassResponsibility();
  14407. return self;
  14408. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  14409. },
  14410. args: ["aString"],
  14411. source: "fromString: aString\x0a\x09self subclassResponsibility",
  14412. referencedClasses: [],
  14413. messageSends: ["subclassResponsibility"]
  14414. }),
  14415. $globals.CharacterArray.klass);
  14416. $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections');
  14417. $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 >> #,`";
  14418. $core.addMethod(
  14419. $core.method({
  14420. selector: ",",
  14421. protocol: 'copying',
  14422. fn: function (aString){
  14423. var self=this;
  14424. return $core.withContext(function($ctx1) {
  14425. return String(self) + aString;
  14426. return self;
  14427. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  14428. },
  14429. args: ["aString"],
  14430. source: ", aString\x0a\x09<return String(self) + aString>",
  14431. referencedClasses: [],
  14432. messageSends: []
  14433. }),
  14434. $globals.String);
  14435. $core.addMethod(
  14436. $core.method({
  14437. selector: "<",
  14438. protocol: 'comparing',
  14439. fn: function (aString){
  14440. var self=this;
  14441. return $core.withContext(function($ctx1) {
  14442. return String(self) < aString._asString();
  14443. return self;
  14444. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  14445. },
  14446. args: ["aString"],
  14447. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  14448. referencedClasses: [],
  14449. messageSends: []
  14450. }),
  14451. $globals.String);
  14452. $core.addMethod(
  14453. $core.method({
  14454. selector: "<=",
  14455. protocol: 'comparing',
  14456. fn: function (aString){
  14457. var self=this;
  14458. return $core.withContext(function($ctx1) {
  14459. return String(self) <= aString._asString();
  14460. return self;
  14461. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  14462. },
  14463. args: ["aString"],
  14464. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  14465. referencedClasses: [],
  14466. messageSends: []
  14467. }),
  14468. $globals.String);
  14469. $core.addMethod(
  14470. $core.method({
  14471. selector: "=",
  14472. protocol: 'comparing',
  14473. fn: function (aString){
  14474. var self=this;
  14475. return $core.withContext(function($ctx1) {
  14476. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  14477. return self;
  14478. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  14479. },
  14480. args: ["aString"],
  14481. source: "= aString\x0a<return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())>",
  14482. referencedClasses: [],
  14483. messageSends: []
  14484. }),
  14485. $globals.String);
  14486. $core.addMethod(
  14487. $core.method({
  14488. selector: "==",
  14489. protocol: 'comparing',
  14490. fn: function (aString){
  14491. var self=this;
  14492. return $core.withContext(function($ctx1) {
  14493. if (typeof aString === "string") return String(self) === aString;
  14494. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  14495. else return false;;
  14496. return self;
  14497. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  14498. },
  14499. args: ["aString"],
  14500. source: "== aString\x0a<\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>",
  14501. referencedClasses: [],
  14502. messageSends: []
  14503. }),
  14504. $globals.String);
  14505. $core.addMethod(
  14506. $core.method({
  14507. selector: ">",
  14508. protocol: 'comparing',
  14509. fn: function (aString){
  14510. var self=this;
  14511. return $core.withContext(function($ctx1) {
  14512. return String(self) > aString._asString();
  14513. return self;
  14514. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  14515. },
  14516. args: ["aString"],
  14517. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  14518. referencedClasses: [],
  14519. messageSends: []
  14520. }),
  14521. $globals.String);
  14522. $core.addMethod(
  14523. $core.method({
  14524. selector: ">=",
  14525. protocol: 'comparing',
  14526. fn: function (aString){
  14527. var self=this;
  14528. return $core.withContext(function($ctx1) {
  14529. return String(self) >= aString._asString();
  14530. return self;
  14531. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  14532. },
  14533. args: ["aString"],
  14534. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  14535. referencedClasses: [],
  14536. messageSends: []
  14537. }),
  14538. $globals.String);
  14539. $core.addMethod(
  14540. $core.method({
  14541. selector: "asJSON",
  14542. protocol: 'converting',
  14543. fn: function (){
  14544. var self=this;
  14545. return self;
  14546. },
  14547. args: [],
  14548. source: "asJSON\x0a\x09^ self",
  14549. referencedClasses: [],
  14550. messageSends: []
  14551. }),
  14552. $globals.String);
  14553. $core.addMethod(
  14554. $core.method({
  14555. selector: "asJavaScriptMethodName",
  14556. protocol: 'converting',
  14557. fn: function (){
  14558. var self=this;
  14559. return $core.withContext(function($ctx1) {
  14560. return $core.st2js(self);
  14561. return self;
  14562. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  14563. },
  14564. args: [],
  14565. source: "asJavaScriptMethodName\x0a\x09<return $core.st2js(self)>",
  14566. referencedClasses: [],
  14567. messageSends: []
  14568. }),
  14569. $globals.String);
  14570. $core.addMethod(
  14571. $core.method({
  14572. selector: "asJavascript",
  14573. protocol: 'converting',
  14574. fn: function (){
  14575. var self=this;
  14576. return $core.withContext(function($ctx1) {
  14577. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  14578. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  14579. else
  14580. return "\"" + self + "\"";
  14581. ;
  14582. return self;
  14583. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  14584. },
  14585. args: [],
  14586. source: "asJavascript\x0a\x09<\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>",
  14587. referencedClasses: [],
  14588. messageSends: []
  14589. }),
  14590. $globals.String);
  14591. $core.addMethod(
  14592. $core.method({
  14593. selector: "asLowercase",
  14594. protocol: 'converting',
  14595. fn: function (){
  14596. var self=this;
  14597. return $core.withContext(function($ctx1) {
  14598. return self.toLowerCase();
  14599. return self;
  14600. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  14601. },
  14602. args: [],
  14603. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  14604. referencedClasses: [],
  14605. messageSends: []
  14606. }),
  14607. $globals.String);
  14608. $core.addMethod(
  14609. $core.method({
  14610. selector: "asMutator",
  14611. protocol: 'converting',
  14612. fn: function (){
  14613. var self=this;
  14614. return $core.withContext(function($ctx1) {
  14615. var $1;
  14616. $1=$recv(self._last()).__eq(":");
  14617. if(!$core.assert($1)){
  14618. return self.__comma(":");
  14619. };
  14620. return self;
  14621. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  14622. },
  14623. args: [],
  14624. 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",
  14625. referencedClasses: [],
  14626. messageSends: ["ifFalse:", "=", "last", ","]
  14627. }),
  14628. $globals.String);
  14629. $core.addMethod(
  14630. $core.method({
  14631. selector: "asNumber",
  14632. protocol: 'converting',
  14633. fn: function (){
  14634. var self=this;
  14635. return $core.withContext(function($ctx1) {
  14636. return Number(self);
  14637. return self;
  14638. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  14639. },
  14640. args: [],
  14641. source: "asNumber\x0a\x09<return Number(self)>",
  14642. referencedClasses: [],
  14643. messageSends: []
  14644. }),
  14645. $globals.String);
  14646. $core.addMethod(
  14647. $core.method({
  14648. selector: "asRegexp",
  14649. protocol: 'converting',
  14650. fn: function (){
  14651. var self=this;
  14652. return $core.withContext(function($ctx1) {
  14653. return $recv($globals.RegularExpression)._fromString_(self);
  14654. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  14655. },
  14656. args: [],
  14657. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  14658. referencedClasses: ["RegularExpression"],
  14659. messageSends: ["fromString:"]
  14660. }),
  14661. $globals.String);
  14662. $core.addMethod(
  14663. $core.method({
  14664. selector: "asString",
  14665. protocol: 'converting',
  14666. fn: function (){
  14667. var self=this;
  14668. return self;
  14669. },
  14670. args: [],
  14671. source: "asString\x0a\x09^ self",
  14672. referencedClasses: [],
  14673. messageSends: []
  14674. }),
  14675. $globals.String);
  14676. $core.addMethod(
  14677. $core.method({
  14678. selector: "asSymbol",
  14679. protocol: 'converting',
  14680. fn: function (){
  14681. var self=this;
  14682. return self;
  14683. },
  14684. args: [],
  14685. source: "asSymbol\x0a\x09^ self",
  14686. referencedClasses: [],
  14687. messageSends: []
  14688. }),
  14689. $globals.String);
  14690. $core.addMethod(
  14691. $core.method({
  14692. selector: "asUppercase",
  14693. protocol: 'converting',
  14694. fn: function (){
  14695. var self=this;
  14696. return $core.withContext(function($ctx1) {
  14697. return self.toUpperCase();
  14698. return self;
  14699. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  14700. },
  14701. args: [],
  14702. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  14703. referencedClasses: [],
  14704. messageSends: []
  14705. }),
  14706. $globals.String);
  14707. $core.addMethod(
  14708. $core.method({
  14709. selector: "asciiValue",
  14710. protocol: 'accessing',
  14711. fn: function (){
  14712. var self=this;
  14713. return $core.withContext(function($ctx1) {
  14714. return self.charCodeAt(0);;
  14715. return self;
  14716. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  14717. },
  14718. args: [],
  14719. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  14720. referencedClasses: [],
  14721. messageSends: []
  14722. }),
  14723. $globals.String);
  14724. $core.addMethod(
  14725. $core.method({
  14726. selector: "at:ifAbsent:",
  14727. protocol: 'accessing',
  14728. fn: function (anIndex,aBlock){
  14729. var self=this;
  14730. return $core.withContext(function($ctx1) {
  14731. return String(self)[anIndex - 1] || aBlock._value();
  14732. return self;
  14733. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  14734. },
  14735. args: ["anIndex", "aBlock"],
  14736. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  14737. referencedClasses: [],
  14738. messageSends: []
  14739. }),
  14740. $globals.String);
  14741. $core.addMethod(
  14742. $core.method({
  14743. selector: "at:ifPresent:ifAbsent:",
  14744. protocol: 'accessing',
  14745. fn: function (anIndex,aBlock,anotherBlock){
  14746. var self=this;
  14747. return $core.withContext(function($ctx1) {
  14748. var result = String(self)[anIndex - 1];
  14749. return result ? aBlock._value_(result) : anotherBlock._value();
  14750. ;
  14751. return self;
  14752. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  14753. },
  14754. args: ["anIndex", "aBlock", "anotherBlock"],
  14755. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09>",
  14756. referencedClasses: [],
  14757. messageSends: []
  14758. }),
  14759. $globals.String);
  14760. $core.addMethod(
  14761. $core.method({
  14762. selector: "capitalized",
  14763. protocol: 'converting',
  14764. fn: function (){
  14765. var self=this;
  14766. return $core.withContext(function($ctx1) {
  14767. return self._ifNotEmpty_((function(){
  14768. return $core.withContext(function($ctx2) {
  14769. return $recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  14770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14771. }));
  14772. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  14773. },
  14774. args: [],
  14775. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  14776. referencedClasses: [],
  14777. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  14778. }),
  14779. $globals.String);
  14780. $core.addMethod(
  14781. $core.method({
  14782. selector: "charCodeAt:",
  14783. protocol: 'accessing',
  14784. fn: function (anInteger){
  14785. var self=this;
  14786. return $core.withContext(function($ctx1) {
  14787. return self.charCodeAt(anInteger - 1);
  14788. return self;
  14789. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  14790. },
  14791. args: ["anInteger"],
  14792. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  14793. referencedClasses: [],
  14794. messageSends: []
  14795. }),
  14796. $globals.String);
  14797. $core.addMethod(
  14798. $core.method({
  14799. selector: "copyFrom:to:",
  14800. protocol: 'copying',
  14801. fn: function (anIndex,anotherIndex){
  14802. var self=this;
  14803. return $core.withContext(function($ctx1) {
  14804. return self.substring(anIndex - 1, anotherIndex);
  14805. return self;
  14806. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  14807. },
  14808. args: ["anIndex", "anotherIndex"],
  14809. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  14810. referencedClasses: [],
  14811. messageSends: []
  14812. }),
  14813. $globals.String);
  14814. $core.addMethod(
  14815. $core.method({
  14816. selector: "crlfSanitized",
  14817. protocol: 'converting',
  14818. fn: function (){
  14819. var self=this;
  14820. return $core.withContext(function($ctx1) {
  14821. return $recv(self._lines())._join_($recv($globals.String)._lf());
  14822. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  14823. },
  14824. args: [],
  14825. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  14826. referencedClasses: ["String"],
  14827. messageSends: ["join:", "lines", "lf"]
  14828. }),
  14829. $globals.String);
  14830. $core.addMethod(
  14831. $core.method({
  14832. selector: "deepCopy",
  14833. protocol: 'copying',
  14834. fn: function (){
  14835. var self=this;
  14836. return $core.withContext(function($ctx1) {
  14837. return self._shallowCopy();
  14838. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  14839. },
  14840. args: [],
  14841. source: "deepCopy\x0a\x09^ self shallowCopy",
  14842. referencedClasses: [],
  14843. messageSends: ["shallowCopy"]
  14844. }),
  14845. $globals.String);
  14846. $core.addMethod(
  14847. $core.method({
  14848. selector: "escaped",
  14849. protocol: 'converting',
  14850. fn: function (){
  14851. var self=this;
  14852. return $core.withContext(function($ctx1) {
  14853. return escape(self);
  14854. return self;
  14855. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  14856. },
  14857. args: [],
  14858. source: "escaped\x0a\x09<return escape(self)>",
  14859. referencedClasses: [],
  14860. messageSends: []
  14861. }),
  14862. $globals.String);
  14863. $core.addMethod(
  14864. $core.method({
  14865. selector: "includesSubString:",
  14866. protocol: 'testing',
  14867. fn: function (subString){
  14868. var self=this;
  14869. return $core.withContext(function($ctx1) {
  14870. return self.indexOf(subString) != -1;
  14871. return self;
  14872. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  14873. },
  14874. args: ["subString"],
  14875. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  14876. referencedClasses: [],
  14877. messageSends: []
  14878. }),
  14879. $globals.String);
  14880. $core.addMethod(
  14881. $core.method({
  14882. selector: "isCapitalized",
  14883. protocol: 'testing',
  14884. fn: function (){
  14885. var self=this;
  14886. return $core.withContext(function($ctx1) {
  14887. var $2,$1;
  14888. $2=self._first();
  14889. $ctx1.sendIdx["first"]=1;
  14890. $1=$recv($2)._asUppercase();
  14891. return $recv($1).__eq_eq(self._first());
  14892. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  14893. },
  14894. args: [],
  14895. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  14896. referencedClasses: [],
  14897. messageSends: ["==", "asUppercase", "first"]
  14898. }),
  14899. $globals.String);
  14900. $core.addMethod(
  14901. $core.method({
  14902. selector: "isImmutable",
  14903. protocol: 'testing',
  14904. fn: function (){
  14905. var self=this;
  14906. return true;
  14907. },
  14908. args: [],
  14909. source: "isImmutable\x0a\x09^ true",
  14910. referencedClasses: [],
  14911. messageSends: []
  14912. }),
  14913. $globals.String);
  14914. $core.addMethod(
  14915. $core.method({
  14916. selector: "isString",
  14917. protocol: 'testing',
  14918. fn: function (){
  14919. var self=this;
  14920. return true;
  14921. },
  14922. args: [],
  14923. source: "isString\x0a\x09^ true",
  14924. referencedClasses: [],
  14925. messageSends: []
  14926. }),
  14927. $globals.String);
  14928. $core.addMethod(
  14929. $core.method({
  14930. selector: "isVowel",
  14931. protocol: 'testing',
  14932. fn: function (){
  14933. var self=this;
  14934. return $core.withContext(function($ctx1) {
  14935. return $recv($recv(self._size()).__eq((1)))._and_((function(){
  14936. return $core.withContext(function($ctx2) {
  14937. return "aeiou"._includes_(self._asLowercase());
  14938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14939. }));
  14940. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  14941. },
  14942. args: [],
  14943. 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 ]",
  14944. referencedClasses: [],
  14945. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  14946. }),
  14947. $globals.String);
  14948. $core.addMethod(
  14949. $core.method({
  14950. selector: "join:",
  14951. protocol: 'split join',
  14952. fn: function (aCollection){
  14953. var self=this;
  14954. return $core.withContext(function($ctx1) {
  14955. return $recv($globals.String)._streamContents_((function(stream){
  14956. return $core.withContext(function($ctx2) {
  14957. return $recv(aCollection)._do_separatedBy_((function(each){
  14958. return $core.withContext(function($ctx3) {
  14959. return $recv(stream)._nextPutAll_($recv(each)._asString());
  14960. $ctx3.sendIdx["nextPutAll:"]=1;
  14961. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14962. }),(function(){
  14963. return $core.withContext(function($ctx3) {
  14964. return $recv(stream)._nextPutAll_(self);
  14965. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  14966. }));
  14967. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14968. }));
  14969. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  14970. },
  14971. args: ["aCollection"],
  14972. 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 ]]",
  14973. referencedClasses: ["String"],
  14974. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  14975. }),
  14976. $globals.String);
  14977. $core.addMethod(
  14978. $core.method({
  14979. selector: "lineIndicesDo:",
  14980. protocol: 'split join',
  14981. fn: function (aBlock){
  14982. var self=this;
  14983. var cr,lf,start,sz,nextLF,nextCR;
  14984. return $core.withContext(function($ctx1) {
  14985. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  14986. var $early={};
  14987. try {
  14988. start=(1);
  14989. sz=self._size();
  14990. cr=$recv($globals.String)._cr();
  14991. nextCR=self._indexOf_startingAt_(cr,(1));
  14992. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  14993. lf=$recv($globals.String)._lf();
  14994. nextLF=self._indexOf_startingAt_(lf,(1));
  14995. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  14996. $recv((function(){
  14997. return $core.withContext(function($ctx2) {
  14998. return $recv(start).__lt_eq(sz);
  14999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15000. }))._whileTrue_((function(){
  15001. return $core.withContext(function($ctx2) {
  15002. $2=$recv(nextLF).__eq((0));
  15003. $ctx2.sendIdx["="]=1;
  15004. $1=$recv($2)._and_((function(){
  15005. return $core.withContext(function($ctx3) {
  15006. return $recv(nextCR).__eq((0));
  15007. $ctx3.sendIdx["="]=2;
  15008. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  15009. }));
  15010. $ctx2.sendIdx["and:"]=1;
  15011. if($core.assert($1)){
  15012. $recv(aBlock)._value_value_value_(start,sz,sz);
  15013. $ctx2.sendIdx["value:value:value:"]=1;
  15014. throw $early=[self];
  15015. };
  15016. $4=$recv(nextCR).__eq((0));
  15017. $ctx2.sendIdx["="]=3;
  15018. $3=$recv($4)._or_((function(){
  15019. return $core.withContext(function($ctx3) {
  15020. $5=(0).__lt(nextLF);
  15021. $ctx3.sendIdx["<"]=1;
  15022. return $recv($5)._and_((function(){
  15023. return $core.withContext(function($ctx4) {
  15024. return $recv(nextLF).__lt(nextCR);
  15025. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  15026. }));
  15027. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  15028. }));
  15029. if($core.assert($3)){
  15030. $6=start;
  15031. $7=$recv(nextLF).__minus((1));
  15032. $ctx2.sendIdx["-"]=1;
  15033. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  15034. $ctx2.sendIdx["value:value:value:"]=2;
  15035. start=(1).__plus(nextLF);
  15036. $ctx2.sendIdx["+"]=1;
  15037. start;
  15038. nextLF=self._indexOf_startingAt_(lf,start);
  15039. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  15040. return nextLF;
  15041. } else {
  15042. $9=(1).__plus(nextCR);
  15043. $ctx2.sendIdx["+"]=2;
  15044. $8=$recv($9).__eq(nextLF);
  15045. if($core.assert($8)){
  15046. $10=start;
  15047. $11=$recv(nextCR).__minus((1));
  15048. $ctx2.sendIdx["-"]=2;
  15049. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  15050. $ctx2.sendIdx["value:value:value:"]=3;
  15051. start=(1).__plus(nextLF);
  15052. $ctx2.sendIdx["+"]=3;
  15053. start;
  15054. nextCR=self._indexOf_startingAt_(cr,start);
  15055. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  15056. nextCR;
  15057. nextLF=self._indexOf_startingAt_(lf,start);
  15058. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  15059. return nextLF;
  15060. } else {
  15061. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  15062. start=(1).__plus(nextCR);
  15063. start;
  15064. nextCR=self._indexOf_startingAt_(cr,start);
  15065. return nextCR;
  15066. };
  15067. };
  15068. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15069. }));
  15070. return self;
  15071. }
  15072. catch(e) {if(e===$early)return e[0]; throw e}
  15073. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  15074. },
  15075. args: ["aBlock"],
  15076. 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 ] ]]",
  15077. referencedClasses: ["String"],
  15078. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  15079. }),
  15080. $globals.String);
  15081. $core.addMethod(
  15082. $core.method({
  15083. selector: "lineNumber:",
  15084. protocol: 'split join',
  15085. fn: function (anIndex){
  15086. var self=this;
  15087. var lineCount;
  15088. return $core.withContext(function($ctx1) {
  15089. var $2,$1;
  15090. var $early={};
  15091. try {
  15092. lineCount=(0);
  15093. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  15094. return $core.withContext(function($ctx2) {
  15095. lineCount=$recv(lineCount).__plus((1));
  15096. $2=lineCount;
  15097. $1=$recv($2).__eq(anIndex);
  15098. if($core.assert($1)){
  15099. throw $early=[self._copyFrom_to_(start,endWithoutDelimiters)];
  15100. };
  15101. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  15102. }));
  15103. return nil;
  15104. }
  15105. catch(e) {if(e===$early)return e[0]; throw e}
  15106. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  15107. },
  15108. args: ["anIndex"],
  15109. 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",
  15110. referencedClasses: [],
  15111. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  15112. }),
  15113. $globals.String);
  15114. $core.addMethod(
  15115. $core.method({
  15116. selector: "lines",
  15117. protocol: 'split join',
  15118. fn: function (){
  15119. var self=this;
  15120. return $core.withContext(function($ctx1) {
  15121. var result = self.split(/\r\n|\r|\n/);
  15122. if (!result[result.length-1]) result.pop();
  15123. return result;;
  15124. return self;
  15125. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  15126. },
  15127. args: [],
  15128. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a<\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;\x0a>",
  15129. referencedClasses: [],
  15130. messageSends: []
  15131. }),
  15132. $globals.String);
  15133. $core.addMethod(
  15134. $core.method({
  15135. selector: "linesDo:",
  15136. protocol: 'split join',
  15137. fn: function (aBlock){
  15138. var self=this;
  15139. return $core.withContext(function($ctx1) {
  15140. $recv(self._lines())._do_(aBlock);
  15141. return self;
  15142. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  15143. },
  15144. args: ["aBlock"],
  15145. 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",
  15146. referencedClasses: [],
  15147. messageSends: ["do:", "lines"]
  15148. }),
  15149. $globals.String);
  15150. $core.addMethod(
  15151. $core.method({
  15152. selector: "match:",
  15153. protocol: 'regular expressions',
  15154. fn: function (aRegexp){
  15155. var self=this;
  15156. return $core.withContext(function($ctx1) {
  15157. return self.search(aRegexp) != -1;
  15158. return self;
  15159. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  15160. },
  15161. args: ["aRegexp"],
  15162. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  15163. referencedClasses: [],
  15164. messageSends: []
  15165. }),
  15166. $globals.String);
  15167. $core.addMethod(
  15168. $core.method({
  15169. selector: "matchesOf:",
  15170. protocol: 'regular expressions',
  15171. fn: function (aRegularExpression){
  15172. var self=this;
  15173. return $core.withContext(function($ctx1) {
  15174. return self.match(aRegularExpression);
  15175. return self;
  15176. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  15177. },
  15178. args: ["aRegularExpression"],
  15179. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  15180. referencedClasses: [],
  15181. messageSends: []
  15182. }),
  15183. $globals.String);
  15184. $core.addMethod(
  15185. $core.method({
  15186. selector: "numericallyIndexable",
  15187. protocol: 'private',
  15188. fn: function (){
  15189. var self=this;
  15190. return $core.withContext(function($ctx1) {
  15191. return String(self);
  15192. return self;
  15193. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  15194. },
  15195. args: [],
  15196. source: "numericallyIndexable\x0a\x09<return String(self)>",
  15197. referencedClasses: [],
  15198. messageSends: []
  15199. }),
  15200. $globals.String);
  15201. $core.addMethod(
  15202. $core.method({
  15203. selector: "printNl",
  15204. protocol: 'printing',
  15205. fn: function (){
  15206. var self=this;
  15207. return $core.withContext(function($ctx1) {
  15208. console.log(self);
  15209. return self;
  15210. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  15211. },
  15212. args: [],
  15213. source: "printNl\x0a\x09<console.log(self)>",
  15214. referencedClasses: [],
  15215. messageSends: []
  15216. }),
  15217. $globals.String);
  15218. $core.addMethod(
  15219. $core.method({
  15220. selector: "printOn:",
  15221. protocol: 'printing',
  15222. fn: function (aStream){
  15223. var self=this;
  15224. return $core.withContext(function($ctx1) {
  15225. $recv(aStream)._nextPutAll_("'");
  15226. $ctx1.sendIdx["nextPutAll:"]=1;
  15227. $recv(aStream)._nextPutAll_(self);
  15228. $ctx1.sendIdx["nextPutAll:"]=2;
  15229. $recv(aStream)._nextPutAll_("'");
  15230. return self;
  15231. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  15232. },
  15233. args: ["aStream"],
  15234. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  15235. referencedClasses: [],
  15236. messageSends: ["nextPutAll:"]
  15237. }),
  15238. $globals.String);
  15239. $core.addMethod(
  15240. $core.method({
  15241. selector: "replace:with:",
  15242. protocol: 'regular expressions',
  15243. fn: function (aString,anotherString){
  15244. var self=this;
  15245. return $core.withContext(function($ctx1) {
  15246. return self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  15247. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  15248. },
  15249. args: ["aString", "anotherString"],
  15250. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  15251. referencedClasses: ["RegularExpression"],
  15252. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  15253. }),
  15254. $globals.String);
  15255. $core.addMethod(
  15256. $core.method({
  15257. selector: "replaceRegexp:with:",
  15258. protocol: 'regular expressions',
  15259. fn: function (aRegexp,aString){
  15260. var self=this;
  15261. return $core.withContext(function($ctx1) {
  15262. return self.replace(aRegexp, aString);
  15263. return self;
  15264. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  15265. },
  15266. args: ["aRegexp", "aString"],
  15267. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  15268. referencedClasses: [],
  15269. messageSends: []
  15270. }),
  15271. $globals.String);
  15272. $core.addMethod(
  15273. $core.method({
  15274. selector: "reversed",
  15275. protocol: 'converting',
  15276. fn: function (){
  15277. var self=this;
  15278. return $core.withContext(function($ctx1) {
  15279. return self.split("").reverse().join("");
  15280. return self;
  15281. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  15282. },
  15283. args: [],
  15284. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  15285. referencedClasses: [],
  15286. messageSends: []
  15287. }),
  15288. $globals.String);
  15289. $core.addMethod(
  15290. $core.method({
  15291. selector: "shallowCopy",
  15292. protocol: 'copying',
  15293. fn: function (){
  15294. var self=this;
  15295. return self;
  15296. },
  15297. args: [],
  15298. source: "shallowCopy\x0a\x09^ self",
  15299. referencedClasses: [],
  15300. messageSends: []
  15301. }),
  15302. $globals.String);
  15303. $core.addMethod(
  15304. $core.method({
  15305. selector: "size",
  15306. protocol: 'accessing',
  15307. fn: function (){
  15308. var self=this;
  15309. return $core.withContext(function($ctx1) {
  15310. return self.length;
  15311. return self;
  15312. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  15313. },
  15314. args: [],
  15315. source: "size\x0a\x09<return self.length>",
  15316. referencedClasses: [],
  15317. messageSends: []
  15318. }),
  15319. $globals.String);
  15320. $core.addMethod(
  15321. $core.method({
  15322. selector: "subStrings:",
  15323. protocol: 'split join',
  15324. fn: function (aString){
  15325. var self=this;
  15326. return $core.withContext(function($ctx1) {
  15327. return self._tokenize_(aString);
  15328. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  15329. },
  15330. args: ["aString"],
  15331. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  15332. referencedClasses: [],
  15333. messageSends: ["tokenize:"]
  15334. }),
  15335. $globals.String);
  15336. $core.addMethod(
  15337. $core.method({
  15338. selector: "tokenize:",
  15339. protocol: 'split join',
  15340. fn: function (aString){
  15341. var self=this;
  15342. return $core.withContext(function($ctx1) {
  15343. return self.split(aString);
  15344. return self;
  15345. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  15346. },
  15347. args: ["aString"],
  15348. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  15349. referencedClasses: [],
  15350. messageSends: []
  15351. }),
  15352. $globals.String);
  15353. $core.addMethod(
  15354. $core.method({
  15355. selector: "trimBoth",
  15356. protocol: 'regular expressions',
  15357. fn: function (){
  15358. var self=this;
  15359. return $core.withContext(function($ctx1) {
  15360. return self._trimBoth_("\x5cs");
  15361. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  15362. },
  15363. args: [],
  15364. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  15365. referencedClasses: [],
  15366. messageSends: ["trimBoth:"]
  15367. }),
  15368. $globals.String);
  15369. $core.addMethod(
  15370. $core.method({
  15371. selector: "trimBoth:",
  15372. protocol: 'regular expressions',
  15373. fn: function (separators){
  15374. var self=this;
  15375. return $core.withContext(function($ctx1) {
  15376. return $recv(self._trimLeft_(separators))._trimRight_(separators);
  15377. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  15378. },
  15379. args: ["separators"],
  15380. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  15381. referencedClasses: [],
  15382. messageSends: ["trimRight:", "trimLeft:"]
  15383. }),
  15384. $globals.String);
  15385. $core.addMethod(
  15386. $core.method({
  15387. selector: "trimLeft",
  15388. protocol: 'regular expressions',
  15389. fn: function (){
  15390. var self=this;
  15391. return $core.withContext(function($ctx1) {
  15392. return self._trimLeft_("\x5cs");
  15393. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  15394. },
  15395. args: [],
  15396. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  15397. referencedClasses: [],
  15398. messageSends: ["trimLeft:"]
  15399. }),
  15400. $globals.String);
  15401. $core.addMethod(
  15402. $core.method({
  15403. selector: "trimLeft:",
  15404. protocol: 'regular expressions',
  15405. fn: function (separators){
  15406. var self=this;
  15407. return $core.withContext(function($ctx1) {
  15408. var $2,$1;
  15409. $2=$recv("^[".__comma(separators)).__comma("]+");
  15410. $ctx1.sendIdx[","]=1;
  15411. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  15412. return self._replaceRegexp_with_($1,"");
  15413. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  15414. },
  15415. args: ["separators"],
  15416. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  15417. referencedClasses: ["RegularExpression"],
  15418. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15419. }),
  15420. $globals.String);
  15421. $core.addMethod(
  15422. $core.method({
  15423. selector: "trimRight",
  15424. protocol: 'regular expressions',
  15425. fn: function (){
  15426. var self=this;
  15427. return $core.withContext(function($ctx1) {
  15428. return self._trimRight_("\x5cs");
  15429. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  15430. },
  15431. args: [],
  15432. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  15433. referencedClasses: [],
  15434. messageSends: ["trimRight:"]
  15435. }),
  15436. $globals.String);
  15437. $core.addMethod(
  15438. $core.method({
  15439. selector: "trimRight:",
  15440. protocol: 'regular expressions',
  15441. fn: function (separators){
  15442. var self=this;
  15443. return $core.withContext(function($ctx1) {
  15444. var $2,$1;
  15445. $2=$recv("[".__comma(separators)).__comma("]+$");
  15446. $ctx1.sendIdx[","]=1;
  15447. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  15448. return self._replaceRegexp_with_($1,"");
  15449. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  15450. },
  15451. args: ["separators"],
  15452. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  15453. referencedClasses: ["RegularExpression"],
  15454. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15455. }),
  15456. $globals.String);
  15457. $core.addMethod(
  15458. $core.method({
  15459. selector: "unescaped",
  15460. protocol: 'converting',
  15461. fn: function (){
  15462. var self=this;
  15463. return $core.withContext(function($ctx1) {
  15464. return unescape(self);
  15465. return self;
  15466. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  15467. },
  15468. args: [],
  15469. source: "unescaped\x0a\x09<return unescape(self)>",
  15470. referencedClasses: [],
  15471. messageSends: []
  15472. }),
  15473. $globals.String);
  15474. $core.addMethod(
  15475. $core.method({
  15476. selector: "uriComponentDecoded",
  15477. protocol: 'converting',
  15478. fn: function (){
  15479. var self=this;
  15480. return $core.withContext(function($ctx1) {
  15481. return decodeURIComponent(self);
  15482. return self;
  15483. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  15484. },
  15485. args: [],
  15486. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  15487. referencedClasses: [],
  15488. messageSends: []
  15489. }),
  15490. $globals.String);
  15491. $core.addMethod(
  15492. $core.method({
  15493. selector: "uriComponentEncoded",
  15494. protocol: 'converting',
  15495. fn: function (){
  15496. var self=this;
  15497. return $core.withContext(function($ctx1) {
  15498. return encodeURIComponent(self);
  15499. return self;
  15500. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  15501. },
  15502. args: [],
  15503. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  15504. referencedClasses: [],
  15505. messageSends: []
  15506. }),
  15507. $globals.String);
  15508. $core.addMethod(
  15509. $core.method({
  15510. selector: "uriDecoded",
  15511. protocol: 'converting',
  15512. fn: function (){
  15513. var self=this;
  15514. return $core.withContext(function($ctx1) {
  15515. return decodeURI(self);
  15516. return self;
  15517. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  15518. },
  15519. args: [],
  15520. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  15521. referencedClasses: [],
  15522. messageSends: []
  15523. }),
  15524. $globals.String);
  15525. $core.addMethod(
  15526. $core.method({
  15527. selector: "uriEncoded",
  15528. protocol: 'converting',
  15529. fn: function (){
  15530. var self=this;
  15531. return $core.withContext(function($ctx1) {
  15532. return encodeURI(self);
  15533. return self;
  15534. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  15535. },
  15536. args: [],
  15537. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  15538. referencedClasses: [],
  15539. messageSends: []
  15540. }),
  15541. $globals.String);
  15542. $core.addMethod(
  15543. $core.method({
  15544. selector: "value:",
  15545. protocol: 'evaluating',
  15546. fn: function (anObject){
  15547. var self=this;
  15548. return $core.withContext(function($ctx1) {
  15549. return $recv(anObject)._perform_(self);
  15550. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  15551. },
  15552. args: ["anObject"],
  15553. source: "value: anObject \x0a\x09^ anObject perform: self",
  15554. referencedClasses: [],
  15555. messageSends: ["perform:"]
  15556. }),
  15557. $globals.String);
  15558. $core.addMethod(
  15559. $core.method({
  15560. selector: "cr",
  15561. protocol: 'accessing',
  15562. fn: function (){
  15563. var self=this;
  15564. return $core.withContext(function($ctx1) {
  15565. return '\r';
  15566. return self;
  15567. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  15568. },
  15569. args: [],
  15570. source: "cr\x0a\x09<return '\x5cr'>",
  15571. referencedClasses: [],
  15572. messageSends: []
  15573. }),
  15574. $globals.String.klass);
  15575. $core.addMethod(
  15576. $core.method({
  15577. selector: "crlf",
  15578. protocol: 'accessing',
  15579. fn: function (){
  15580. var self=this;
  15581. return $core.withContext(function($ctx1) {
  15582. return '\r\n';
  15583. return self;
  15584. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  15585. },
  15586. args: [],
  15587. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  15588. referencedClasses: [],
  15589. messageSends: []
  15590. }),
  15591. $globals.String.klass);
  15592. $core.addMethod(
  15593. $core.method({
  15594. selector: "esc",
  15595. protocol: 'accessing',
  15596. fn: function (){
  15597. var self=this;
  15598. return $core.withContext(function($ctx1) {
  15599. return self._fromCharCode_((27));
  15600. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  15601. },
  15602. args: [],
  15603. source: "esc\x0a\x09^ self fromCharCode: 27",
  15604. referencedClasses: [],
  15605. messageSends: ["fromCharCode:"]
  15606. }),
  15607. $globals.String.klass);
  15608. $core.addMethod(
  15609. $core.method({
  15610. selector: "fromCharCode:",
  15611. protocol: 'instance creation',
  15612. fn: function (anInteger){
  15613. var self=this;
  15614. return $core.withContext(function($ctx1) {
  15615. return String.fromCharCode(anInteger);
  15616. return self;
  15617. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  15618. },
  15619. args: ["anInteger"],
  15620. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  15621. referencedClasses: [],
  15622. messageSends: []
  15623. }),
  15624. $globals.String.klass);
  15625. $core.addMethod(
  15626. $core.method({
  15627. selector: "fromString:",
  15628. protocol: 'instance creation',
  15629. fn: function (aString){
  15630. var self=this;
  15631. return $core.withContext(function($ctx1) {
  15632. return String(aString);
  15633. return self;
  15634. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  15635. },
  15636. args: ["aString"],
  15637. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  15638. referencedClasses: [],
  15639. messageSends: []
  15640. }),
  15641. $globals.String.klass);
  15642. $core.addMethod(
  15643. $core.method({
  15644. selector: "lf",
  15645. protocol: 'accessing',
  15646. fn: function (){
  15647. var self=this;
  15648. return $core.withContext(function($ctx1) {
  15649. return '\n';
  15650. return self;
  15651. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  15652. },
  15653. args: [],
  15654. source: "lf\x0a\x09<return '\x5cn'>",
  15655. referencedClasses: [],
  15656. messageSends: []
  15657. }),
  15658. $globals.String.klass);
  15659. $core.addMethod(
  15660. $core.method({
  15661. selector: "random",
  15662. protocol: 'random',
  15663. fn: function (){
  15664. var self=this;
  15665. return $core.withContext(function($ctx1) {
  15666. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  15667. return self;
  15668. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  15669. },
  15670. args: [],
  15671. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);>",
  15672. referencedClasses: [],
  15673. messageSends: []
  15674. }),
  15675. $globals.String.klass);
  15676. $core.addMethod(
  15677. $core.method({
  15678. selector: "randomNotIn:",
  15679. protocol: 'random',
  15680. fn: function (aString){
  15681. var self=this;
  15682. var result;
  15683. return $core.withContext(function($ctx1) {
  15684. $recv((function(){
  15685. return $core.withContext(function($ctx2) {
  15686. result=self._random();
  15687. result;
  15688. return $recv(aString)._includesSubString_(result);
  15689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15690. }))._whileTrue();
  15691. return result;
  15692. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  15693. },
  15694. args: ["aString"],
  15695. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  15696. referencedClasses: [],
  15697. messageSends: ["whileTrue", "random", "includesSubString:"]
  15698. }),
  15699. $globals.String.klass);
  15700. $core.addMethod(
  15701. $core.method({
  15702. selector: "space",
  15703. protocol: 'accessing',
  15704. fn: function (){
  15705. var self=this;
  15706. return $core.withContext(function($ctx1) {
  15707. return ' ';
  15708. return self;
  15709. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  15710. },
  15711. args: [],
  15712. source: "space\x0a\x09<return ' '>",
  15713. referencedClasses: [],
  15714. messageSends: []
  15715. }),
  15716. $globals.String.klass);
  15717. $core.addMethod(
  15718. $core.method({
  15719. selector: "streamClass",
  15720. protocol: 'accessing',
  15721. fn: function (){
  15722. var self=this;
  15723. return $globals.StringStream;
  15724. },
  15725. args: [],
  15726. source: "streamClass\x0a\x09\x09^ StringStream",
  15727. referencedClasses: ["StringStream"],
  15728. messageSends: []
  15729. }),
  15730. $globals.String.klass);
  15731. $core.addMethod(
  15732. $core.method({
  15733. selector: "tab",
  15734. protocol: 'accessing',
  15735. fn: function (){
  15736. var self=this;
  15737. return $core.withContext(function($ctx1) {
  15738. return '\t';
  15739. return self;
  15740. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  15741. },
  15742. args: [],
  15743. source: "tab\x0a\x09<return '\x5ct'>",
  15744. referencedClasses: [],
  15745. messageSends: []
  15746. }),
  15747. $globals.String.klass);
  15748. $core.addMethod(
  15749. $core.method({
  15750. selector: "value:",
  15751. protocol: 'instance creation',
  15752. fn: function (aUTFCharCode){
  15753. var self=this;
  15754. return $core.withContext(function($ctx1) {
  15755. return String.fromCharCode(aUTFCharCode);;
  15756. return self;
  15757. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  15758. },
  15759. args: ["aUTFCharCode"],
  15760. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  15761. referencedClasses: [],
  15762. messageSends: []
  15763. }),
  15764. $globals.String.klass);
  15765. $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  15766. $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`.";
  15767. $core.addMethod(
  15768. $core.method({
  15769. selector: "=",
  15770. protocol: 'comparing',
  15771. fn: function (aCollection){
  15772. var self=this;
  15773. return $core.withContext(function($ctx1) {
  15774. var $2,$1,$4,$3,$5;
  15775. var $early={};
  15776. try {
  15777. $2=self._class();
  15778. $ctx1.sendIdx["class"]=1;
  15779. $1=$recv($2).__eq($recv(aCollection)._class());
  15780. $ctx1.sendIdx["="]=1;
  15781. if(!$core.assert($1)){
  15782. return false;
  15783. };
  15784. $4=self._size();
  15785. $ctx1.sendIdx["size"]=1;
  15786. $3=$recv($4).__eq($recv(aCollection)._size());
  15787. if(!$core.assert($3)){
  15788. return false;
  15789. };
  15790. self._do_((function(each){
  15791. return $core.withContext(function($ctx2) {
  15792. $5=$recv(aCollection)._includes_(each);
  15793. if(!$core.assert($5)){
  15794. throw $early=[false];
  15795. };
  15796. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15797. }));
  15798. return true;
  15799. }
  15800. catch(e) {if(e===$early)return e[0]; throw e}
  15801. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  15802. },
  15803. args: ["aCollection"],
  15804. 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",
  15805. referencedClasses: [],
  15806. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  15807. }),
  15808. $globals.Set);
  15809. $core.addMethod(
  15810. $core.method({
  15811. selector: "add:",
  15812. protocol: 'adding/removing',
  15813. fn: function (anObject){
  15814. var self=this;
  15815. var bucket;
  15816. return $core.withContext(function($ctx1) {
  15817. var $1,$receiver;
  15818. bucket=self._bucketsOfElement_(anObject);
  15819. $1=$recv(bucket)._second();
  15820. if(($receiver = $1) == null || $receiver.isNil){
  15821. var object,slowBucket;
  15822. object=$recv(bucket)._first();
  15823. $ctx1.sendIdx["first"]=1;
  15824. object;
  15825. slowBucket=$recv(bucket)._third();
  15826. slowBucket;
  15827. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  15828. return $core.withContext(function($ctx2) {
  15829. $recv(slowBucket)._add_(object);
  15830. self["@size"]=$recv(self["@size"]).__plus((1));
  15831. return self["@size"];
  15832. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15833. }));
  15834. return object;
  15835. } else {
  15836. var primitiveBucket;
  15837. primitiveBucket=$receiver;
  15838. return self._add_in_($recv(bucket)._first(),primitiveBucket);
  15839. };
  15840. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  15841. },
  15842. args: ["anObject"],
  15843. 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 ]",
  15844. referencedClasses: [],
  15845. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  15846. }),
  15847. $globals.Set);
  15848. $core.addMethod(
  15849. $core.method({
  15850. selector: "add:in:",
  15851. protocol: 'private',
  15852. fn: function (anObject,anotherObject){
  15853. var self=this;
  15854. return $core.withContext(function($ctx1) {
  15855. if (anObject in anotherObject.store) { return false; }
  15856. self['@size']++;
  15857. anotherObject.store[anObject] = true;
  15858. return anObject;
  15859. ;
  15860. return self;
  15861. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  15862. },
  15863. args: ["anObject", "anotherObject"],
  15864. source: "add: anObject in: anotherObject\x0a\x09<\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>",
  15865. referencedClasses: [],
  15866. messageSends: []
  15867. }),
  15868. $globals.Set);
  15869. $core.addMethod(
  15870. $core.method({
  15871. selector: "bucketsOfElement:",
  15872. protocol: 'private',
  15873. fn: function (anObject){
  15874. var self=this;
  15875. return $core.withContext(function($ctx1) {
  15876. // include nil to well-known objects under 'boolean' fastBucket
  15877. if (anObject == null || anObject.isNil) return [ null, self['@fastBuckets'].boolean ];
  15878. var prim = anObject.valueOf();
  15879. if (typeof prim === "object" || typeof prim === "function" || !self['@fastBuckets'][typeof prim]) {
  15880. var bucket = null;
  15881. self['@slowBucketStores'].some(function (store) {
  15882. return bucket = store._bucketOfElement_(anObject);
  15883. });
  15884. return [ anObject, null, bucket || self['@defaultBucket'] ];
  15885. }
  15886. return [ prim, self['@fastBuckets'][typeof prim] ];
  15887. ;
  15888. return self;
  15889. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  15890. },
  15891. args: ["anObject"],
  15892. 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<\x0a\x09\x09// include nil to well-known objects under 'boolean' 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>",
  15893. referencedClasses: [],
  15894. messageSends: []
  15895. }),
  15896. $globals.Set);
  15897. $core.addMethod(
  15898. $core.method({
  15899. selector: "classNameOf:",
  15900. protocol: 'private',
  15901. fn: function (anObject){
  15902. var self=this;
  15903. return $core.withContext(function($ctx1) {
  15904. return anObject.klass != null && anObject.klass.className;
  15905. return self;
  15906. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  15907. },
  15908. args: ["anObject"],
  15909. 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<return anObject.klass != null && anObject.klass.className>",
  15910. referencedClasses: [],
  15911. messageSends: []
  15912. }),
  15913. $globals.Set);
  15914. $core.addMethod(
  15915. $core.method({
  15916. selector: "collect:",
  15917. protocol: 'enumerating',
  15918. fn: function (aBlock){
  15919. var self=this;
  15920. var collection;
  15921. return $core.withContext(function($ctx1) {
  15922. collection=$recv(self._class())._new();
  15923. self._do_((function(each){
  15924. return $core.withContext(function($ctx2) {
  15925. return $recv(collection)._add_($recv(aBlock)._value_(each));
  15926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15927. }));
  15928. return collection;
  15929. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  15930. },
  15931. args: ["aBlock"],
  15932. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  15933. referencedClasses: [],
  15934. messageSends: ["new", "class", "do:", "add:", "value:"]
  15935. }),
  15936. $globals.Set);
  15937. $core.addMethod(
  15938. $core.method({
  15939. selector: "detect:ifNone:",
  15940. protocol: 'enumerating',
  15941. fn: function (aBlock,anotherBlock){
  15942. var self=this;
  15943. return $core.withContext(function($ctx1) {
  15944. var $1;
  15945. var $early={};
  15946. try {
  15947. self._do_((function(each){
  15948. return $core.withContext(function($ctx2) {
  15949. $1=$recv(aBlock)._value_(each);
  15950. if($core.assert($1)){
  15951. throw $early=[each];
  15952. };
  15953. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15954. }));
  15955. return $recv(anotherBlock)._value();
  15956. }
  15957. catch(e) {if(e===$early)return e[0]; throw e}
  15958. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  15959. },
  15960. args: ["aBlock", "anotherBlock"],
  15961. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  15962. referencedClasses: [],
  15963. messageSends: ["do:", "ifTrue:", "value:", "value"]
  15964. }),
  15965. $globals.Set);
  15966. $core.addMethod(
  15967. $core.method({
  15968. selector: "do:",
  15969. protocol: 'enumerating',
  15970. fn: function (aBlock){
  15971. var self=this;
  15972. return $core.withContext(function($ctx1) {
  15973. var el, keys, i;
  15974. el = self['@fastBuckets'];
  15975. keys = Object.keys(el);
  15976. for (i = 0; i < keys.length; ++i) {
  15977. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  15978. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  15979. else { store._do_(aBlock); }
  15980. }
  15981. el = self['@slowBucketStores'];
  15982. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  15983. self['@defaultBucket']._do_(aBlock);
  15984. ;
  15985. return self;
  15986. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  15987. },
  15988. args: ["aBlock"],
  15989. source: "do: aBlock\x0a\x09<\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>",
  15990. referencedClasses: [],
  15991. messageSends: []
  15992. }),
  15993. $globals.Set);
  15994. $core.addMethod(
  15995. $core.method({
  15996. selector: "includes:",
  15997. protocol: 'testing',
  15998. fn: function (anObject){
  15999. var self=this;
  16000. var bucket;
  16001. return $core.withContext(function($ctx1) {
  16002. var $1,$2,$3,$receiver;
  16003. bucket=self._bucketsOfElement_(anObject);
  16004. $1=$recv(bucket)._second();
  16005. if(($receiver = $1) == null || $receiver.isNil){
  16006. $2=$recv(bucket)._third();
  16007. $3=$recv(bucket)._first();
  16008. $ctx1.sendIdx["first"]=1;
  16009. return $recv($2)._includes_($3);
  16010. } else {
  16011. var primitiveBucket;
  16012. primitiveBucket=$receiver;
  16013. return self._includes_in_($recv(bucket)._first(),primitiveBucket);
  16014. };
  16015. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  16016. },
  16017. args: ["anObject"],
  16018. 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 ]",
  16019. referencedClasses: [],
  16020. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  16021. }),
  16022. $globals.Set);
  16023. $core.addMethod(
  16024. $core.method({
  16025. selector: "includes:in:",
  16026. protocol: 'private',
  16027. fn: function (anObject,anotherObject){
  16028. var self=this;
  16029. return $core.withContext(function($ctx1) {
  16030. return anObject in anotherObject.store;
  16031. return self;
  16032. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16033. },
  16034. args: ["anObject", "anotherObject"],
  16035. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  16036. referencedClasses: [],
  16037. messageSends: []
  16038. }),
  16039. $globals.Set);
  16040. $core.addMethod(
  16041. $core.method({
  16042. selector: "initialize",
  16043. protocol: 'initialization',
  16044. fn: function (){
  16045. var self=this;
  16046. return $core.withContext(function($ctx1) {
  16047. (
  16048. $ctx1.supercall = true,
  16049. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  16050. $ctx1.supercall = false;
  16051. self["@defaultBucket"]=[];
  16052. self._initializeSlowBucketStores();
  16053. self._removeAll();
  16054. return self;
  16055. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  16056. },
  16057. args: [],
  16058. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  16059. referencedClasses: [],
  16060. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  16061. }),
  16062. $globals.Set);
  16063. $core.addMethod(
  16064. $core.method({
  16065. selector: "initializeSlowBucketStores",
  16066. protocol: 'initialization',
  16067. fn: function (){
  16068. var self=this;
  16069. return $core.withContext(function($ctx1) {
  16070. var $1;
  16071. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  16072. return $core.withContext(function($ctx2) {
  16073. return self._classNameOf_(x);
  16074. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  16075. }));
  16076. $ctx1.sendIdx["hashBlock:"]=1;
  16077. self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  16078. return $core.withContext(function($ctx2) {
  16079. return self._jsConstructorNameOf_(x);
  16080. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  16081. }))];
  16082. return self;
  16083. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  16084. },
  16085. args: [],
  16086. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  16087. referencedClasses: ["ArrayBucketStore"],
  16088. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  16089. }),
  16090. $globals.Set);
  16091. $core.addMethod(
  16092. $core.method({
  16093. selector: "jsConstructorNameOf:",
  16094. protocol: 'private',
  16095. fn: function (anObject){
  16096. var self=this;
  16097. return $core.withContext(function($ctx1) {
  16098. return anObject.constructor && anObject.constructor.name;
  16099. return self;
  16100. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  16101. },
  16102. args: ["anObject"],
  16103. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  16104. referencedClasses: [],
  16105. messageSends: []
  16106. }),
  16107. $globals.Set);
  16108. $core.addMethod(
  16109. $core.method({
  16110. selector: "printOn:",
  16111. protocol: 'printing',
  16112. fn: function (aStream){
  16113. var self=this;
  16114. return $core.withContext(function($ctx1) {
  16115. (
  16116. $ctx1.supercall = true,
  16117. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  16118. $ctx1.supercall = false;
  16119. $ctx1.sendIdx["printOn:"]=1;
  16120. $recv(aStream)._nextPutAll_(" (");
  16121. $ctx1.sendIdx["nextPutAll:"]=1;
  16122. self._do_separatedBy_((function(each){
  16123. return $core.withContext(function($ctx2) {
  16124. return $recv(each)._printOn_(aStream);
  16125. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16126. }),(function(){
  16127. return $core.withContext(function($ctx2) {
  16128. return $recv(aStream)._nextPutAll_(" ");
  16129. $ctx2.sendIdx["nextPutAll:"]=2;
  16130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16131. }));
  16132. $recv(aStream)._nextPutAll_(")");
  16133. return self;
  16134. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  16135. },
  16136. args: ["aStream"],
  16137. 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: ')'",
  16138. referencedClasses: [],
  16139. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  16140. }),
  16141. $globals.Set);
  16142. $core.addMethod(
  16143. $core.method({
  16144. selector: "remove:ifAbsent:",
  16145. protocol: 'adding/removing',
  16146. fn: function (anObject,aBlock){
  16147. var self=this;
  16148. var bucket;
  16149. return $core.withContext(function($ctx1) {
  16150. var $1,$2,$3,$receiver;
  16151. var $early={};
  16152. try {
  16153. bucket=self._bucketsOfElement_(anObject);
  16154. $1=$recv(bucket)._second();
  16155. if(($receiver = $1) == null || $receiver.isNil){
  16156. $2=$recv(bucket)._third();
  16157. $3=$recv(bucket)._first();
  16158. $ctx1.sendIdx["first"]=1;
  16159. $recv($2)._remove_ifAbsent_($3,(function(){
  16160. return $core.withContext(function($ctx2) {
  16161. throw $early=[$recv(aBlock)._value()];
  16162. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16163. }));
  16164. self["@size"]=$recv(self["@size"]).__minus((1));
  16165. return self["@size"];
  16166. } else {
  16167. var primitiveBucket;
  16168. primitiveBucket=$receiver;
  16169. return self._remove_in_($recv(bucket)._first(),primitiveBucket);
  16170. };
  16171. }
  16172. catch(e) {if(e===$early)return e[0]; throw e}
  16173. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  16174. },
  16175. args: ["anObject", "aBlock"],
  16176. 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 ]",
  16177. referencedClasses: [],
  16178. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  16179. }),
  16180. $globals.Set);
  16181. $core.addMethod(
  16182. $core.method({
  16183. selector: "remove:in:",
  16184. protocol: 'private',
  16185. fn: function (anObject,anotherObject){
  16186. var self=this;
  16187. return $core.withContext(function($ctx1) {
  16188. if (delete anotherObject.store[anObject]) self['@size']--;
  16189. return self;
  16190. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16191. },
  16192. args: ["anObject", "anotherObject"],
  16193. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  16194. referencedClasses: [],
  16195. messageSends: []
  16196. }),
  16197. $globals.Set);
  16198. $core.addMethod(
  16199. $core.method({
  16200. selector: "removeAll",
  16201. protocol: 'adding/removing',
  16202. fn: function (){
  16203. var self=this;
  16204. return $core.withContext(function($ctx1) {
  16205. self['@fastBuckets'] = {
  16206. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  16207. 'number': { store: Object.create(null), fn: Number },
  16208. 'string': { store: Object.create(null) }
  16209. };
  16210. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  16211. self['@defaultBucket']._removeAll();
  16212. self['@size'] = 0;
  16213. ;
  16214. return self;
  16215. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  16216. },
  16217. args: [],
  16218. source: "removeAll\x0a\x09<\x0a\x09\x09self['@fastBuckets'] = {\x0a\x09\x09\x09'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },\x0a\x09\x09\x09'number': { store: Object.create(null), fn: Number },\x0a\x09\x09\x09'string': { 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>",
  16219. referencedClasses: [],
  16220. messageSends: []
  16221. }),
  16222. $globals.Set);
  16223. $core.addMethod(
  16224. $core.method({
  16225. selector: "select:",
  16226. protocol: 'enumerating',
  16227. fn: function (aBlock){
  16228. var self=this;
  16229. var collection;
  16230. return $core.withContext(function($ctx1) {
  16231. var $1;
  16232. collection=$recv(self._class())._new();
  16233. self._do_((function(each){
  16234. return $core.withContext(function($ctx2) {
  16235. $1=$recv(aBlock)._value_(each);
  16236. if($core.assert($1)){
  16237. return $recv(collection)._add_(each);
  16238. };
  16239. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16240. }));
  16241. return collection;
  16242. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  16243. },
  16244. args: ["aBlock"],
  16245. 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",
  16246. referencedClasses: [],
  16247. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  16248. }),
  16249. $globals.Set);
  16250. $core.addMethod(
  16251. $core.method({
  16252. selector: "size",
  16253. protocol: 'accessing',
  16254. fn: function (){
  16255. var self=this;
  16256. return self["@size"];
  16257. },
  16258. args: [],
  16259. source: "size\x0a\x09^ size",
  16260. referencedClasses: [],
  16261. messageSends: []
  16262. }),
  16263. $globals.Set);
  16264. $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
  16265. $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.";
  16266. $core.addMethod(
  16267. $core.method({
  16268. selector: "<<",
  16269. protocol: 'writing',
  16270. fn: function (anObject){
  16271. var self=this;
  16272. return $core.withContext(function($ctx1) {
  16273. self._write_(anObject);
  16274. return self;
  16275. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  16276. },
  16277. args: ["anObject"],
  16278. source: "<< anObject\x0a\x09self write: anObject",
  16279. referencedClasses: [],
  16280. messageSends: ["write:"]
  16281. }),
  16282. $globals.ProtoStream);
  16283. $core.addMethod(
  16284. $core.method({
  16285. selector: "atEnd",
  16286. protocol: 'testing',
  16287. fn: function (){
  16288. var self=this;
  16289. return $core.withContext(function($ctx1) {
  16290. self._subclassResponsibility();
  16291. return self;
  16292. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  16293. },
  16294. args: [],
  16295. source: "atEnd\x0a\x09self subclassResponsibility",
  16296. referencedClasses: [],
  16297. messageSends: ["subclassResponsibility"]
  16298. }),
  16299. $globals.ProtoStream);
  16300. $core.addMethod(
  16301. $core.method({
  16302. selector: "atStart",
  16303. protocol: 'testing',
  16304. fn: function (){
  16305. var self=this;
  16306. return $core.withContext(function($ctx1) {
  16307. self._subclassResponsibility();
  16308. return self;
  16309. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  16310. },
  16311. args: [],
  16312. source: "atStart\x0a\x09self subclassResponsibility",
  16313. referencedClasses: [],
  16314. messageSends: ["subclassResponsibility"]
  16315. }),
  16316. $globals.ProtoStream);
  16317. $core.addMethod(
  16318. $core.method({
  16319. selector: "contents",
  16320. protocol: 'accessing',
  16321. fn: function (){
  16322. var self=this;
  16323. return $core.withContext(function($ctx1) {
  16324. self._subclassResponsibility();
  16325. return self;
  16326. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  16327. },
  16328. args: [],
  16329. source: "contents\x0a\x09self subclassResponsibility",
  16330. referencedClasses: [],
  16331. messageSends: ["subclassResponsibility"]
  16332. }),
  16333. $globals.ProtoStream);
  16334. $core.addMethod(
  16335. $core.method({
  16336. selector: "do:",
  16337. protocol: 'enumerating',
  16338. fn: function (aBlock){
  16339. var self=this;
  16340. return $core.withContext(function($ctx1) {
  16341. $recv((function(){
  16342. return $core.withContext(function($ctx2) {
  16343. return self._atEnd();
  16344. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16345. }))._whileFalse_((function(){
  16346. return $core.withContext(function($ctx2) {
  16347. return $recv(aBlock)._value_(self._next());
  16348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16349. }));
  16350. return self;
  16351. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  16352. },
  16353. args: ["aBlock"],
  16354. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  16355. referencedClasses: [],
  16356. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  16357. }),
  16358. $globals.ProtoStream);
  16359. $core.addMethod(
  16360. $core.method({
  16361. selector: "isEmpty",
  16362. protocol: 'testing',
  16363. fn: function (){
  16364. var self=this;
  16365. return $core.withContext(function($ctx1) {
  16366. return $recv(self._atStart())._and_((function(){
  16367. return $core.withContext(function($ctx2) {
  16368. return self._atEnd();
  16369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16370. }));
  16371. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  16372. },
  16373. args: [],
  16374. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  16375. referencedClasses: [],
  16376. messageSends: ["and:", "atStart", "atEnd"]
  16377. }),
  16378. $globals.ProtoStream);
  16379. $core.addMethod(
  16380. $core.method({
  16381. selector: "next",
  16382. protocol: 'reading',
  16383. fn: function (){
  16384. var self=this;
  16385. return $core.withContext(function($ctx1) {
  16386. var $1;
  16387. $1=self._atEnd();
  16388. if($core.assert($1)){
  16389. return nil;
  16390. } else {
  16391. return self._subclassResponsibility();
  16392. };
  16393. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  16394. },
  16395. args: [],
  16396. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16397. referencedClasses: [],
  16398. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16399. }),
  16400. $globals.ProtoStream);
  16401. $core.addMethod(
  16402. $core.method({
  16403. selector: "nextPut:",
  16404. protocol: 'writing',
  16405. fn: function (anObject){
  16406. var self=this;
  16407. return $core.withContext(function($ctx1) {
  16408. self._subclassResponsibility();
  16409. return self;
  16410. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  16411. },
  16412. args: ["anObject"],
  16413. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  16414. referencedClasses: [],
  16415. messageSends: ["subclassResponsibility"]
  16416. }),
  16417. $globals.ProtoStream);
  16418. $core.addMethod(
  16419. $core.method({
  16420. selector: "nextPutAll:",
  16421. protocol: 'writing',
  16422. fn: function (aCollection){
  16423. var self=this;
  16424. return $core.withContext(function($ctx1) {
  16425. $recv(aCollection)._do_((function(each){
  16426. return $core.withContext(function($ctx2) {
  16427. return self._nextPut_(each);
  16428. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16429. }));
  16430. return self;
  16431. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  16432. },
  16433. args: ["aCollection"],
  16434. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  16435. referencedClasses: [],
  16436. messageSends: ["do:", "nextPut:"]
  16437. }),
  16438. $globals.ProtoStream);
  16439. $core.addMethod(
  16440. $core.method({
  16441. selector: "nextPutJSObject:",
  16442. protocol: 'writing',
  16443. fn: function (aJSObject){
  16444. var self=this;
  16445. return $core.withContext(function($ctx1) {
  16446. self._nextPut_(aJSObject);
  16447. return self;
  16448. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  16449. },
  16450. args: ["aJSObject"],
  16451. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  16452. referencedClasses: [],
  16453. messageSends: ["nextPut:"]
  16454. }),
  16455. $globals.ProtoStream);
  16456. $core.addMethod(
  16457. $core.method({
  16458. selector: "nextPutString:",
  16459. protocol: 'writing',
  16460. fn: function (aString){
  16461. var self=this;
  16462. return $core.withContext(function($ctx1) {
  16463. self._nextPut_(aString);
  16464. return self;
  16465. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  16466. },
  16467. args: ["aString"],
  16468. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  16469. referencedClasses: [],
  16470. messageSends: ["nextPut:"]
  16471. }),
  16472. $globals.ProtoStream);
  16473. $core.addMethod(
  16474. $core.method({
  16475. selector: "peek",
  16476. protocol: 'reading',
  16477. fn: function (){
  16478. var self=this;
  16479. return $core.withContext(function($ctx1) {
  16480. var $1;
  16481. $1=self._atEnd();
  16482. if($core.assert($1)){
  16483. return nil;
  16484. } else {
  16485. return self._subclassResponsibility();
  16486. };
  16487. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  16488. },
  16489. args: [],
  16490. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16491. referencedClasses: [],
  16492. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16493. }),
  16494. $globals.ProtoStream);
  16495. $core.addMethod(
  16496. $core.method({
  16497. selector: "reset",
  16498. protocol: 'actions',
  16499. fn: function (){
  16500. var self=this;
  16501. return $core.withContext(function($ctx1) {
  16502. self._subclassResponsibility();
  16503. return self;
  16504. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  16505. },
  16506. args: [],
  16507. source: "reset\x0a\x09self subclassResponsibility",
  16508. referencedClasses: [],
  16509. messageSends: ["subclassResponsibility"]
  16510. }),
  16511. $globals.ProtoStream);
  16512. $core.addMethod(
  16513. $core.method({
  16514. selector: "resetContents",
  16515. protocol: 'actions',
  16516. fn: function (){
  16517. var self=this;
  16518. return $core.withContext(function($ctx1) {
  16519. self._subclassResponsibility();
  16520. return self;
  16521. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  16522. },
  16523. args: [],
  16524. source: "resetContents\x0a\x09self subclassResponsibility",
  16525. referencedClasses: [],
  16526. messageSends: ["subclassResponsibility"]
  16527. }),
  16528. $globals.ProtoStream);
  16529. $core.addMethod(
  16530. $core.method({
  16531. selector: "setToEnd",
  16532. protocol: 'positioning',
  16533. fn: function (){
  16534. var self=this;
  16535. return $core.withContext(function($ctx1) {
  16536. self._subclassResponsibility();
  16537. return self;
  16538. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  16539. },
  16540. args: [],
  16541. source: "setToEnd\x0a\x09self subclassResponsibility",
  16542. referencedClasses: [],
  16543. messageSends: ["subclassResponsibility"]
  16544. }),
  16545. $globals.ProtoStream);
  16546. $core.addMethod(
  16547. $core.method({
  16548. selector: "setToStart",
  16549. protocol: 'positioning',
  16550. fn: function (){
  16551. var self=this;
  16552. return $core.withContext(function($ctx1) {
  16553. self._reset();
  16554. return self;
  16555. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  16556. },
  16557. args: [],
  16558. source: "setToStart\x0a\x09self reset",
  16559. referencedClasses: [],
  16560. messageSends: ["reset"]
  16561. }),
  16562. $globals.ProtoStream);
  16563. $core.addMethod(
  16564. $core.method({
  16565. selector: "write:",
  16566. protocol: 'writing',
  16567. fn: function (anObject){
  16568. var self=this;
  16569. return $core.withContext(function($ctx1) {
  16570. $recv(anObject)._putOn_(self);
  16571. return self;
  16572. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  16573. },
  16574. args: ["anObject"],
  16575. source: "write: anObject\x0a\x09anObject putOn: self",
  16576. referencedClasses: [],
  16577. messageSends: ["putOn:"]
  16578. }),
  16579. $globals.ProtoStream);
  16580. $core.addMethod(
  16581. $core.method({
  16582. selector: "on:",
  16583. protocol: 'instance creation',
  16584. fn: function (aCollection){
  16585. var self=this;
  16586. return $core.withContext(function($ctx1) {
  16587. var $1;
  16588. $1=self._new();
  16589. $recv($1)._setCollection_(aCollection);
  16590. $recv($1)._setStreamSize_($recv(aCollection)._size());
  16591. return $recv($1)._yourself();
  16592. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  16593. },
  16594. args: ["aCollection"],
  16595. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16596. referencedClasses: [],
  16597. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16598. }),
  16599. $globals.ProtoStream.klass);
  16600. $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  16601. $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.";
  16602. $core.addMethod(
  16603. $core.method({
  16604. selector: "atEnd",
  16605. protocol: 'testing',
  16606. fn: function (){
  16607. var self=this;
  16608. return $core.withContext(function($ctx1) {
  16609. return $recv(self._position()).__eq(self._size());
  16610. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  16611. },
  16612. args: [],
  16613. source: "atEnd\x0a\x09^ self position = self size",
  16614. referencedClasses: [],
  16615. messageSends: ["=", "position", "size"]
  16616. }),
  16617. $globals.Stream);
  16618. $core.addMethod(
  16619. $core.method({
  16620. selector: "atStart",
  16621. protocol: 'testing',
  16622. fn: function (){
  16623. var self=this;
  16624. return $core.withContext(function($ctx1) {
  16625. return $recv(self._position()).__eq((0));
  16626. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  16627. },
  16628. args: [],
  16629. source: "atStart\x0a\x09^ self position = 0",
  16630. referencedClasses: [],
  16631. messageSends: ["=", "position"]
  16632. }),
  16633. $globals.Stream);
  16634. $core.addMethod(
  16635. $core.method({
  16636. selector: "close",
  16637. protocol: 'actions',
  16638. fn: function (){
  16639. var self=this;
  16640. return self;
  16641. },
  16642. args: [],
  16643. source: "close",
  16644. referencedClasses: [],
  16645. messageSends: []
  16646. }),
  16647. $globals.Stream);
  16648. $core.addMethod(
  16649. $core.method({
  16650. selector: "collection",
  16651. protocol: 'accessing',
  16652. fn: function (){
  16653. var self=this;
  16654. return self["@collection"];
  16655. },
  16656. args: [],
  16657. source: "collection\x0a\x09^ collection",
  16658. referencedClasses: [],
  16659. messageSends: []
  16660. }),
  16661. $globals.Stream);
  16662. $core.addMethod(
  16663. $core.method({
  16664. selector: "contents",
  16665. protocol: 'accessing',
  16666. fn: function (){
  16667. var self=this;
  16668. return $core.withContext(function($ctx1) {
  16669. return $recv(self._collection())._copyFrom_to_((1),self._streamSize());
  16670. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  16671. },
  16672. args: [],
  16673. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  16674. referencedClasses: [],
  16675. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  16676. }),
  16677. $globals.Stream);
  16678. $core.addMethod(
  16679. $core.method({
  16680. selector: "flush",
  16681. protocol: 'actions',
  16682. fn: function (){
  16683. var self=this;
  16684. return self;
  16685. },
  16686. args: [],
  16687. source: "flush",
  16688. referencedClasses: [],
  16689. messageSends: []
  16690. }),
  16691. $globals.Stream);
  16692. $core.addMethod(
  16693. $core.method({
  16694. selector: "isEmpty",
  16695. protocol: 'testing',
  16696. fn: function (){
  16697. var self=this;
  16698. return $core.withContext(function($ctx1) {
  16699. return $recv(self._size()).__eq((0));
  16700. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  16701. },
  16702. args: [],
  16703. source: "isEmpty\x0a\x09^ self size = 0",
  16704. referencedClasses: [],
  16705. messageSends: ["=", "size"]
  16706. }),
  16707. $globals.Stream);
  16708. $core.addMethod(
  16709. $core.method({
  16710. selector: "next",
  16711. protocol: 'reading',
  16712. fn: function (){
  16713. var self=this;
  16714. return $core.withContext(function($ctx1) {
  16715. var $1,$3,$2;
  16716. $1=self._atEnd();
  16717. if($core.assert($1)){
  16718. return nil;
  16719. } else {
  16720. $3=self._position();
  16721. $ctx1.sendIdx["position"]=1;
  16722. $2=$recv($3).__plus((1));
  16723. self._position_($2);
  16724. return $recv(self["@collection"])._at_(self._position());
  16725. };
  16726. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  16727. },
  16728. args: [],
  16729. 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 ]",
  16730. referencedClasses: [],
  16731. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  16732. }),
  16733. $globals.Stream);
  16734. $core.addMethod(
  16735. $core.method({
  16736. selector: "next:",
  16737. protocol: 'reading',
  16738. fn: function (anInteger){
  16739. var self=this;
  16740. var tempCollection;
  16741. return $core.withContext(function($ctx1) {
  16742. var $1;
  16743. tempCollection=$recv($recv(self._collection())._class())._new();
  16744. $recv(anInteger)._timesRepeat_((function(){
  16745. return $core.withContext(function($ctx2) {
  16746. $1=self._atEnd();
  16747. if(!$core.assert($1)){
  16748. return $recv(tempCollection)._add_(self._next());
  16749. };
  16750. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16751. }));
  16752. return tempCollection;
  16753. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  16754. },
  16755. args: ["anInteger"],
  16756. 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",
  16757. referencedClasses: [],
  16758. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  16759. }),
  16760. $globals.Stream);
  16761. $core.addMethod(
  16762. $core.method({
  16763. selector: "nextPut:",
  16764. protocol: 'writing',
  16765. fn: function (anObject){
  16766. var self=this;
  16767. return $core.withContext(function($ctx1) {
  16768. var $2,$1,$3,$4;
  16769. $2=self._position();
  16770. $ctx1.sendIdx["position"]=1;
  16771. $1=$recv($2).__plus((1));
  16772. self._position_($1);
  16773. $3=self._collection();
  16774. $4=self._position();
  16775. $ctx1.sendIdx["position"]=2;
  16776. $recv($3)._at_put_($4,anObject);
  16777. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  16778. return self;
  16779. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  16780. },
  16781. args: ["anObject"],
  16782. 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)",
  16783. referencedClasses: [],
  16784. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  16785. }),
  16786. $globals.Stream);
  16787. $core.addMethod(
  16788. $core.method({
  16789. selector: "peek",
  16790. protocol: 'reading',
  16791. fn: function (){
  16792. var self=this;
  16793. return $core.withContext(function($ctx1) {
  16794. var $1;
  16795. $1=self._atEnd();
  16796. if(!$core.assert($1)){
  16797. return $recv(self._collection())._at_($recv(self._position()).__plus((1)));
  16798. };
  16799. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  16800. },
  16801. args: [],
  16802. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  16803. referencedClasses: [],
  16804. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  16805. }),
  16806. $globals.Stream);
  16807. $core.addMethod(
  16808. $core.method({
  16809. selector: "position",
  16810. protocol: 'accessing',
  16811. fn: function (){
  16812. var self=this;
  16813. return $core.withContext(function($ctx1) {
  16814. var $1,$receiver;
  16815. $1=self["@position"];
  16816. if(($receiver = $1) == null || $receiver.isNil){
  16817. self["@position"]=(0);
  16818. return self["@position"];
  16819. } else {
  16820. return $1;
  16821. };
  16822. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  16823. },
  16824. args: [],
  16825. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  16826. referencedClasses: [],
  16827. messageSends: ["ifNil:"]
  16828. }),
  16829. $globals.Stream);
  16830. $core.addMethod(
  16831. $core.method({
  16832. selector: "position:",
  16833. protocol: 'accessing',
  16834. fn: function (anInteger){
  16835. var self=this;
  16836. self["@position"]=anInteger;
  16837. return self;
  16838. },
  16839. args: ["anInteger"],
  16840. source: "position: anInteger\x0a\x09position := anInteger",
  16841. referencedClasses: [],
  16842. messageSends: []
  16843. }),
  16844. $globals.Stream);
  16845. $core.addMethod(
  16846. $core.method({
  16847. selector: "reset",
  16848. protocol: 'actions',
  16849. fn: function (){
  16850. var self=this;
  16851. return $core.withContext(function($ctx1) {
  16852. self._position_((0));
  16853. return self;
  16854. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  16855. },
  16856. args: [],
  16857. source: "reset\x0a\x09self position: 0",
  16858. referencedClasses: [],
  16859. messageSends: ["position:"]
  16860. }),
  16861. $globals.Stream);
  16862. $core.addMethod(
  16863. $core.method({
  16864. selector: "resetContents",
  16865. protocol: 'actions',
  16866. fn: function (){
  16867. var self=this;
  16868. return $core.withContext(function($ctx1) {
  16869. self._reset();
  16870. self._setStreamSize_((0));
  16871. return self;
  16872. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  16873. },
  16874. args: [],
  16875. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  16876. referencedClasses: [],
  16877. messageSends: ["reset", "setStreamSize:"]
  16878. }),
  16879. $globals.Stream);
  16880. $core.addMethod(
  16881. $core.method({
  16882. selector: "setCollection:",
  16883. protocol: 'accessing',
  16884. fn: function (aCollection){
  16885. var self=this;
  16886. self["@collection"]=aCollection;
  16887. return self;
  16888. },
  16889. args: ["aCollection"],
  16890. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  16891. referencedClasses: [],
  16892. messageSends: []
  16893. }),
  16894. $globals.Stream);
  16895. $core.addMethod(
  16896. $core.method({
  16897. selector: "setStreamSize:",
  16898. protocol: 'accessing',
  16899. fn: function (anInteger){
  16900. var self=this;
  16901. self["@streamSize"]=anInteger;
  16902. return self;
  16903. },
  16904. args: ["anInteger"],
  16905. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  16906. referencedClasses: [],
  16907. messageSends: []
  16908. }),
  16909. $globals.Stream);
  16910. $core.addMethod(
  16911. $core.method({
  16912. selector: "setToEnd",
  16913. protocol: 'positioning',
  16914. fn: function (){
  16915. var self=this;
  16916. return $core.withContext(function($ctx1) {
  16917. self._position_(self._size());
  16918. return self;
  16919. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  16920. },
  16921. args: [],
  16922. source: "setToEnd\x0a\x09self position: self size",
  16923. referencedClasses: [],
  16924. messageSends: ["position:", "size"]
  16925. }),
  16926. $globals.Stream);
  16927. $core.addMethod(
  16928. $core.method({
  16929. selector: "size",
  16930. protocol: 'accessing',
  16931. fn: function (){
  16932. var self=this;
  16933. return $core.withContext(function($ctx1) {
  16934. return self._streamSize();
  16935. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  16936. },
  16937. args: [],
  16938. source: "size\x0a\x09^ self streamSize",
  16939. referencedClasses: [],
  16940. messageSends: ["streamSize"]
  16941. }),
  16942. $globals.Stream);
  16943. $core.addMethod(
  16944. $core.method({
  16945. selector: "skip:",
  16946. protocol: 'positioning',
  16947. fn: function (anInteger){
  16948. var self=this;
  16949. return $core.withContext(function($ctx1) {
  16950. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  16951. return self;
  16952. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  16953. },
  16954. args: ["anInteger"],
  16955. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  16956. referencedClasses: [],
  16957. messageSends: ["position:", "min:max:", "+", "position", "size"]
  16958. }),
  16959. $globals.Stream);
  16960. $core.addMethod(
  16961. $core.method({
  16962. selector: "streamSize",
  16963. protocol: 'accessing',
  16964. fn: function (){
  16965. var self=this;
  16966. return self["@streamSize"];
  16967. },
  16968. args: [],
  16969. source: "streamSize\x0a\x09^ streamSize",
  16970. referencedClasses: [],
  16971. messageSends: []
  16972. }),
  16973. $globals.Stream);
  16974. $core.addMethod(
  16975. $core.method({
  16976. selector: "on:",
  16977. protocol: 'instance creation',
  16978. fn: function (aCollection){
  16979. var self=this;
  16980. return $core.withContext(function($ctx1) {
  16981. var $1;
  16982. $1=self._new();
  16983. $recv($1)._setCollection_(aCollection);
  16984. $recv($1)._setStreamSize_($recv(aCollection)._size());
  16985. return $recv($1)._yourself();
  16986. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  16987. },
  16988. args: ["aCollection"],
  16989. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16990. referencedClasses: [],
  16991. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16992. }),
  16993. $globals.Stream.klass);
  16994. $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
  16995. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  16996. $core.addMethod(
  16997. $core.method({
  16998. selector: "cr",
  16999. protocol: 'writing',
  17000. fn: function (){
  17001. var self=this;
  17002. return $core.withContext(function($ctx1) {
  17003. return self._nextPutAll_($recv($globals.String)._cr());
  17004. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  17005. },
  17006. args: [],
  17007. source: "cr\x0a\x09^ self nextPutAll: String cr",
  17008. referencedClasses: ["String"],
  17009. messageSends: ["nextPutAll:", "cr"]
  17010. }),
  17011. $globals.StringStream);
  17012. $core.addMethod(
  17013. $core.method({
  17014. selector: "crlf",
  17015. protocol: 'writing',
  17016. fn: function (){
  17017. var self=this;
  17018. return $core.withContext(function($ctx1) {
  17019. return self._nextPutAll_($recv($globals.String)._crlf());
  17020. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  17021. },
  17022. args: [],
  17023. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  17024. referencedClasses: ["String"],
  17025. messageSends: ["nextPutAll:", "crlf"]
  17026. }),
  17027. $globals.StringStream);
  17028. $core.addMethod(
  17029. $core.method({
  17030. selector: "lf",
  17031. protocol: 'writing',
  17032. fn: function (){
  17033. var self=this;
  17034. return $core.withContext(function($ctx1) {
  17035. return self._nextPutAll_($recv($globals.String)._lf());
  17036. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  17037. },
  17038. args: [],
  17039. source: "lf\x0a\x09^ self nextPutAll: String lf",
  17040. referencedClasses: ["String"],
  17041. messageSends: ["nextPutAll:", "lf"]
  17042. }),
  17043. $globals.StringStream);
  17044. $core.addMethod(
  17045. $core.method({
  17046. selector: "next:",
  17047. protocol: 'reading',
  17048. fn: function (anInteger){
  17049. var self=this;
  17050. var tempCollection;
  17051. return $core.withContext(function($ctx1) {
  17052. var $1;
  17053. tempCollection=$recv($recv(self._collection())._class())._new();
  17054. $recv(anInteger)._timesRepeat_((function(){
  17055. return $core.withContext(function($ctx2) {
  17056. $1=self._atEnd();
  17057. if(!$core.assert($1)){
  17058. tempCollection=$recv(tempCollection).__comma(self._next());
  17059. return tempCollection;
  17060. };
  17061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17062. }));
  17063. return tempCollection;
  17064. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  17065. },
  17066. args: ["anInteger"],
  17067. 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",
  17068. referencedClasses: [],
  17069. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  17070. }),
  17071. $globals.StringStream);
  17072. $core.addMethod(
  17073. $core.method({
  17074. selector: "nextPut:",
  17075. protocol: 'writing',
  17076. fn: function (aString){
  17077. var self=this;
  17078. return $core.withContext(function($ctx1) {
  17079. self._nextPutAll_(aString);
  17080. return self;
  17081. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  17082. },
  17083. args: ["aString"],
  17084. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  17085. referencedClasses: [],
  17086. messageSends: ["nextPutAll:"]
  17087. }),
  17088. $globals.StringStream);
  17089. $core.addMethod(
  17090. $core.method({
  17091. selector: "nextPutAll:",
  17092. protocol: 'writing',
  17093. fn: function (aString){
  17094. var self=this;
  17095. var pre,post;
  17096. return $core.withContext(function($ctx1) {
  17097. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  17098. $1=self._atEnd();
  17099. if($core.assert($1)){
  17100. $3=self._collection();
  17101. $ctx1.sendIdx["collection"]=1;
  17102. $2=$recv($3).__comma(aString);
  17103. $ctx1.sendIdx[","]=1;
  17104. self._setCollection_($2);
  17105. $ctx1.sendIdx["setCollection:"]=1;
  17106. } else {
  17107. $4=self._collection();
  17108. $ctx1.sendIdx["collection"]=2;
  17109. $5=self._position();
  17110. $ctx1.sendIdx["position"]=1;
  17111. pre=$recv($4)._copyFrom_to_((1),$5);
  17112. $ctx1.sendIdx["copyFrom:to:"]=1;
  17113. pre;
  17114. $6=self._collection();
  17115. $ctx1.sendIdx["collection"]=3;
  17116. $9=self._position();
  17117. $ctx1.sendIdx["position"]=2;
  17118. $8=$recv($9).__plus((1));
  17119. $ctx1.sendIdx["+"]=2;
  17120. $10=$recv(aString)._size();
  17121. $ctx1.sendIdx["size"]=1;
  17122. $7=$recv($8).__plus($10);
  17123. $ctx1.sendIdx["+"]=1;
  17124. $11=$recv(self._collection())._size();
  17125. $ctx1.sendIdx["size"]=2;
  17126. post=$recv($6)._copyFrom_to_($7,$11);
  17127. post;
  17128. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  17129. $ctx1.sendIdx[","]=2;
  17130. self._setCollection_($12);
  17131. };
  17132. $14=self._position();
  17133. $ctx1.sendIdx["position"]=3;
  17134. $13=$recv($14).__plus($recv(aString)._size());
  17135. self._position_($13);
  17136. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  17137. return self;
  17138. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  17139. },
  17140. args: ["aString"],
  17141. 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)",
  17142. referencedClasses: [],
  17143. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  17144. }),
  17145. $globals.StringStream);
  17146. $core.addMethod(
  17147. $core.method({
  17148. selector: "nextPutString:",
  17149. protocol: 'writing',
  17150. fn: function (aString){
  17151. var self=this;
  17152. return $core.withContext(function($ctx1) {
  17153. self._nextPutAll_(aString);
  17154. return self;
  17155. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  17156. },
  17157. args: ["aString"],
  17158. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  17159. referencedClasses: [],
  17160. messageSends: ["nextPutAll:"]
  17161. }),
  17162. $globals.StringStream);
  17163. $core.addMethod(
  17164. $core.method({
  17165. selector: "space",
  17166. protocol: 'writing',
  17167. fn: function (){
  17168. var self=this;
  17169. return $core.withContext(function($ctx1) {
  17170. self._nextPut_(" ");
  17171. return self;
  17172. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  17173. },
  17174. args: [],
  17175. source: "space\x0a\x09self nextPut: ' '",
  17176. referencedClasses: [],
  17177. messageSends: ["nextPut:"]
  17178. }),
  17179. $globals.StringStream);
  17180. $core.addMethod(
  17181. $core.method({
  17182. selector: "tab",
  17183. protocol: 'writing',
  17184. fn: function (){
  17185. var self=this;
  17186. return $core.withContext(function($ctx1) {
  17187. return self._nextPutAll_($recv($globals.String)._tab());
  17188. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  17189. },
  17190. args: [],
  17191. source: "tab\x0a\x09^ self nextPutAll: String tab",
  17192. referencedClasses: ["String"],
  17193. messageSends: ["nextPutAll:", "tab"]
  17194. }),
  17195. $globals.StringStream);
  17196. $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  17197. $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.";
  17198. $core.addMethod(
  17199. $core.method({
  17200. selector: "initialize",
  17201. protocol: 'initialization',
  17202. fn: function (){
  17203. var self=this;
  17204. return $core.withContext(function($ctx1) {
  17205. (
  17206. $ctx1.supercall = true,
  17207. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  17208. $ctx1.supercall = false;
  17209. self["@read"]=$recv($globals.OrderedCollection)._new();
  17210. $ctx1.sendIdx["new"]=1;
  17211. self["@write"]=$recv($globals.OrderedCollection)._new();
  17212. self["@readIndex"]=(1);
  17213. return self;
  17214. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  17215. },
  17216. args: [],
  17217. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  17218. referencedClasses: ["OrderedCollection"],
  17219. messageSends: ["initialize", "new"]
  17220. }),
  17221. $globals.Queue);
  17222. $core.addMethod(
  17223. $core.method({
  17224. selector: "next",
  17225. protocol: 'accessing',
  17226. fn: function (){
  17227. var self=this;
  17228. return $core.withContext(function($ctx1) {
  17229. return self._nextIfAbsent_((function(){
  17230. return $core.withContext(function($ctx2) {
  17231. return self._error_("Cannot read from empty Queue.");
  17232. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17233. }));
  17234. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  17235. },
  17236. args: [],
  17237. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  17238. referencedClasses: [],
  17239. messageSends: ["nextIfAbsent:", "error:"]
  17240. }),
  17241. $globals.Queue);
  17242. $core.addMethod(
  17243. $core.method({
  17244. selector: "nextIfAbsent:",
  17245. protocol: 'accessing',
  17246. fn: function (aBlock){
  17247. var self=this;
  17248. var result;
  17249. return $core.withContext(function($ctx1) {
  17250. var $1;
  17251. var $early={};
  17252. try {
  17253. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  17254. return $core.withContext(function($ctx2) {
  17255. $recv(self["@write"])._ifEmpty_((function(){
  17256. return $core.withContext(function($ctx3) {
  17257. $1=$recv(self["@readIndex"]).__gt((1));
  17258. if($core.assert($1)){
  17259. self["@read"]=[];
  17260. self["@read"];
  17261. self["@readIndex"]=(1);
  17262. self["@readIndex"];
  17263. };
  17264. throw $early=[$recv(aBlock)._value()];
  17265. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17266. }));
  17267. self["@read"]=self["@write"];
  17268. self["@read"];
  17269. self["@readIndex"]=(1);
  17270. self["@readIndex"];
  17271. self["@write"]=$recv($globals.OrderedCollection)._new();
  17272. self["@write"];
  17273. return $recv(self["@read"])._first();
  17274. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17275. }));
  17276. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  17277. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  17278. return result;
  17279. }
  17280. catch(e) {if(e===$early)return e[0]; throw e}
  17281. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  17282. },
  17283. args: ["aBlock"],
  17284. 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",
  17285. referencedClasses: ["OrderedCollection"],
  17286. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  17287. }),
  17288. $globals.Queue);
  17289. $core.addMethod(
  17290. $core.method({
  17291. selector: "nextPut:",
  17292. protocol: 'accessing',
  17293. fn: function (anObject){
  17294. var self=this;
  17295. return $core.withContext(function($ctx1) {
  17296. $recv(self["@write"])._add_(anObject);
  17297. return self;
  17298. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  17299. },
  17300. args: ["anObject"],
  17301. source: "nextPut: anObject\x0a\x09write add: anObject",
  17302. referencedClasses: [],
  17303. messageSends: ["add:"]
  17304. }),
  17305. $globals.Queue);
  17306. $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
  17307. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  17308. $core.addMethod(
  17309. $core.method({
  17310. selector: "compile:",
  17311. protocol: 'evaluating',
  17312. fn: function (aString){
  17313. var self=this;
  17314. return $core.withContext(function($ctx1) {
  17315. return self.compile(aString);
  17316. return self;
  17317. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  17318. },
  17319. args: ["aString"],
  17320. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  17321. referencedClasses: [],
  17322. messageSends: []
  17323. }),
  17324. $globals.RegularExpression);
  17325. $core.addMethod(
  17326. $core.method({
  17327. selector: "exec:",
  17328. protocol: 'evaluating',
  17329. fn: function (aString){
  17330. var self=this;
  17331. return $core.withContext(function($ctx1) {
  17332. return self.exec(aString) || nil;
  17333. return self;
  17334. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  17335. },
  17336. args: ["aString"],
  17337. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  17338. referencedClasses: [],
  17339. messageSends: []
  17340. }),
  17341. $globals.RegularExpression);
  17342. $core.addMethod(
  17343. $core.method({
  17344. selector: "test:",
  17345. protocol: 'evaluating',
  17346. fn: function (aString){
  17347. var self=this;
  17348. return $core.withContext(function($ctx1) {
  17349. return self.test(aString);
  17350. return self;
  17351. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  17352. },
  17353. args: ["aString"],
  17354. source: "test: aString\x0a\x09<return self.test(aString)>",
  17355. referencedClasses: [],
  17356. messageSends: []
  17357. }),
  17358. $globals.RegularExpression);
  17359. $core.addMethod(
  17360. $core.method({
  17361. selector: "fromString:",
  17362. protocol: 'instance creation',
  17363. fn: function (aString){
  17364. var self=this;
  17365. return $core.withContext(function($ctx1) {
  17366. return self._fromString_flag_(aString,"");
  17367. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  17368. },
  17369. args: ["aString"],
  17370. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  17371. referencedClasses: [],
  17372. messageSends: ["fromString:flag:"]
  17373. }),
  17374. $globals.RegularExpression.klass);
  17375. $core.addMethod(
  17376. $core.method({
  17377. selector: "fromString:flag:",
  17378. protocol: 'instance creation',
  17379. fn: function (aString,anotherString){
  17380. var self=this;
  17381. return $core.withContext(function($ctx1) {
  17382. return new RegExp(aString, anotherString);
  17383. return self;
  17384. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  17385. },
  17386. args: ["aString", "anotherString"],
  17387. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  17388. referencedClasses: [],
  17389. messageSends: []
  17390. }),
  17391. $globals.RegularExpression.klass);
  17392. });
  17393. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17394. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  17395. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17396. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  17397. $core.addPackage('Kernel-Exceptions');
  17398. $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  17399. $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17400. $core.addClass('Error', $globals.Object, ['messageText'], 'Kernel-Exceptions');
  17401. $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.";
  17402. $core.addMethod(
  17403. $core.method({
  17404. selector: "beHandled",
  17405. protocol: 'accessing',
  17406. fn: function (){
  17407. var self=this;
  17408. return $core.withContext(function($ctx1) {
  17409. self.amberHandled = true;
  17410. return self;
  17411. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  17412. },
  17413. args: [],
  17414. source: "beHandled\x0a\x09<self.amberHandled = true>",
  17415. referencedClasses: [],
  17416. messageSends: []
  17417. }),
  17418. $globals.Error);
  17419. $core.addMethod(
  17420. $core.method({
  17421. selector: "beUnhandled",
  17422. protocol: 'accessing',
  17423. fn: function (){
  17424. var self=this;
  17425. return $core.withContext(function($ctx1) {
  17426. self.amberHandled = false;
  17427. return self;
  17428. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  17429. },
  17430. args: [],
  17431. source: "beUnhandled\x0a\x09<self.amberHandled = false>",
  17432. referencedClasses: [],
  17433. messageSends: []
  17434. }),
  17435. $globals.Error);
  17436. $core.addMethod(
  17437. $core.method({
  17438. selector: "context",
  17439. protocol: 'accessing',
  17440. fn: function (){
  17441. var self=this;
  17442. return $core.withContext(function($ctx1) {
  17443. return self.context;
  17444. return self;
  17445. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  17446. },
  17447. args: [],
  17448. source: "context\x0a\x09<return self.context>",
  17449. referencedClasses: [],
  17450. messageSends: []
  17451. }),
  17452. $globals.Error);
  17453. $core.addMethod(
  17454. $core.method({
  17455. selector: "initialize",
  17456. protocol: 'initialization',
  17457. fn: function (){
  17458. var self=this;
  17459. return $core.withContext(function($ctx1) {
  17460. self._messageText_("Errorclass: ".__comma($recv(self._class())._name()));
  17461. return self;
  17462. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  17463. },
  17464. args: [],
  17465. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  17466. referencedClasses: [],
  17467. messageSends: ["messageText:", ",", "name", "class"]
  17468. }),
  17469. $globals.Error);
  17470. $core.addMethod(
  17471. $core.method({
  17472. selector: "isSmalltalkError",
  17473. protocol: 'testing',
  17474. fn: function (){
  17475. var self=this;
  17476. return $core.withContext(function($ctx1) {
  17477. return self.smalltalkError === true;
  17478. return self;
  17479. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  17480. },
  17481. args: [],
  17482. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  17483. referencedClasses: [],
  17484. messageSends: []
  17485. }),
  17486. $globals.Error);
  17487. $core.addMethod(
  17488. $core.method({
  17489. selector: "jsStack",
  17490. protocol: 'accessing',
  17491. fn: function (){
  17492. var self=this;
  17493. return $core.withContext(function($ctx1) {
  17494. return self.stack;
  17495. return self;
  17496. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  17497. },
  17498. args: [],
  17499. source: "jsStack\x0a\x09<return self.stack>",
  17500. referencedClasses: [],
  17501. messageSends: []
  17502. }),
  17503. $globals.Error);
  17504. $core.addMethod(
  17505. $core.method({
  17506. selector: "messageText",
  17507. protocol: 'accessing',
  17508. fn: function (){
  17509. var self=this;
  17510. return self["@messageText"];
  17511. },
  17512. args: [],
  17513. source: "messageText\x0a\x09^ messageText",
  17514. referencedClasses: [],
  17515. messageSends: []
  17516. }),
  17517. $globals.Error);
  17518. $core.addMethod(
  17519. $core.method({
  17520. selector: "messageText:",
  17521. protocol: 'accessing',
  17522. fn: function (aString){
  17523. var self=this;
  17524. self["@messageText"]=aString;
  17525. return self;
  17526. },
  17527. args: ["aString"],
  17528. source: "messageText: aString\x0a\x09messageText := aString",
  17529. referencedClasses: [],
  17530. messageSends: []
  17531. }),
  17532. $globals.Error);
  17533. $core.addMethod(
  17534. $core.method({
  17535. selector: "resignal",
  17536. protocol: 'signaling',
  17537. fn: function (){
  17538. var self=this;
  17539. return $core.withContext(function($ctx1) {
  17540. self.amberHandled = false;
  17541. throw(self);
  17542. ;
  17543. return self;
  17544. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  17545. },
  17546. args: [],
  17547. source: "resignal\x0a\x09\x22Resignal the receiver without changing its exception context\x22\x0a\x09\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw(self);\x0a\x09>",
  17548. referencedClasses: [],
  17549. messageSends: []
  17550. }),
  17551. $globals.Error);
  17552. $core.addMethod(
  17553. $core.method({
  17554. selector: "signal",
  17555. protocol: 'signaling',
  17556. fn: function (){
  17557. var self=this;
  17558. return $core.withContext(function($ctx1) {
  17559. self.amberHandled = false;
  17560. self.context = $core.getThisContext();
  17561. self.smalltalkError = true;
  17562. throw self;
  17563. ;
  17564. return self;
  17565. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  17566. },
  17567. args: [],
  17568. source: "signal\x0a\x09<\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09self.context = $core.getThisContext(); \x0a\x09\x09self.smalltalkError = true;\x0a\x09\x09throw self;\x0a\x09>",
  17569. referencedClasses: [],
  17570. messageSends: []
  17571. }),
  17572. $globals.Error);
  17573. $core.addMethod(
  17574. $core.method({
  17575. selector: "signal:",
  17576. protocol: 'signaling',
  17577. fn: function (aString){
  17578. var self=this;
  17579. return $core.withContext(function($ctx1) {
  17580. self._messageText_(aString);
  17581. self._signal();
  17582. return self;
  17583. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  17584. },
  17585. args: ["aString"],
  17586. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  17587. referencedClasses: [],
  17588. messageSends: ["messageText:", "signal"]
  17589. }),
  17590. $globals.Error);
  17591. $core.addMethod(
  17592. $core.method({
  17593. selector: "signalerContext",
  17594. protocol: 'accessing',
  17595. fn: function (){
  17596. var self=this;
  17597. return $core.withContext(function($ctx1) {
  17598. return self._signalerContextFrom_(self._context());
  17599. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  17600. },
  17601. args: [],
  17602. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  17603. referencedClasses: [],
  17604. messageSends: ["signalerContextFrom:", "context"]
  17605. }),
  17606. $globals.Error);
  17607. $core.addMethod(
  17608. $core.method({
  17609. selector: "signalerContextFrom:",
  17610. protocol: 'accessing',
  17611. fn: function (aContext){
  17612. var self=this;
  17613. return $core.withContext(function($ctx1) {
  17614. var $3,$2,$1;
  17615. return $recv(aContext)._findContextSuchThat_((function(context){
  17616. return $core.withContext(function($ctx2) {
  17617. $3=$recv(context)._receiver();
  17618. $ctx2.sendIdx["receiver"]=1;
  17619. $2=$recv($3).__eq_eq(self);
  17620. $ctx2.sendIdx["=="]=1;
  17621. $1=$recv($2)._or_((function(){
  17622. return $core.withContext(function($ctx3) {
  17623. return $recv($recv(context)._receiver()).__eq_eq(self._class());
  17624. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17625. }));
  17626. return $recv($1)._not();
  17627. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  17628. }));
  17629. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  17630. },
  17631. args: ["aContext"],
  17632. 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 ]",
  17633. referencedClasses: [],
  17634. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  17635. }),
  17636. $globals.Error);
  17637. $core.addMethod(
  17638. $core.method({
  17639. selector: "wasHandled",
  17640. protocol: 'testing',
  17641. fn: function (){
  17642. var self=this;
  17643. return $core.withContext(function($ctx1) {
  17644. return self.amberHandled || false;
  17645. return self;
  17646. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  17647. },
  17648. args: [],
  17649. source: "wasHandled\x0a\x09<return self.amberHandled || false>",
  17650. referencedClasses: [],
  17651. messageSends: []
  17652. }),
  17653. $globals.Error);
  17654. $core.addMethod(
  17655. $core.method({
  17656. selector: "classTag",
  17657. protocol: 'accessing',
  17658. fn: function (){
  17659. var self=this;
  17660. return "exception";
  17661. },
  17662. args: [],
  17663. 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'",
  17664. referencedClasses: [],
  17665. messageSends: []
  17666. }),
  17667. $globals.Error.klass);
  17668. $core.addMethod(
  17669. $core.method({
  17670. selector: "signal",
  17671. protocol: 'instance creation',
  17672. fn: function (){
  17673. var self=this;
  17674. return $core.withContext(function($ctx1) {
  17675. return $recv(self._new())._signal();
  17676. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.klass)});
  17677. },
  17678. args: [],
  17679. source: "signal\x0a\x09^ self new signal",
  17680. referencedClasses: [],
  17681. messageSends: ["signal", "new"]
  17682. }),
  17683. $globals.Error.klass);
  17684. $core.addMethod(
  17685. $core.method({
  17686. selector: "signal:",
  17687. protocol: 'instance creation',
  17688. fn: function (aString){
  17689. var self=this;
  17690. return $core.withContext(function($ctx1) {
  17691. return $recv(self._new())._signal_(aString);
  17692. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.klass)});
  17693. },
  17694. args: ["aString"],
  17695. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  17696. referencedClasses: [],
  17697. messageSends: ["signal:", "new"]
  17698. }),
  17699. $globals.Error.klass);
  17700. $core.addClass('Halt', $globals.Error, [], 'Kernel-Exceptions');
  17701. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  17702. $core.addMethod(
  17703. $core.method({
  17704. selector: "messageText",
  17705. protocol: 'accessing',
  17706. fn: function (){
  17707. var self=this;
  17708. return "Halt encountered";
  17709. },
  17710. args: [],
  17711. source: "messageText\x0a\x09^ 'Halt encountered'",
  17712. referencedClasses: [],
  17713. messageSends: []
  17714. }),
  17715. $globals.Halt);
  17716. $core.addMethod(
  17717. $core.method({
  17718. selector: "signalerContextFrom:",
  17719. protocol: 'accessing',
  17720. fn: function (aContext){
  17721. var self=this;
  17722. return $core.withContext(function($ctx1) {
  17723. var $3,$2,$1;
  17724. return $recv(aContext)._findContextSuchThat_((function(context){
  17725. return $core.withContext(function($ctx2) {
  17726. $3=$recv(context)._receiver();
  17727. $ctx2.sendIdx["receiver"]=1;
  17728. $2=$recv($3).__eq_eq(self);
  17729. $ctx2.sendIdx["=="]=1;
  17730. $1=$recv($2)._or_((function(){
  17731. return $core.withContext(function($ctx3) {
  17732. return $recv($recv($recv(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  17733. return $core.withContext(function($ctx4) {
  17734. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  17735. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  17736. }));
  17737. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17738. }));
  17739. $ctx2.sendIdx["or:"]=1;
  17740. return $recv($1)._not();
  17741. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  17742. }));
  17743. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  17744. },
  17745. args: ["aContext"],
  17746. 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 ]",
  17747. referencedClasses: [],
  17748. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  17749. }),
  17750. $globals.Halt);
  17751. $core.addClass('JavaScriptException', $globals.Error, ['exception'], 'Kernel-Exceptions');
  17752. $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:`";
  17753. $core.addMethod(
  17754. $core.method({
  17755. selector: "context:",
  17756. protocol: 'accessing',
  17757. fn: function (aMethodContext){
  17758. var self=this;
  17759. return $core.withContext(function($ctx1) {
  17760. self.context = aMethodContext;
  17761. return self;
  17762. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  17763. },
  17764. args: ["aMethodContext"],
  17765. source: "context: aMethodContext\x0a\x09\x22Set the context from the outside.\x0a\x09See boot.js `inContext()` exception handling\x22\x0a\x09\x0a\x09<self.context = aMethodContext>",
  17766. referencedClasses: [],
  17767. messageSends: []
  17768. }),
  17769. $globals.JavaScriptException);
  17770. $core.addMethod(
  17771. $core.method({
  17772. selector: "exception",
  17773. protocol: 'accessing',
  17774. fn: function (){
  17775. var self=this;
  17776. return self["@exception"];
  17777. },
  17778. args: [],
  17779. source: "exception\x0a\x09^ exception",
  17780. referencedClasses: [],
  17781. messageSends: []
  17782. }),
  17783. $globals.JavaScriptException);
  17784. $core.addMethod(
  17785. $core.method({
  17786. selector: "exception:",
  17787. protocol: 'accessing',
  17788. fn: function (anException){
  17789. var self=this;
  17790. self["@exception"]=anException;
  17791. return self;
  17792. },
  17793. args: ["anException"],
  17794. source: "exception: anException\x0a\x09exception := anException",
  17795. referencedClasses: [],
  17796. messageSends: []
  17797. }),
  17798. $globals.JavaScriptException);
  17799. $core.addMethod(
  17800. $core.method({
  17801. selector: "messageText",
  17802. protocol: 'accessing',
  17803. fn: function (){
  17804. var self=this;
  17805. return $core.withContext(function($ctx1) {
  17806. return 'JavaScript exception: ' + self["@exception"].toString();
  17807. return self;
  17808. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  17809. },
  17810. args: [],
  17811. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  17812. referencedClasses: [],
  17813. messageSends: []
  17814. }),
  17815. $globals.JavaScriptException);
  17816. $core.addMethod(
  17817. $core.method({
  17818. selector: "on:",
  17819. protocol: 'instance creation',
  17820. fn: function (anException){
  17821. var self=this;
  17822. return $core.withContext(function($ctx1) {
  17823. var $1;
  17824. $1=self._new();
  17825. $recv($1)._exception_(anException);
  17826. return $recv($1)._yourself();
  17827. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.klass)});
  17828. },
  17829. args: ["anException"],
  17830. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  17831. referencedClasses: [],
  17832. messageSends: ["exception:", "new", "yourself"]
  17833. }),
  17834. $globals.JavaScriptException.klass);
  17835. $core.addMethod(
  17836. $core.method({
  17837. selector: "on:context:",
  17838. protocol: 'instance creation',
  17839. fn: function (anException,aMethodContext){
  17840. var self=this;
  17841. return $core.withContext(function($ctx1) {
  17842. var $1;
  17843. $1=self._new();
  17844. $recv($1)._exception_(anException);
  17845. $recv($1)._context_(aMethodContext);
  17846. return $recv($1)._yourself();
  17847. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.klass)});
  17848. },
  17849. args: ["anException", "aMethodContext"],
  17850. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  17851. referencedClasses: [],
  17852. messageSends: ["exception:", "new", "context:", "yourself"]
  17853. }),
  17854. $globals.JavaScriptException.klass);
  17855. $core.addClass('MessageNotUnderstood', $globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  17856. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  17857. $core.addMethod(
  17858. $core.method({
  17859. selector: "message",
  17860. protocol: 'accessing',
  17861. fn: function (){
  17862. var self=this;
  17863. return self["@message"];
  17864. },
  17865. args: [],
  17866. source: "message\x0a\x09^ message",
  17867. referencedClasses: [],
  17868. messageSends: []
  17869. }),
  17870. $globals.MessageNotUnderstood);
  17871. $core.addMethod(
  17872. $core.method({
  17873. selector: "message:",
  17874. protocol: 'accessing',
  17875. fn: function (aMessage){
  17876. var self=this;
  17877. self["@message"]=aMessage;
  17878. return self;
  17879. },
  17880. args: ["aMessage"],
  17881. source: "message: aMessage\x0a\x09message := aMessage",
  17882. referencedClasses: [],
  17883. messageSends: []
  17884. }),
  17885. $globals.MessageNotUnderstood);
  17886. $core.addMethod(
  17887. $core.method({
  17888. selector: "messageText",
  17889. protocol: 'accessing',
  17890. fn: function (){
  17891. var self=this;
  17892. return $core.withContext(function($ctx1) {
  17893. var $1;
  17894. $1=$recv($recv($recv(self._receiver())._asString()).__comma(" does not understand #")).__comma($recv(self._message())._selector());
  17895. $ctx1.sendIdx[","]=1;
  17896. return $1;
  17897. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  17898. },
  17899. args: [],
  17900. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  17901. referencedClasses: [],
  17902. messageSends: [",", "asString", "receiver", "selector", "message"]
  17903. }),
  17904. $globals.MessageNotUnderstood);
  17905. $core.addMethod(
  17906. $core.method({
  17907. selector: "receiver",
  17908. protocol: 'accessing',
  17909. fn: function (){
  17910. var self=this;
  17911. return self["@receiver"];
  17912. },
  17913. args: [],
  17914. source: "receiver\x0a\x09^ receiver",
  17915. referencedClasses: [],
  17916. messageSends: []
  17917. }),
  17918. $globals.MessageNotUnderstood);
  17919. $core.addMethod(
  17920. $core.method({
  17921. selector: "receiver:",
  17922. protocol: 'accessing',
  17923. fn: function (anObject){
  17924. var self=this;
  17925. self["@receiver"]=anObject;
  17926. return self;
  17927. },
  17928. args: ["anObject"],
  17929. source: "receiver: anObject\x0a\x09receiver := anObject",
  17930. referencedClasses: [],
  17931. messageSends: []
  17932. }),
  17933. $globals.MessageNotUnderstood);
  17934. $core.addClass('NonBooleanReceiver', $globals.Error, ['object'], 'Kernel-Exceptions');
  17935. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  17936. $core.addMethod(
  17937. $core.method({
  17938. selector: "object",
  17939. protocol: 'accessing',
  17940. fn: function (){
  17941. var self=this;
  17942. return self["@object"];
  17943. },
  17944. args: [],
  17945. source: "object\x0a\x09^ object",
  17946. referencedClasses: [],
  17947. messageSends: []
  17948. }),
  17949. $globals.NonBooleanReceiver);
  17950. $core.addMethod(
  17951. $core.method({
  17952. selector: "object:",
  17953. protocol: 'accessing',
  17954. fn: function (anObject){
  17955. var self=this;
  17956. self["@object"]=anObject;
  17957. return self;
  17958. },
  17959. args: ["anObject"],
  17960. source: "object: anObject\x0a\x09object := anObject",
  17961. referencedClasses: [],
  17962. messageSends: []
  17963. }),
  17964. $globals.NonBooleanReceiver);
  17965. });
  17966. define('amber_core/Kernel-Infrastructure',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17967. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  17968. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17969. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  17970. $core.addPackage('Kernel-Infrastructure');
  17971. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  17972. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17973. $core.addClass('JSObjectProxy', $globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  17974. $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`.";
  17975. $core.addMethod(
  17976. $core.method({
  17977. selector: "=",
  17978. protocol: 'comparing',
  17979. fn: function (anObject){
  17980. var self=this;
  17981. return $core.withContext(function($ctx1) {
  17982. var $2,$1;
  17983. $2=$recv(anObject)._class();
  17984. $ctx1.sendIdx["class"]=1;
  17985. $1=$recv($2).__eq_eq(self._class());
  17986. if(!$core.assert($1)){
  17987. return false;
  17988. };
  17989. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  17990. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  17991. },
  17992. args: ["anObject"],
  17993. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  17994. referencedClasses: ["JSObjectProxy"],
  17995. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  17996. }),
  17997. $globals.JSObjectProxy);
  17998. $core.addMethod(
  17999. $core.method({
  18000. selector: "asJSON",
  18001. protocol: 'enumerating',
  18002. fn: function (){
  18003. var self=this;
  18004. return self["@jsObject"];
  18005. },
  18006. args: [],
  18007. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  18008. referencedClasses: [],
  18009. messageSends: []
  18010. }),
  18011. $globals.JSObjectProxy);
  18012. $core.addMethod(
  18013. $core.method({
  18014. selector: "at:",
  18015. protocol: 'accessing',
  18016. fn: function (aString){
  18017. var self=this;
  18018. return $core.withContext(function($ctx1) {
  18019. return self['@jsObject'][aString];
  18020. return self;
  18021. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  18022. },
  18023. args: ["aString"],
  18024. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  18025. referencedClasses: [],
  18026. messageSends: []
  18027. }),
  18028. $globals.JSObjectProxy);
  18029. $core.addMethod(
  18030. $core.method({
  18031. selector: "at:ifAbsent:",
  18032. protocol: 'accessing',
  18033. fn: function (aString,aBlock){
  18034. var self=this;
  18035. return $core.withContext(function($ctx1) {
  18036. var obj = self['@jsObject'];
  18037. return aString in obj ? obj[aString] : aBlock._value();
  18038. ;
  18039. return self;
  18040. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  18041. },
  18042. args: ["aString", "aBlock"],
  18043. 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<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? obj[aString] : aBlock._value();\x0a\x09>",
  18044. referencedClasses: [],
  18045. messageSends: []
  18046. }),
  18047. $globals.JSObjectProxy);
  18048. $core.addMethod(
  18049. $core.method({
  18050. selector: "at:ifPresent:",
  18051. protocol: 'accessing',
  18052. fn: function (aString,aBlock){
  18053. var self=this;
  18054. return $core.withContext(function($ctx1) {
  18055. var obj = self['@jsObject'];
  18056. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  18057. ;
  18058. return self;
  18059. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  18060. },
  18061. args: ["aString", "aBlock"],
  18062. 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<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : nil;\x0a\x09>",
  18063. referencedClasses: [],
  18064. messageSends: []
  18065. }),
  18066. $globals.JSObjectProxy);
  18067. $core.addMethod(
  18068. $core.method({
  18069. selector: "at:ifPresent:ifAbsent:",
  18070. protocol: 'accessing',
  18071. fn: function (aString,aBlock,anotherBlock){
  18072. var self=this;
  18073. return $core.withContext(function($ctx1) {
  18074. var obj = self['@jsObject'];
  18075. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  18076. ;
  18077. return self;
  18078. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  18079. },
  18080. args: ["aString", "aBlock", "anotherBlock"],
  18081. 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<\x0a\x09\x09var obj = self['@jsObject'];\x0a\x09\x09return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();\x0a\x09>",
  18082. referencedClasses: [],
  18083. messageSends: []
  18084. }),
  18085. $globals.JSObjectProxy);
  18086. $core.addMethod(
  18087. $core.method({
  18088. selector: "at:put:",
  18089. protocol: 'accessing',
  18090. fn: function (aString,anObject){
  18091. var self=this;
  18092. return $core.withContext(function($ctx1) {
  18093. return self['@jsObject'][aString] = anObject;
  18094. return self;
  18095. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  18096. },
  18097. args: ["aString", "anObject"],
  18098. source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
  18099. referencedClasses: [],
  18100. messageSends: []
  18101. }),
  18102. $globals.JSObjectProxy);
  18103. $core.addMethod(
  18104. $core.method({
  18105. selector: "doesNotUnderstand:",
  18106. protocol: 'proxy',
  18107. fn: function (aMessage){
  18108. var self=this;
  18109. return $core.withContext(function($ctx1) {
  18110. var $1,$receiver;
  18111. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  18112. if(($receiver = $1) == null || $receiver.isNil){
  18113. return (
  18114. $ctx1.supercall = true,
  18115. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
  18116. $ctx1.supercall = false;
  18117. } else {
  18118. var jsSelector;
  18119. jsSelector=$receiver;
  18120. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  18121. };
  18122. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  18123. },
  18124. args: ["aMessage"],
  18125. 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 ]",
  18126. referencedClasses: ["JSObjectProxy"],
  18127. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  18128. }),
  18129. $globals.JSObjectProxy);
  18130. $core.addMethod(
  18131. $core.method({
  18132. selector: "in:",
  18133. protocol: 'accessing',
  18134. fn: function (aValuable){
  18135. var self=this;
  18136. return $core.withContext(function($ctx1) {
  18137. return $recv(aValuable)._value_(self["@jsObject"]);
  18138. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  18139. },
  18140. args: ["aValuable"],
  18141. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  18142. referencedClasses: [],
  18143. messageSends: ["value:"]
  18144. }),
  18145. $globals.JSObjectProxy);
  18146. $core.addMethod(
  18147. $core.method({
  18148. selector: "jsObject",
  18149. protocol: 'accessing',
  18150. fn: function (){
  18151. var self=this;
  18152. return self["@jsObject"];
  18153. },
  18154. args: [],
  18155. source: "jsObject\x0a\x09^ jsObject",
  18156. referencedClasses: [],
  18157. messageSends: []
  18158. }),
  18159. $globals.JSObjectProxy);
  18160. $core.addMethod(
  18161. $core.method({
  18162. selector: "keysAndValuesDo:",
  18163. protocol: 'enumerating',
  18164. fn: function (aBlock){
  18165. var self=this;
  18166. return $core.withContext(function($ctx1) {
  18167. var o = self['@jsObject'];
  18168. for(var i in o) {
  18169. aBlock._value_value_(i, o[i]);
  18170. }
  18171. ;
  18172. return self;
  18173. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  18174. },
  18175. args: ["aBlock"],
  18176. source: "keysAndValuesDo: aBlock\x0a\x09<\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>",
  18177. referencedClasses: [],
  18178. messageSends: []
  18179. }),
  18180. $globals.JSObjectProxy);
  18181. $core.addMethod(
  18182. $core.method({
  18183. selector: "printOn:",
  18184. protocol: 'printing',
  18185. fn: function (aStream){
  18186. var self=this;
  18187. return $core.withContext(function($ctx1) {
  18188. $recv(aStream)._nextPutAll_(self._printString());
  18189. return self;
  18190. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  18191. },
  18192. args: ["aStream"],
  18193. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  18194. referencedClasses: [],
  18195. messageSends: ["nextPutAll:", "printString"]
  18196. }),
  18197. $globals.JSObjectProxy);
  18198. $core.addMethod(
  18199. $core.method({
  18200. selector: "printString",
  18201. protocol: 'printing',
  18202. fn: function (){
  18203. var self=this;
  18204. return $core.withContext(function($ctx1) {
  18205. var js = self['@jsObject'];
  18206. return js.toString
  18207. ? js.toString()
  18208. : Object.prototype.toString.call(js)
  18209. ;
  18210. return self;
  18211. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  18212. },
  18213. args: [],
  18214. source: "printString\x0a\x09<\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>",
  18215. referencedClasses: [],
  18216. messageSends: []
  18217. }),
  18218. $globals.JSObjectProxy);
  18219. $core.addMethod(
  18220. $core.method({
  18221. selector: "putOn:",
  18222. protocol: 'streaming',
  18223. fn: function (aStream){
  18224. var self=this;
  18225. return $core.withContext(function($ctx1) {
  18226. $recv(aStream)._nextPutJSObject_(self["@jsObject"]);
  18227. return self;
  18228. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  18229. },
  18230. args: ["aStream"],
  18231. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  18232. referencedClasses: [],
  18233. messageSends: ["nextPutJSObject:"]
  18234. }),
  18235. $globals.JSObjectProxy);
  18236. $core.addMethod(
  18237. $core.method({
  18238. selector: "addObjectVariablesTo:ofProxy:",
  18239. protocol: 'proxy',
  18240. fn: function (aDictionary,aProxy){
  18241. var self=this;
  18242. return $core.withContext(function($ctx1) {
  18243. var jsObject = aProxy['@jsObject'];
  18244. for(var i in jsObject) {
  18245. aDictionary._at_put_(i, jsObject[i]);
  18246. }
  18247. ;
  18248. return self;
  18249. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18250. },
  18251. args: ["aDictionary", "aProxy"],
  18252. source: "addObjectVariablesTo: aDictionary ofProxy: aProxy\x0a\x09<\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>",
  18253. referencedClasses: [],
  18254. messageSends: []
  18255. }),
  18256. $globals.JSObjectProxy.klass);
  18257. $core.addMethod(
  18258. $core.method({
  18259. selector: "compareJSObjectOfProxy:withProxy:",
  18260. protocol: 'proxy',
  18261. fn: function (aProxy,anotherProxy){
  18262. var self=this;
  18263. return $core.withContext(function($ctx1) {
  18264. var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy;
  18265. return aProxy["@jsObject"] === anotherJSObject;
  18266. return self;
  18267. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)});
  18268. },
  18269. args: ["aProxy", "anotherProxy"],
  18270. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<\x0a\x09var anotherJSObject = anotherProxy.klass ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a>",
  18271. referencedClasses: [],
  18272. messageSends: []
  18273. }),
  18274. $globals.JSObjectProxy.klass);
  18275. $core.addMethod(
  18276. $core.method({
  18277. selector: "forwardMessage:withArguments:ofProxy:",
  18278. protocol: 'proxy',
  18279. fn: function (aString,anArray,aProxy){
  18280. var self=this;
  18281. return $core.withContext(function($ctx1) {
  18282. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  18283. ;
  18284. return self;
  18285. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18286. },
  18287. args: ["aString", "anArray", "aProxy"],
  18288. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09>",
  18289. referencedClasses: [],
  18290. messageSends: []
  18291. }),
  18292. $globals.JSObjectProxy.klass);
  18293. $core.addMethod(
  18294. $core.method({
  18295. selector: "jsObject:ofProxy:",
  18296. protocol: 'proxy',
  18297. fn: function (aJSObject,aProxy){
  18298. var self=this;
  18299. return $core.withContext(function($ctx1) {
  18300. aProxy['@jsObject'] = aJSObject;
  18301. return self;
  18302. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18303. },
  18304. args: ["aJSObject", "aProxy"],
  18305. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<aProxy['@jsObject'] = aJSObject>",
  18306. referencedClasses: [],
  18307. messageSends: []
  18308. }),
  18309. $globals.JSObjectProxy.klass);
  18310. $core.addMethod(
  18311. $core.method({
  18312. selector: "lookupProperty:ofProxy:",
  18313. protocol: 'proxy',
  18314. fn: function (aString,aProxy){
  18315. var self=this;
  18316. return $core.withContext(function($ctx1) {
  18317. return aString in aProxy._jsObject() ? aString : nil;
  18318. return self;
  18319. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18320. },
  18321. args: ["aString", "aProxy"],
  18322. 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<return aString in aProxy._jsObject() ? aString : nil>",
  18323. referencedClasses: [],
  18324. messageSends: []
  18325. }),
  18326. $globals.JSObjectProxy.klass);
  18327. $core.addMethod(
  18328. $core.method({
  18329. selector: "on:",
  18330. protocol: 'instance creation',
  18331. fn: function (aJSObject){
  18332. var self=this;
  18333. var instance;
  18334. return $core.withContext(function($ctx1) {
  18335. instance=self._new();
  18336. self._jsObject_ofProxy_(aJSObject,instance);
  18337. return instance;
  18338. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)});
  18339. },
  18340. args: ["aJSObject"],
  18341. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  18342. referencedClasses: [],
  18343. messageSends: ["new", "jsObject:ofProxy:"]
  18344. }),
  18345. $globals.JSObjectProxy.klass);
  18346. $core.addClass('Organizer', $globals.Object, [], 'Kernel-Infrastructure');
  18347. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  18348. $core.addMethod(
  18349. $core.method({
  18350. selector: "addElement:",
  18351. protocol: 'accessing',
  18352. fn: function (anObject){
  18353. var self=this;
  18354. return $core.withContext(function($ctx1) {
  18355. self.elements.addElement(anObject);
  18356. return self;
  18357. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  18358. },
  18359. args: ["anObject"],
  18360. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  18361. referencedClasses: [],
  18362. messageSends: []
  18363. }),
  18364. $globals.Organizer);
  18365. $core.addMethod(
  18366. $core.method({
  18367. selector: "elements",
  18368. protocol: 'accessing',
  18369. fn: function (){
  18370. var self=this;
  18371. return $core.withContext(function($ctx1) {
  18372. return $recv(self._basicAt_("elements"))._copy();
  18373. }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
  18374. },
  18375. args: [],
  18376. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  18377. referencedClasses: [],
  18378. messageSends: ["copy", "basicAt:"]
  18379. }),
  18380. $globals.Organizer);
  18381. $core.addMethod(
  18382. $core.method({
  18383. selector: "removeElement:",
  18384. protocol: 'accessing',
  18385. fn: function (anObject){
  18386. var self=this;
  18387. return $core.withContext(function($ctx1) {
  18388. self.elements.removeElement(anObject);
  18389. return self;
  18390. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  18391. },
  18392. args: ["anObject"],
  18393. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  18394. referencedClasses: [],
  18395. messageSends: []
  18396. }),
  18397. $globals.Organizer);
  18398. $core.addClass('ClassOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  18399. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  18400. $core.addMethod(
  18401. $core.method({
  18402. selector: "addElement:",
  18403. protocol: 'accessing',
  18404. fn: function (aString){
  18405. var self=this;
  18406. return $core.withContext(function($ctx1) {
  18407. var $1,$3,$2;
  18408. (
  18409. $ctx1.supercall = true,
  18410. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($recv(self), [aString]));
  18411. $ctx1.supercall = false;
  18412. $1=$recv($globals.SystemAnnouncer)._current();
  18413. $3=$recv($globals.ProtocolAdded)._new();
  18414. $recv($3)._protocol_(aString);
  18415. $recv($3)._theClass_(self._theClass());
  18416. $2=$recv($3)._yourself();
  18417. $recv($1)._announce_($2);
  18418. return self;
  18419. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  18420. },
  18421. args: ["aString"],
  18422. 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)",
  18423. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  18424. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  18425. }),
  18426. $globals.ClassOrganizer);
  18427. $core.addMethod(
  18428. $core.method({
  18429. selector: "removeElement:",
  18430. protocol: 'accessing',
  18431. fn: function (aString){
  18432. var self=this;
  18433. return $core.withContext(function($ctx1) {
  18434. var $1,$3,$2;
  18435. (
  18436. $ctx1.supercall = true,
  18437. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($recv(self), [aString]));
  18438. $ctx1.supercall = false;
  18439. $1=$recv($globals.SystemAnnouncer)._current();
  18440. $3=$recv($globals.ProtocolRemoved)._new();
  18441. $recv($3)._protocol_(aString);
  18442. $recv($3)._theClass_(self._theClass());
  18443. $2=$recv($3)._yourself();
  18444. $recv($1)._announce_($2);
  18445. return self;
  18446. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  18447. },
  18448. args: ["aString"],
  18449. 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)",
  18450. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  18451. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  18452. }),
  18453. $globals.ClassOrganizer);
  18454. $core.addMethod(
  18455. $core.method({
  18456. selector: "theClass",
  18457. protocol: 'accessing',
  18458. fn: function (){
  18459. var self=this;
  18460. return $core.withContext(function($ctx1) {
  18461. return self.theClass ;
  18462. return self;
  18463. }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
  18464. },
  18465. args: [],
  18466. source: "theClass\x0a\x09< return self.theClass >",
  18467. referencedClasses: [],
  18468. messageSends: []
  18469. }),
  18470. $globals.ClassOrganizer);
  18471. $core.addClass('PackageOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  18472. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  18473. $core.addClass('Package', $globals.Object, ['transport', 'imports', 'dirty'], 'Kernel-Infrastructure');
  18474. $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'";
  18475. $core.addMethod(
  18476. $core.method({
  18477. selector: "basicImports",
  18478. protocol: 'private',
  18479. fn: function (){
  18480. var self=this;
  18481. return $core.withContext(function($ctx1) {
  18482. return self.imports || [];
  18483. return self;
  18484. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  18485. },
  18486. args: [],
  18487. source: "basicImports\x0a\x09\x22Answer the imports literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<return self.imports || []>",
  18488. referencedClasses: [],
  18489. messageSends: []
  18490. }),
  18491. $globals.Package);
  18492. $core.addMethod(
  18493. $core.method({
  18494. selector: "basicName:",
  18495. protocol: 'private',
  18496. fn: function (aString){
  18497. var self=this;
  18498. return $core.withContext(function($ctx1) {
  18499. self.pkgName = aString;
  18500. return self;
  18501. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  18502. },
  18503. args: ["aString"],
  18504. source: "basicName: aString\x0a\x09<self.pkgName = aString>",
  18505. referencedClasses: [],
  18506. messageSends: []
  18507. }),
  18508. $globals.Package);
  18509. $core.addMethod(
  18510. $core.method({
  18511. selector: "basicTransport",
  18512. protocol: 'private',
  18513. fn: function (){
  18514. var self=this;
  18515. return $core.withContext(function($ctx1) {
  18516. return self.transport;
  18517. return self;
  18518. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  18519. },
  18520. args: [],
  18521. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09<return self.transport>",
  18522. referencedClasses: [],
  18523. messageSends: []
  18524. }),
  18525. $globals.Package);
  18526. $core.addMethod(
  18527. $core.method({
  18528. selector: "beClean",
  18529. protocol: 'accessing',
  18530. fn: function (){
  18531. var self=this;
  18532. return $core.withContext(function($ctx1) {
  18533. var $1,$3,$2;
  18534. self["@dirty"]=false;
  18535. $1=$recv($globals.SystemAnnouncer)._current();
  18536. $3=$recv($globals.PackageClean)._new();
  18537. $recv($3)._package_(self);
  18538. $2=$recv($3)._yourself();
  18539. $recv($1)._announce_($2);
  18540. return self;
  18541. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  18542. },
  18543. args: [],
  18544. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18545. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  18546. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18547. }),
  18548. $globals.Package);
  18549. $core.addMethod(
  18550. $core.method({
  18551. selector: "beDirty",
  18552. protocol: 'accessing',
  18553. fn: function (){
  18554. var self=this;
  18555. return $core.withContext(function($ctx1) {
  18556. var $1,$3,$2;
  18557. self["@dirty"]=true;
  18558. $1=$recv($globals.SystemAnnouncer)._current();
  18559. $3=$recv($globals.PackageDirty)._new();
  18560. $recv($3)._package_(self);
  18561. $2=$recv($3)._yourself();
  18562. $recv($1)._announce_($2);
  18563. return self;
  18564. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  18565. },
  18566. args: [],
  18567. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18568. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  18569. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18570. }),
  18571. $globals.Package);
  18572. $core.addMethod(
  18573. $core.method({
  18574. selector: "classTemplate",
  18575. protocol: 'accessing',
  18576. fn: function (){
  18577. var self=this;
  18578. return $core.withContext(function($ctx1) {
  18579. var $2,$3,$1,$4,$5;
  18580. return $recv($globals.String)._streamContents_((function(stream){
  18581. return $core.withContext(function($ctx2) {
  18582. $recv(stream)._nextPutAll_("Object");
  18583. $ctx2.sendIdx["nextPutAll:"]=1;
  18584. $recv(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  18585. $ctx2.sendIdx["nextPutAll:"]=2;
  18586. $2=$recv($globals.String)._lf();
  18587. $ctx2.sendIdx["lf"]=1;
  18588. $3=$recv($globals.String)._tab();
  18589. $ctx2.sendIdx["tab"]=1;
  18590. $1=$recv($2).__comma($3);
  18591. $ctx2.sendIdx[","]=1;
  18592. $recv(stream)._nextPutAll_($1);
  18593. $ctx2.sendIdx["nextPutAll:"]=3;
  18594. $4=$recv(stream)._nextPutAll_("instanceVariableNames: ''");
  18595. $ctx2.sendIdx["nextPutAll:"]=4;
  18596. $4;
  18597. $5=$recv("'".__comma($recv($globals.String)._lf())).__comma($recv($globals.String)._tab());
  18598. $ctx2.sendIdx[","]=2;
  18599. $recv(stream)._nextPutAll_($5);
  18600. $ctx2.sendIdx["nextPutAll:"]=5;
  18601. $recv(stream)._nextPutAll_("package: '");
  18602. $ctx2.sendIdx["nextPutAll:"]=6;
  18603. $recv(stream)._nextPutAll_(self._name());
  18604. $ctx2.sendIdx["nextPutAll:"]=7;
  18605. return $recv(stream)._nextPutAll_("'");
  18606. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18607. }));
  18608. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  18609. },
  18610. args: [],
  18611. 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: '''' ]",
  18612. referencedClasses: ["String"],
  18613. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"]
  18614. }),
  18615. $globals.Package);
  18616. $core.addMethod(
  18617. $core.method({
  18618. selector: "classes",
  18619. protocol: 'classes',
  18620. fn: function (){
  18621. var self=this;
  18622. return $core.withContext(function($ctx1) {
  18623. return $recv(self._organization())._elements();
  18624. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  18625. },
  18626. args: [],
  18627. source: "classes\x0a\x09^ self organization elements",
  18628. referencedClasses: [],
  18629. messageSends: ["elements", "organization"]
  18630. }),
  18631. $globals.Package);
  18632. $core.addMethod(
  18633. $core.method({
  18634. selector: "definition",
  18635. protocol: 'accessing',
  18636. fn: function (){
  18637. var self=this;
  18638. return $core.withContext(function($ctx1) {
  18639. var $1,$3,$4,$2,$6,$5,$8,$9,$7,$10;
  18640. return $recv($globals.String)._streamContents_((function(stream){
  18641. return $core.withContext(function($ctx2) {
  18642. $1=$recv(self._class())._name();
  18643. $ctx2.sendIdx["name"]=1;
  18644. $recv(stream)._nextPutAll_($1);
  18645. $ctx2.sendIdx["nextPutAll:"]=1;
  18646. $3=$recv($globals.String)._lf();
  18647. $ctx2.sendIdx["lf"]=1;
  18648. $4=$recv($globals.String)._tab();
  18649. $ctx2.sendIdx["tab"]=1;
  18650. $2=$recv($3).__comma($4);
  18651. $ctx2.sendIdx[","]=1;
  18652. $recv(stream)._nextPutAll_($2);
  18653. $ctx2.sendIdx["nextPutAll:"]=2;
  18654. $recv(stream)._nextPutAll_("named: ");
  18655. $ctx2.sendIdx["nextPutAll:"]=3;
  18656. $6="'".__comma(self._name());
  18657. $ctx2.sendIdx[","]=3;
  18658. $5=$recv($6).__comma("'");
  18659. $ctx2.sendIdx[","]=2;
  18660. $recv(stream)._nextPutAll_($5);
  18661. $ctx2.sendIdx["nextPutAll:"]=4;
  18662. $8=$recv($globals.String)._lf();
  18663. $ctx2.sendIdx["lf"]=2;
  18664. $9=$recv($globals.String)._tab();
  18665. $ctx2.sendIdx["tab"]=2;
  18666. $7=$recv($8).__comma($9);
  18667. $ctx2.sendIdx[","]=4;
  18668. $recv(stream)._nextPutAll_($7);
  18669. $ctx2.sendIdx["nextPutAll:"]=5;
  18670. $recv(stream)._nextPutAll_("imports: ");
  18671. $ctx2.sendIdx["nextPutAll:"]=6;
  18672. $recv(stream)._nextPutAll_(self._importsDefinition());
  18673. $ctx2.sendIdx["nextPutAll:"]=7;
  18674. $10=$recv($recv($globals.String)._lf()).__comma($recv($globals.String)._tab());
  18675. $ctx2.sendIdx[","]=5;
  18676. $recv(stream)._nextPutAll_($10);
  18677. $ctx2.sendIdx["nextPutAll:"]=8;
  18678. $recv(stream)._nextPutAll_("transport: (");
  18679. $ctx2.sendIdx["nextPutAll:"]=9;
  18680. return $recv(stream)._nextPutAll_($recv($recv(self._transport())._definition()).__comma(")"));
  18681. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18682. }));
  18683. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  18684. },
  18685. args: [],
  18686. 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, ')' ]",
  18687. referencedClasses: ["String"],
  18688. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "importsDefinition", "definition", "transport"]
  18689. }),
  18690. $globals.Package);
  18691. $core.addMethod(
  18692. $core.method({
  18693. selector: "imports",
  18694. protocol: 'accessing',
  18695. fn: function (){
  18696. var self=this;
  18697. return $core.withContext(function($ctx1) {
  18698. var $1,$receiver;
  18699. $1=self["@imports"];
  18700. if(($receiver = $1) == null || $receiver.isNil){
  18701. var parsed;
  18702. parsed=self._importsFromJson_(self._basicImports());
  18703. parsed;
  18704. self._imports_(parsed);
  18705. return self["@imports"];
  18706. } else {
  18707. return $1;
  18708. };
  18709. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  18710. },
  18711. args: [],
  18712. 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 ]",
  18713. referencedClasses: [],
  18714. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  18715. }),
  18716. $globals.Package);
  18717. $core.addMethod(
  18718. $core.method({
  18719. selector: "imports:",
  18720. protocol: 'accessing',
  18721. fn: function (anArray){
  18722. var self=this;
  18723. return $core.withContext(function($ctx1) {
  18724. self._validateImports_(anArray);
  18725. self["@imports"]=$recv(anArray)._asSet();
  18726. return self;
  18727. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  18728. },
  18729. args: ["anArray"],
  18730. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  18731. referencedClasses: [],
  18732. messageSends: ["validateImports:", "asSet"]
  18733. }),
  18734. $globals.Package);
  18735. $core.addMethod(
  18736. $core.method({
  18737. selector: "importsAsJson",
  18738. protocol: 'converting',
  18739. fn: function (){
  18740. var self=this;
  18741. return $core.withContext(function($ctx1) {
  18742. var $1;
  18743. return $recv(self._sortedImportsAsArray())._collect_((function(each){
  18744. return $core.withContext(function($ctx2) {
  18745. $1=$recv(each)._isString();
  18746. if($core.assert($1)){
  18747. return each;
  18748. } else {
  18749. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  18750. $ctx2.sendIdx[","]=1;
  18751. };
  18752. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18753. }));
  18754. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  18755. },
  18756. args: [],
  18757. 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 ]]",
  18758. referencedClasses: [],
  18759. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  18760. }),
  18761. $globals.Package);
  18762. $core.addMethod(
  18763. $core.method({
  18764. selector: "importsDefinition",
  18765. protocol: 'accessing',
  18766. fn: function (){
  18767. var self=this;
  18768. return $core.withContext(function($ctx1) {
  18769. return $recv($globals.String)._streamContents_((function(stream){
  18770. return $core.withContext(function($ctx2) {
  18771. $recv(stream)._nextPutAll_("{");
  18772. $ctx2.sendIdx["nextPutAll:"]=1;
  18773. $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
  18774. return $core.withContext(function($ctx3) {
  18775. return $recv(stream)._nextPutAll_($recv(each)._importsString());
  18776. $ctx3.sendIdx["nextPutAll:"]=2;
  18777. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  18778. }),(function(){
  18779. return $core.withContext(function($ctx3) {
  18780. return $recv(stream)._nextPutAll_(". ");
  18781. $ctx3.sendIdx["nextPutAll:"]=3;
  18782. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  18783. }));
  18784. return $recv(stream)._nextPutAll_("}");
  18785. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18786. }));
  18787. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  18788. },
  18789. args: [],
  18790. 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: '}' ]",
  18791. referencedClasses: ["String"],
  18792. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "sortedImportsAsArray", "importsString"]
  18793. }),
  18794. $globals.Package);
  18795. $core.addMethod(
  18796. $core.method({
  18797. selector: "importsFromJson:",
  18798. protocol: 'converting',
  18799. fn: function (anArray){
  18800. var self=this;
  18801. return $core.withContext(function($ctx1) {
  18802. var $1;
  18803. return $recv(anArray)._collect_((function(each){
  18804. var split;
  18805. return $core.withContext(function($ctx2) {
  18806. split=$recv(each)._tokenize_("=");
  18807. split;
  18808. $1=$recv($recv(split)._size()).__eq((1));
  18809. if($core.assert($1)){
  18810. return $recv(split)._first();
  18811. $ctx2.sendIdx["first"]=1;
  18812. } else {
  18813. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  18814. };
  18815. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  18816. }));
  18817. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  18818. },
  18819. args: ["anArray"],
  18820. 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 ]]",
  18821. referencedClasses: [],
  18822. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  18823. }),
  18824. $globals.Package);
  18825. $core.addMethod(
  18826. $core.method({
  18827. selector: "isDirty",
  18828. protocol: 'testing',
  18829. fn: function (){
  18830. var self=this;
  18831. return $core.withContext(function($ctx1) {
  18832. var $1,$receiver;
  18833. $1=self["@dirty"];
  18834. if(($receiver = $1) == null || $receiver.isNil){
  18835. return false;
  18836. } else {
  18837. return $1;
  18838. };
  18839. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  18840. },
  18841. args: [],
  18842. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  18843. referencedClasses: [],
  18844. messageSends: ["ifNil:"]
  18845. }),
  18846. $globals.Package);
  18847. $core.addMethod(
  18848. $core.method({
  18849. selector: "isPackage",
  18850. protocol: 'testing',
  18851. fn: function (){
  18852. var self=this;
  18853. return true;
  18854. },
  18855. args: [],
  18856. source: "isPackage\x0a\x09^ true",
  18857. referencedClasses: [],
  18858. messageSends: []
  18859. }),
  18860. $globals.Package);
  18861. $core.addMethod(
  18862. $core.method({
  18863. selector: "loadDependencies",
  18864. protocol: 'dependencies',
  18865. fn: function (){
  18866. var self=this;
  18867. var classes,packages;
  18868. return $core.withContext(function($ctx1) {
  18869. var $1;
  18870. classes=self._loadDependencyClasses();
  18871. $1=$recv($recv(classes)._collect_((function(each){
  18872. return $core.withContext(function($ctx2) {
  18873. return $recv(each)._package();
  18874. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18875. })))._asSet();
  18876. $recv($1)._remove_ifAbsent_(self,(function(){
  18877. }));
  18878. return $recv($1)._yourself();
  18879. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  18880. },
  18881. args: [],
  18882. 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",
  18883. referencedClasses: [],
  18884. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  18885. }),
  18886. $globals.Package);
  18887. $core.addMethod(
  18888. $core.method({
  18889. selector: "loadDependencyClasses",
  18890. protocol: 'dependencies',
  18891. fn: function (){
  18892. var self=this;
  18893. var starCategoryName;
  18894. return $core.withContext(function($ctx1) {
  18895. var $3,$2,$1,$5,$4;
  18896. starCategoryName="*".__comma(self._name());
  18897. $ctx1.sendIdx[","]=1;
  18898. $3=self._classes();
  18899. $ctx1.sendIdx["classes"]=1;
  18900. $2=$recv($3)._collect_((function(each){
  18901. return $core.withContext(function($ctx2) {
  18902. return $recv(each)._superclass();
  18903. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18904. }));
  18905. $1=$recv($2)._asSet();
  18906. $recv($1)._remove_ifAbsent_(nil,(function(){
  18907. }));
  18908. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  18909. return $core.withContext(function($ctx2) {
  18910. $5=$recv(each)._protocols();
  18911. $ctx2.sendIdx["protocols"]=1;
  18912. $4=$recv($5).__comma($recv($recv(each)._class())._protocols());
  18913. return $recv($4)._includes_(starCategoryName);
  18914. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  18915. })));
  18916. return $recv($1)._yourself();
  18917. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  18918. },
  18919. args: [],
  18920. 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",
  18921. referencedClasses: ["Smalltalk"],
  18922. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"]
  18923. }),
  18924. $globals.Package);
  18925. $core.addMethod(
  18926. $core.method({
  18927. selector: "name",
  18928. protocol: 'accessing',
  18929. fn: function (){
  18930. var self=this;
  18931. return $core.withContext(function($ctx1) {
  18932. return self.pkgName;
  18933. return self;
  18934. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  18935. },
  18936. args: [],
  18937. source: "name\x0a\x09<return self.pkgName>",
  18938. referencedClasses: [],
  18939. messageSends: []
  18940. }),
  18941. $globals.Package);
  18942. $core.addMethod(
  18943. $core.method({
  18944. selector: "name:",
  18945. protocol: 'accessing',
  18946. fn: function (aString){
  18947. var self=this;
  18948. return $core.withContext(function($ctx1) {
  18949. self._basicName_(aString);
  18950. self._beDirty();
  18951. return self;
  18952. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  18953. },
  18954. args: ["aString"],
  18955. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  18956. referencedClasses: [],
  18957. messageSends: ["basicName:", "beDirty"]
  18958. }),
  18959. $globals.Package);
  18960. $core.addMethod(
  18961. $core.method({
  18962. selector: "organization",
  18963. protocol: 'accessing',
  18964. fn: function (){
  18965. var self=this;
  18966. return $core.withContext(function($ctx1) {
  18967. return self._basicAt_("organization");
  18968. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  18969. },
  18970. args: [],
  18971. source: "organization\x0a\x09^ self basicAt: 'organization'",
  18972. referencedClasses: [],
  18973. messageSends: ["basicAt:"]
  18974. }),
  18975. $globals.Package);
  18976. $core.addMethod(
  18977. $core.method({
  18978. selector: "printOn:",
  18979. protocol: 'printing',
  18980. fn: function (aStream){
  18981. var self=this;
  18982. return $core.withContext(function($ctx1) {
  18983. (
  18984. $ctx1.supercall = true,
  18985. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  18986. $ctx1.supercall = false;
  18987. $recv(aStream)._nextPutAll_(" (");
  18988. $ctx1.sendIdx["nextPutAll:"]=1;
  18989. $recv(aStream)._nextPutAll_(self._name());
  18990. $ctx1.sendIdx["nextPutAll:"]=2;
  18991. $recv(aStream)._nextPutAll_(")");
  18992. return self;
  18993. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  18994. },
  18995. args: ["aStream"],
  18996. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  18997. referencedClasses: [],
  18998. messageSends: ["printOn:", "nextPutAll:", "name"]
  18999. }),
  19000. $globals.Package);
  19001. $core.addMethod(
  19002. $core.method({
  19003. selector: "setupClasses",
  19004. protocol: 'classes',
  19005. fn: function (){
  19006. var self=this;
  19007. return $core.withContext(function($ctx1) {
  19008. var $1;
  19009. $1=self._classes();
  19010. $recv($1)._do_((function(each){
  19011. return $core.withContext(function($ctx2) {
  19012. return $recv($recv($globals.ClassBuilder)._new())._setupClass_(each);
  19013. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19014. }));
  19015. $ctx1.sendIdx["do:"]=1;
  19016. $recv($1)._do_((function(each){
  19017. return $core.withContext(function($ctx2) {
  19018. return $recv(each)._initialize();
  19019. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  19020. }));
  19021. return self;
  19022. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  19023. },
  19024. args: [],
  19025. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  19026. referencedClasses: ["ClassBuilder"],
  19027. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"]
  19028. }),
  19029. $globals.Package);
  19030. $core.addMethod(
  19031. $core.method({
  19032. selector: "sortedClasses",
  19033. protocol: 'classes',
  19034. fn: function (){
  19035. var self=this;
  19036. return $core.withContext(function($ctx1) {
  19037. return $recv(self._class())._sortedClasses_(self._classes());
  19038. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  19039. },
  19040. args: [],
  19041. 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",
  19042. referencedClasses: [],
  19043. messageSends: ["sortedClasses:", "class", "classes"]
  19044. }),
  19045. $globals.Package);
  19046. $core.addMethod(
  19047. $core.method({
  19048. selector: "sortedImportsAsArray",
  19049. protocol: 'private',
  19050. fn: function (){
  19051. var self=this;
  19052. return $core.withContext(function($ctx1) {
  19053. var $3,$2,$4,$1,$6,$5,$7;
  19054. return $recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  19055. return $core.withContext(function($ctx2) {
  19056. $3=$recv(a)._isString();
  19057. $ctx2.sendIdx["isString"]=1;
  19058. $2=$recv($3)._not();
  19059. $4=$recv(b)._isString();
  19060. $ctx2.sendIdx["isString"]=2;
  19061. $1=$recv($2).__and($4);
  19062. return $recv($1)._or_((function(){
  19063. return $core.withContext(function($ctx3) {
  19064. $6=$recv(a)._isString();
  19065. $ctx3.sendIdx["isString"]=3;
  19066. $5=$recv($6).__eq($recv(b)._isString());
  19067. return $recv($5)._and_((function(){
  19068. return $core.withContext(function($ctx4) {
  19069. $7=$recv(a)._value();
  19070. $ctx4.sendIdx["value"]=1;
  19071. return $recv($7).__lt_eq($recv(b)._value());
  19072. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  19073. }));
  19074. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  19075. }));
  19076. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  19077. }));
  19078. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  19079. },
  19080. args: [],
  19081. 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 ]]]",
  19082. referencedClasses: [],
  19083. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  19084. }),
  19085. $globals.Package);
  19086. $core.addMethod(
  19087. $core.method({
  19088. selector: "transport",
  19089. protocol: 'accessing',
  19090. fn: function (){
  19091. var self=this;
  19092. return $core.withContext(function($ctx1) {
  19093. var $1,$2,$receiver;
  19094. $1=self["@transport"];
  19095. if(($receiver = $1) == null || $receiver.isNil){
  19096. $2=$recv($globals.PackageTransport)._fromJson_(self._basicTransport());
  19097. $recv($2)._package_(self);
  19098. self["@transport"]=$recv($2)._yourself();
  19099. return self["@transport"];
  19100. } else {
  19101. return $1;
  19102. };
  19103. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  19104. },
  19105. args: [],
  19106. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  19107. referencedClasses: ["PackageTransport"],
  19108. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  19109. }),
  19110. $globals.Package);
  19111. $core.addMethod(
  19112. $core.method({
  19113. selector: "transport:",
  19114. protocol: 'accessing',
  19115. fn: function (aPackageTransport){
  19116. var self=this;
  19117. return $core.withContext(function($ctx1) {
  19118. self["@transport"]=aPackageTransport;
  19119. $recv(aPackageTransport)._package_(self);
  19120. return self;
  19121. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  19122. },
  19123. args: ["aPackageTransport"],
  19124. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  19125. referencedClasses: [],
  19126. messageSends: ["package:"]
  19127. }),
  19128. $globals.Package);
  19129. $core.addMethod(
  19130. $core.method({
  19131. selector: "validateImports:",
  19132. protocol: 'validation',
  19133. fn: function (aCollection){
  19134. var self=this;
  19135. return $core.withContext(function($ctx1) {
  19136. var $1,$2,$5,$4,$3,$6;
  19137. $recv(aCollection)._do_((function(import_){
  19138. return $core.withContext(function($ctx2) {
  19139. $1=$recv(import_)._isString();
  19140. $ctx2.sendIdx["isString"]=1;
  19141. if(!$core.assert($1)){
  19142. $2=$recv(import_)._respondsTo_("key");
  19143. if(!$core.assert($2)){
  19144. self._error_("Imports must be Strings or Associations");
  19145. $ctx2.sendIdx["error:"]=1;
  19146. };
  19147. $5=$recv(import_)._key();
  19148. $ctx2.sendIdx["key"]=1;
  19149. $4=$recv($5)._isString();
  19150. $ctx2.sendIdx["isString"]=2;
  19151. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  19152. if(!$core.assert($3)){
  19153. self._error_("Key and value must be Strings");
  19154. $ctx2.sendIdx["error:"]=2;
  19155. };
  19156. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  19157. if(!$core.assert($6)){
  19158. return self._error_("Keys must be identifiers");
  19159. };
  19160. };
  19161. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  19162. }));
  19163. return self;
  19164. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  19165. },
  19166. args: ["aCollection"],
  19167. 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' ]]]",
  19168. referencedClasses: [],
  19169. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  19170. }),
  19171. $globals.Package);
  19172. $globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  19173. $core.addMethod(
  19174. $core.method({
  19175. selector: "named:",
  19176. protocol: 'accessing',
  19177. fn: function (aPackageName){
  19178. var self=this;
  19179. return $core.withContext(function($ctx1) {
  19180. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  19181. return $core.withContext(function($ctx2) {
  19182. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  19183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19184. }));
  19185. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  19186. },
  19187. args: ["aPackageName"],
  19188. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  19189. referencedClasses: ["Smalltalk"],
  19190. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  19191. }),
  19192. $globals.Package.klass);
  19193. $core.addMethod(
  19194. $core.method({
  19195. selector: "named:ifAbsent:",
  19196. protocol: 'accessing',
  19197. fn: function (aPackageName,aBlock){
  19198. var self=this;
  19199. return $core.withContext(function($ctx1) {
  19200. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  19201. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  19202. },
  19203. args: ["aPackageName", "aBlock"],
  19204. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  19205. referencedClasses: ["Smalltalk"],
  19206. messageSends: ["packageAt:ifAbsent:"]
  19207. }),
  19208. $globals.Package.klass);
  19209. $core.addMethod(
  19210. $core.method({
  19211. selector: "named:imports:transport:",
  19212. protocol: 'accessing',
  19213. fn: function (aPackageName,anArray,aTransport){
  19214. var self=this;
  19215. var package_;
  19216. return $core.withContext(function($ctx1) {
  19217. package_=self._named_(aPackageName);
  19218. $recv(package_)._imports_(anArray);
  19219. $recv(package_)._transport_(aTransport);
  19220. return package_;
  19221. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  19222. },
  19223. args: ["aPackageName", "anArray", "aTransport"],
  19224. 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",
  19225. referencedClasses: [],
  19226. messageSends: ["named:", "imports:", "transport:"]
  19227. }),
  19228. $globals.Package.klass);
  19229. $core.addMethod(
  19230. $core.method({
  19231. selector: "named:transport:",
  19232. protocol: 'accessing',
  19233. fn: function (aPackageName,aTransport){
  19234. var self=this;
  19235. var package_;
  19236. return $core.withContext(function($ctx1) {
  19237. package_=self._named_(aPackageName);
  19238. $recv(package_)._transport_(aTransport);
  19239. return package_;
  19240. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  19241. },
  19242. args: ["aPackageName", "aTransport"],
  19243. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  19244. referencedClasses: [],
  19245. messageSends: ["named:", "transport:"]
  19246. }),
  19247. $globals.Package.klass);
  19248. $core.addMethod(
  19249. $core.method({
  19250. selector: "sortedClasses:",
  19251. protocol: 'sorting',
  19252. fn: function (classes){
  19253. var self=this;
  19254. var children,others,nodes,expandedClasses;
  19255. return $core.withContext(function($ctx1) {
  19256. var $1,$3,$2;
  19257. children=[];
  19258. others=[];
  19259. $recv(classes)._do_((function(each){
  19260. return $core.withContext(function($ctx2) {
  19261. $1=$recv(classes)._includes_($recv(each)._superclass());
  19262. if($core.assert($1)){
  19263. return $recv(others)._add_(each);
  19264. } else {
  19265. return $recv(children)._add_(each);
  19266. $ctx2.sendIdx["add:"]=1;
  19267. };
  19268. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19269. }));
  19270. $ctx1.sendIdx["do:"]=1;
  19271. nodes=$recv(children)._collect_((function(each){
  19272. return $core.withContext(function($ctx2) {
  19273. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  19274. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  19275. }));
  19276. nodes=$recv(nodes)._sorted_((function(a,b){
  19277. return $core.withContext(function($ctx2) {
  19278. $3=$recv(a)._theClass();
  19279. $ctx2.sendIdx["theClass"]=1;
  19280. $2=$recv($3)._name();
  19281. $ctx2.sendIdx["name"]=1;
  19282. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  19283. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  19284. }));
  19285. expandedClasses=$recv($globals.Array)._new();
  19286. $recv(nodes)._do_((function(aNode){
  19287. return $core.withContext(function($ctx2) {
  19288. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  19289. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  19290. }));
  19291. return expandedClasses;
  19292. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  19293. },
  19294. args: ["classes"],
  19295. 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",
  19296. referencedClasses: ["ClassSorterNode", "Array"],
  19297. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  19298. }),
  19299. $globals.Package.klass);
  19300. $core.addClass('PackageStateObserver', $globals.Object, [], 'Kernel-Infrastructure');
  19301. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  19302. $core.addMethod(
  19303. $core.method({
  19304. selector: "announcer",
  19305. protocol: 'accessing',
  19306. fn: function (){
  19307. var self=this;
  19308. return $core.withContext(function($ctx1) {
  19309. return $recv($globals.SystemAnnouncer)._current();
  19310. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  19311. },
  19312. args: [],
  19313. source: "announcer\x0a\x09^ SystemAnnouncer current",
  19314. referencedClasses: ["SystemAnnouncer"],
  19315. messageSends: ["current"]
  19316. }),
  19317. $globals.PackageStateObserver);
  19318. $core.addMethod(
  19319. $core.method({
  19320. selector: "observeSystem",
  19321. protocol: 'actions',
  19322. fn: function (){
  19323. var self=this;
  19324. return $core.withContext(function($ctx1) {
  19325. var $1;
  19326. $1=self._announcer();
  19327. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  19328. $ctx1.sendIdx["on:send:to:"]=1;
  19329. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  19330. $ctx1.sendIdx["on:send:to:"]=2;
  19331. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  19332. $ctx1.sendIdx["on:send:to:"]=3;
  19333. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  19334. return self;
  19335. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  19336. },
  19337. args: [],
  19338. 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",
  19339. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  19340. messageSends: ["on:send:to:", "announcer"]
  19341. }),
  19342. $globals.PackageStateObserver);
  19343. $core.addMethod(
  19344. $core.method({
  19345. selector: "onClassModification:",
  19346. protocol: 'reactions',
  19347. fn: function (anAnnouncement){
  19348. var self=this;
  19349. return $core.withContext(function($ctx1) {
  19350. var $1,$receiver;
  19351. $1=$recv(anAnnouncement)._theClass();
  19352. if(($receiver = $1) == null || $receiver.isNil){
  19353. $1;
  19354. } else {
  19355. var theClass;
  19356. theClass=$receiver;
  19357. $recv($recv(theClass)._package())._beDirty();
  19358. };
  19359. return self;
  19360. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19361. },
  19362. args: ["anAnnouncement"],
  19363. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  19364. referencedClasses: [],
  19365. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  19366. }),
  19367. $globals.PackageStateObserver);
  19368. $core.addMethod(
  19369. $core.method({
  19370. selector: "onMethodModification:",
  19371. protocol: 'reactions',
  19372. fn: function (anAnnouncement){
  19373. var self=this;
  19374. return $core.withContext(function($ctx1) {
  19375. var $1,$receiver;
  19376. $1=$recv($recv(anAnnouncement)._method())._package();
  19377. if(($receiver = $1) == null || $receiver.isNil){
  19378. $1;
  19379. } else {
  19380. var package_;
  19381. package_=$receiver;
  19382. $recv(package_)._beDirty();
  19383. };
  19384. return self;
  19385. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19386. },
  19387. args: ["anAnnouncement"],
  19388. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  19389. referencedClasses: [],
  19390. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  19391. }),
  19392. $globals.PackageStateObserver);
  19393. $core.addMethod(
  19394. $core.method({
  19395. selector: "onPackageAdded:",
  19396. protocol: 'reactions',
  19397. fn: function (anAnnouncement){
  19398. var self=this;
  19399. return $core.withContext(function($ctx1) {
  19400. $recv($recv(anAnnouncement)._package())._beDirty();
  19401. return self;
  19402. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19403. },
  19404. args: ["anAnnouncement"],
  19405. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  19406. referencedClasses: [],
  19407. messageSends: ["beDirty", "package"]
  19408. }),
  19409. $globals.PackageStateObserver);
  19410. $core.addMethod(
  19411. $core.method({
  19412. selector: "onProtocolModification:",
  19413. protocol: 'reactions',
  19414. fn: function (anAnnouncement){
  19415. var self=this;
  19416. return $core.withContext(function($ctx1) {
  19417. var $1,$receiver;
  19418. $1=$recv(anAnnouncement)._package();
  19419. if(($receiver = $1) == null || $receiver.isNil){
  19420. $1;
  19421. } else {
  19422. var package_;
  19423. package_=$receiver;
  19424. $recv(package_)._beDirty();
  19425. };
  19426. return self;
  19427. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19428. },
  19429. args: ["anAnnouncement"],
  19430. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  19431. referencedClasses: [],
  19432. messageSends: ["ifNotNil:", "package", "beDirty"]
  19433. }),
  19434. $globals.PackageStateObserver);
  19435. $globals.PackageStateObserver.klass.iVarNames = ['current'];
  19436. $core.addMethod(
  19437. $core.method({
  19438. selector: "current",
  19439. protocol: 'accessing',
  19440. fn: function (){
  19441. var self=this;
  19442. return $core.withContext(function($ctx1) {
  19443. var $1,$receiver;
  19444. $1=self["@current"];
  19445. if(($receiver = $1) == null || $receiver.isNil){
  19446. self["@current"]=self._new();
  19447. return self["@current"];
  19448. } else {
  19449. return $1;
  19450. };
  19451. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  19452. },
  19453. args: [],
  19454. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  19455. referencedClasses: [],
  19456. messageSends: ["ifNil:", "new"]
  19457. }),
  19458. $globals.PackageStateObserver.klass);
  19459. $core.addMethod(
  19460. $core.method({
  19461. selector: "initialize",
  19462. protocol: 'initialization',
  19463. fn: function (){
  19464. var self=this;
  19465. return $core.withContext(function($ctx1) {
  19466. $recv(self._current())._observeSystem();
  19467. return self;
  19468. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  19469. },
  19470. args: [],
  19471. source: "initialize\x0a\x09self current observeSystem",
  19472. referencedClasses: [],
  19473. messageSends: ["observeSystem", "current"]
  19474. }),
  19475. $globals.PackageStateObserver.klass);
  19476. $core.addClass('ParseError', $globals.Error, [], 'Kernel-Infrastructure');
  19477. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  19478. $core.addClass('RethrowErrorHandler', $globals.Object, [], 'Kernel-Infrastructure');
  19479. $globals.RethrowErrorHandler.comment="This class is used in the commandline version of the compiler.\x0aIt uses the handleError: message of ErrorHandler for printing the stacktrace and throws the error again as JS exception.\x0aAs a result Smalltalk errors are not swallowd by the Amber runtime and compilation can be aborted.";
  19480. $core.addMethod(
  19481. $core.method({
  19482. selector: "basicSignal:",
  19483. protocol: 'error handling',
  19484. fn: function (anError){
  19485. var self=this;
  19486. return $core.withContext(function($ctx1) {
  19487. throw anError;
  19488. return self;
  19489. }, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},$globals.RethrowErrorHandler)});
  19490. },
  19491. args: ["anError"],
  19492. source: "basicSignal: anError\x0a <throw anError>",
  19493. referencedClasses: [],
  19494. messageSends: []
  19495. }),
  19496. $globals.RethrowErrorHandler);
  19497. $core.addMethod(
  19498. $core.method({
  19499. selector: "handleError:",
  19500. protocol: 'error handling',
  19501. fn: function (anError){
  19502. var self=this;
  19503. return $core.withContext(function($ctx1) {
  19504. self._basicSignal_(anError);
  19505. return self;
  19506. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.RethrowErrorHandler)});
  19507. },
  19508. args: ["anError"],
  19509. source: "handleError: anError\x0a self basicSignal: anError",
  19510. referencedClasses: [],
  19511. messageSends: ["basicSignal:"]
  19512. }),
  19513. $globals.RethrowErrorHandler);
  19514. $core.addClass('Setting', $globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  19515. $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`";
  19516. $core.addMethod(
  19517. $core.method({
  19518. selector: "defaultValue",
  19519. protocol: 'accessing',
  19520. fn: function (){
  19521. var self=this;
  19522. return self["@defaultValue"];
  19523. },
  19524. args: [],
  19525. source: "defaultValue\x0a\x09^ defaultValue",
  19526. referencedClasses: [],
  19527. messageSends: []
  19528. }),
  19529. $globals.Setting);
  19530. $core.addMethod(
  19531. $core.method({
  19532. selector: "defaultValue:",
  19533. protocol: 'accessing',
  19534. fn: function (aStringifiableObject){
  19535. var self=this;
  19536. self["@defaultValue"]=aStringifiableObject;
  19537. return self;
  19538. },
  19539. args: ["aStringifiableObject"],
  19540. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  19541. referencedClasses: [],
  19542. messageSends: []
  19543. }),
  19544. $globals.Setting);
  19545. $core.addMethod(
  19546. $core.method({
  19547. selector: "key",
  19548. protocol: 'accessing',
  19549. fn: function (){
  19550. var self=this;
  19551. return self["@key"];
  19552. },
  19553. args: [],
  19554. source: "key\x0a\x09^ key",
  19555. referencedClasses: [],
  19556. messageSends: []
  19557. }),
  19558. $globals.Setting);
  19559. $core.addMethod(
  19560. $core.method({
  19561. selector: "key:",
  19562. protocol: 'accessing',
  19563. fn: function (aString){
  19564. var self=this;
  19565. self["@key"]=aString;
  19566. return self;
  19567. },
  19568. args: ["aString"],
  19569. source: "key: aString\x0a\x09key := aString",
  19570. referencedClasses: [],
  19571. messageSends: []
  19572. }),
  19573. $globals.Setting);
  19574. $core.addMethod(
  19575. $core.method({
  19576. selector: "value",
  19577. protocol: 'accessing',
  19578. fn: function (){
  19579. var self=this;
  19580. return $core.withContext(function($ctx1) {
  19581. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_(self._key(),(function(){
  19582. return $core.withContext(function($ctx2) {
  19583. return self._defaultValue();
  19584. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19585. }));
  19586. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  19587. },
  19588. args: [],
  19589. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  19590. referencedClasses: ["Smalltalk"],
  19591. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  19592. }),
  19593. $globals.Setting);
  19594. $core.addMethod(
  19595. $core.method({
  19596. selector: "value:",
  19597. protocol: 'accessing',
  19598. fn: function (aStringifiableObject){
  19599. var self=this;
  19600. return $core.withContext(function($ctx1) {
  19601. return $recv($recv($globals.Smalltalk)._settings())._at_put_(self._key(),aStringifiableObject);
  19602. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  19603. },
  19604. args: ["aStringifiableObject"],
  19605. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  19606. referencedClasses: ["Smalltalk"],
  19607. messageSends: ["at:put:", "settings", "key"]
  19608. }),
  19609. $globals.Setting);
  19610. $core.addMethod(
  19611. $core.method({
  19612. selector: "at:ifAbsent:",
  19613. protocol: 'instance creation',
  19614. fn: function (aString,aDefaultValue){
  19615. var self=this;
  19616. return $core.withContext(function($ctx1) {
  19617. var $1;
  19618. $1=(
  19619. $ctx1.supercall = true,
  19620. ($globals.Setting.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  19621. $ctx1.supercall = false;
  19622. $recv($1)._key_(aString);
  19623. $recv($1)._defaultValue_(aDefaultValue);
  19624. return $recv($1)._yourself();
  19625. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  19626. },
  19627. args: ["aString", "aDefaultValue"],
  19628. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  19629. referencedClasses: [],
  19630. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  19631. }),
  19632. $globals.Setting.klass);
  19633. $core.addMethod(
  19634. $core.method({
  19635. selector: "new",
  19636. protocol: 'instance creation',
  19637. fn: function (){
  19638. var self=this;
  19639. return $core.withContext(function($ctx1) {
  19640. self._shouldNotImplement();
  19641. return self;
  19642. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  19643. },
  19644. args: [],
  19645. source: "new\x0a\x09self shouldNotImplement",
  19646. referencedClasses: [],
  19647. messageSends: ["shouldNotImplement"]
  19648. }),
  19649. $globals.Setting.klass);
  19650. $core.addClass('SmalltalkImage', $globals.Object, [], 'Kernel-Infrastructure');
  19651. $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.";
  19652. $core.addMethod(
  19653. $core.method({
  19654. selector: "addGlobalJsVariable:",
  19655. protocol: 'globals',
  19656. fn: function (aString){
  19657. var self=this;
  19658. return $core.withContext(function($ctx1) {
  19659. $recv(self._globalJsVariables())._add_(aString);
  19660. return self;
  19661. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19662. },
  19663. args: ["aString"],
  19664. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  19665. referencedClasses: [],
  19666. messageSends: ["add:", "globalJsVariables"]
  19667. }),
  19668. $globals.SmalltalkImage);
  19669. $core.addMethod(
  19670. $core.method({
  19671. selector: "amdRequire",
  19672. protocol: 'accessing amd',
  19673. fn: function (){
  19674. var self=this;
  19675. return $core.withContext(function($ctx1) {
  19676. return $recv(self._core())._at_("amdRequire");
  19677. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  19678. },
  19679. args: [],
  19680. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  19681. referencedClasses: [],
  19682. messageSends: ["at:", "core"]
  19683. }),
  19684. $globals.SmalltalkImage);
  19685. $core.addMethod(
  19686. $core.method({
  19687. selector: "asSmalltalkException:",
  19688. protocol: 'error handling',
  19689. fn: function (anObject){
  19690. var self=this;
  19691. return $core.withContext(function($ctx1) {
  19692. var $1;
  19693. $1=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  19694. return $core.withContext(function($ctx2) {
  19695. return $recv(anObject)._isKindOf_($globals.Error);
  19696. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19697. }));
  19698. if($core.assert($1)){
  19699. return anObject;
  19700. } else {
  19701. return $recv($globals.JavaScriptException)._on_(anObject);
  19702. };
  19703. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  19704. },
  19705. args: ["anObject"],
  19706. 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 ]",
  19707. referencedClasses: ["Error", "JavaScriptException"],
  19708. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  19709. }),
  19710. $globals.SmalltalkImage);
  19711. $core.addMethod(
  19712. $core.method({
  19713. selector: "basicCreatePackage:",
  19714. protocol: 'private',
  19715. fn: function (packageName){
  19716. var self=this;
  19717. return $core.withContext(function($ctx1) {
  19718. return $core.addPackage(packageName);
  19719. return self;
  19720. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19721. },
  19722. args: ["packageName"],
  19723. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09<return $core.addPackage(packageName)>",
  19724. referencedClasses: [],
  19725. messageSends: []
  19726. }),
  19727. $globals.SmalltalkImage);
  19728. $core.addMethod(
  19729. $core.method({
  19730. selector: "basicParse:",
  19731. protocol: 'private',
  19732. fn: function (aString){
  19733. var self=this;
  19734. return $core.withContext(function($ctx1) {
  19735. return $recv($globals.SmalltalkParser)._parse_(aString);
  19736. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  19737. },
  19738. args: ["aString"],
  19739. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  19740. referencedClasses: ["SmalltalkParser"],
  19741. messageSends: ["parse:"]
  19742. }),
  19743. $globals.SmalltalkImage);
  19744. $core.addMethod(
  19745. $core.method({
  19746. selector: "basicRegisterPackage:",
  19747. protocol: 'private',
  19748. fn: function (aPackage){
  19749. var self=this;
  19750. return $core.withContext(function($ctx1) {
  19751. $core.packages[aPackage.pkgName]=aPackage;
  19752. return self;
  19753. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  19754. },
  19755. args: ["aPackage"],
  19756. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<$core.packages[aPackage.pkgName]=aPackage>",
  19757. referencedClasses: [],
  19758. messageSends: []
  19759. }),
  19760. $globals.SmalltalkImage);
  19761. $core.addMethod(
  19762. $core.method({
  19763. selector: "cancelOptOut:",
  19764. protocol: 'accessing',
  19765. fn: function (anObject){
  19766. var self=this;
  19767. return $core.withContext(function($ctx1) {
  19768. delete anObject.klass;
  19769. return self;
  19770. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  19771. },
  19772. args: ["anObject"],
  19773. 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<delete anObject.klass>",
  19774. referencedClasses: [],
  19775. messageSends: []
  19776. }),
  19777. $globals.SmalltalkImage);
  19778. $core.addMethod(
  19779. $core.method({
  19780. selector: "classes",
  19781. protocol: 'classes',
  19782. fn: function (){
  19783. var self=this;
  19784. return $core.withContext(function($ctx1) {
  19785. return $core.classes();
  19786. return self;
  19787. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  19788. },
  19789. args: [],
  19790. source: "classes\x0a\x09<return $core.classes()>",
  19791. referencedClasses: [],
  19792. messageSends: []
  19793. }),
  19794. $globals.SmalltalkImage);
  19795. $core.addMethod(
  19796. $core.method({
  19797. selector: "core",
  19798. protocol: 'accessing',
  19799. fn: function (){
  19800. var self=this;
  19801. return $core.withContext(function($ctx1) {
  19802. return $core;
  19803. return self;
  19804. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  19805. },
  19806. args: [],
  19807. source: "core\x0a\x09<return $core>",
  19808. referencedClasses: [],
  19809. messageSends: []
  19810. }),
  19811. $globals.SmalltalkImage);
  19812. $core.addMethod(
  19813. $core.method({
  19814. selector: "createPackage:",
  19815. protocol: 'packages',
  19816. fn: function (packageName){
  19817. var self=this;
  19818. var package_,announcement;
  19819. return $core.withContext(function($ctx1) {
  19820. var $1;
  19821. package_=self._basicCreatePackage_(packageName);
  19822. $1=$recv($globals.PackageAdded)._new();
  19823. $recv($1)._package_(package_);
  19824. announcement=$recv($1)._yourself();
  19825. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  19826. return package_;
  19827. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  19828. },
  19829. args: ["packageName"],
  19830. 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",
  19831. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  19832. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  19833. }),
  19834. $globals.SmalltalkImage);
  19835. $core.addMethod(
  19836. $core.method({
  19837. selector: "defaultAmdNamespace",
  19838. protocol: 'accessing amd',
  19839. fn: function (){
  19840. var self=this;
  19841. return $core.withContext(function($ctx1) {
  19842. return "transport.defaultAmdNamespace"._settingValue();
  19843. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  19844. },
  19845. args: [],
  19846. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  19847. referencedClasses: [],
  19848. messageSends: ["settingValue"]
  19849. }),
  19850. $globals.SmalltalkImage);
  19851. $core.addMethod(
  19852. $core.method({
  19853. selector: "defaultAmdNamespace:",
  19854. protocol: 'accessing amd',
  19855. fn: function (aString){
  19856. var self=this;
  19857. return $core.withContext(function($ctx1) {
  19858. "transport.defaultAmdNamespace"._settingValue_(aString);
  19859. return self;
  19860. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  19861. },
  19862. args: ["aString"],
  19863. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  19864. referencedClasses: [],
  19865. messageSends: ["settingValue:"]
  19866. }),
  19867. $globals.SmalltalkImage);
  19868. $core.addMethod(
  19869. $core.method({
  19870. selector: "deleteClass:",
  19871. protocol: 'private',
  19872. fn: function (aClass){
  19873. var self=this;
  19874. return $core.withContext(function($ctx1) {
  19875. $core.removeClass(aClass);
  19876. return self;
  19877. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  19878. },
  19879. args: ["aClass"],
  19880. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<$core.removeClass(aClass)>",
  19881. referencedClasses: [],
  19882. messageSends: []
  19883. }),
  19884. $globals.SmalltalkImage);
  19885. $core.addMethod(
  19886. $core.method({
  19887. selector: "deleteGlobalJsVariable:",
  19888. protocol: 'globals',
  19889. fn: function (aString){
  19890. var self=this;
  19891. return $core.withContext(function($ctx1) {
  19892. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  19893. }));
  19894. return self;
  19895. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19896. },
  19897. args: ["aString"],
  19898. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  19899. referencedClasses: [],
  19900. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  19901. }),
  19902. $globals.SmalltalkImage);
  19903. $core.addMethod(
  19904. $core.method({
  19905. selector: "deletePackage:",
  19906. protocol: 'private',
  19907. fn: function (packageName){
  19908. var self=this;
  19909. return $core.withContext(function($ctx1) {
  19910. delete $core.packages[packageName];
  19911. return self;
  19912. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19913. },
  19914. args: ["packageName"],
  19915. 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<delete $core.packages[packageName]>",
  19916. referencedClasses: [],
  19917. messageSends: []
  19918. }),
  19919. $globals.SmalltalkImage);
  19920. $core.addMethod(
  19921. $core.method({
  19922. selector: "existsJsGlobal:",
  19923. protocol: 'testing',
  19924. fn: function (aString){
  19925. var self=this;
  19926. return $core.withContext(function($ctx1) {
  19927. return $recv($recv($globals.Platform)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  19928. return true;
  19929. }),(function(){
  19930. return false;
  19931. }));
  19932. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  19933. },
  19934. args: ["aString"],
  19935. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  19936. referencedClasses: ["Platform"],
  19937. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  19938. }),
  19939. $globals.SmalltalkImage);
  19940. $core.addMethod(
  19941. $core.method({
  19942. selector: "globalJsVariables",
  19943. protocol: 'globals',
  19944. fn: function (){
  19945. var self=this;
  19946. return $core.withContext(function($ctx1) {
  19947. return $core.globalJsVariables;
  19948. return self;
  19949. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  19950. },
  19951. args: [],
  19952. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return $core.globalJsVariables>",
  19953. referencedClasses: [],
  19954. messageSends: []
  19955. }),
  19956. $globals.SmalltalkImage);
  19957. $core.addMethod(
  19958. $core.method({
  19959. selector: "globals",
  19960. protocol: 'accessing',
  19961. fn: function (){
  19962. var self=this;
  19963. return $core.withContext(function($ctx1) {
  19964. return $globals;
  19965. return self;
  19966. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  19967. },
  19968. args: [],
  19969. source: "globals\x0a\x09<return $globals>",
  19970. referencedClasses: [],
  19971. messageSends: []
  19972. }),
  19973. $globals.SmalltalkImage);
  19974. $core.addMethod(
  19975. $core.method({
  19976. selector: "includesKey:",
  19977. protocol: 'accessing',
  19978. fn: function (aKey){
  19979. var self=this;
  19980. return $core.withContext(function($ctx1) {
  19981. return $core.hasOwnProperty(aKey);
  19982. return self;
  19983. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  19984. },
  19985. args: ["aKey"],
  19986. source: "includesKey: aKey\x0a\x09<return $core.hasOwnProperty(aKey)>",
  19987. referencedClasses: [],
  19988. messageSends: []
  19989. }),
  19990. $globals.SmalltalkImage);
  19991. $core.addMethod(
  19992. $core.method({
  19993. selector: "isSmalltalkObject:",
  19994. protocol: 'testing',
  19995. fn: function (anObject){
  19996. var self=this;
  19997. return $core.withContext(function($ctx1) {
  19998. return anObject.klass != null;
  19999. return self;
  20000. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  20001. },
  20002. args: ["anObject"],
  20003. 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<return anObject.klass != null>",
  20004. referencedClasses: [],
  20005. messageSends: []
  20006. }),
  20007. $globals.SmalltalkImage);
  20008. $core.addMethod(
  20009. $core.method({
  20010. selector: "optOut:",
  20011. protocol: 'accessing',
  20012. fn: function (anObject){
  20013. var self=this;
  20014. return $core.withContext(function($ctx1) {
  20015. anObject.klass = null;
  20016. return self;
  20017. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  20018. },
  20019. args: ["anObject"],
  20020. 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<anObject.klass = null>",
  20021. referencedClasses: [],
  20022. messageSends: []
  20023. }),
  20024. $globals.SmalltalkImage);
  20025. $core.addMethod(
  20026. $core.method({
  20027. selector: "packageAt:",
  20028. protocol: 'packages',
  20029. fn: function (packageName){
  20030. var self=this;
  20031. return $core.withContext(function($ctx1) {
  20032. return $core.packages[packageName];
  20033. return self;
  20034. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  20035. },
  20036. args: ["packageName"],
  20037. source: "packageAt: packageName\x0a\x09<return $core.packages[packageName]>",
  20038. referencedClasses: [],
  20039. messageSends: []
  20040. }),
  20041. $globals.SmalltalkImage);
  20042. $core.addMethod(
  20043. $core.method({
  20044. selector: "packageAt:ifAbsent:",
  20045. protocol: 'packages',
  20046. fn: function (packageName,aBlock){
  20047. var self=this;
  20048. return $core.withContext(function($ctx1) {
  20049. var $1;
  20050. $1=self._packageAt_(packageName);
  20051. return $recv($1)._ifNil_(aBlock);
  20052. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  20053. },
  20054. args: ["packageName", "aBlock"],
  20055. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  20056. referencedClasses: [],
  20057. messageSends: ["ifNil:", "packageAt:"]
  20058. }),
  20059. $globals.SmalltalkImage);
  20060. $core.addMethod(
  20061. $core.method({
  20062. selector: "packages",
  20063. protocol: 'packages',
  20064. fn: function (){
  20065. var self=this;
  20066. return $core.withContext(function($ctx1) {
  20067. return Object.keys($core.packages).map(function(k) {
  20068. return $core.packages[k];
  20069. })
  20070. ;
  20071. return self;
  20072. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  20073. },
  20074. args: [],
  20075. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09<\x0a\x09\x09return Object.keys($core.packages).map(function(k) {\x0a\x09\x09\x09return $core.packages[k];\x0a\x09\x09})\x0a\x09>",
  20076. referencedClasses: [],
  20077. messageSends: []
  20078. }),
  20079. $globals.SmalltalkImage);
  20080. $core.addMethod(
  20081. $core.method({
  20082. selector: "parse:",
  20083. protocol: 'accessing',
  20084. fn: function (aString){
  20085. var self=this;
  20086. var result;
  20087. return $core.withContext(function($ctx1) {
  20088. var $1;
  20089. $recv((function(){
  20090. return $core.withContext(function($ctx2) {
  20091. result=self._basicParse_(aString);
  20092. return result;
  20093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20094. }))._tryCatch_((function(ex){
  20095. return $core.withContext(function($ctx2) {
  20096. return $recv(self._parseError_parsing_(ex,aString))._signal();
  20097. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  20098. }));
  20099. $1=result;
  20100. $recv($1)._source_(aString);
  20101. return $recv($1)._yourself();
  20102. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  20103. },
  20104. args: ["aString"],
  20105. 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",
  20106. referencedClasses: [],
  20107. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  20108. }),
  20109. $globals.SmalltalkImage);
  20110. $core.addMethod(
  20111. $core.method({
  20112. selector: "parseError:parsing:",
  20113. protocol: 'error handling',
  20114. fn: function (anException,aString){
  20115. var self=this;
  20116. return $core.withContext(function($ctx1) {
  20117. var $1,$7,$6,$5,$8,$4,$3,$2;
  20118. $1=$recv($globals.ParseError)._new();
  20119. $7=$recv(anException)._basicAt_("line");
  20120. $ctx1.sendIdx["basicAt:"]=1;
  20121. $6="Parse error on line ".__comma($7);
  20122. $5=$recv($6).__comma(" column ");
  20123. $ctx1.sendIdx[","]=4;
  20124. $8=$recv(anException)._basicAt_("column");
  20125. $ctx1.sendIdx["basicAt:"]=2;
  20126. $4=$recv($5).__comma($8);
  20127. $ctx1.sendIdx[","]=3;
  20128. $3=$recv($4).__comma(" : Unexpected character ");
  20129. $ctx1.sendIdx[","]=2;
  20130. $2=$recv($3).__comma($recv(anException)._basicAt_("found"));
  20131. $ctx1.sendIdx[","]=1;
  20132. return $recv($1)._messageText_($2);
  20133. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  20134. },
  20135. args: ["anException", "aString"],
  20136. 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')",
  20137. referencedClasses: ["ParseError"],
  20138. messageSends: ["messageText:", "new", ",", "basicAt:"]
  20139. }),
  20140. $globals.SmalltalkImage);
  20141. $core.addMethod(
  20142. $core.method({
  20143. selector: "pseudoVariableNames",
  20144. protocol: 'accessing',
  20145. fn: function (){
  20146. var self=this;
  20147. return ["self", "super", "nil", "true", "false", "thisContext"];
  20148. },
  20149. args: [],
  20150. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  20151. referencedClasses: [],
  20152. messageSends: []
  20153. }),
  20154. $globals.SmalltalkImage);
  20155. $core.addMethod(
  20156. $core.method({
  20157. selector: "readJSObject:",
  20158. protocol: 'accessing',
  20159. fn: function (anObject){
  20160. var self=this;
  20161. return $core.withContext(function($ctx1) {
  20162. return $core.readJSObject(anObject);
  20163. return self;
  20164. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  20165. },
  20166. args: ["anObject"],
  20167. source: "readJSObject: anObject\x0a\x09<return $core.readJSObject(anObject)>",
  20168. referencedClasses: [],
  20169. messageSends: []
  20170. }),
  20171. $globals.SmalltalkImage);
  20172. $core.addMethod(
  20173. $core.method({
  20174. selector: "removeClass:",
  20175. protocol: 'classes',
  20176. fn: function (aClass){
  20177. var self=this;
  20178. return $core.withContext(function($ctx1) {
  20179. var $1,$2,$4,$3;
  20180. $1=$recv(aClass)._isMetaclass();
  20181. if($core.assert($1)){
  20182. self._error_($recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  20183. };
  20184. self._deleteClass_(aClass);
  20185. $2=$recv($globals.SystemAnnouncer)._current();
  20186. $4=$recv($globals.ClassRemoved)._new();
  20187. $recv($4)._theClass_(aClass);
  20188. $3=$recv($4)._yourself();
  20189. $recv($2)._announce_($3);
  20190. return self;
  20191. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  20192. },
  20193. args: ["aClass"],
  20194. 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)",
  20195. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  20196. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  20197. }),
  20198. $globals.SmalltalkImage);
  20199. $core.addMethod(
  20200. $core.method({
  20201. selector: "removePackage:",
  20202. protocol: 'packages',
  20203. fn: function (packageName){
  20204. var self=this;
  20205. var pkg;
  20206. return $core.withContext(function($ctx1) {
  20207. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  20208. return $core.withContext(function($ctx2) {
  20209. return self._error_("Missing package: ".__comma(packageName));
  20210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20211. }));
  20212. $recv($recv(pkg)._classes())._do_((function(each){
  20213. return $core.withContext(function($ctx2) {
  20214. return self._removeClass_(each);
  20215. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  20216. }));
  20217. self._deletePackage_(packageName);
  20218. return self;
  20219. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  20220. },
  20221. args: ["packageName"],
  20222. 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",
  20223. referencedClasses: [],
  20224. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  20225. }),
  20226. $globals.SmalltalkImage);
  20227. $core.addMethod(
  20228. $core.method({
  20229. selector: "renamePackage:to:",
  20230. protocol: 'packages',
  20231. fn: function (packageName,newName){
  20232. var self=this;
  20233. var pkg;
  20234. return $core.withContext(function($ctx1) {
  20235. var $1,$2,$receiver;
  20236. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  20237. return $core.withContext(function($ctx2) {
  20238. $1="Missing package: ".__comma(packageName);
  20239. $ctx2.sendIdx[","]=1;
  20240. return self._error_($1);
  20241. $ctx2.sendIdx["error:"]=1;
  20242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20243. }));
  20244. $2=self._packageAt_(newName);
  20245. if(($receiver = $2) == null || $receiver.isNil){
  20246. $2;
  20247. } else {
  20248. self._error_("Already exists a package called: ".__comma(newName));
  20249. };
  20250. $recv(pkg)._name_(newName);
  20251. self._basicRegisterPackage_(pkg);
  20252. self._deletePackage_(packageName);
  20253. return self;
  20254. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  20255. },
  20256. args: ["packageName", "newName"],
  20257. 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.",
  20258. referencedClasses: [],
  20259. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  20260. }),
  20261. $globals.SmalltalkImage);
  20262. $core.addMethod(
  20263. $core.method({
  20264. selector: "reservedWords",
  20265. protocol: 'accessing',
  20266. fn: function (){
  20267. var self=this;
  20268. return $core.withContext(function($ctx1) {
  20269. return $core.reservedWords;
  20270. return self;
  20271. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  20272. },
  20273. args: [],
  20274. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return $core.reservedWords>",
  20275. referencedClasses: [],
  20276. messageSends: []
  20277. }),
  20278. $globals.SmalltalkImage);
  20279. $core.addMethod(
  20280. $core.method({
  20281. selector: "settings",
  20282. protocol: 'accessing',
  20283. fn: function (){
  20284. var self=this;
  20285. return $globals.SmalltalkSettings;
  20286. },
  20287. args: [],
  20288. source: "settings\x0a\x09^ SmalltalkSettings",
  20289. referencedClasses: ["SmalltalkSettings"],
  20290. messageSends: []
  20291. }),
  20292. $globals.SmalltalkImage);
  20293. $core.addMethod(
  20294. $core.method({
  20295. selector: "version",
  20296. protocol: 'accessing',
  20297. fn: function (){
  20298. var self=this;
  20299. return "0.17.0";
  20300. },
  20301. args: [],
  20302. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.17.0'",
  20303. referencedClasses: [],
  20304. messageSends: []
  20305. }),
  20306. $globals.SmalltalkImage);
  20307. $globals.SmalltalkImage.klass.iVarNames = ['current'];
  20308. $core.addMethod(
  20309. $core.method({
  20310. selector: "current",
  20311. protocol: 'instance creation',
  20312. fn: function (){
  20313. var self=this;
  20314. return $core.withContext(function($ctx1) {
  20315. var $1,$receiver;
  20316. $1=self["@current"];
  20317. if(($receiver = $1) == null || $receiver.isNil){
  20318. self["@current"]=(
  20319. $ctx1.supercall = true,
  20320. ($globals.SmalltalkImage.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  20321. $ctx1.supercall = false;
  20322. return self["@current"];
  20323. } else {
  20324. self._deprecatedAPI();
  20325. return self["@current"];
  20326. };
  20327. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  20328. },
  20329. args: [],
  20330. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  20331. referencedClasses: [],
  20332. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  20333. }),
  20334. $globals.SmalltalkImage.klass);
  20335. $core.addMethod(
  20336. $core.method({
  20337. selector: "initialize",
  20338. protocol: 'initialization',
  20339. fn: function (){
  20340. var self=this;
  20341. var st;
  20342. return $core.withContext(function($ctx1) {
  20343. st=self._current();
  20344. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  20345. return self;
  20346. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  20347. },
  20348. args: [],
  20349. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  20350. referencedClasses: [],
  20351. messageSends: ["current", "at:put:", "globals"]
  20352. }),
  20353. $globals.SmalltalkImage.klass);
  20354. $core.addMethod(
  20355. $core.method({
  20356. selector: "new",
  20357. protocol: 'instance creation',
  20358. fn: function (){
  20359. var self=this;
  20360. return $core.withContext(function($ctx1) {
  20361. self._shouldNotImplement();
  20362. return self;
  20363. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  20364. },
  20365. args: [],
  20366. source: "new\x0a\x09self shouldNotImplement",
  20367. referencedClasses: [],
  20368. messageSends: ["shouldNotImplement"]
  20369. }),
  20370. $globals.SmalltalkImage.klass);
  20371. $core.addMethod(
  20372. $core.method({
  20373. selector: "importsString",
  20374. protocol: '*Kernel-Infrastructure',
  20375. fn: function (){
  20376. var self=this;
  20377. return $core.withContext(function($ctx1) {
  20378. var $3,$2,$1;
  20379. $3=$recv(self._key())._importsString();
  20380. $ctx1.sendIdx["importsString"]=1;
  20381. $2=$recv($3).__comma(" -> ");
  20382. $1=$recv($2).__comma($recv(self._value())._importsString());
  20383. $ctx1.sendIdx[","]=1;
  20384. return $1;
  20385. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.Association)});
  20386. },
  20387. args: [],
  20388. 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",
  20389. referencedClasses: [],
  20390. messageSends: [",", "importsString", "key", "value"]
  20391. }),
  20392. $globals.Association);
  20393. $core.addMethod(
  20394. $core.method({
  20395. selector: "asJavaScriptPropertyName",
  20396. protocol: '*Kernel-Infrastructure',
  20397. fn: function (){
  20398. var self=this;
  20399. return $core.withContext(function($ctx1) {
  20400. return $core.st2prop(self);
  20401. return self;
  20402. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  20403. },
  20404. args: [],
  20405. source: "asJavaScriptPropertyName\x0a<return $core.st2prop(self)>",
  20406. referencedClasses: [],
  20407. messageSends: []
  20408. }),
  20409. $globals.String);
  20410. $core.addMethod(
  20411. $core.method({
  20412. selector: "asSetting",
  20413. protocol: '*Kernel-Infrastructure',
  20414. fn: function (){
  20415. var self=this;
  20416. return $core.withContext(function($ctx1) {
  20417. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  20418. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  20419. },
  20420. args: [],
  20421. 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",
  20422. referencedClasses: ["Setting"],
  20423. messageSends: ["at:ifAbsent:"]
  20424. }),
  20425. $globals.String);
  20426. $core.addMethod(
  20427. $core.method({
  20428. selector: "asSettingIfAbsent:",
  20429. protocol: '*Kernel-Infrastructure',
  20430. fn: function (aDefaultValue){
  20431. var self=this;
  20432. return $core.withContext(function($ctx1) {
  20433. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  20434. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20435. },
  20436. args: ["aDefaultValue"],
  20437. 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",
  20438. referencedClasses: ["Setting"],
  20439. messageSends: ["at:ifAbsent:"]
  20440. }),
  20441. $globals.String);
  20442. $core.addMethod(
  20443. $core.method({
  20444. selector: "importsString",
  20445. protocol: '*Kernel-Infrastructure',
  20446. fn: function (){
  20447. var self=this;
  20448. return $core.withContext(function($ctx1) {
  20449. var $1;
  20450. $1=$recv("'".__comma(self._replace_with_("'","''"))).__comma("'");
  20451. $ctx1.sendIdx[","]=1;
  20452. return $1;
  20453. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.String)});
  20454. },
  20455. args: [],
  20456. source: "importsString\x0a\x09\x22Answer receiver as Smalltalk expression\x22\x0a\x09^ '''', (self replace: '''' with: ''''''), ''''",
  20457. referencedClasses: [],
  20458. messageSends: [",", "replace:with:"]
  20459. }),
  20460. $globals.String);
  20461. $core.addMethod(
  20462. $core.method({
  20463. selector: "settingValue",
  20464. protocol: '*Kernel-Infrastructure',
  20465. fn: function (){
  20466. var self=this;
  20467. return $core.withContext(function($ctx1) {
  20468. return $recv(self._asSetting())._value();
  20469. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  20470. },
  20471. args: [],
  20472. source: "settingValue\x0a\x09^ self asSetting value",
  20473. referencedClasses: [],
  20474. messageSends: ["value", "asSetting"]
  20475. }),
  20476. $globals.String);
  20477. $core.addMethod(
  20478. $core.method({
  20479. selector: "settingValue:",
  20480. protocol: '*Kernel-Infrastructure',
  20481. fn: function (aValue){
  20482. var self=this;
  20483. return $core.withContext(function($ctx1) {
  20484. return $recv(self._asSetting())._value_(aValue);
  20485. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  20486. },
  20487. args: ["aValue"],
  20488. 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",
  20489. referencedClasses: [],
  20490. messageSends: ["value:", "asSetting"]
  20491. }),
  20492. $globals.String);
  20493. $core.addMethod(
  20494. $core.method({
  20495. selector: "settingValueIfAbsent:",
  20496. protocol: '*Kernel-Infrastructure',
  20497. fn: function (aDefaultValue){
  20498. var self=this;
  20499. return $core.withContext(function($ctx1) {
  20500. return $recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  20501. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20502. },
  20503. args: ["aDefaultValue"],
  20504. 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",
  20505. referencedClasses: [],
  20506. messageSends: ["value", "asSettingIfAbsent:"]
  20507. }),
  20508. $globals.String);
  20509. });
  20510. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20511. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  20512. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20513. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  20514. $core.addPackage('Kernel-Promises');
  20515. $core.packages["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  20516. $core.packages["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20517. $core.addClass('Thenable', $globals.Object, [], 'Kernel-Promises');
  20518. $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.";
  20519. $core.addMethod(
  20520. $core.method({
  20521. selector: "catch:",
  20522. protocol: 'promises',
  20523. fn: function (aBlock){
  20524. var self=this;
  20525. return $core.withContext(function($ctx1) {
  20526. return self.then(null, function (err) {return $core.seamless(function () {
  20527. return aBlock._value_(err);
  20528. })});
  20529. return self;
  20530. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.Thenable)});
  20531. },
  20532. args: ["aBlock"],
  20533. source: "catch: aBlock\x0a<return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})>",
  20534. referencedClasses: [],
  20535. messageSends: []
  20536. }),
  20537. $globals.Thenable);
  20538. $core.addMethod(
  20539. $core.method({
  20540. selector: "on:do:",
  20541. protocol: 'promises',
  20542. fn: function (aClass,aBlock){
  20543. var self=this;
  20544. return $core.withContext(function($ctx1) {
  20545. return self.then(null, function (err) {return $core.seamless(function () {
  20546. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  20547. else throw err;
  20548. })});
  20549. return self;
  20550. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Thenable)});
  20551. },
  20552. args: ["aClass", "aBlock"],
  20553. source: "on: aClass do: aBlock\x0a<return self.then(null, function (err) {return $core.seamless(function () {\x0a if (err._isKindOf_(aClass)) return aBlock._value_(err);\x0a else throw err;\x0a})})>",
  20554. referencedClasses: [],
  20555. messageSends: []
  20556. }),
  20557. $globals.Thenable);
  20558. $core.addMethod(
  20559. $core.method({
  20560. selector: "on:do:catch:",
  20561. protocol: 'promises',
  20562. fn: function (aClass,aBlock,anotherBlock){
  20563. var self=this;
  20564. return $core.withContext(function($ctx1) {
  20565. return self.then(null, function (err) {return $core.seamless(function () {
  20566. try { if (err._isKindOf_(aClass)) return aBlock._value_(err); } catch (e) { err = e; }
  20567. return anotherBlock._value_(err);
  20568. })});
  20569. return self;
  20570. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Thenable)});
  20571. },
  20572. args: ["aClass", "aBlock", "anotherBlock"],
  20573. source: "on: aClass do: aBlock catch: anotherBlock\x0a<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})})>",
  20574. referencedClasses: [],
  20575. messageSends: []
  20576. }),
  20577. $globals.Thenable);
  20578. $core.addMethod(
  20579. $core.method({
  20580. selector: "then:",
  20581. protocol: 'promises',
  20582. fn: function (aBlockOrArray){
  20583. var self=this;
  20584. return $core.withContext(function($ctx1) {
  20585. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  20586. return array.reduce(function (soFar, aBlock) {
  20587. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  20588. function (result) {return $core.seamless(function () {
  20589. if (Array.isArray(result)) {
  20590. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  20591. } else {
  20592. return aBlock._value_(result);
  20593. }
  20594. })} :
  20595. function (result) {return $core.seamless(function () {
  20596. return aBlock._value_(result);
  20597. })}
  20598. );
  20599. }, self);
  20600. return self;
  20601. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.Thenable)});
  20602. },
  20603. args: ["aBlockOrArray"],
  20604. 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<\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)>",
  20605. referencedClasses: [],
  20606. messageSends: []
  20607. }),
  20608. $globals.Thenable);
  20609. $core.addMethod(
  20610. $core.method({
  20611. selector: "then:catch:",
  20612. protocol: 'promises',
  20613. fn: function (aBlockOrArray,anotherBlock){
  20614. var self=this;
  20615. return $core.withContext(function($ctx1) {
  20616. return $recv(self._then_(aBlockOrArray))._catch_(anotherBlock);
  20617. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.Thenable)});
  20618. },
  20619. args: ["aBlockOrArray", "anotherBlock"],
  20620. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  20621. referencedClasses: [],
  20622. messageSends: ["catch:", "then:"]
  20623. }),
  20624. $globals.Thenable);
  20625. $core.addMethod(
  20626. $core.method({
  20627. selector: "then:on:do:",
  20628. protocol: 'promises',
  20629. fn: function (aBlockOrArray,aClass,aBlock){
  20630. var self=this;
  20631. return $core.withContext(function($ctx1) {
  20632. return $recv(self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  20633. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.Thenable)});
  20634. },
  20635. args: ["aBlockOrArray", "aClass", "aBlock"],
  20636. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  20637. referencedClasses: [],
  20638. messageSends: ["on:do:", "then:"]
  20639. }),
  20640. $globals.Thenable);
  20641. $core.addMethod(
  20642. $core.method({
  20643. selector: "then:on:do:catch:",
  20644. protocol: 'promises',
  20645. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  20646. var self=this;
  20647. return $core.withContext(function($ctx1) {
  20648. return $recv($recv(self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  20649. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Thenable)});
  20650. },
  20651. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  20652. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  20653. referencedClasses: [],
  20654. messageSends: ["catch:", "on:do:", "then:"]
  20655. }),
  20656. $globals.Thenable);
  20657. $core.addClass('Promise', $globals.Thenable, [], 'Kernel-Promises');
  20658. $core.addMethod(
  20659. $core.method({
  20660. selector: "all:",
  20661. protocol: 'composites',
  20662. fn: function (aCollection){
  20663. var self=this;
  20664. return $core.withContext(function($ctx1) {
  20665. return Promise.all($recv(aCollection)._asArray());
  20666. return self;
  20667. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.klass)});
  20668. },
  20669. args: ["aCollection"],
  20670. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<return Promise.all($recv(aCollection)._asArray())>",
  20671. referencedClasses: [],
  20672. messageSends: []
  20673. }),
  20674. $globals.Promise.klass);
  20675. $core.addMethod(
  20676. $core.method({
  20677. selector: "any:",
  20678. protocol: 'composites',
  20679. fn: function (aCollection){
  20680. var self=this;
  20681. return $core.withContext(function($ctx1) {
  20682. return Promise.race($recv(aCollection)._asArray());
  20683. return self;
  20684. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.klass)});
  20685. },
  20686. args: ["aCollection"],
  20687. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<return Promise.race($recv(aCollection)._asArray())>",
  20688. referencedClasses: [],
  20689. messageSends: []
  20690. }),
  20691. $globals.Promise.klass);
  20692. $core.addMethod(
  20693. $core.method({
  20694. selector: "forBlock:",
  20695. protocol: 'instance creation',
  20696. fn: function (aBlock){
  20697. var self=this;
  20698. return $core.withContext(function($ctx1) {
  20699. return $recv(self._new())._then_(aBlock);
  20700. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.klass)});
  20701. },
  20702. args: ["aBlock"],
  20703. 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",
  20704. referencedClasses: [],
  20705. messageSends: ["then:", "new"]
  20706. }),
  20707. $globals.Promise.klass);
  20708. $core.addMethod(
  20709. $core.method({
  20710. selector: "new",
  20711. protocol: 'instance creation',
  20712. fn: function (){
  20713. var self=this;
  20714. return $core.withContext(function($ctx1) {
  20715. return Promise.resolve();
  20716. return self;
  20717. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.klass)});
  20718. },
  20719. args: [],
  20720. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<return Promise.resolve()>",
  20721. referencedClasses: [],
  20722. messageSends: []
  20723. }),
  20724. $globals.Promise.klass);
  20725. $core.addMethod(
  20726. $core.method({
  20727. selector: "new:",
  20728. protocol: 'instance creation',
  20729. fn: function (aBlock){
  20730. var self=this;
  20731. return $core.withContext(function($ctx1) {
  20732. return new Promise(function (resolve, reject) {
  20733. var model = {value: resolve, signal: reject}; // TODO make faster
  20734. aBlock._value_(model);
  20735. });
  20736. return self;
  20737. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.klass)});
  20738. },
  20739. args: ["aBlock"],
  20740. 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<return new Promise(function (resolve, reject) {\x0a var model = {value: resolve, signal: reject}; // TODO make faster\x0a aBlock._value_(model);\x0a})>",
  20741. referencedClasses: [],
  20742. messageSends: []
  20743. }),
  20744. $globals.Promise.klass);
  20745. $core.addMethod(
  20746. $core.method({
  20747. selector: "signal:",
  20748. protocol: 'instance creation',
  20749. fn: function (anObject){
  20750. var self=this;
  20751. return $core.withContext(function($ctx1) {
  20752. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  20753. return self;
  20754. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.klass)});
  20755. },
  20756. args: ["anObject"],
  20757. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<return $recv(anObject)._in_(function (x) {return Promise.reject(x)})>",
  20758. referencedClasses: [],
  20759. messageSends: []
  20760. }),
  20761. $globals.Promise.klass);
  20762. $core.addMethod(
  20763. $core.method({
  20764. selector: "value:",
  20765. protocol: 'instance creation',
  20766. fn: function (anObject){
  20767. var self=this;
  20768. return $core.withContext(function($ctx1) {
  20769. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  20770. return self;
  20771. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.klass)});
  20772. },
  20773. args: ["anObject"],
  20774. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})>",
  20775. referencedClasses: [],
  20776. messageSends: []
  20777. }),
  20778. $globals.Promise.klass);
  20779. $core.addMethod(
  20780. $core.method({
  20781. selector: "catch:",
  20782. protocol: '*Kernel-Promises',
  20783. fn: function (aBlock){
  20784. var self=this;
  20785. return $core.withContext(function($ctx1) {
  20786. var js = self["@jsObject"];
  20787. if (typeof js.then === "function")
  20788. return $globals.Thenable.fn.prototype._catch_.call(js, aBlock);
  20789. else
  20790. return self._doesNotUnderstand_(
  20791. $globals.Message._new()
  20792. ._selector_("catch:")
  20793. ._arguments_([aBlock])
  20794. );
  20795. return self;
  20796. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  20797. },
  20798. args: ["aBlock"],
  20799. source: "catch: aBlock\x0a<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 )>",
  20800. referencedClasses: [],
  20801. messageSends: []
  20802. }),
  20803. $globals.JSObjectProxy);
  20804. $core.addMethod(
  20805. $core.method({
  20806. selector: "on:do:",
  20807. protocol: '*Kernel-Promises',
  20808. fn: function (aClass,aBlock){
  20809. var self=this;
  20810. return $core.withContext(function($ctx1) {
  20811. var js = self["@jsObject"];
  20812. if (typeof js.then === "function")
  20813. return $globals.Thenable.fn.prototype._on_do_.call(js, aClass, aBlock);
  20814. else
  20815. return self._doesNotUnderstand_(
  20816. $globals.Message._new()
  20817. ._selector_("on:do:")
  20818. ._arguments_([aClass, aBlock])
  20819. );
  20820. return self;
  20821. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  20822. },
  20823. args: ["aClass", "aBlock"],
  20824. source: "on: aClass do: aBlock\x0a<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 )>",
  20825. referencedClasses: [],
  20826. messageSends: []
  20827. }),
  20828. $globals.JSObjectProxy);
  20829. $core.addMethod(
  20830. $core.method({
  20831. selector: "on:do:catch:",
  20832. protocol: '*Kernel-Promises',
  20833. fn: function (aClass,aBlock,anotherBlock){
  20834. var self=this;
  20835. return $core.withContext(function($ctx1) {
  20836. var js = self["@jsObject"];
  20837. if (typeof js.then === "function")
  20838. return $globals.Thenable.fn.prototype._on_do_catch_.call(js, aClass, aBlock, anotherBlock);
  20839. else
  20840. return self._doesNotUnderstand_(
  20841. $globals.Message._new()
  20842. ._selector_("on:do:catch:")
  20843. ._arguments_([aClass, aBlock, anotherBlock])
  20844. );
  20845. return self;
  20846. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  20847. },
  20848. args: ["aClass", "aBlock", "anotherBlock"],
  20849. source: "on: aClass do: aBlock catch: anotherBlock\x0a<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 )>",
  20850. referencedClasses: [],
  20851. messageSends: []
  20852. }),
  20853. $globals.JSObjectProxy);
  20854. $core.addMethod(
  20855. $core.method({
  20856. selector: "then:",
  20857. protocol: '*Kernel-Promises',
  20858. fn: function (aBlockOrArray){
  20859. var self=this;
  20860. return $core.withContext(function($ctx1) {
  20861. var js = self["@jsObject"];
  20862. if (typeof js.then === "function")
  20863. return $globals.Thenable.fn.prototype._then_.call(js, aBlockOrArray);
  20864. else
  20865. return self._doesNotUnderstand_(
  20866. $globals.Message._new()
  20867. ._selector_("then:")
  20868. ._arguments_([aBlockOrArray])
  20869. );
  20870. return self;
  20871. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  20872. },
  20873. args: ["aBlockOrArray"],
  20874. source: "then: aBlockOrArray\x0a<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 )>",
  20875. referencedClasses: [],
  20876. messageSends: []
  20877. }),
  20878. $globals.JSObjectProxy);
  20879. $core.addMethod(
  20880. $core.method({
  20881. selector: "then:catch:",
  20882. protocol: '*Kernel-Promises',
  20883. fn: function (aBlockOrArray,anotherBlock){
  20884. var self=this;
  20885. return $core.withContext(function($ctx1) {
  20886. var js = self["@jsObject"];
  20887. if (typeof js.then === "function")
  20888. return $globals.Thenable.fn.prototype._then_catch_.call(js, aBlockOrArray, anotherBlock);
  20889. else
  20890. return self._doesNotUnderstand_(
  20891. $globals.Message._new()
  20892. ._selector_("then:catch:")
  20893. ._arguments_([aBlockOrArray, anotherBlock])
  20894. );
  20895. return self;
  20896. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  20897. },
  20898. args: ["aBlockOrArray", "anotherBlock"],
  20899. source: "then: aBlockOrArray catch: anotherBlock\x0a<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 )>",
  20900. referencedClasses: [],
  20901. messageSends: []
  20902. }),
  20903. $globals.JSObjectProxy);
  20904. $core.addMethod(
  20905. $core.method({
  20906. selector: "then:on:do:",
  20907. protocol: '*Kernel-Promises',
  20908. fn: function (aBlockOrArray,aClass,aBlock){
  20909. var self=this;
  20910. return $core.withContext(function($ctx1) {
  20911. var js = self["@jsObject"];
  20912. if (typeof js.then === "function")
  20913. return $globals.Thenable.fn.prototype._then_on_do_.call(js, aBlockOrArray, aClass, aBlock);
  20914. else
  20915. return self._doesNotUnderstand_(
  20916. $globals.Message._new()
  20917. ._selector_("then:on:do:")
  20918. ._arguments_([aBlockOrArray, aClass, aBlock])
  20919. );
  20920. return self;
  20921. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  20922. },
  20923. args: ["aBlockOrArray", "aClass", "aBlock"],
  20924. source: "then: aBlockOrArray on: aClass do: aBlock\x0a<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 )>",
  20925. referencedClasses: [],
  20926. messageSends: []
  20927. }),
  20928. $globals.JSObjectProxy);
  20929. $core.addMethod(
  20930. $core.method({
  20931. selector: "then:on:do:catch:",
  20932. protocol: '*Kernel-Promises',
  20933. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  20934. var self=this;
  20935. return $core.withContext(function($ctx1) {
  20936. var js = self["@jsObject"];
  20937. if (typeof js.then === "function")
  20938. return $globals.Thenable.fn.prototype._then_on_do_catch_.call(js, aBlockOrArray, aClass, aBlock, anotherBlock);
  20939. else
  20940. return self._doesNotUnderstand_(
  20941. $globals.Message._new()
  20942. ._selector_("then:on:do:catch:")
  20943. ._arguments_([aBlockOrArray, aClass, aBlock, anotherBlock])
  20944. );
  20945. return self;
  20946. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  20947. },
  20948. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  20949. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a<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 )>",
  20950. referencedClasses: [],
  20951. messageSends: []
  20952. }),
  20953. $globals.JSObjectProxy);
  20954. });
  20955. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20956. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  20957. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20958. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  20959. $core.addPackage('Kernel-Announcements');
  20960. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  20961. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20962. $core.addClass('AnnouncementSubscription', $globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  20963. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  20964. $core.addMethod(
  20965. $core.method({
  20966. selector: "announcementClass",
  20967. protocol: 'accessing',
  20968. fn: function (){
  20969. var self=this;
  20970. return self["@announcementClass"];
  20971. },
  20972. args: [],
  20973. source: "announcementClass\x0a\x09^ announcementClass",
  20974. referencedClasses: [],
  20975. messageSends: []
  20976. }),
  20977. $globals.AnnouncementSubscription);
  20978. $core.addMethod(
  20979. $core.method({
  20980. selector: "announcementClass:",
  20981. protocol: 'accessing',
  20982. fn: function (aClass){
  20983. var self=this;
  20984. self["@announcementClass"]=aClass;
  20985. return self;
  20986. },
  20987. args: ["aClass"],
  20988. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  20989. referencedClasses: [],
  20990. messageSends: []
  20991. }),
  20992. $globals.AnnouncementSubscription);
  20993. $core.addMethod(
  20994. $core.method({
  20995. selector: "deliver:",
  20996. protocol: 'announcing',
  20997. fn: function (anAnnouncement){
  20998. var self=this;
  20999. return $core.withContext(function($ctx1) {
  21000. var $1;
  21001. $1=self._handlesAnnouncement_(anAnnouncement);
  21002. if($core.assert($1)){
  21003. $recv(self._valuable())._value_(anAnnouncement);
  21004. };
  21005. return self;
  21006. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  21007. },
  21008. args: ["anAnnouncement"],
  21009. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  21010. referencedClasses: [],
  21011. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  21012. }),
  21013. $globals.AnnouncementSubscription);
  21014. $core.addMethod(
  21015. $core.method({
  21016. selector: "handlesAnnouncement:",
  21017. protocol: 'announcing',
  21018. fn: function (anAnnouncement){
  21019. var self=this;
  21020. return $core.withContext(function($ctx1) {
  21021. var $2,$3,$1,$receiver;
  21022. $2=$recv($globals.Smalltalk)._globals();
  21023. $ctx1.sendIdx["globals"]=1;
  21024. $3=$recv(self._announcementClass())._name();
  21025. $ctx1.sendIdx["name"]=1;
  21026. $1=$recv($2)._at_($3);
  21027. $ctx1.sendIdx["at:"]=1;
  21028. if(($receiver = $1) == null || $receiver.isNil){
  21029. return false;
  21030. } else {
  21031. var class_;
  21032. class_=$receiver;
  21033. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  21034. };
  21035. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  21036. },
  21037. args: ["anAnnouncement"],
  21038. 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 ]",
  21039. referencedClasses: ["Smalltalk"],
  21040. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  21041. }),
  21042. $globals.AnnouncementSubscription);
  21043. $core.addMethod(
  21044. $core.method({
  21045. selector: "receiver",
  21046. protocol: 'accessing',
  21047. fn: function (){
  21048. var self=this;
  21049. return $core.withContext(function($ctx1) {
  21050. return $recv(self._valuable())._receiver();
  21051. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  21052. },
  21053. args: [],
  21054. source: "receiver\x0a\x09^ self valuable receiver",
  21055. referencedClasses: [],
  21056. messageSends: ["receiver", "valuable"]
  21057. }),
  21058. $globals.AnnouncementSubscription);
  21059. $core.addMethod(
  21060. $core.method({
  21061. selector: "valuable",
  21062. protocol: 'accessing',
  21063. fn: function (){
  21064. var self=this;
  21065. return self["@valuable"];
  21066. },
  21067. args: [],
  21068. source: "valuable\x0a\x09^ valuable",
  21069. referencedClasses: [],
  21070. messageSends: []
  21071. }),
  21072. $globals.AnnouncementSubscription);
  21073. $core.addMethod(
  21074. $core.method({
  21075. selector: "valuable:",
  21076. protocol: 'accessing',
  21077. fn: function (aValuable){
  21078. var self=this;
  21079. self["@valuable"]=aValuable;
  21080. return self;
  21081. },
  21082. args: ["aValuable"],
  21083. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  21084. referencedClasses: [],
  21085. messageSends: []
  21086. }),
  21087. $globals.AnnouncementSubscription);
  21088. $core.addClass('AnnouncementValuable', $globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
  21089. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  21090. $core.addMethod(
  21091. $core.method({
  21092. selector: "receiver",
  21093. protocol: 'accessing',
  21094. fn: function (){
  21095. var self=this;
  21096. return self["@receiver"];
  21097. },
  21098. args: [],
  21099. source: "receiver\x0a\x09^ receiver",
  21100. referencedClasses: [],
  21101. messageSends: []
  21102. }),
  21103. $globals.AnnouncementValuable);
  21104. $core.addMethod(
  21105. $core.method({
  21106. selector: "receiver:",
  21107. protocol: 'accessing',
  21108. fn: function (anObject){
  21109. var self=this;
  21110. self["@receiver"]=anObject;
  21111. return self;
  21112. },
  21113. args: ["anObject"],
  21114. source: "receiver: anObject\x0a\x09receiver := anObject",
  21115. referencedClasses: [],
  21116. messageSends: []
  21117. }),
  21118. $globals.AnnouncementValuable);
  21119. $core.addMethod(
  21120. $core.method({
  21121. selector: "valuable",
  21122. protocol: 'accessing',
  21123. fn: function (){
  21124. var self=this;
  21125. return self["@valuable"];
  21126. },
  21127. args: [],
  21128. source: "valuable\x0a\x09^ valuable",
  21129. referencedClasses: [],
  21130. messageSends: []
  21131. }),
  21132. $globals.AnnouncementValuable);
  21133. $core.addMethod(
  21134. $core.method({
  21135. selector: "valuable:",
  21136. protocol: 'accessing',
  21137. fn: function (anObject){
  21138. var self=this;
  21139. self["@valuable"]=anObject;
  21140. return self;
  21141. },
  21142. args: ["anObject"],
  21143. source: "valuable: anObject\x0a\x09valuable := anObject",
  21144. referencedClasses: [],
  21145. messageSends: []
  21146. }),
  21147. $globals.AnnouncementValuable);
  21148. $core.addMethod(
  21149. $core.method({
  21150. selector: "value",
  21151. protocol: 'evaluating',
  21152. fn: function (){
  21153. var self=this;
  21154. return $core.withContext(function($ctx1) {
  21155. return $recv(self._valuable())._value();
  21156. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  21157. },
  21158. args: [],
  21159. source: "value\x0a\x09^ self valuable value",
  21160. referencedClasses: [],
  21161. messageSends: ["value", "valuable"]
  21162. }),
  21163. $globals.AnnouncementValuable);
  21164. $core.addMethod(
  21165. $core.method({
  21166. selector: "value:",
  21167. protocol: 'evaluating',
  21168. fn: function (anObject){
  21169. var self=this;
  21170. return $core.withContext(function($ctx1) {
  21171. return $recv(self._valuable())._value_(anObject);
  21172. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  21173. },
  21174. args: ["anObject"],
  21175. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  21176. referencedClasses: [],
  21177. messageSends: ["value:", "valuable"]
  21178. }),
  21179. $globals.AnnouncementValuable);
  21180. $core.addClass('Announcer', $globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  21181. $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' ].";
  21182. $core.addMethod(
  21183. $core.method({
  21184. selector: "announce:",
  21185. protocol: 'announcing',
  21186. fn: function (anAnnouncement){
  21187. var self=this;
  21188. return $core.withContext(function($ctx1) {
  21189. $recv(self["@subscriptions"])._do_((function(each){
  21190. return $core.withContext(function($ctx2) {
  21191. return $recv(each)._deliver_(anAnnouncement);
  21192. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21193. }));
  21194. return self;
  21195. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  21196. },
  21197. args: ["anAnnouncement"],
  21198. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  21199. referencedClasses: [],
  21200. messageSends: ["do:", "deliver:"]
  21201. }),
  21202. $globals.Announcer);
  21203. $core.addMethod(
  21204. $core.method({
  21205. selector: "initialize",
  21206. protocol: 'initialization',
  21207. fn: function (){
  21208. var self=this;
  21209. return $core.withContext(function($ctx1) {
  21210. (
  21211. $ctx1.supercall = true,
  21212. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  21213. $ctx1.supercall = false;
  21214. self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  21215. return self;
  21216. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  21217. },
  21218. args: [],
  21219. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  21220. referencedClasses: ["OrderedCollection"],
  21221. messageSends: ["initialize", "new"]
  21222. }),
  21223. $globals.Announcer);
  21224. $core.addMethod(
  21225. $core.method({
  21226. selector: "on:do:",
  21227. protocol: 'subscribing',
  21228. fn: function (aClass,aBlock){
  21229. var self=this;
  21230. return $core.withContext(function($ctx1) {
  21231. self._on_do_for_(aClass,aBlock,nil);
  21232. return self;
  21233. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  21234. },
  21235. args: ["aClass", "aBlock"],
  21236. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  21237. referencedClasses: [],
  21238. messageSends: ["on:do:for:"]
  21239. }),
  21240. $globals.Announcer);
  21241. $core.addMethod(
  21242. $core.method({
  21243. selector: "on:do:for:",
  21244. protocol: 'subscribing',
  21245. fn: function (aClass,aBlock,aReceiver){
  21246. var self=this;
  21247. return $core.withContext(function($ctx1) {
  21248. var $1,$3,$5,$6,$4,$2;
  21249. $1=self["@subscriptions"];
  21250. $3=$recv($globals.AnnouncementSubscription)._new();
  21251. $ctx1.sendIdx["new"]=1;
  21252. $5=$recv($globals.AnnouncementValuable)._new();
  21253. $recv($5)._valuable_(aBlock);
  21254. $recv($5)._receiver_(aReceiver);
  21255. $6=$recv($5)._yourself();
  21256. $ctx1.sendIdx["yourself"]=1;
  21257. $4=$6;
  21258. $recv($3)._valuable_($4);
  21259. $ctx1.sendIdx["valuable:"]=1;
  21260. $recv($3)._announcementClass_(aClass);
  21261. $2=$recv($3)._yourself();
  21262. $recv($1)._add_($2);
  21263. return self;
  21264. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  21265. },
  21266. args: ["aClass", "aBlock", "aReceiver"],
  21267. 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)",
  21268. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  21269. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  21270. }),
  21271. $globals.Announcer);
  21272. $core.addMethod(
  21273. $core.method({
  21274. selector: "on:doOnce:",
  21275. protocol: 'subscribing',
  21276. fn: function (aClass,aBlock){
  21277. var self=this;
  21278. var subscription;
  21279. return $core.withContext(function($ctx1) {
  21280. var $1;
  21281. $1=$recv($globals.AnnouncementSubscription)._new();
  21282. $recv($1)._announcementClass_(aClass);
  21283. subscription=$recv($1)._yourself();
  21284. $recv(subscription)._valuable_((function(ann){
  21285. return $core.withContext(function($ctx2) {
  21286. $recv(self["@subscriptions"])._remove_(subscription);
  21287. return $recv(aBlock)._value_(ann);
  21288. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  21289. }));
  21290. $recv(self["@subscriptions"])._add_(subscription);
  21291. return self;
  21292. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  21293. },
  21294. args: ["aClass", "aBlock"],
  21295. 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",
  21296. referencedClasses: ["AnnouncementSubscription"],
  21297. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  21298. }),
  21299. $globals.Announcer);
  21300. $core.addMethod(
  21301. $core.method({
  21302. selector: "on:send:to:",
  21303. protocol: 'subscribing',
  21304. fn: function (aClass,aSelector,anObject){
  21305. var self=this;
  21306. return $core.withContext(function($ctx1) {
  21307. var $1,$3,$5,$6,$4,$2;
  21308. $1=self["@subscriptions"];
  21309. $3=$recv($globals.AnnouncementSubscription)._new();
  21310. $ctx1.sendIdx["new"]=1;
  21311. $5=$recv($globals.MessageSend)._new();
  21312. $recv($5)._receiver_(anObject);
  21313. $recv($5)._selector_(aSelector);
  21314. $6=$recv($5)._yourself();
  21315. $ctx1.sendIdx["yourself"]=1;
  21316. $4=$6;
  21317. $recv($3)._valuable_($4);
  21318. $recv($3)._announcementClass_(aClass);
  21319. $2=$recv($3)._yourself();
  21320. $recv($1)._add_($2);
  21321. return self;
  21322. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  21323. },
  21324. args: ["aClass", "aSelector", "anObject"],
  21325. 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)",
  21326. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  21327. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  21328. }),
  21329. $globals.Announcer);
  21330. $core.addMethod(
  21331. $core.method({
  21332. selector: "unsubscribe:",
  21333. protocol: 'subscribing',
  21334. fn: function (anObject){
  21335. var self=this;
  21336. return $core.withContext(function($ctx1) {
  21337. self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){
  21338. return $core.withContext(function($ctx2) {
  21339. return $recv($recv(each)._receiver()).__eq(anObject);
  21340. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21341. }));
  21342. return self;
  21343. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  21344. },
  21345. args: ["anObject"],
  21346. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  21347. referencedClasses: [],
  21348. messageSends: ["reject:", "=", "receiver"]
  21349. }),
  21350. $globals.Announcer);
  21351. $core.addClass('SystemAnnouncer', $globals.Announcer, [], 'Kernel-Announcements');
  21352. $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`";
  21353. $globals.SystemAnnouncer.klass.iVarNames = ['current'];
  21354. $core.addMethod(
  21355. $core.method({
  21356. selector: "current",
  21357. protocol: 'accessing',
  21358. fn: function (){
  21359. var self=this;
  21360. return $core.withContext(function($ctx1) {
  21361. var $1,$receiver;
  21362. $1=self["@current"];
  21363. if(($receiver = $1) == null || $receiver.isNil){
  21364. self["@current"]=(
  21365. $ctx1.supercall = true,
  21366. ($globals.SystemAnnouncer.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  21367. $ctx1.supercall = false;
  21368. return self["@current"];
  21369. } else {
  21370. return $1;
  21371. };
  21372. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)});
  21373. },
  21374. args: [],
  21375. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  21376. referencedClasses: [],
  21377. messageSends: ["ifNil:", "new"]
  21378. }),
  21379. $globals.SystemAnnouncer.klass);
  21380. $core.addMethod(
  21381. $core.method({
  21382. selector: "new",
  21383. protocol: 'instance creation',
  21384. fn: function (){
  21385. var self=this;
  21386. return $core.withContext(function($ctx1) {
  21387. self._shouldNotImplement();
  21388. return self;
  21389. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)});
  21390. },
  21391. args: [],
  21392. source: "new\x0a\x09self shouldNotImplement",
  21393. referencedClasses: [],
  21394. messageSends: ["shouldNotImplement"]
  21395. }),
  21396. $globals.SystemAnnouncer.klass);
  21397. $core.addClass('SystemAnnouncement', $globals.Object, [], 'Kernel-Announcements');
  21398. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  21399. $core.addMethod(
  21400. $core.method({
  21401. selector: "classTag",
  21402. protocol: 'accessing',
  21403. fn: function (){
  21404. var self=this;
  21405. return "announcement";
  21406. },
  21407. args: [],
  21408. 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'",
  21409. referencedClasses: [],
  21410. messageSends: []
  21411. }),
  21412. $globals.SystemAnnouncement.klass);
  21413. $core.addClass('ClassAnnouncement', $globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  21414. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  21415. $core.addMethod(
  21416. $core.method({
  21417. selector: "theClass",
  21418. protocol: 'accessing',
  21419. fn: function (){
  21420. var self=this;
  21421. return self["@theClass"];
  21422. },
  21423. args: [],
  21424. source: "theClass\x0a\x09^ theClass",
  21425. referencedClasses: [],
  21426. messageSends: []
  21427. }),
  21428. $globals.ClassAnnouncement);
  21429. $core.addMethod(
  21430. $core.method({
  21431. selector: "theClass:",
  21432. protocol: 'accessing',
  21433. fn: function (aClass){
  21434. var self=this;
  21435. self["@theClass"]=aClass;
  21436. return self;
  21437. },
  21438. args: ["aClass"],
  21439. source: "theClass: aClass\x0a\x09theClass := aClass",
  21440. referencedClasses: [],
  21441. messageSends: []
  21442. }),
  21443. $globals.ClassAnnouncement);
  21444. $core.addClass('ClassAdded', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21445. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  21446. $core.addClass('ClassCommentChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21447. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  21448. $core.addClass('ClassDefinitionChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21449. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  21450. $core.addClass('ClassMigrated', $globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  21451. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  21452. $core.addMethod(
  21453. $core.method({
  21454. selector: "oldClass",
  21455. protocol: 'accessing',
  21456. fn: function (){
  21457. var self=this;
  21458. return self["@oldClass"];
  21459. },
  21460. args: [],
  21461. source: "oldClass\x0a\x09^ oldClass",
  21462. referencedClasses: [],
  21463. messageSends: []
  21464. }),
  21465. $globals.ClassMigrated);
  21466. $core.addMethod(
  21467. $core.method({
  21468. selector: "oldClass:",
  21469. protocol: 'accessing',
  21470. fn: function (aClass){
  21471. var self=this;
  21472. self["@oldClass"]=aClass;
  21473. return self;
  21474. },
  21475. args: ["aClass"],
  21476. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  21477. referencedClasses: [],
  21478. messageSends: []
  21479. }),
  21480. $globals.ClassMigrated);
  21481. $core.addClass('ClassMoved', $globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  21482. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  21483. $core.addMethod(
  21484. $core.method({
  21485. selector: "oldPackage",
  21486. protocol: 'accessing',
  21487. fn: function (){
  21488. var self=this;
  21489. return self["@oldPackage"];
  21490. },
  21491. args: [],
  21492. source: "oldPackage\x0a\x09^ oldPackage",
  21493. referencedClasses: [],
  21494. messageSends: []
  21495. }),
  21496. $globals.ClassMoved);
  21497. $core.addMethod(
  21498. $core.method({
  21499. selector: "oldPackage:",
  21500. protocol: 'accessing',
  21501. fn: function (aPackage){
  21502. var self=this;
  21503. self["@oldPackage"]=aPackage;
  21504. return self;
  21505. },
  21506. args: ["aPackage"],
  21507. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  21508. referencedClasses: [],
  21509. messageSends: []
  21510. }),
  21511. $globals.ClassMoved);
  21512. $core.addClass('ClassRemoved', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21513. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  21514. $core.addClass('ClassRenamed', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21515. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  21516. $core.addClass('MethodAnnouncement', $globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  21517. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  21518. $core.addMethod(
  21519. $core.method({
  21520. selector: "method",
  21521. protocol: 'accessing',
  21522. fn: function (){
  21523. var self=this;
  21524. return self["@method"];
  21525. },
  21526. args: [],
  21527. source: "method\x0a\x09^ method",
  21528. referencedClasses: [],
  21529. messageSends: []
  21530. }),
  21531. $globals.MethodAnnouncement);
  21532. $core.addMethod(
  21533. $core.method({
  21534. selector: "method:",
  21535. protocol: 'accessing',
  21536. fn: function (aCompiledMethod){
  21537. var self=this;
  21538. self["@method"]=aCompiledMethod;
  21539. return self;
  21540. },
  21541. args: ["aCompiledMethod"],
  21542. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  21543. referencedClasses: [],
  21544. messageSends: []
  21545. }),
  21546. $globals.MethodAnnouncement);
  21547. $core.addClass('MethodAdded', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21548. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  21549. $core.addClass('MethodModified', $globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  21550. $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.";
  21551. $core.addMethod(
  21552. $core.method({
  21553. selector: "oldMethod",
  21554. protocol: 'accessing',
  21555. fn: function (){
  21556. var self=this;
  21557. return self["@oldMethod"];
  21558. },
  21559. args: [],
  21560. source: "oldMethod\x0a\x09^ oldMethod",
  21561. referencedClasses: [],
  21562. messageSends: []
  21563. }),
  21564. $globals.MethodModified);
  21565. $core.addMethod(
  21566. $core.method({
  21567. selector: "oldMethod:",
  21568. protocol: 'accessing',
  21569. fn: function (aMethod){
  21570. var self=this;
  21571. self["@oldMethod"]=aMethod;
  21572. return self;
  21573. },
  21574. args: ["aMethod"],
  21575. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  21576. referencedClasses: [],
  21577. messageSends: []
  21578. }),
  21579. $globals.MethodModified);
  21580. $core.addClass('MethodMoved', $globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  21581. $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.";
  21582. $core.addMethod(
  21583. $core.method({
  21584. selector: "oldProtocol",
  21585. protocol: 'accessing',
  21586. fn: function (){
  21587. var self=this;
  21588. return self["@oldProtocol"];
  21589. },
  21590. args: [],
  21591. source: "oldProtocol\x0a\x09^ oldProtocol",
  21592. referencedClasses: [],
  21593. messageSends: []
  21594. }),
  21595. $globals.MethodMoved);
  21596. $core.addMethod(
  21597. $core.method({
  21598. selector: "oldProtocol:",
  21599. protocol: 'accessing',
  21600. fn: function (aString){
  21601. var self=this;
  21602. self["@oldProtocol"]=aString;
  21603. return self;
  21604. },
  21605. args: ["aString"],
  21606. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  21607. referencedClasses: [],
  21608. messageSends: []
  21609. }),
  21610. $globals.MethodMoved);
  21611. $core.addClass('MethodRemoved', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21612. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  21613. $core.addClass('PackageAnnouncement', $globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  21614. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  21615. $core.addMethod(
  21616. $core.method({
  21617. selector: "package",
  21618. protocol: 'accessing',
  21619. fn: function (){
  21620. var self=this;
  21621. return self["@package"];
  21622. },
  21623. args: [],
  21624. source: "package\x0a\x09^ package",
  21625. referencedClasses: [],
  21626. messageSends: []
  21627. }),
  21628. $globals.PackageAnnouncement);
  21629. $core.addMethod(
  21630. $core.method({
  21631. selector: "package:",
  21632. protocol: 'accessing',
  21633. fn: function (aPackage){
  21634. var self=this;
  21635. self["@package"]=aPackage;
  21636. return self;
  21637. },
  21638. args: ["aPackage"],
  21639. source: "package: aPackage\x0a\x09package := aPackage",
  21640. referencedClasses: [],
  21641. messageSends: []
  21642. }),
  21643. $globals.PackageAnnouncement);
  21644. $core.addClass('PackageAdded', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21645. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  21646. $core.addClass('PackageClean', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21647. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  21648. $core.addClass('PackageDirty', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21649. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  21650. $core.addClass('PackageRemoved', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21651. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  21652. $core.addClass('ProtocolAnnouncement', $globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  21653. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  21654. $core.addMethod(
  21655. $core.method({
  21656. selector: "package",
  21657. protocol: 'accessing',
  21658. fn: function (){
  21659. var self=this;
  21660. return $core.withContext(function($ctx1) {
  21661. var $1,$receiver;
  21662. $1=self._theClass();
  21663. if(($receiver = $1) == null || $receiver.isNil){
  21664. return $1;
  21665. } else {
  21666. var class_;
  21667. class_=$receiver;
  21668. return $recv(class_)._packageOfProtocol_(self._protocol());
  21669. };
  21670. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  21671. },
  21672. args: [],
  21673. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  21674. referencedClasses: [],
  21675. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  21676. }),
  21677. $globals.ProtocolAnnouncement);
  21678. $core.addMethod(
  21679. $core.method({
  21680. selector: "protocol",
  21681. protocol: 'accessing',
  21682. fn: function (){
  21683. var self=this;
  21684. return self["@protocol"];
  21685. },
  21686. args: [],
  21687. source: "protocol\x0a\x09^ protocol",
  21688. referencedClasses: [],
  21689. messageSends: []
  21690. }),
  21691. $globals.ProtocolAnnouncement);
  21692. $core.addMethod(
  21693. $core.method({
  21694. selector: "protocol:",
  21695. protocol: 'accessing',
  21696. fn: function (aString){
  21697. var self=this;
  21698. self["@protocol"]=aString;
  21699. return self;
  21700. },
  21701. args: ["aString"],
  21702. source: "protocol: aString\x0a\x09protocol := aString",
  21703. referencedClasses: [],
  21704. messageSends: []
  21705. }),
  21706. $globals.ProtocolAnnouncement);
  21707. $core.addMethod(
  21708. $core.method({
  21709. selector: "theClass",
  21710. protocol: 'accessing',
  21711. fn: function (){
  21712. var self=this;
  21713. return self["@theClass"];
  21714. },
  21715. args: [],
  21716. source: "theClass\x0a\x09^ theClass",
  21717. referencedClasses: [],
  21718. messageSends: []
  21719. }),
  21720. $globals.ProtocolAnnouncement);
  21721. $core.addMethod(
  21722. $core.method({
  21723. selector: "theClass:",
  21724. protocol: 'accessing',
  21725. fn: function (aClass){
  21726. var self=this;
  21727. self["@theClass"]=aClass;
  21728. return self;
  21729. },
  21730. args: ["aClass"],
  21731. source: "theClass: aClass\x0a\x09theClass := aClass",
  21732. referencedClasses: [],
  21733. messageSends: []
  21734. }),
  21735. $globals.ProtocolAnnouncement);
  21736. $core.addClass('ProtocolAdded', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21737. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  21738. $core.addClass('ProtocolRemoved', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21739. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  21740. });
  21741. 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";
  21742. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  21743. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21744. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  21745. $core.addPackage('Platform-Services');
  21746. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  21747. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21748. $core.addClass('ConsoleErrorHandler', $globals.Object, [], 'Platform-Services');
  21749. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  21750. $core.addMethod(
  21751. $core.method({
  21752. selector: "handleError:",
  21753. protocol: 'error handling',
  21754. fn: function (anError){
  21755. var self=this;
  21756. return $core.withContext(function($ctx1) {
  21757. var $1,$receiver;
  21758. $1=$recv(anError)._context();
  21759. $ctx1.sendIdx["context"]=1;
  21760. if(($receiver = $1) == null || $receiver.isNil){
  21761. $1;
  21762. } else {
  21763. self._logErrorContext_($recv(anError)._context());
  21764. };
  21765. self._logError_(anError);
  21766. return self;
  21767. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21768. },
  21769. args: ["anError"],
  21770. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  21771. referencedClasses: [],
  21772. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  21773. }),
  21774. $globals.ConsoleErrorHandler);
  21775. $core.addMethod(
  21776. $core.method({
  21777. selector: "log:",
  21778. protocol: 'private',
  21779. fn: function (aString){
  21780. var self=this;
  21781. return $core.withContext(function($ctx1) {
  21782. $recv(console)._log_(aString);
  21783. return self;
  21784. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  21785. },
  21786. args: ["aString"],
  21787. source: "log: aString\x0a\x09console log: aString",
  21788. referencedClasses: [],
  21789. messageSends: ["log:"]
  21790. }),
  21791. $globals.ConsoleErrorHandler);
  21792. $core.addMethod(
  21793. $core.method({
  21794. selector: "logContext:",
  21795. protocol: 'private',
  21796. fn: function (aContext){
  21797. var self=this;
  21798. return $core.withContext(function($ctx1) {
  21799. var $1,$receiver;
  21800. $1=$recv(aContext)._home();
  21801. $ctx1.sendIdx["home"]=1;
  21802. if(($receiver = $1) == null || $receiver.isNil){
  21803. $1;
  21804. } else {
  21805. self._logContext_($recv(aContext)._home());
  21806. };
  21807. self._log_($recv(aContext)._asString());
  21808. return self;
  21809. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21810. },
  21811. args: ["aContext"],
  21812. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  21813. referencedClasses: [],
  21814. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  21815. }),
  21816. $globals.ConsoleErrorHandler);
  21817. $core.addMethod(
  21818. $core.method({
  21819. selector: "logError:",
  21820. protocol: 'private',
  21821. fn: function (anError){
  21822. var self=this;
  21823. return $core.withContext(function($ctx1) {
  21824. self._log_($recv(anError)._messageText());
  21825. return self;
  21826. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21827. },
  21828. args: ["anError"],
  21829. source: "logError: anError\x0a\x09self log: anError messageText",
  21830. referencedClasses: [],
  21831. messageSends: ["log:", "messageText"]
  21832. }),
  21833. $globals.ConsoleErrorHandler);
  21834. $core.addMethod(
  21835. $core.method({
  21836. selector: "logErrorContext:",
  21837. protocol: 'private',
  21838. fn: function (aContext){
  21839. var self=this;
  21840. return $core.withContext(function($ctx1) {
  21841. var $1,$receiver;
  21842. if(($receiver = aContext) == null || $receiver.isNil){
  21843. aContext;
  21844. } else {
  21845. $1=$recv(aContext)._home();
  21846. $ctx1.sendIdx["home"]=1;
  21847. if(($receiver = $1) == null || $receiver.isNil){
  21848. $1;
  21849. } else {
  21850. self._logContext_($recv(aContext)._home());
  21851. };
  21852. };
  21853. return self;
  21854. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21855. },
  21856. args: ["aContext"],
  21857. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  21858. referencedClasses: [],
  21859. messageSends: ["ifNotNil:", "home", "logContext:"]
  21860. }),
  21861. $globals.ConsoleErrorHandler);
  21862. $globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  21863. $core.addMethod(
  21864. $core.method({
  21865. selector: "initialize",
  21866. protocol: 'initialization',
  21867. fn: function (){
  21868. var self=this;
  21869. return $core.withContext(function($ctx1) {
  21870. $recv($globals.ErrorHandler)._registerIfNone_(self._new());
  21871. return self;
  21872. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)});
  21873. },
  21874. args: [],
  21875. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  21876. referencedClasses: ["ErrorHandler"],
  21877. messageSends: ["registerIfNone:", "new"]
  21878. }),
  21879. $globals.ConsoleErrorHandler.klass);
  21880. $core.addClass('ConsoleTranscript', $globals.Object, ['textarea'], 'Platform-Services');
  21881. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  21882. $core.addMethod(
  21883. $core.method({
  21884. selector: "clear",
  21885. protocol: 'printing',
  21886. fn: function (){
  21887. var self=this;
  21888. return self;
  21889. },
  21890. args: [],
  21891. source: "clear\x0a\x09\x22no op\x22",
  21892. referencedClasses: [],
  21893. messageSends: []
  21894. }),
  21895. $globals.ConsoleTranscript);
  21896. $core.addMethod(
  21897. $core.method({
  21898. selector: "cr",
  21899. protocol: 'printing',
  21900. fn: function (){
  21901. var self=this;
  21902. return self;
  21903. },
  21904. args: [],
  21905. source: "cr\x0a\x09\x22no op\x22",
  21906. referencedClasses: [],
  21907. messageSends: []
  21908. }),
  21909. $globals.ConsoleTranscript);
  21910. $core.addMethod(
  21911. $core.method({
  21912. selector: "open",
  21913. protocol: 'actions',
  21914. fn: function (){
  21915. var self=this;
  21916. return self;
  21917. },
  21918. args: [],
  21919. source: "open",
  21920. referencedClasses: [],
  21921. messageSends: []
  21922. }),
  21923. $globals.ConsoleTranscript);
  21924. $core.addMethod(
  21925. $core.method({
  21926. selector: "show:",
  21927. protocol: 'printing',
  21928. fn: function (anObject){
  21929. var self=this;
  21930. return $core.withContext(function($ctx1) {
  21931. console.log(String($recv(anObject)._asString()));
  21932. return self;
  21933. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  21934. },
  21935. args: ["anObject"],
  21936. 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<console.log(String($recv(anObject)._asString()))>",
  21937. referencedClasses: [],
  21938. messageSends: []
  21939. }),
  21940. $globals.ConsoleTranscript);
  21941. $core.addMethod(
  21942. $core.method({
  21943. selector: "initialize",
  21944. protocol: 'initialization',
  21945. fn: function (){
  21946. var self=this;
  21947. return $core.withContext(function($ctx1) {
  21948. $recv($globals.Transcript)._registerIfNone_(self._new());
  21949. return self;
  21950. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
  21951. },
  21952. args: [],
  21953. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  21954. referencedClasses: ["Transcript"],
  21955. messageSends: ["registerIfNone:", "new"]
  21956. }),
  21957. $globals.ConsoleTranscript.klass);
  21958. $core.addClass('Environment', $globals.Object, [], 'Platform-Services');
  21959. $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.";
  21960. $core.addMethod(
  21961. $core.method({
  21962. selector: "addInstVarNamed:to:",
  21963. protocol: 'compiling',
  21964. fn: function (aString,aClass){
  21965. var self=this;
  21966. return $core.withContext(function($ctx1) {
  21967. var $1,$2,$3,$5,$4;
  21968. $1=self._classBuilder();
  21969. $2=$recv(aClass)._superclass();
  21970. $3=$recv(aClass)._name();
  21971. $ctx1.sendIdx["name"]=1;
  21972. $5=$recv($recv(aClass)._instanceVariableNames())._copy();
  21973. $recv($5)._add_(aString);
  21974. $4=$recv($5)._yourself();
  21975. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$recv($recv(aClass)._package())._name());
  21976. return self;
  21977. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  21978. },
  21979. args: ["aString", "aClass"],
  21980. 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",
  21981. referencedClasses: [],
  21982. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  21983. }),
  21984. $globals.Environment);
  21985. $core.addMethod(
  21986. $core.method({
  21987. selector: "allSelectors",
  21988. protocol: 'accessing',
  21989. fn: function (){
  21990. var self=this;
  21991. return $core.withContext(function($ctx1) {
  21992. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  21993. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  21994. },
  21995. args: [],
  21996. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  21997. referencedClasses: ["Smalltalk"],
  21998. messageSends: ["allSelectors", "core"]
  21999. }),
  22000. $globals.Environment);
  22001. $core.addMethod(
  22002. $core.method({
  22003. selector: "availableClassNames",
  22004. protocol: 'accessing',
  22005. fn: function (){
  22006. var self=this;
  22007. return $core.withContext(function($ctx1) {
  22008. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  22009. return $core.withContext(function($ctx2) {
  22010. return $recv(each)._name();
  22011. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22012. }));
  22013. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  22014. },
  22015. args: [],
  22016. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  22017. referencedClasses: ["Smalltalk"],
  22018. messageSends: ["collect:", "classes", "name"]
  22019. }),
  22020. $globals.Environment);
  22021. $core.addMethod(
  22022. $core.method({
  22023. selector: "availablePackageNames",
  22024. protocol: 'accessing',
  22025. fn: function (){
  22026. var self=this;
  22027. return $core.withContext(function($ctx1) {
  22028. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  22029. return $core.withContext(function($ctx2) {
  22030. return $recv(each)._name();
  22031. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22032. }));
  22033. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  22034. },
  22035. args: [],
  22036. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  22037. referencedClasses: ["Smalltalk"],
  22038. messageSends: ["collect:", "packages", "name"]
  22039. }),
  22040. $globals.Environment);
  22041. $core.addMethod(
  22042. $core.method({
  22043. selector: "availableProtocolsFor:",
  22044. protocol: 'accessing',
  22045. fn: function (aClass){
  22046. var self=this;
  22047. var protocols;
  22048. return $core.withContext(function($ctx1) {
  22049. var $1,$receiver;
  22050. protocols=$recv(aClass)._protocols();
  22051. $1=$recv(aClass)._superclass();
  22052. $ctx1.sendIdx["superclass"]=1;
  22053. if(($receiver = $1) == null || $receiver.isNil){
  22054. $1;
  22055. } else {
  22056. $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
  22057. };
  22058. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  22059. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  22060. },
  22061. args: ["aClass"],
  22062. 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",
  22063. referencedClasses: [],
  22064. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  22065. }),
  22066. $globals.Environment);
  22067. $core.addMethod(
  22068. $core.method({
  22069. selector: "classBuilder",
  22070. protocol: 'accessing',
  22071. fn: function (){
  22072. var self=this;
  22073. return $core.withContext(function($ctx1) {
  22074. return $recv($globals.ClassBuilder)._new();
  22075. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  22076. },
  22077. args: [],
  22078. source: "classBuilder\x0a\x09^ ClassBuilder new",
  22079. referencedClasses: ["ClassBuilder"],
  22080. messageSends: ["new"]
  22081. }),
  22082. $globals.Environment);
  22083. $core.addMethod(
  22084. $core.method({
  22085. selector: "classNamed:",
  22086. protocol: 'accessing',
  22087. fn: function (aString){
  22088. var self=this;
  22089. return $core.withContext(function($ctx1) {
  22090. var $1,$receiver;
  22091. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  22092. if(($receiver = $1) == null || $receiver.isNil){
  22093. return self._error_("Invalid class name");
  22094. } else {
  22095. return $1;
  22096. };
  22097. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  22098. },
  22099. args: ["aString"],
  22100. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  22101. referencedClasses: ["Smalltalk"],
  22102. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  22103. }),
  22104. $globals.Environment);
  22105. $core.addMethod(
  22106. $core.method({
  22107. selector: "classes",
  22108. protocol: 'accessing',
  22109. fn: function (){
  22110. var self=this;
  22111. return $core.withContext(function($ctx1) {
  22112. return $recv($globals.Smalltalk)._classes();
  22113. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  22114. },
  22115. args: [],
  22116. source: "classes\x0a\x09^ Smalltalk classes",
  22117. referencedClasses: ["Smalltalk"],
  22118. messageSends: ["classes"]
  22119. }),
  22120. $globals.Environment);
  22121. $core.addMethod(
  22122. $core.method({
  22123. selector: "commitPackage:onSuccess:onError:",
  22124. protocol: 'actions',
  22125. fn: function (aPackage,aBlock,anotherBlock){
  22126. var self=this;
  22127. return $core.withContext(function($ctx1) {
  22128. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  22129. return self;
  22130. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  22131. },
  22132. args: ["aPackage", "aBlock", "anotherBlock"],
  22133. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  22134. referencedClasses: [],
  22135. messageSends: ["commitOnSuccess:onError:", "transport"]
  22136. }),
  22137. $globals.Environment);
  22138. $core.addMethod(
  22139. $core.method({
  22140. selector: "compileClassComment:for:",
  22141. protocol: 'compiling',
  22142. fn: function (aString,aClass){
  22143. var self=this;
  22144. return $core.withContext(function($ctx1) {
  22145. $recv(aClass)._comment_(aString);
  22146. return self;
  22147. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  22148. },
  22149. args: ["aString", "aClass"],
  22150. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  22151. referencedClasses: [],
  22152. messageSends: ["comment:"]
  22153. }),
  22154. $globals.Environment);
  22155. $core.addMethod(
  22156. $core.method({
  22157. selector: "compileClassDefinition:",
  22158. protocol: 'compiling',
  22159. fn: function (aString){
  22160. var self=this;
  22161. return $core.withContext(function($ctx1) {
  22162. $recv((function(){
  22163. return $core.withContext(function($ctx2) {
  22164. return self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  22165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22166. }))._on_do_($globals.Error,(function(error){
  22167. return $core.withContext(function($ctx2) {
  22168. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  22169. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  22170. }));
  22171. return self;
  22172. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  22173. },
  22174. args: ["aString"],
  22175. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  22176. referencedClasses: ["DoIt", "Error", "Terminal"],
  22177. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  22178. }),
  22179. $globals.Environment);
  22180. $core.addMethod(
  22181. $core.method({
  22182. selector: "compileMethod:for:protocol:",
  22183. protocol: 'compiling',
  22184. fn: function (sourceCode,class_,protocol){
  22185. var self=this;
  22186. return $core.withContext(function($ctx1) {
  22187. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  22188. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  22189. },
  22190. args: ["sourceCode", "class", "protocol"],
  22191. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  22192. referencedClasses: [],
  22193. messageSends: ["compile:protocol:"]
  22194. }),
  22195. $globals.Environment);
  22196. $core.addMethod(
  22197. $core.method({
  22198. selector: "copyClass:to:",
  22199. protocol: 'actions',
  22200. fn: function (aClass,aClassName){
  22201. var self=this;
  22202. return $core.withContext(function($ctx1) {
  22203. var $1,$2,$receiver;
  22204. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  22205. if(($receiver = $1) == null || $receiver.isNil){
  22206. $1;
  22207. } else {
  22208. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22209. $ctx1.sendIdx[","]=1;
  22210. self._error_($2);
  22211. };
  22212. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  22213. return self;
  22214. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22215. },
  22216. args: ["aClass", "aClassName"],
  22217. 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",
  22218. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22219. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  22220. }),
  22221. $globals.Environment);
  22222. $core.addMethod(
  22223. $core.method({
  22224. selector: "doItReceiver",
  22225. protocol: 'accessing',
  22226. fn: function (){
  22227. var self=this;
  22228. return $core.withContext(function($ctx1) {
  22229. return $recv($globals.DoIt)._new();
  22230. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  22231. },
  22232. args: [],
  22233. source: "doItReceiver\x0a\x09^ DoIt new",
  22234. referencedClasses: ["DoIt"],
  22235. messageSends: ["new"]
  22236. }),
  22237. $globals.Environment);
  22238. $core.addMethod(
  22239. $core.method({
  22240. selector: "evaluate:for:",
  22241. protocol: 'evaluating',
  22242. fn: function (aString,anObject){
  22243. var self=this;
  22244. return $core.withContext(function($ctx1) {
  22245. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  22246. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  22247. },
  22248. args: ["aString", "anObject"],
  22249. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  22250. referencedClasses: ["Evaluator"],
  22251. messageSends: ["evaluate:for:"]
  22252. }),
  22253. $globals.Environment);
  22254. $core.addMethod(
  22255. $core.method({
  22256. selector: "evaluate:on:do:",
  22257. protocol: 'error handling',
  22258. fn: function (aBlock,anErrorClass,exceptionBlock){
  22259. var self=this;
  22260. return $core.withContext(function($ctx1) {
  22261. var $1;
  22262. $recv(aBlock)._tryCatch_((function(exception){
  22263. return $core.withContext(function($ctx2) {
  22264. $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
  22265. if($core.assert($1)){
  22266. return $recv(exceptionBlock)._value_(exception);
  22267. } else {
  22268. return $recv(exception)._resignal();
  22269. };
  22270. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  22271. }));
  22272. return self;
  22273. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  22274. },
  22275. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  22276. 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 ] ]",
  22277. referencedClasses: [],
  22278. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  22279. }),
  22280. $globals.Environment);
  22281. $core.addMethod(
  22282. $core.method({
  22283. selector: "inspect:",
  22284. protocol: 'actions',
  22285. fn: function (anObject){
  22286. var self=this;
  22287. return $core.withContext(function($ctx1) {
  22288. $recv($globals.Inspector)._inspect_(anObject);
  22289. return self;
  22290. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  22291. },
  22292. args: ["anObject"],
  22293. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  22294. referencedClasses: ["Inspector"],
  22295. messageSends: ["inspect:"]
  22296. }),
  22297. $globals.Environment);
  22298. $core.addMethod(
  22299. $core.method({
  22300. selector: "moveClass:toPackage:",
  22301. protocol: 'actions',
  22302. fn: function (aClass,aPackageName){
  22303. var self=this;
  22304. var package_;
  22305. return $core.withContext(function($ctx1) {
  22306. var $1,$2,$receiver;
  22307. package_=$recv($globals.Package)._named_(aPackageName);
  22308. $1=package_;
  22309. if(($receiver = $1) == null || $receiver.isNil){
  22310. self._error_("Invalid package name");
  22311. } else {
  22312. $1;
  22313. };
  22314. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  22315. if($core.assert($2)){
  22316. return self;
  22317. };
  22318. $recv(aClass)._package_(package_);
  22319. return self;
  22320. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  22321. },
  22322. args: ["aClass", "aPackageName"],
  22323. 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",
  22324. referencedClasses: ["Package"],
  22325. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
  22326. }),
  22327. $globals.Environment);
  22328. $core.addMethod(
  22329. $core.method({
  22330. selector: "moveMethod:toClass:",
  22331. protocol: 'actions',
  22332. fn: function (aMethod,aClassName){
  22333. var self=this;
  22334. var destinationClass;
  22335. return $core.withContext(function($ctx1) {
  22336. var $2,$3,$1,$5,$4;
  22337. destinationClass=self._classNamed_(aClassName);
  22338. $2=destinationClass;
  22339. $3=$recv(aMethod)._methodClass();
  22340. $ctx1.sendIdx["methodClass"]=1;
  22341. $1=$recv($2).__eq_eq($3);
  22342. if($core.assert($1)){
  22343. return self;
  22344. };
  22345. $5=$recv(aMethod)._methodClass();
  22346. $ctx1.sendIdx["methodClass"]=2;
  22347. $4=$recv($5)._isMetaclass();
  22348. if($core.assert($4)){
  22349. destinationClass=$recv(destinationClass)._class();
  22350. destinationClass;
  22351. };
  22352. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  22353. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22354. return self;
  22355. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  22356. },
  22357. args: ["aMethod", "aClassName"],
  22358. 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",
  22359. referencedClasses: [],
  22360. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  22361. }),
  22362. $globals.Environment);
  22363. $core.addMethod(
  22364. $core.method({
  22365. selector: "moveMethod:toProtocol:",
  22366. protocol: 'actions',
  22367. fn: function (aMethod,aProtocol){
  22368. var self=this;
  22369. return $core.withContext(function($ctx1) {
  22370. $recv(aMethod)._protocol_(aProtocol);
  22371. return self;
  22372. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  22373. },
  22374. args: ["aMethod", "aProtocol"],
  22375. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  22376. referencedClasses: [],
  22377. messageSends: ["protocol:"]
  22378. }),
  22379. $globals.Environment);
  22380. $core.addMethod(
  22381. $core.method({
  22382. selector: "packages",
  22383. protocol: 'accessing',
  22384. fn: function (){
  22385. var self=this;
  22386. return $core.withContext(function($ctx1) {
  22387. return $recv($globals.Smalltalk)._packages();
  22388. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  22389. },
  22390. args: [],
  22391. source: "packages\x0a\x09^ Smalltalk packages",
  22392. referencedClasses: ["Smalltalk"],
  22393. messageSends: ["packages"]
  22394. }),
  22395. $globals.Environment);
  22396. $core.addMethod(
  22397. $core.method({
  22398. selector: "registerErrorHandler:",
  22399. protocol: 'services',
  22400. fn: function (anErrorHandler){
  22401. var self=this;
  22402. return $core.withContext(function($ctx1) {
  22403. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  22404. return self;
  22405. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  22406. },
  22407. args: ["anErrorHandler"],
  22408. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  22409. referencedClasses: ["ErrorHandler"],
  22410. messageSends: ["register:"]
  22411. }),
  22412. $globals.Environment);
  22413. $core.addMethod(
  22414. $core.method({
  22415. selector: "registerFinder:",
  22416. protocol: 'services',
  22417. fn: function (aFinder){
  22418. var self=this;
  22419. return $core.withContext(function($ctx1) {
  22420. $recv($globals.Finder)._register_(aFinder);
  22421. return self;
  22422. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  22423. },
  22424. args: ["aFinder"],
  22425. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  22426. referencedClasses: ["Finder"],
  22427. messageSends: ["register:"]
  22428. }),
  22429. $globals.Environment);
  22430. $core.addMethod(
  22431. $core.method({
  22432. selector: "registerInspector:",
  22433. protocol: 'services',
  22434. fn: function (anInspector){
  22435. var self=this;
  22436. return $core.withContext(function($ctx1) {
  22437. $recv($globals.Inspector)._register_(anInspector);
  22438. return self;
  22439. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  22440. },
  22441. args: ["anInspector"],
  22442. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  22443. referencedClasses: ["Inspector"],
  22444. messageSends: ["register:"]
  22445. }),
  22446. $globals.Environment);
  22447. $core.addMethod(
  22448. $core.method({
  22449. selector: "registerProgressHandler:",
  22450. protocol: 'services',
  22451. fn: function (aProgressHandler){
  22452. var self=this;
  22453. return $core.withContext(function($ctx1) {
  22454. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  22455. return self;
  22456. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  22457. },
  22458. args: ["aProgressHandler"],
  22459. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  22460. referencedClasses: ["ProgressHandler"],
  22461. messageSends: ["register:"]
  22462. }),
  22463. $globals.Environment);
  22464. $core.addMethod(
  22465. $core.method({
  22466. selector: "registerTranscript:",
  22467. protocol: 'services',
  22468. fn: function (aTranscript){
  22469. var self=this;
  22470. return $core.withContext(function($ctx1) {
  22471. $recv($globals.Transcript)._register_(aTranscript);
  22472. return self;
  22473. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  22474. },
  22475. args: ["aTranscript"],
  22476. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  22477. referencedClasses: ["Transcript"],
  22478. messageSends: ["register:"]
  22479. }),
  22480. $globals.Environment);
  22481. $core.addMethod(
  22482. $core.method({
  22483. selector: "removeClass:",
  22484. protocol: 'actions',
  22485. fn: function (aClass){
  22486. var self=this;
  22487. return $core.withContext(function($ctx1) {
  22488. $recv($globals.Smalltalk)._removeClass_(aClass);
  22489. return self;
  22490. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  22491. },
  22492. args: ["aClass"],
  22493. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  22494. referencedClasses: ["Smalltalk"],
  22495. messageSends: ["removeClass:"]
  22496. }),
  22497. $globals.Environment);
  22498. $core.addMethod(
  22499. $core.method({
  22500. selector: "removeMethod:",
  22501. protocol: 'actions',
  22502. fn: function (aMethod){
  22503. var self=this;
  22504. return $core.withContext(function($ctx1) {
  22505. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22506. return self;
  22507. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  22508. },
  22509. args: ["aMethod"],
  22510. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  22511. referencedClasses: [],
  22512. messageSends: ["removeCompiledMethod:", "methodClass"]
  22513. }),
  22514. $globals.Environment);
  22515. $core.addMethod(
  22516. $core.method({
  22517. selector: "removeProtocol:from:",
  22518. protocol: 'actions',
  22519. fn: function (aString,aClass){
  22520. var self=this;
  22521. return $core.withContext(function($ctx1) {
  22522. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22523. return $core.withContext(function($ctx2) {
  22524. return $recv(aClass)._removeCompiledMethod_(each);
  22525. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22526. }));
  22527. return self;
  22528. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  22529. },
  22530. args: ["aString", "aClass"],
  22531. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  22532. referencedClasses: [],
  22533. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  22534. }),
  22535. $globals.Environment);
  22536. $core.addMethod(
  22537. $core.method({
  22538. selector: "renameClass:to:",
  22539. protocol: 'actions',
  22540. fn: function (aClass,aClassName){
  22541. var self=this;
  22542. return $core.withContext(function($ctx1) {
  22543. var $1,$2,$receiver;
  22544. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  22545. if(($receiver = $1) == null || $receiver.isNil){
  22546. $1;
  22547. } else {
  22548. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22549. $ctx1.sendIdx[","]=1;
  22550. self._error_($2);
  22551. };
  22552. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  22553. return self;
  22554. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22555. },
  22556. args: ["aClass", "aClassName"],
  22557. 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",
  22558. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22559. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  22560. }),
  22561. $globals.Environment);
  22562. $core.addMethod(
  22563. $core.method({
  22564. selector: "renamePackage:to:",
  22565. protocol: 'actions',
  22566. fn: function (aPackageName,aNewPackageName){
  22567. var self=this;
  22568. return $core.withContext(function($ctx1) {
  22569. var $1,$2,$receiver;
  22570. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aNewPackageName);
  22571. if(($receiver = $1) == null || $receiver.isNil){
  22572. $1;
  22573. } else {
  22574. $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
  22575. $ctx1.sendIdx[","]=1;
  22576. self._error_($2);
  22577. };
  22578. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  22579. return self;
  22580. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  22581. },
  22582. args: ["aPackageName", "aNewPackageName"],
  22583. 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",
  22584. referencedClasses: ["Smalltalk"],
  22585. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
  22586. }),
  22587. $globals.Environment);
  22588. $core.addMethod(
  22589. $core.method({
  22590. selector: "renameProtocol:to:in:",
  22591. protocol: 'actions',
  22592. fn: function (aString,anotherString,aClass){
  22593. var self=this;
  22594. return $core.withContext(function($ctx1) {
  22595. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22596. return $core.withContext(function($ctx2) {
  22597. return $recv(each)._protocol_(anotherString);
  22598. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22599. }));
  22600. return self;
  22601. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  22602. },
  22603. args: ["aString", "anotherString", "aClass"],
  22604. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  22605. referencedClasses: [],
  22606. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  22607. }),
  22608. $globals.Environment);
  22609. $core.addMethod(
  22610. $core.method({
  22611. selector: "setClassCommentOf:to:",
  22612. protocol: 'actions',
  22613. fn: function (aClass,aString){
  22614. var self=this;
  22615. return $core.withContext(function($ctx1) {
  22616. $recv(aClass)._comment_(aString);
  22617. return self;
  22618. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  22619. },
  22620. args: ["aClass", "aString"],
  22621. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  22622. referencedClasses: [],
  22623. messageSends: ["comment:"]
  22624. }),
  22625. $globals.Environment);
  22626. $core.addMethod(
  22627. $core.method({
  22628. selector: "systemAnnouncer",
  22629. protocol: 'accessing',
  22630. fn: function (){
  22631. var self=this;
  22632. return $core.withContext(function($ctx1) {
  22633. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  22634. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  22635. },
  22636. args: [],
  22637. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  22638. referencedClasses: ["Smalltalk"],
  22639. messageSends: ["current", "at:", "globals"]
  22640. }),
  22641. $globals.Environment);
  22642. $core.addClass('NullProgressHandler', $globals.Object, [], 'Platform-Services');
  22643. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  22644. $core.addMethod(
  22645. $core.method({
  22646. selector: "do:on:displaying:",
  22647. protocol: 'progress handling',
  22648. fn: function (aBlock,aCollection,aString){
  22649. var self=this;
  22650. return $core.withContext(function($ctx1) {
  22651. $recv(aCollection)._do_(aBlock);
  22652. return self;
  22653. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  22654. },
  22655. args: ["aBlock", "aCollection", "aString"],
  22656. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  22657. referencedClasses: [],
  22658. messageSends: ["do:"]
  22659. }),
  22660. $globals.NullProgressHandler);
  22661. $globals.NullProgressHandler.klass.iVarNames = ['current'];
  22662. $core.addMethod(
  22663. $core.method({
  22664. selector: "initialize",
  22665. protocol: 'initialization',
  22666. fn: function (){
  22667. var self=this;
  22668. return $core.withContext(function($ctx1) {
  22669. $recv($globals.ProgressHandler)._registerIfNone_(self._new());
  22670. return self;
  22671. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
  22672. },
  22673. args: [],
  22674. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  22675. referencedClasses: ["ProgressHandler"],
  22676. messageSends: ["registerIfNone:", "new"]
  22677. }),
  22678. $globals.NullProgressHandler.klass);
  22679. $core.addClass('Service', $globals.Object, [], 'Platform-Services');
  22680. $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.";
  22681. $globals.Service.klass.iVarNames = ['current'];
  22682. $core.addMethod(
  22683. $core.method({
  22684. selector: "current",
  22685. protocol: 'accessing',
  22686. fn: function (){
  22687. var self=this;
  22688. return self["@current"];
  22689. },
  22690. args: [],
  22691. source: "current\x0a\x09^ current",
  22692. referencedClasses: [],
  22693. messageSends: []
  22694. }),
  22695. $globals.Service.klass);
  22696. $core.addMethod(
  22697. $core.method({
  22698. selector: "new",
  22699. protocol: 'instance creation',
  22700. fn: function (){
  22701. var self=this;
  22702. return $core.withContext(function($ctx1) {
  22703. self._shouldNotImplement();
  22704. return self;
  22705. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
  22706. },
  22707. args: [],
  22708. source: "new\x0a\x09self shouldNotImplement",
  22709. referencedClasses: [],
  22710. messageSends: ["shouldNotImplement"]
  22711. }),
  22712. $globals.Service.klass);
  22713. $core.addMethod(
  22714. $core.method({
  22715. selector: "register:",
  22716. protocol: 'registration',
  22717. fn: function (anObject){
  22718. var self=this;
  22719. self["@current"]=anObject;
  22720. return self;
  22721. },
  22722. args: ["anObject"],
  22723. source: "register: anObject\x0a\x09current := anObject",
  22724. referencedClasses: [],
  22725. messageSends: []
  22726. }),
  22727. $globals.Service.klass);
  22728. $core.addMethod(
  22729. $core.method({
  22730. selector: "registerIfNone:",
  22731. protocol: 'registration',
  22732. fn: function (anObject){
  22733. var self=this;
  22734. return $core.withContext(function($ctx1) {
  22735. var $1,$receiver;
  22736. $1=self._current();
  22737. if(($receiver = $1) == null || $receiver.isNil){
  22738. self._register_(anObject);
  22739. } else {
  22740. $1;
  22741. };
  22742. return self;
  22743. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
  22744. },
  22745. args: ["anObject"],
  22746. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  22747. referencedClasses: [],
  22748. messageSends: ["ifNil:", "current", "register:"]
  22749. }),
  22750. $globals.Service.klass);
  22751. $core.addClass('ErrorHandler', $globals.Service, [], 'Platform-Services');
  22752. $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.";
  22753. $core.addMethod(
  22754. $core.method({
  22755. selector: "handleError:",
  22756. protocol: 'error handling',
  22757. fn: function (anError){
  22758. var self=this;
  22759. return $core.withContext(function($ctx1) {
  22760. self._handleUnhandledError_(anError);
  22761. return self;
  22762. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
  22763. },
  22764. args: ["anError"],
  22765. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  22766. referencedClasses: [],
  22767. messageSends: ["handleUnhandledError:"]
  22768. }),
  22769. $globals.ErrorHandler.klass);
  22770. $core.addMethod(
  22771. $core.method({
  22772. selector: "handleUnhandledError:",
  22773. protocol: 'error handling',
  22774. fn: function (anError){
  22775. var self=this;
  22776. return $core.withContext(function($ctx1) {
  22777. var $1;
  22778. $1=$recv(anError)._wasHandled();
  22779. if($core.assert($1)){
  22780. return self;
  22781. };
  22782. return $recv(self._current())._handleError_(anError);
  22783. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
  22784. },
  22785. args: ["anError"],
  22786. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  22787. referencedClasses: [],
  22788. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  22789. }),
  22790. $globals.ErrorHandler.klass);
  22791. $core.addClass('Finder', $globals.Service, [], 'Platform-Services');
  22792. $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.";
  22793. $core.addMethod(
  22794. $core.method({
  22795. selector: "findClass:",
  22796. protocol: 'finding',
  22797. fn: function (aClass){
  22798. var self=this;
  22799. return $core.withContext(function($ctx1) {
  22800. return $recv(self._current())._findClass_(aClass);
  22801. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
  22802. },
  22803. args: ["aClass"],
  22804. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  22805. referencedClasses: [],
  22806. messageSends: ["findClass:", "current"]
  22807. }),
  22808. $globals.Finder.klass);
  22809. $core.addMethod(
  22810. $core.method({
  22811. selector: "findMethod:",
  22812. protocol: 'finding',
  22813. fn: function (aCompiledMethod){
  22814. var self=this;
  22815. return $core.withContext(function($ctx1) {
  22816. return $recv(self._current())._findMethod_(aCompiledMethod);
  22817. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
  22818. },
  22819. args: ["aCompiledMethod"],
  22820. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  22821. referencedClasses: [],
  22822. messageSends: ["findMethod:", "current"]
  22823. }),
  22824. $globals.Finder.klass);
  22825. $core.addMethod(
  22826. $core.method({
  22827. selector: "findString:",
  22828. protocol: 'finding',
  22829. fn: function (aString){
  22830. var self=this;
  22831. return $core.withContext(function($ctx1) {
  22832. return $recv(self._current())._findString_(aString);
  22833. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
  22834. },
  22835. args: ["aString"],
  22836. source: "findString: aString\x0a\x09^ self current findString: aString",
  22837. referencedClasses: [],
  22838. messageSends: ["findString:", "current"]
  22839. }),
  22840. $globals.Finder.klass);
  22841. $core.addClass('Inspector', $globals.Service, [], 'Platform-Services');
  22842. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  22843. $core.addMethod(
  22844. $core.method({
  22845. selector: "inspect:",
  22846. protocol: 'inspecting',
  22847. fn: function (anObject){
  22848. var self=this;
  22849. return $core.withContext(function($ctx1) {
  22850. return $recv(self._current())._inspect_(anObject);
  22851. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
  22852. },
  22853. args: ["anObject"],
  22854. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  22855. referencedClasses: [],
  22856. messageSends: ["inspect:", "current"]
  22857. }),
  22858. $globals.Inspector.klass);
  22859. $core.addClass('Platform', $globals.Service, [], 'Platform-Services');
  22860. $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";
  22861. $core.addMethod(
  22862. $core.method({
  22863. selector: "globals",
  22864. protocol: 'accessing',
  22865. fn: function (){
  22866. var self=this;
  22867. return $core.withContext(function($ctx1) {
  22868. return $recv(self._current())._globals();
  22869. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.klass)});
  22870. },
  22871. args: [],
  22872. source: "globals\x0a\x09^ self current globals",
  22873. referencedClasses: [],
  22874. messageSends: ["globals", "current"]
  22875. }),
  22876. $globals.Platform.klass);
  22877. $core.addMethod(
  22878. $core.method({
  22879. selector: "newXhr",
  22880. protocol: 'accessing',
  22881. fn: function (){
  22882. var self=this;
  22883. return $core.withContext(function($ctx1) {
  22884. return $recv(self._current())._newXhr();
  22885. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.klass)});
  22886. },
  22887. args: [],
  22888. source: "newXhr\x0a\x09^ self current newXhr",
  22889. referencedClasses: [],
  22890. messageSends: ["newXhr", "current"]
  22891. }),
  22892. $globals.Platform.klass);
  22893. $core.addClass('ProgressHandler', $globals.Service, [], 'Platform-Services');
  22894. $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`.";
  22895. $core.addMethod(
  22896. $core.method({
  22897. selector: "do:on:displaying:",
  22898. protocol: 'progress handling',
  22899. fn: function (aBlock,aCollection,aString){
  22900. var self=this;
  22901. return $core.withContext(function($ctx1) {
  22902. $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  22903. return self;
  22904. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
  22905. },
  22906. args: ["aBlock", "aCollection", "aString"],
  22907. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  22908. referencedClasses: [],
  22909. messageSends: ["do:on:displaying:", "current"]
  22910. }),
  22911. $globals.ProgressHandler.klass);
  22912. $core.addClass('Terminal', $globals.Service, [], 'Platform-Services');
  22913. $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:'.";
  22914. $core.addMethod(
  22915. $core.method({
  22916. selector: "alert:",
  22917. protocol: 'dialogs',
  22918. fn: function (aString){
  22919. var self=this;
  22920. return $core.withContext(function($ctx1) {
  22921. return $recv(self._current())._alert_(aString);
  22922. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.klass)});
  22923. },
  22924. args: ["aString"],
  22925. source: "alert: aString\x0a\x09^ self current alert: aString",
  22926. referencedClasses: [],
  22927. messageSends: ["alert:", "current"]
  22928. }),
  22929. $globals.Terminal.klass);
  22930. $core.addMethod(
  22931. $core.method({
  22932. selector: "confirm:",
  22933. protocol: 'dialogs',
  22934. fn: function (aString){
  22935. var self=this;
  22936. return $core.withContext(function($ctx1) {
  22937. return $recv(self._current())._confirm_(aString);
  22938. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.klass)});
  22939. },
  22940. args: ["aString"],
  22941. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  22942. referencedClasses: [],
  22943. messageSends: ["confirm:", "current"]
  22944. }),
  22945. $globals.Terminal.klass);
  22946. $core.addMethod(
  22947. $core.method({
  22948. selector: "prompt:",
  22949. protocol: 'dialogs',
  22950. fn: function (aString){
  22951. var self=this;
  22952. return $core.withContext(function($ctx1) {
  22953. return $recv(self._current())._prompt_(aString);
  22954. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.klass)});
  22955. },
  22956. args: ["aString"],
  22957. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  22958. referencedClasses: [],
  22959. messageSends: ["prompt:", "current"]
  22960. }),
  22961. $globals.Terminal.klass);
  22962. $core.addMethod(
  22963. $core.method({
  22964. selector: "prompt:default:",
  22965. protocol: 'dialogs',
  22966. fn: function (aString,defaultString){
  22967. var self=this;
  22968. return $core.withContext(function($ctx1) {
  22969. return $recv(self._current())._prompt_default_(aString,defaultString);
  22970. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.klass)});
  22971. },
  22972. args: ["aString", "defaultString"],
  22973. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  22974. referencedClasses: [],
  22975. messageSends: ["prompt:default:", "current"]
  22976. }),
  22977. $globals.Terminal.klass);
  22978. $core.addClass('Transcript', $globals.Service, [], 'Platform-Services');
  22979. $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.";
  22980. $core.addMethod(
  22981. $core.method({
  22982. selector: "clear",
  22983. protocol: 'printing',
  22984. fn: function (){
  22985. var self=this;
  22986. return $core.withContext(function($ctx1) {
  22987. $recv(self._current())._clear();
  22988. return self;
  22989. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
  22990. },
  22991. args: [],
  22992. source: "clear\x0a\x09self current clear",
  22993. referencedClasses: [],
  22994. messageSends: ["clear", "current"]
  22995. }),
  22996. $globals.Transcript.klass);
  22997. $core.addMethod(
  22998. $core.method({
  22999. selector: "cr",
  23000. protocol: 'printing',
  23001. fn: function (){
  23002. var self=this;
  23003. return $core.withContext(function($ctx1) {
  23004. $recv(self._current())._show_($recv($globals.String)._cr());
  23005. return self;
  23006. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
  23007. },
  23008. args: [],
  23009. source: "cr\x0a\x09self current show: String cr",
  23010. referencedClasses: ["String"],
  23011. messageSends: ["show:", "current", "cr"]
  23012. }),
  23013. $globals.Transcript.klass);
  23014. $core.addMethod(
  23015. $core.method({
  23016. selector: "inspect:",
  23017. protocol: 'printing',
  23018. fn: function (anObject){
  23019. var self=this;
  23020. return $core.withContext(function($ctx1) {
  23021. self._show_(anObject);
  23022. return self;
  23023. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
  23024. },
  23025. args: ["anObject"],
  23026. source: "inspect: anObject\x0a\x09self show: anObject",
  23027. referencedClasses: [],
  23028. messageSends: ["show:"]
  23029. }),
  23030. $globals.Transcript.klass);
  23031. $core.addMethod(
  23032. $core.method({
  23033. selector: "open",
  23034. protocol: 'instance creation',
  23035. fn: function (){
  23036. var self=this;
  23037. return $core.withContext(function($ctx1) {
  23038. $recv(self._current())._open();
  23039. return self;
  23040. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
  23041. },
  23042. args: [],
  23043. source: "open\x0a\x09self current open",
  23044. referencedClasses: [],
  23045. messageSends: ["open", "current"]
  23046. }),
  23047. $globals.Transcript.klass);
  23048. $core.addMethod(
  23049. $core.method({
  23050. selector: "show:",
  23051. protocol: 'printing',
  23052. fn: function (anObject){
  23053. var self=this;
  23054. return $core.withContext(function($ctx1) {
  23055. $recv(self._current())._show_(anObject);
  23056. return self;
  23057. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
  23058. },
  23059. args: ["anObject"],
  23060. source: "show: anObject\x0a\x09self current show: anObject",
  23061. referencedClasses: [],
  23062. messageSends: ["show:", "current"]
  23063. }),
  23064. $globals.Transcript.klass);
  23065. $core.addMethod(
  23066. $core.method({
  23067. selector: "inspectOn:",
  23068. protocol: '*Platform-Services',
  23069. fn: function (anInspector){
  23070. var self=this;
  23071. var variables;
  23072. return $core.withContext(function($ctx1) {
  23073. variables=$recv($globals.Dictionary)._new();
  23074. $recv(variables)._at_put_("#self",self);
  23075. $ctx1.sendIdx["at:put:"]=1;
  23076. $recv(variables)._at_put_("#keys",self._keys());
  23077. $ctx1.sendIdx["at:put:"]=2;
  23078. self._keysAndValuesDo_((function(key,value){
  23079. return $core.withContext(function($ctx2) {
  23080. return $recv(variables)._at_put_(key,value);
  23081. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23082. }));
  23083. $recv(anInspector)._setLabel_(self._printString());
  23084. $recv(anInspector)._setVariables_(variables);
  23085. return self;
  23086. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  23087. },
  23088. args: ["anInspector"],
  23089. 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",
  23090. referencedClasses: ["Dictionary"],
  23091. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  23092. }),
  23093. $globals.AssociativeCollection);
  23094. $core.addMethod(
  23095. $core.method({
  23096. selector: "inspectOn:",
  23097. protocol: '*Platform-Services',
  23098. fn: function (anInspector){
  23099. var self=this;
  23100. var variables;
  23101. return $core.withContext(function($ctx1) {
  23102. variables=$recv($globals.Dictionary)._new();
  23103. $recv(variables)._at_put_("#self",self);
  23104. $ctx1.sendIdx["at:put:"]=1;
  23105. self._withIndexDo_((function(each,i){
  23106. return $core.withContext(function($ctx2) {
  23107. return $recv(variables)._at_put_(i,each);
  23108. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  23109. }));
  23110. $recv(anInspector)._setLabel_(self._printString());
  23111. $recv(anInspector)._setVariables_(variables);
  23112. return self;
  23113. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  23114. },
  23115. args: ["anInspector"],
  23116. 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",
  23117. referencedClasses: ["Dictionary"],
  23118. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  23119. }),
  23120. $globals.Collection);
  23121. $core.addMethod(
  23122. $core.method({
  23123. selector: "inspectOn:",
  23124. protocol: '*Platform-Services',
  23125. fn: function (anInspector){
  23126. var self=this;
  23127. var variables;
  23128. return $core.withContext(function($ctx1) {
  23129. variables=$recv($globals.Dictionary)._new();
  23130. $recv(variables)._at_put_("#self",self);
  23131. $ctx1.sendIdx["at:put:"]=1;
  23132. $recv(variables)._at_put_("#year",self._year());
  23133. $ctx1.sendIdx["at:put:"]=2;
  23134. $recv(variables)._at_put_("#month",self._month());
  23135. $ctx1.sendIdx["at:put:"]=3;
  23136. $recv(variables)._at_put_("#day",self._day());
  23137. $ctx1.sendIdx["at:put:"]=4;
  23138. $recv(variables)._at_put_("#hours",self._hours());
  23139. $ctx1.sendIdx["at:put:"]=5;
  23140. $recv(variables)._at_put_("#minutes",self._minutes());
  23141. $ctx1.sendIdx["at:put:"]=6;
  23142. $recv(variables)._at_put_("#seconds",self._seconds());
  23143. $ctx1.sendIdx["at:put:"]=7;
  23144. $recv(variables)._at_put_("#milliseconds",self._milliseconds());
  23145. $recv(anInspector)._setLabel_(self._printString());
  23146. $recv(anInspector)._setVariables_(variables);
  23147. return self;
  23148. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  23149. },
  23150. args: ["anInspector"],
  23151. 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",
  23152. referencedClasses: ["Dictionary"],
  23153. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  23154. }),
  23155. $globals.Date);
  23156. $core.addMethod(
  23157. $core.method({
  23158. selector: "inspectOn:",
  23159. protocol: '*Platform-Services',
  23160. fn: function (anInspector){
  23161. var self=this;
  23162. var variables;
  23163. return $core.withContext(function($ctx1) {
  23164. variables=$recv($globals.Dictionary)._new();
  23165. $recv(variables)._at_put_("#self",self._jsObject());
  23166. $recv(anInspector)._setLabel_(self._printString());
  23167. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  23168. $recv(anInspector)._setVariables_(variables);
  23169. return self;
  23170. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  23171. },
  23172. args: ["anInspector"],
  23173. 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",
  23174. referencedClasses: ["Dictionary", "JSObjectProxy"],
  23175. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  23176. }),
  23177. $globals.JSObjectProxy);
  23178. $core.addMethod(
  23179. $core.method({
  23180. selector: "inspectOn:",
  23181. protocol: '*Platform-Services',
  23182. fn: function (anInspector){
  23183. var self=this;
  23184. var variables;
  23185. return $core.withContext(function($ctx1) {
  23186. variables=$recv($globals.Dictionary)._new();
  23187. $recv(variables)._at_put_("#self",self);
  23188. $ctx1.sendIdx["at:put:"]=1;
  23189. $recv(variables)._at_put_("#home",self._home());
  23190. $ctx1.sendIdx["at:put:"]=2;
  23191. $recv(variables)._at_put_("#receiver",self._receiver());
  23192. $ctx1.sendIdx["at:put:"]=3;
  23193. $recv(variables)._at_put_("#selector",self._selector());
  23194. $ctx1.sendIdx["at:put:"]=4;
  23195. $recv(variables)._at_put_("#locals",self._locals());
  23196. $ctx1.sendIdx["at:put:"]=5;
  23197. $recv($recv(self._class())._instanceVariableNames())._do_((function(each){
  23198. return $core.withContext(function($ctx2) {
  23199. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23200. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23201. }));
  23202. $recv(anInspector)._setLabel_(self._printString());
  23203. $recv(anInspector)._setVariables_(variables);
  23204. return self;
  23205. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  23206. },
  23207. args: ["anInspector"],
  23208. 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",
  23209. referencedClasses: ["Dictionary"],
  23210. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23211. }),
  23212. $globals.MethodContext);
  23213. $core.addMethod(
  23214. $core.method({
  23215. selector: "inspectOn:",
  23216. protocol: '*Platform-Services',
  23217. fn: function (anInspector){
  23218. var self=this;
  23219. var variables;
  23220. return $core.withContext(function($ctx1) {
  23221. variables=$recv($globals.Dictionary)._new();
  23222. $recv(variables)._at_put_("#self",self);
  23223. $ctx1.sendIdx["at:put:"]=1;
  23224. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  23225. return $core.withContext(function($ctx2) {
  23226. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23227. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23228. }));
  23229. $recv(anInspector)._setLabel_(self._printString());
  23230. $recv(anInspector)._setVariables_(variables);
  23231. return self;
  23232. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  23233. },
  23234. args: ["anInspector"],
  23235. 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",
  23236. referencedClasses: ["Dictionary"],
  23237. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23238. }),
  23239. $globals.Object);
  23240. $core.addMethod(
  23241. $core.method({
  23242. selector: "do:displayingProgress:",
  23243. protocol: '*Platform-Services',
  23244. fn: function (aBlock,aString){
  23245. var self=this;
  23246. return $core.withContext(function($ctx1) {
  23247. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  23248. return self;
  23249. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  23250. },
  23251. args: ["aBlock", "aString"],
  23252. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  23253. referencedClasses: ["ProgressHandler"],
  23254. messageSends: ["do:on:displaying:"]
  23255. }),
  23256. $globals.SequenceableCollection);
  23257. $core.addMethod(
  23258. $core.method({
  23259. selector: "inspectOn:",
  23260. protocol: '*Platform-Services',
  23261. fn: function (anInspector){
  23262. var self=this;
  23263. var variables,i;
  23264. return $core.withContext(function($ctx1) {
  23265. variables=$recv($globals.Dictionary)._new();
  23266. $recv(variables)._at_put_("#self",self);
  23267. $ctx1.sendIdx["at:put:"]=1;
  23268. i=(1);
  23269. self._do_((function(each){
  23270. return $core.withContext(function($ctx2) {
  23271. $recv(variables)._at_put_(i,each);
  23272. i=$recv(i).__plus((1));
  23273. return i;
  23274. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23275. }));
  23276. $recv(anInspector)._setLabel_(self._printString());
  23277. $recv(anInspector)._setVariables_(variables);
  23278. return self;
  23279. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  23280. },
  23281. args: ["anInspector"],
  23282. 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",
  23283. referencedClasses: ["Dictionary"],
  23284. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  23285. }),
  23286. $globals.Set);
  23287. $core.addMethod(
  23288. $core.method({
  23289. selector: "inspectOn:",
  23290. protocol: '*Platform-Services',
  23291. fn: function (anInspector){
  23292. var self=this;
  23293. var label;
  23294. return $core.withContext(function($ctx1) {
  23295. var $3,$2,$1,$5,$4;
  23296. (
  23297. $ctx1.supercall = true,
  23298. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($recv(self), [anInspector]));
  23299. $ctx1.supercall = false;
  23300. $3=self._printString();
  23301. $ctx1.sendIdx["printString"]=1;
  23302. $2=$recv($3)._size();
  23303. $1=$recv($2).__gt((30));
  23304. if($core.assert($1)){
  23305. $5=self._printString();
  23306. $ctx1.sendIdx["printString"]=2;
  23307. $4=$recv($5)._copyFrom_to_((1),(30));
  23308. label=$recv($4).__comma("...'");
  23309. label;
  23310. } else {
  23311. label=self._printString();
  23312. label;
  23313. };
  23314. $recv(anInspector)._setLabel_(label);
  23315. return self;
  23316. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  23317. },
  23318. args: ["anInspector"],
  23319. 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",
  23320. referencedClasses: [],
  23321. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  23322. }),
  23323. $globals.String);
  23324. });
  23325. define('amber_core/Platform-Node',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  23326. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  23327. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  23328. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  23329. $core.addPackage('Platform-Node');
  23330. $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  23331. $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23332. $core.addClass('NodePlatform', $globals.Object, [], 'Platform-Node');
  23333. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  23334. $core.addMethod(
  23335. $core.method({
  23336. selector: "globals",
  23337. protocol: 'accessing',
  23338. fn: function (){
  23339. var self=this;
  23340. return global;
  23341. },
  23342. args: [],
  23343. source: "globals\x0a\x09^ global",
  23344. referencedClasses: [],
  23345. messageSends: []
  23346. }),
  23347. $globals.NodePlatform);
  23348. $core.addMethod(
  23349. $core.method({
  23350. selector: "newXhr",
  23351. protocol: 'accessing',
  23352. fn: function (){
  23353. var self=this;
  23354. return $core.withContext(function($ctx1) {
  23355. var $receiver;
  23356. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.isNil){
  23357. self._error_("XMLHttpRequest not available.");
  23358. } else {
  23359. return $recv($globals.XMLHttpRequest)._new();
  23360. };
  23361. return self;
  23362. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  23363. },
  23364. args: [],
  23365. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  23366. referencedClasses: ["XMLHttpRequest"],
  23367. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  23368. }),
  23369. $globals.NodePlatform);
  23370. $core.addMethod(
  23371. $core.method({
  23372. selector: "initialize",
  23373. protocol: 'testing',
  23374. fn: function (){
  23375. var self=this;
  23376. return $core.withContext(function($ctx1) {
  23377. var $1;
  23378. $1=self._isFeasible();
  23379. if($core.assert($1)){
  23380. $recv($globals.Platform)._registerIfNone_(self._new());
  23381. };
  23382. return self;
  23383. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.klass)});
  23384. },
  23385. args: [],
  23386. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  23387. referencedClasses: ["Platform"],
  23388. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  23389. }),
  23390. $globals.NodePlatform.klass);
  23391. $core.addMethod(
  23392. $core.method({
  23393. selector: "isFeasible",
  23394. protocol: 'testing',
  23395. fn: function (){
  23396. var self=this;
  23397. return $core.withContext(function($ctx1) {
  23398. return typeof global !== "undefined";
  23399. return self;
  23400. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.klass)});
  23401. },
  23402. args: [],
  23403. source: "isFeasible\x0a<return typeof global !== \x22undefined\x22>",
  23404. referencedClasses: [],
  23405. messageSends: []
  23406. }),
  23407. $globals.NodePlatform.klass);
  23408. });
  23409. define('amber/deploy',[
  23410. './helpers',
  23411. './compatibility', // pre-fetch, dep of ./boot
  23412. './boot', // pre-fetch, dep of ./helpers
  23413. // --- packages of the core Amber begin here ---
  23414. 'amber_core/Kernel-Objects',
  23415. 'amber_core/Kernel-Classes',
  23416. 'amber_core/Kernel-Methods',
  23417. 'amber_core/Kernel-Collections',
  23418. 'amber_core/Kernel-Infrastructure',
  23419. 'amber_core/Kernel-Promises',
  23420. 'amber_core/Kernel-Exceptions',
  23421. 'amber_core/Kernel-Announcements',
  23422. 'amber_core/Platform-Services',
  23423. 'amber/Platform'
  23424. // --- packages of the core Amber end here ---
  23425. ], function (amber) { return amber; });
  23426. define('amber/parser',['./boot'], function($boot) {
  23427. var $globals = $boot.globals, nil = $boot.nilAsReceiver;
  23428. $globals.SmalltalkParser = (function() {
  23429. "use strict";
  23430. /*
  23431. * Generated by PEG.js 0.9.0.
  23432. *
  23433. * http://pegjs.org/
  23434. */
  23435. function peg$subclass(child, parent) {
  23436. function ctor() { this.constructor = child; }
  23437. ctor.prototype = parent.prototype;
  23438. child.prototype = new ctor();
  23439. }
  23440. function peg$SyntaxError(message, expected, found, location) {
  23441. this.message = message;
  23442. this.expected = expected;
  23443. this.found = found;
  23444. this.location = location;
  23445. this.name = "SyntaxError";
  23446. if (typeof Error.captureStackTrace === "function") {
  23447. Error.captureStackTrace(this, peg$SyntaxError);
  23448. }
  23449. }
  23450. peg$subclass(peg$SyntaxError, Error);
  23451. function peg$parse(input) {
  23452. var options = arguments.length > 1 ? arguments[1] : {},
  23453. parser = this,
  23454. peg$FAILED = {},
  23455. peg$startRuleFunctions = { start: peg$parsestart },
  23456. peg$startRuleFunction = peg$parsestart,
  23457. peg$c0 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  23458. peg$c1 = { type: "class", value: "[ \\t\\v\\f\\u00A0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\v\\f\\u00A0\\uFEFF\\n\\r\\u2028\\u2029]" },
  23459. peg$c2 = "\"",
  23460. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  23461. peg$c4 = /^[^"]/,
  23462. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  23463. peg$c6 = ".",
  23464. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  23465. peg$c8 = /^[a-zA-Z]/,
  23466. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  23467. peg$c10 = /^[a-zA-Z0-9]/,
  23468. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  23469. peg$c12 = function(first, others) {return first + others.join("");},
  23470. peg$c13 = ":",
  23471. peg$c14 = { type: "literal", value: ":", description: "\":\"" },
  23472. peg$c15 = function(first, last) {return first + last;},
  23473. peg$c16 = /^[a-zA-Z0-9:]/,
  23474. peg$c17 = { type: "class", value: "[a-zA-Z0-9\\:]", description: "[a-zA-Z0-9\\:]" },
  23475. peg$c18 = /^[A-Z]/,
  23476. peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  23477. peg$c20 = "'",
  23478. peg$c21 = { type: "literal", value: "'", description: "\"'\"" },
  23479. peg$c22 = "''",
  23480. peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
  23481. peg$c24 = function() {return "'";},
  23482. peg$c25 = /^[^']/,
  23483. peg$c26 = { type: "class", value: "[^']", description: "[^']" },
  23484. peg$c27 = function(val) {
  23485. return $globals.ValueNode._new()
  23486. ._location_(location())
  23487. ._source_(text())
  23488. ._value_(val.join(""));
  23489. },
  23490. peg$c28 = "$",
  23491. peg$c29 = { type: "literal", value: "$", description: "\"$\"" },
  23492. peg$c30 = { type: "any", description: "any character" },
  23493. peg$c31 = function(char) {
  23494. return $globals.ValueNode._new()
  23495. ._location_(location())
  23496. ._source_(text())
  23497. ._value_(char);
  23498. },
  23499. peg$c32 = "#",
  23500. peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
  23501. peg$c34 = function(rest) {return rest;},
  23502. peg$c35 = function(node) {return node._value();},
  23503. peg$c36 = function(val) {
  23504. return $globals.ValueNode._new()
  23505. ._location_(location())
  23506. ._source_(text())
  23507. ._value_(val);
  23508. },
  23509. peg$c37 = function(n) {
  23510. return $globals.ValueNode._new()
  23511. ._location_(location())
  23512. ._source_(text())
  23513. ._value_(n);
  23514. },
  23515. peg$c38 = "e",
  23516. peg$c39 = { type: "literal", value: "e", description: "\"e\"" },
  23517. peg$c40 = function(n) {return parseFloat(n.join(""));},
  23518. peg$c41 = "-",
  23519. peg$c42 = { type: "literal", value: "-", description: "\"-\"" },
  23520. peg$c43 = "16r",
  23521. peg$c44 = { type: "literal", value: "16r", description: "\"16r\"" },
  23522. peg$c45 = /^[0-9a-fA-F]/,
  23523. peg$c46 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  23524. peg$c47 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  23525. peg$c48 = /^[0-9]/,
  23526. peg$c49 = { type: "class", value: "[0-9]", description: "[0-9]" },
  23527. peg$c50 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  23528. peg$c51 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));},
  23529. peg$c52 = "#(",
  23530. peg$c53 = { type: "literal", value: "#(", description: "\"#(\"" },
  23531. peg$c54 = ")",
  23532. peg$c55 = { type: "literal", value: ")", description: "\")\"" },
  23533. peg$c56 = function(rest) {
  23534. return rest
  23535. ._location_(location())
  23536. ._source_(text());
  23537. },
  23538. peg$c57 = "(",
  23539. peg$c58 = { type: "literal", value: "(", description: "\"(\"" },
  23540. peg$c59 = function(lit) {return lit._value();},
  23541. peg$c60 = function(lits) {
  23542. return $globals.ValueNode._new()
  23543. ._value_(lits);
  23544. },
  23545. peg$c61 = "{",
  23546. peg$c62 = { type: "literal", value: "{", description: "\"{\"" },
  23547. peg$c63 = "}",
  23548. peg$c64 = { type: "literal", value: "}", description: "\"}\"" },
  23549. peg$c65 = function(expressions) {
  23550. return $globals.DynamicArrayNode._new()
  23551. ._location_(location())
  23552. ._source_(text())
  23553. ._nodes_(expressions || []);
  23554. },
  23555. peg$c66 = "#{",
  23556. peg$c67 = { type: "literal", value: "#{", description: "\"#{\"" },
  23557. peg$c68 = function(expressions) {
  23558. return $globals.DynamicDictionaryNode._new()
  23559. ._location_(location())
  23560. ._source_(text())
  23561. ._nodes_(expressions || []);
  23562. },
  23563. peg$c69 = "true",
  23564. peg$c70 = { type: "literal", value: "true", description: "\"true\"" },
  23565. peg$c71 = function() {return true;},
  23566. peg$c72 = "false",
  23567. peg$c73 = { type: "literal", value: "false", description: "\"false\"" },
  23568. peg$c74 = function() {return false;},
  23569. peg$c75 = "nil",
  23570. peg$c76 = { type: "literal", value: "nil", description: "\"nil\"" },
  23571. peg$c77 = function() {return nil;},
  23572. peg$c78 = function(val) {
  23573. return $globals.ValueNode._new()
  23574. ._location_(location())
  23575. ._source_(text())
  23576. ._value_(val);
  23577. },
  23578. peg$c79 = function(identifier) {
  23579. return $globals.VariableNode._new()
  23580. ._location_(location())
  23581. ._source_(text())
  23582. ._value_(identifier);
  23583. },
  23584. peg$c80 = /^[\\+*\/=><,@%~|&\-]/,
  23585. peg$c81 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  23586. peg$c82 = function(bin) {return bin.join("");},
  23587. peg$c83 = function(key, arg) {return {key:key, arg:arg};},
  23588. peg$c84 = function(pairs) {
  23589. var selector = "";
  23590. var params = [];
  23591. for(var i = 0; i < pairs.length; i++){
  23592. selector += pairs[i].key;
  23593. params.push(pairs[i].arg);
  23594. }
  23595. return [selector, params];
  23596. },
  23597. peg$c85 = function(selector, arg) {return [selector, [arg]];},
  23598. peg$c86 = function(selector) {return [selector, []];},
  23599. peg$c87 = function(expression) {return expression;},
  23600. peg$c88 = function(first, others) { return [first].concat(others); },
  23601. peg$c89 = ":=",
  23602. peg$c90 = { type: "literal", value: ":=", description: "\":=\"" },
  23603. peg$c91 = function(variable, expression) {
  23604. return $globals.AssignmentNode._new()
  23605. ._location_(location())
  23606. ._source_(text())
  23607. ._left_(variable)
  23608. ._right_(expression);
  23609. },
  23610. peg$c92 = "^",
  23611. peg$c93 = { type: "literal", value: "^", description: "\"^\"" },
  23612. peg$c94 = function(expression) {
  23613. return $globals.ReturnNode._new()
  23614. ._location_(location())
  23615. ._source_(text())
  23616. ._nodes_([expression]);
  23617. },
  23618. peg$c95 = "|",
  23619. peg$c96 = { type: "literal", value: "|", description: "\"|\"" },
  23620. peg$c97 = function(variable) {return variable;},
  23621. peg$c98 = function(vars) {return vars;},
  23622. peg$c99 = function(param) {return param;},
  23623. peg$c100 = function(params) {return params;},
  23624. peg$c101 = function(ret) {return [ret];},
  23625. peg$c102 = function(exps, ret) {
  23626. var expressions = exps;
  23627. expressions.push(ret);
  23628. return expressions;
  23629. },
  23630. peg$c103 = function(expressions) {
  23631. return expressions || [];
  23632. },
  23633. peg$c104 = function(js) { return js; },
  23634. peg$c105 = function(temps, statements) {
  23635. return $globals.SequenceNode._new()
  23636. ._location_(location())
  23637. ._source_(text())
  23638. ._temps_(temps || [])
  23639. ._nodes_(statements || []);
  23640. },
  23641. peg$c106 = "[",
  23642. peg$c107 = { type: "literal", value: "[", description: "\"[\"" },
  23643. peg$c108 = "]",
  23644. peg$c109 = { type: "literal", value: "]", description: "\"]\"" },
  23645. peg$c110 = function(params, sequence) {
  23646. return $globals.BlockNode._new()
  23647. ._location_(location())
  23648. ._source_(text())
  23649. ._parameters_(params || [])
  23650. ._nodes_([sequence._asBlockSequenceNode()]);
  23651. },
  23652. peg$c111 = function(selector) {
  23653. return $globals.SendNode._new()
  23654. ._location_(location())
  23655. ._source_(text())
  23656. ._selector_(selector);
  23657. },
  23658. peg$c112 = function(message, tail) {
  23659. if(tail) {
  23660. return tail._valueForReceiver_(message);
  23661. }
  23662. else {
  23663. return message;
  23664. }
  23665. },
  23666. peg$c113 = function(receiver, tail) {
  23667. if(tail) {
  23668. return tail._valueForReceiver_(receiver);
  23669. }
  23670. else {
  23671. return receiver;
  23672. }
  23673. },
  23674. peg$c114 = function(selector, arg) {
  23675. return $globals.SendNode._new()
  23676. ._location_(location())
  23677. ._source_(text())
  23678. ._selector_(selector)
  23679. ._arguments_([arg]);
  23680. },
  23681. peg$c115 = function(message, tail) {
  23682. if(tail) {
  23683. return tail._valueForReceiver_(message);
  23684. }
  23685. else {
  23686. return message;
  23687. }
  23688. },
  23689. peg$c116 = function(pairs) {
  23690. var selector = "";
  23691. var args = [];
  23692. for(var i = 0; i < pairs.length; i++) {
  23693. selector += pairs[i].key;
  23694. args.push(pairs[i].arg);
  23695. }
  23696. return $globals.SendNode._new()
  23697. ._location_(location())
  23698. ._source_(text())
  23699. ._selector_(selector)
  23700. ._arguments_(args);
  23701. },
  23702. peg$c117 = function(send) { return send._isSendNode(); },
  23703. peg$c118 = ";",
  23704. peg$c119 = { type: "literal", value: ";", description: "\";\"" },
  23705. peg$c120 = function(send, mess) {return mess;},
  23706. peg$c121 = function(send, messages) {
  23707. messages.unshift(send);
  23708. return $globals.CascadeNode._new()
  23709. ._location_(location())
  23710. ._source_(text())
  23711. ._nodes_(messages);
  23712. },
  23713. peg$c122 = "<",
  23714. peg$c123 = { type: "literal", value: "<", description: "\"<\"" },
  23715. peg$c124 = ">>",
  23716. peg$c125 = { type: "literal", value: ">>", description: "\">>\"" },
  23717. peg$c126 = function() {return ">";},
  23718. peg$c127 = /^[^>]/,
  23719. peg$c128 = { type: "class", value: "[^>]", description: "[^>]" },
  23720. peg$c129 = ">",
  23721. peg$c130 = { type: "literal", value: ">", description: "\">\"" },
  23722. peg$c131 = function(val) {
  23723. return $globals.JSStatementNode._new()
  23724. ._location_(location())
  23725. ._source_(val.join(""))
  23726. },
  23727. peg$c132 = function(pattern, sequence) {
  23728. return $globals.MethodNode._new()
  23729. ._location_(location())
  23730. ._source_(text())
  23731. ._selector_(pattern[0])
  23732. ._arguments_(pattern[1])
  23733. ._nodes_([sequence]);
  23734. },
  23735. peg$c133 = function(send) { return send._isSendNode() && send._selector() === "->" },
  23736. peg$c134 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  23737. peg$c135 = function(first, others) { return first.concat.apply(first, others); },
  23738. peg$currPos = 0,
  23739. peg$savedPos = 0,
  23740. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  23741. peg$maxFailPos = 0,
  23742. peg$maxFailExpected = [],
  23743. peg$silentFails = 0,
  23744. peg$resultsCache = {},
  23745. peg$result;
  23746. if ("startRule" in options) {
  23747. if (!(options.startRule in peg$startRuleFunctions)) {
  23748. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  23749. }
  23750. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  23751. }
  23752. function text() {
  23753. return input.substring(peg$savedPos, peg$currPos);
  23754. }
  23755. function location() {
  23756. return peg$computeLocation(peg$savedPos, peg$currPos);
  23757. }
  23758. function expected(description) {
  23759. throw peg$buildException(
  23760. null,
  23761. [{ type: "other", description: description }],
  23762. input.substring(peg$savedPos, peg$currPos),
  23763. peg$computeLocation(peg$savedPos, peg$currPos)
  23764. );
  23765. }
  23766. function error(message) {
  23767. throw peg$buildException(
  23768. message,
  23769. null,
  23770. input.substring(peg$savedPos, peg$currPos),
  23771. peg$computeLocation(peg$savedPos, peg$currPos)
  23772. );
  23773. }
  23774. function peg$computePosDetails(pos) {
  23775. var details = peg$posDetailsCache[pos],
  23776. p, ch;
  23777. if (details) {
  23778. return details;
  23779. } else {
  23780. p = pos - 1;
  23781. while (!peg$posDetailsCache[p]) {
  23782. p--;
  23783. }
  23784. details = peg$posDetailsCache[p];
  23785. details = {
  23786. line: details.line,
  23787. column: details.column,
  23788. seenCR: details.seenCR
  23789. };
  23790. while (p < pos) {
  23791. ch = input.charAt(p);
  23792. if (ch === "\n") {
  23793. if (!details.seenCR) { details.line++; }
  23794. details.column = 1;
  23795. details.seenCR = false;
  23796. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  23797. details.line++;
  23798. details.column = 1;
  23799. details.seenCR = true;
  23800. } else {
  23801. details.column++;
  23802. details.seenCR = false;
  23803. }
  23804. p++;
  23805. }
  23806. peg$posDetailsCache[pos] = details;
  23807. return details;
  23808. }
  23809. }
  23810. function peg$computeLocation(startPos, endPos) {
  23811. var startPosDetails = peg$computePosDetails(startPos),
  23812. endPosDetails = peg$computePosDetails(endPos);
  23813. return {
  23814. start: {
  23815. offset: startPos,
  23816. line: startPosDetails.line,
  23817. column: startPosDetails.column
  23818. },
  23819. end: {
  23820. offset: endPos,
  23821. line: endPosDetails.line,
  23822. column: endPosDetails.column
  23823. }
  23824. };
  23825. }
  23826. function peg$fail(expected) {
  23827. if (peg$currPos < peg$maxFailPos) { return; }
  23828. if (peg$currPos > peg$maxFailPos) {
  23829. peg$maxFailPos = peg$currPos;
  23830. peg$maxFailExpected = [];
  23831. }
  23832. peg$maxFailExpected.push(expected);
  23833. }
  23834. function peg$buildException(message, expected, found, location) {
  23835. function cleanupExpected(expected) {
  23836. var i = 1;
  23837. expected.sort(function(a, b) {
  23838. if (a.description < b.description) {
  23839. return -1;
  23840. } else if (a.description > b.description) {
  23841. return 1;
  23842. } else {
  23843. return 0;
  23844. }
  23845. });
  23846. while (i < expected.length) {
  23847. if (expected[i - 1] === expected[i]) {
  23848. expected.splice(i, 1);
  23849. } else {
  23850. i++;
  23851. }
  23852. }
  23853. }
  23854. function buildMessage(expected, found) {
  23855. function stringEscape(s) {
  23856. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  23857. return s
  23858. .replace(/\\/g, '\\\\')
  23859. .replace(/"/g, '\\"')
  23860. .replace(/\x08/g, '\\b')
  23861. .replace(/\t/g, '\\t')
  23862. .replace(/\n/g, '\\n')
  23863. .replace(/\f/g, '\\f')
  23864. .replace(/\r/g, '\\r')
  23865. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  23866. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  23867. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  23868. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  23869. }
  23870. var expectedDescs = new Array(expected.length),
  23871. expectedDesc, foundDesc, i;
  23872. for (i = 0; i < expected.length; i++) {
  23873. expectedDescs[i] = expected[i].description;
  23874. }
  23875. expectedDesc = expected.length > 1
  23876. ? expectedDescs.slice(0, -1).join(", ")
  23877. + " or "
  23878. + expectedDescs[expected.length - 1]
  23879. : expectedDescs[0];
  23880. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  23881. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  23882. }
  23883. if (expected !== null) {
  23884. cleanupExpected(expected);
  23885. }
  23886. return new peg$SyntaxError(
  23887. message !== null ? message : buildMessage(expected, found),
  23888. expected,
  23889. found,
  23890. location
  23891. );
  23892. }
  23893. function peg$parsestart() {
  23894. var s0;
  23895. var key = peg$currPos * 61 + 0,
  23896. cached = peg$resultsCache[key];
  23897. if (cached) {
  23898. peg$currPos = cached.nextPos;
  23899. return cached.result;
  23900. }
  23901. s0 = peg$parsemethod();
  23902. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23903. return s0;
  23904. }
  23905. function peg$parseseparator() {
  23906. var s0, s1;
  23907. var key = peg$currPos * 61 + 1,
  23908. cached = peg$resultsCache[key];
  23909. if (cached) {
  23910. peg$currPos = cached.nextPos;
  23911. return cached.result;
  23912. }
  23913. s0 = [];
  23914. if (peg$c0.test(input.charAt(peg$currPos))) {
  23915. s1 = input.charAt(peg$currPos);
  23916. peg$currPos++;
  23917. } else {
  23918. s1 = peg$FAILED;
  23919. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  23920. }
  23921. if (s1 !== peg$FAILED) {
  23922. while (s1 !== peg$FAILED) {
  23923. s0.push(s1);
  23924. if (peg$c0.test(input.charAt(peg$currPos))) {
  23925. s1 = input.charAt(peg$currPos);
  23926. peg$currPos++;
  23927. } else {
  23928. s1 = peg$FAILED;
  23929. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  23930. }
  23931. }
  23932. } else {
  23933. s0 = peg$FAILED;
  23934. }
  23935. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23936. return s0;
  23937. }
  23938. function peg$parsecomments() {
  23939. var s0, s1, s2, s3, s4;
  23940. var key = peg$currPos * 61 + 2,
  23941. cached = peg$resultsCache[key];
  23942. if (cached) {
  23943. peg$currPos = cached.nextPos;
  23944. return cached.result;
  23945. }
  23946. s0 = [];
  23947. s1 = peg$currPos;
  23948. if (input.charCodeAt(peg$currPos) === 34) {
  23949. s2 = peg$c2;
  23950. peg$currPos++;
  23951. } else {
  23952. s2 = peg$FAILED;
  23953. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23954. }
  23955. if (s2 !== peg$FAILED) {
  23956. s3 = [];
  23957. if (peg$c4.test(input.charAt(peg$currPos))) {
  23958. s4 = input.charAt(peg$currPos);
  23959. peg$currPos++;
  23960. } else {
  23961. s4 = peg$FAILED;
  23962. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  23963. }
  23964. while (s4 !== peg$FAILED) {
  23965. s3.push(s4);
  23966. if (peg$c4.test(input.charAt(peg$currPos))) {
  23967. s4 = input.charAt(peg$currPos);
  23968. peg$currPos++;
  23969. } else {
  23970. s4 = peg$FAILED;
  23971. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  23972. }
  23973. }
  23974. if (s3 !== peg$FAILED) {
  23975. if (input.charCodeAt(peg$currPos) === 34) {
  23976. s4 = peg$c2;
  23977. peg$currPos++;
  23978. } else {
  23979. s4 = peg$FAILED;
  23980. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23981. }
  23982. if (s4 !== peg$FAILED) {
  23983. s2 = [s2, s3, s4];
  23984. s1 = s2;
  23985. } else {
  23986. peg$currPos = s1;
  23987. s1 = peg$FAILED;
  23988. }
  23989. } else {
  23990. peg$currPos = s1;
  23991. s1 = peg$FAILED;
  23992. }
  23993. } else {
  23994. peg$currPos = s1;
  23995. s1 = peg$FAILED;
  23996. }
  23997. if (s1 !== peg$FAILED) {
  23998. while (s1 !== peg$FAILED) {
  23999. s0.push(s1);
  24000. s1 = peg$currPos;
  24001. if (input.charCodeAt(peg$currPos) === 34) {
  24002. s2 = peg$c2;
  24003. peg$currPos++;
  24004. } else {
  24005. s2 = peg$FAILED;
  24006. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24007. }
  24008. if (s2 !== peg$FAILED) {
  24009. s3 = [];
  24010. if (peg$c4.test(input.charAt(peg$currPos))) {
  24011. s4 = input.charAt(peg$currPos);
  24012. peg$currPos++;
  24013. } else {
  24014. s4 = peg$FAILED;
  24015. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24016. }
  24017. while (s4 !== peg$FAILED) {
  24018. s3.push(s4);
  24019. if (peg$c4.test(input.charAt(peg$currPos))) {
  24020. s4 = input.charAt(peg$currPos);
  24021. peg$currPos++;
  24022. } else {
  24023. s4 = peg$FAILED;
  24024. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24025. }
  24026. }
  24027. if (s3 !== peg$FAILED) {
  24028. if (input.charCodeAt(peg$currPos) === 34) {
  24029. s4 = peg$c2;
  24030. peg$currPos++;
  24031. } else {
  24032. s4 = peg$FAILED;
  24033. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24034. }
  24035. if (s4 !== peg$FAILED) {
  24036. s2 = [s2, s3, s4];
  24037. s1 = s2;
  24038. } else {
  24039. peg$currPos = s1;
  24040. s1 = peg$FAILED;
  24041. }
  24042. } else {
  24043. peg$currPos = s1;
  24044. s1 = peg$FAILED;
  24045. }
  24046. } else {
  24047. peg$currPos = s1;
  24048. s1 = peg$FAILED;
  24049. }
  24050. }
  24051. } else {
  24052. s0 = peg$FAILED;
  24053. }
  24054. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24055. return s0;
  24056. }
  24057. function peg$parsews() {
  24058. var s0, s1;
  24059. var key = peg$currPos * 61 + 3,
  24060. cached = peg$resultsCache[key];
  24061. if (cached) {
  24062. peg$currPos = cached.nextPos;
  24063. return cached.result;
  24064. }
  24065. s0 = [];
  24066. s1 = peg$parseseparator();
  24067. if (s1 === peg$FAILED) {
  24068. s1 = peg$parsecomments();
  24069. }
  24070. while (s1 !== peg$FAILED) {
  24071. s0.push(s1);
  24072. s1 = peg$parseseparator();
  24073. if (s1 === peg$FAILED) {
  24074. s1 = peg$parsecomments();
  24075. }
  24076. }
  24077. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24078. return s0;
  24079. }
  24080. function peg$parsemaybeDotsWs() {
  24081. var s0, s1;
  24082. var key = peg$currPos * 61 + 4,
  24083. cached = peg$resultsCache[key];
  24084. if (cached) {
  24085. peg$currPos = cached.nextPos;
  24086. return cached.result;
  24087. }
  24088. s0 = [];
  24089. if (input.charCodeAt(peg$currPos) === 46) {
  24090. s1 = peg$c6;
  24091. peg$currPos++;
  24092. } else {
  24093. s1 = peg$FAILED;
  24094. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24095. }
  24096. if (s1 === peg$FAILED) {
  24097. s1 = peg$parseseparator();
  24098. if (s1 === peg$FAILED) {
  24099. s1 = peg$parsecomments();
  24100. }
  24101. }
  24102. while (s1 !== peg$FAILED) {
  24103. s0.push(s1);
  24104. if (input.charCodeAt(peg$currPos) === 46) {
  24105. s1 = peg$c6;
  24106. peg$currPos++;
  24107. } else {
  24108. s1 = peg$FAILED;
  24109. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24110. }
  24111. if (s1 === peg$FAILED) {
  24112. s1 = peg$parseseparator();
  24113. if (s1 === peg$FAILED) {
  24114. s1 = peg$parsecomments();
  24115. }
  24116. }
  24117. }
  24118. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24119. return s0;
  24120. }
  24121. function peg$parseidentifier() {
  24122. var s0, s1, s2, s3;
  24123. var key = peg$currPos * 61 + 5,
  24124. cached = peg$resultsCache[key];
  24125. if (cached) {
  24126. peg$currPos = cached.nextPos;
  24127. return cached.result;
  24128. }
  24129. s0 = peg$currPos;
  24130. if (peg$c8.test(input.charAt(peg$currPos))) {
  24131. s1 = input.charAt(peg$currPos);
  24132. peg$currPos++;
  24133. } else {
  24134. s1 = peg$FAILED;
  24135. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24136. }
  24137. if (s1 !== peg$FAILED) {
  24138. s2 = [];
  24139. if (peg$c10.test(input.charAt(peg$currPos))) {
  24140. s3 = input.charAt(peg$currPos);
  24141. peg$currPos++;
  24142. } else {
  24143. s3 = peg$FAILED;
  24144. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24145. }
  24146. while (s3 !== peg$FAILED) {
  24147. s2.push(s3);
  24148. if (peg$c10.test(input.charAt(peg$currPos))) {
  24149. s3 = input.charAt(peg$currPos);
  24150. peg$currPos++;
  24151. } else {
  24152. s3 = peg$FAILED;
  24153. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24154. }
  24155. }
  24156. if (s2 !== peg$FAILED) {
  24157. peg$savedPos = s0;
  24158. s1 = peg$c12(s1, s2);
  24159. s0 = s1;
  24160. } else {
  24161. peg$currPos = s0;
  24162. s0 = peg$FAILED;
  24163. }
  24164. } else {
  24165. peg$currPos = s0;
  24166. s0 = peg$FAILED;
  24167. }
  24168. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24169. return s0;
  24170. }
  24171. function peg$parsekeyword() {
  24172. var s0, s1, s2;
  24173. var key = peg$currPos * 61 + 6,
  24174. cached = peg$resultsCache[key];
  24175. if (cached) {
  24176. peg$currPos = cached.nextPos;
  24177. return cached.result;
  24178. }
  24179. s0 = peg$currPos;
  24180. s1 = peg$parseidentifier();
  24181. if (s1 !== peg$FAILED) {
  24182. if (input.charCodeAt(peg$currPos) === 58) {
  24183. s2 = peg$c13;
  24184. peg$currPos++;
  24185. } else {
  24186. s2 = peg$FAILED;
  24187. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  24188. }
  24189. if (s2 !== peg$FAILED) {
  24190. peg$savedPos = s0;
  24191. s1 = peg$c15(s1, s2);
  24192. s0 = s1;
  24193. } else {
  24194. peg$currPos = s0;
  24195. s0 = peg$FAILED;
  24196. }
  24197. } else {
  24198. peg$currPos = s0;
  24199. s0 = peg$FAILED;
  24200. }
  24201. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24202. return s0;
  24203. }
  24204. function peg$parseselector() {
  24205. var s0, s1, s2, s3;
  24206. var key = peg$currPos * 61 + 7,
  24207. cached = peg$resultsCache[key];
  24208. if (cached) {
  24209. peg$currPos = cached.nextPos;
  24210. return cached.result;
  24211. }
  24212. s0 = peg$currPos;
  24213. if (peg$c8.test(input.charAt(peg$currPos))) {
  24214. s1 = input.charAt(peg$currPos);
  24215. peg$currPos++;
  24216. } else {
  24217. s1 = peg$FAILED;
  24218. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24219. }
  24220. if (s1 !== peg$FAILED) {
  24221. s2 = [];
  24222. if (peg$c16.test(input.charAt(peg$currPos))) {
  24223. s3 = input.charAt(peg$currPos);
  24224. peg$currPos++;
  24225. } else {
  24226. s3 = peg$FAILED;
  24227. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24228. }
  24229. while (s3 !== peg$FAILED) {
  24230. s2.push(s3);
  24231. if (peg$c16.test(input.charAt(peg$currPos))) {
  24232. s3 = input.charAt(peg$currPos);
  24233. peg$currPos++;
  24234. } else {
  24235. s3 = peg$FAILED;
  24236. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24237. }
  24238. }
  24239. if (s2 !== peg$FAILED) {
  24240. peg$savedPos = s0;
  24241. s1 = peg$c12(s1, s2);
  24242. s0 = s1;
  24243. } else {
  24244. peg$currPos = s0;
  24245. s0 = peg$FAILED;
  24246. }
  24247. } else {
  24248. peg$currPos = s0;
  24249. s0 = peg$FAILED;
  24250. }
  24251. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24252. return s0;
  24253. }
  24254. function peg$parseclassName() {
  24255. var s0, s1, s2, s3;
  24256. var key = peg$currPos * 61 + 8,
  24257. cached = peg$resultsCache[key];
  24258. if (cached) {
  24259. peg$currPos = cached.nextPos;
  24260. return cached.result;
  24261. }
  24262. s0 = peg$currPos;
  24263. if (peg$c18.test(input.charAt(peg$currPos))) {
  24264. s1 = input.charAt(peg$currPos);
  24265. peg$currPos++;
  24266. } else {
  24267. s1 = peg$FAILED;
  24268. if (peg$silentFails === 0) { peg$fail(peg$c19); }
  24269. }
  24270. if (s1 !== peg$FAILED) {
  24271. s2 = [];
  24272. if (peg$c10.test(input.charAt(peg$currPos))) {
  24273. s3 = input.charAt(peg$currPos);
  24274. peg$currPos++;
  24275. } else {
  24276. s3 = peg$FAILED;
  24277. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24278. }
  24279. while (s3 !== peg$FAILED) {
  24280. s2.push(s3);
  24281. if (peg$c10.test(input.charAt(peg$currPos))) {
  24282. s3 = input.charAt(peg$currPos);
  24283. peg$currPos++;
  24284. } else {
  24285. s3 = peg$FAILED;
  24286. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24287. }
  24288. }
  24289. if (s2 !== peg$FAILED) {
  24290. peg$savedPos = s0;
  24291. s1 = peg$c12(s1, s2);
  24292. s0 = s1;
  24293. } else {
  24294. peg$currPos = s0;
  24295. s0 = peg$FAILED;
  24296. }
  24297. } else {
  24298. peg$currPos = s0;
  24299. s0 = peg$FAILED;
  24300. }
  24301. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24302. return s0;
  24303. }
  24304. function peg$parsestring() {
  24305. var s0, s1, s2, s3, s4;
  24306. var key = peg$currPos * 61 + 9,
  24307. cached = peg$resultsCache[key];
  24308. if (cached) {
  24309. peg$currPos = cached.nextPos;
  24310. return cached.result;
  24311. }
  24312. s0 = peg$currPos;
  24313. if (input.charCodeAt(peg$currPos) === 39) {
  24314. s1 = peg$c20;
  24315. peg$currPos++;
  24316. } else {
  24317. s1 = peg$FAILED;
  24318. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24319. }
  24320. if (s1 !== peg$FAILED) {
  24321. s2 = [];
  24322. s3 = peg$currPos;
  24323. if (input.substr(peg$currPos, 2) === peg$c22) {
  24324. s4 = peg$c22;
  24325. peg$currPos += 2;
  24326. } else {
  24327. s4 = peg$FAILED;
  24328. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24329. }
  24330. if (s4 !== peg$FAILED) {
  24331. peg$savedPos = s3;
  24332. s4 = peg$c24();
  24333. }
  24334. s3 = s4;
  24335. if (s3 === peg$FAILED) {
  24336. if (peg$c25.test(input.charAt(peg$currPos))) {
  24337. s3 = input.charAt(peg$currPos);
  24338. peg$currPos++;
  24339. } else {
  24340. s3 = peg$FAILED;
  24341. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24342. }
  24343. }
  24344. while (s3 !== peg$FAILED) {
  24345. s2.push(s3);
  24346. s3 = peg$currPos;
  24347. if (input.substr(peg$currPos, 2) === peg$c22) {
  24348. s4 = peg$c22;
  24349. peg$currPos += 2;
  24350. } else {
  24351. s4 = peg$FAILED;
  24352. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24353. }
  24354. if (s4 !== peg$FAILED) {
  24355. peg$savedPos = s3;
  24356. s4 = peg$c24();
  24357. }
  24358. s3 = s4;
  24359. if (s3 === peg$FAILED) {
  24360. if (peg$c25.test(input.charAt(peg$currPos))) {
  24361. s3 = input.charAt(peg$currPos);
  24362. peg$currPos++;
  24363. } else {
  24364. s3 = peg$FAILED;
  24365. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24366. }
  24367. }
  24368. }
  24369. if (s2 !== peg$FAILED) {
  24370. if (input.charCodeAt(peg$currPos) === 39) {
  24371. s3 = peg$c20;
  24372. peg$currPos++;
  24373. } else {
  24374. s3 = peg$FAILED;
  24375. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24376. }
  24377. if (s3 !== peg$FAILED) {
  24378. peg$savedPos = s0;
  24379. s1 = peg$c27(s2);
  24380. s0 = s1;
  24381. } else {
  24382. peg$currPos = s0;
  24383. s0 = peg$FAILED;
  24384. }
  24385. } else {
  24386. peg$currPos = s0;
  24387. s0 = peg$FAILED;
  24388. }
  24389. } else {
  24390. peg$currPos = s0;
  24391. s0 = peg$FAILED;
  24392. }
  24393. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24394. return s0;
  24395. }
  24396. function peg$parsecharacter() {
  24397. var s0, s1, s2;
  24398. var key = peg$currPos * 61 + 10,
  24399. cached = peg$resultsCache[key];
  24400. if (cached) {
  24401. peg$currPos = cached.nextPos;
  24402. return cached.result;
  24403. }
  24404. s0 = peg$currPos;
  24405. if (input.charCodeAt(peg$currPos) === 36) {
  24406. s1 = peg$c28;
  24407. peg$currPos++;
  24408. } else {
  24409. s1 = peg$FAILED;
  24410. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  24411. }
  24412. if (s1 !== peg$FAILED) {
  24413. if (input.length > peg$currPos) {
  24414. s2 = input.charAt(peg$currPos);
  24415. peg$currPos++;
  24416. } else {
  24417. s2 = peg$FAILED;
  24418. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  24419. }
  24420. if (s2 !== peg$FAILED) {
  24421. peg$savedPos = s0;
  24422. s1 = peg$c31(s2);
  24423. s0 = s1;
  24424. } else {
  24425. peg$currPos = s0;
  24426. s0 = peg$FAILED;
  24427. }
  24428. } else {
  24429. peg$currPos = s0;
  24430. s0 = peg$FAILED;
  24431. }
  24432. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24433. return s0;
  24434. }
  24435. function peg$parsesymbol() {
  24436. var s0, s1, s2;
  24437. var key = peg$currPos * 61 + 11,
  24438. cached = peg$resultsCache[key];
  24439. if (cached) {
  24440. peg$currPos = cached.nextPos;
  24441. return cached.result;
  24442. }
  24443. s0 = peg$currPos;
  24444. if (input.charCodeAt(peg$currPos) === 35) {
  24445. s1 = peg$c32;
  24446. peg$currPos++;
  24447. } else {
  24448. s1 = peg$FAILED;
  24449. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  24450. }
  24451. if (s1 !== peg$FAILED) {
  24452. s2 = peg$parsebareSymbol();
  24453. if (s2 !== peg$FAILED) {
  24454. peg$savedPos = s0;
  24455. s1 = peg$c34(s2);
  24456. s0 = s1;
  24457. } else {
  24458. peg$currPos = s0;
  24459. s0 = peg$FAILED;
  24460. }
  24461. } else {
  24462. peg$currPos = s0;
  24463. s0 = peg$FAILED;
  24464. }
  24465. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24466. return s0;
  24467. }
  24468. function peg$parsebareSymbol() {
  24469. var s0, s1, s2;
  24470. var key = peg$currPos * 61 + 12,
  24471. cached = peg$resultsCache[key];
  24472. if (cached) {
  24473. peg$currPos = cached.nextPos;
  24474. return cached.result;
  24475. }
  24476. s0 = peg$currPos;
  24477. s1 = peg$parseselector();
  24478. if (s1 === peg$FAILED) {
  24479. s1 = peg$parsebinarySelector();
  24480. if (s1 === peg$FAILED) {
  24481. s1 = peg$currPos;
  24482. s2 = peg$parsestring();
  24483. if (s2 !== peg$FAILED) {
  24484. peg$savedPos = s1;
  24485. s2 = peg$c35(s2);
  24486. }
  24487. s1 = s2;
  24488. }
  24489. }
  24490. if (s1 !== peg$FAILED) {
  24491. peg$savedPos = s0;
  24492. s1 = peg$c36(s1);
  24493. }
  24494. s0 = s1;
  24495. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24496. return s0;
  24497. }
  24498. function peg$parsenumber() {
  24499. var s0, s1;
  24500. var key = peg$currPos * 61 + 13,
  24501. cached = peg$resultsCache[key];
  24502. if (cached) {
  24503. peg$currPos = cached.nextPos;
  24504. return cached.result;
  24505. }
  24506. s0 = peg$currPos;
  24507. s1 = peg$parsenumberExp();
  24508. if (s1 === peg$FAILED) {
  24509. s1 = peg$parsehex();
  24510. if (s1 === peg$FAILED) {
  24511. s1 = peg$parsefloat();
  24512. if (s1 === peg$FAILED) {
  24513. s1 = peg$parseinteger();
  24514. }
  24515. }
  24516. }
  24517. if (s1 !== peg$FAILED) {
  24518. peg$savedPos = s0;
  24519. s1 = peg$c37(s1);
  24520. }
  24521. s0 = s1;
  24522. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24523. return s0;
  24524. }
  24525. function peg$parsenumberExp() {
  24526. var s0, s1, s2, s3, s4;
  24527. var key = peg$currPos * 61 + 14,
  24528. cached = peg$resultsCache[key];
  24529. if (cached) {
  24530. peg$currPos = cached.nextPos;
  24531. return cached.result;
  24532. }
  24533. s0 = peg$currPos;
  24534. s1 = peg$currPos;
  24535. s2 = peg$parsefloat();
  24536. if (s2 === peg$FAILED) {
  24537. s2 = peg$parseinteger();
  24538. }
  24539. if (s2 !== peg$FAILED) {
  24540. if (input.charCodeAt(peg$currPos) === 101) {
  24541. s3 = peg$c38;
  24542. peg$currPos++;
  24543. } else {
  24544. s3 = peg$FAILED;
  24545. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  24546. }
  24547. if (s3 !== peg$FAILED) {
  24548. s4 = peg$parseinteger();
  24549. if (s4 !== peg$FAILED) {
  24550. s2 = [s2, s3, s4];
  24551. s1 = s2;
  24552. } else {
  24553. peg$currPos = s1;
  24554. s1 = peg$FAILED;
  24555. }
  24556. } else {
  24557. peg$currPos = s1;
  24558. s1 = peg$FAILED;
  24559. }
  24560. } else {
  24561. peg$currPos = s1;
  24562. s1 = peg$FAILED;
  24563. }
  24564. if (s1 !== peg$FAILED) {
  24565. peg$savedPos = s0;
  24566. s1 = peg$c40(s1);
  24567. }
  24568. s0 = s1;
  24569. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24570. return s0;
  24571. }
  24572. function peg$parsehex() {
  24573. var s0, s1, s2, s3, s4;
  24574. var key = peg$currPos * 61 + 15,
  24575. cached = peg$resultsCache[key];
  24576. if (cached) {
  24577. peg$currPos = cached.nextPos;
  24578. return cached.result;
  24579. }
  24580. s0 = peg$currPos;
  24581. if (input.charCodeAt(peg$currPos) === 45) {
  24582. s1 = peg$c41;
  24583. peg$currPos++;
  24584. } else {
  24585. s1 = peg$FAILED;
  24586. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  24587. }
  24588. if (s1 === peg$FAILED) {
  24589. s1 = null;
  24590. }
  24591. if (s1 !== peg$FAILED) {
  24592. if (input.substr(peg$currPos, 3) === peg$c43) {
  24593. s2 = peg$c43;
  24594. peg$currPos += 3;
  24595. } else {
  24596. s2 = peg$FAILED;
  24597. if (peg$silentFails === 0) { peg$fail(peg$c44); }
  24598. }
  24599. if (s2 !== peg$FAILED) {
  24600. s3 = [];
  24601. if (peg$c45.test(input.charAt(peg$currPos))) {
  24602. s4 = input.charAt(peg$currPos);
  24603. peg$currPos++;
  24604. } else {
  24605. s4 = peg$FAILED;
  24606. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  24607. }
  24608. if (s4 !== peg$FAILED) {
  24609. while (s4 !== peg$FAILED) {
  24610. s3.push(s4);
  24611. if (peg$c45.test(input.charAt(peg$currPos))) {
  24612. s4 = input.charAt(peg$currPos);
  24613. peg$currPos++;
  24614. } else {
  24615. s4 = peg$FAILED;
  24616. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  24617. }
  24618. }
  24619. } else {
  24620. s3 = peg$FAILED;
  24621. }
  24622. if (s3 !== peg$FAILED) {
  24623. peg$savedPos = s0;
  24624. s1 = peg$c47(s1, s3);
  24625. s0 = s1;
  24626. } else {
  24627. peg$currPos = s0;
  24628. s0 = peg$FAILED;
  24629. }
  24630. } else {
  24631. peg$currPos = s0;
  24632. s0 = peg$FAILED;
  24633. }
  24634. } else {
  24635. peg$currPos = s0;
  24636. s0 = peg$FAILED;
  24637. }
  24638. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24639. return s0;
  24640. }
  24641. function peg$parsefloat() {
  24642. var s0, s1, s2, s3, s4, s5;
  24643. var key = peg$currPos * 61 + 16,
  24644. cached = peg$resultsCache[key];
  24645. if (cached) {
  24646. peg$currPos = cached.nextPos;
  24647. return cached.result;
  24648. }
  24649. s0 = peg$currPos;
  24650. if (input.charCodeAt(peg$currPos) === 45) {
  24651. s1 = peg$c41;
  24652. peg$currPos++;
  24653. } else {
  24654. s1 = peg$FAILED;
  24655. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  24656. }
  24657. if (s1 === peg$FAILED) {
  24658. s1 = null;
  24659. }
  24660. if (s1 !== peg$FAILED) {
  24661. s2 = [];
  24662. if (peg$c48.test(input.charAt(peg$currPos))) {
  24663. s3 = input.charAt(peg$currPos);
  24664. peg$currPos++;
  24665. } else {
  24666. s3 = peg$FAILED;
  24667. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24668. }
  24669. if (s3 !== peg$FAILED) {
  24670. while (s3 !== peg$FAILED) {
  24671. s2.push(s3);
  24672. if (peg$c48.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$c49); }
  24678. }
  24679. }
  24680. } else {
  24681. s2 = peg$FAILED;
  24682. }
  24683. if (s2 !== peg$FAILED) {
  24684. if (input.charCodeAt(peg$currPos) === 46) {
  24685. s3 = peg$c6;
  24686. peg$currPos++;
  24687. } else {
  24688. s3 = peg$FAILED;
  24689. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24690. }
  24691. if (s3 !== peg$FAILED) {
  24692. s4 = [];
  24693. if (peg$c48.test(input.charAt(peg$currPos))) {
  24694. s5 = input.charAt(peg$currPos);
  24695. peg$currPos++;
  24696. } else {
  24697. s5 = peg$FAILED;
  24698. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24699. }
  24700. if (s5 !== peg$FAILED) {
  24701. while (s5 !== peg$FAILED) {
  24702. s4.push(s5);
  24703. if (peg$c48.test(input.charAt(peg$currPos))) {
  24704. s5 = input.charAt(peg$currPos);
  24705. peg$currPos++;
  24706. } else {
  24707. s5 = peg$FAILED;
  24708. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24709. }
  24710. }
  24711. } else {
  24712. s4 = peg$FAILED;
  24713. }
  24714. if (s4 !== peg$FAILED) {
  24715. peg$savedPos = s0;
  24716. s1 = peg$c50(s1, s2, s4);
  24717. s0 = s1;
  24718. } else {
  24719. peg$currPos = s0;
  24720. s0 = peg$FAILED;
  24721. }
  24722. } else {
  24723. peg$currPos = s0;
  24724. s0 = peg$FAILED;
  24725. }
  24726. } else {
  24727. peg$currPos = s0;
  24728. s0 = peg$FAILED;
  24729. }
  24730. } else {
  24731. peg$currPos = s0;
  24732. s0 = peg$FAILED;
  24733. }
  24734. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24735. return s0;
  24736. }
  24737. function peg$parseinteger() {
  24738. var s0, s1, s2, s3;
  24739. var key = peg$currPos * 61 + 17,
  24740. cached = peg$resultsCache[key];
  24741. if (cached) {
  24742. peg$currPos = cached.nextPos;
  24743. return cached.result;
  24744. }
  24745. s0 = peg$currPos;
  24746. if (input.charCodeAt(peg$currPos) === 45) {
  24747. s1 = peg$c41;
  24748. peg$currPos++;
  24749. } else {
  24750. s1 = peg$FAILED;
  24751. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  24752. }
  24753. if (s1 === peg$FAILED) {
  24754. s1 = null;
  24755. }
  24756. if (s1 !== peg$FAILED) {
  24757. s2 = [];
  24758. if (peg$c48.test(input.charAt(peg$currPos))) {
  24759. s3 = input.charAt(peg$currPos);
  24760. peg$currPos++;
  24761. } else {
  24762. s3 = peg$FAILED;
  24763. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24764. }
  24765. if (s3 !== peg$FAILED) {
  24766. while (s3 !== peg$FAILED) {
  24767. s2.push(s3);
  24768. if (peg$c48.test(input.charAt(peg$currPos))) {
  24769. s3 = input.charAt(peg$currPos);
  24770. peg$currPos++;
  24771. } else {
  24772. s3 = peg$FAILED;
  24773. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24774. }
  24775. }
  24776. } else {
  24777. s2 = peg$FAILED;
  24778. }
  24779. if (s2 !== peg$FAILED) {
  24780. peg$savedPos = s0;
  24781. s1 = peg$c51(s1, s2);
  24782. s0 = s1;
  24783. } else {
  24784. peg$currPos = s0;
  24785. s0 = peg$FAILED;
  24786. }
  24787. } else {
  24788. peg$currPos = s0;
  24789. s0 = peg$FAILED;
  24790. }
  24791. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24792. return s0;
  24793. }
  24794. function peg$parseliteralArray() {
  24795. var s0, s1, s2, s3, s4;
  24796. var key = peg$currPos * 61 + 18,
  24797. cached = peg$resultsCache[key];
  24798. if (cached) {
  24799. peg$currPos = cached.nextPos;
  24800. return cached.result;
  24801. }
  24802. s0 = peg$currPos;
  24803. if (input.substr(peg$currPos, 2) === peg$c52) {
  24804. s1 = peg$c52;
  24805. peg$currPos += 2;
  24806. } else {
  24807. s1 = peg$FAILED;
  24808. if (peg$silentFails === 0) { peg$fail(peg$c53); }
  24809. }
  24810. if (s1 !== peg$FAILED) {
  24811. s2 = peg$parsewsLiteralArrayContents();
  24812. if (s2 !== peg$FAILED) {
  24813. s3 = peg$parsews();
  24814. if (s3 !== peg$FAILED) {
  24815. if (input.charCodeAt(peg$currPos) === 41) {
  24816. s4 = peg$c54;
  24817. peg$currPos++;
  24818. } else {
  24819. s4 = peg$FAILED;
  24820. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  24821. }
  24822. if (s4 !== peg$FAILED) {
  24823. peg$savedPos = s0;
  24824. s1 = peg$c56(s2);
  24825. s0 = s1;
  24826. } else {
  24827. peg$currPos = s0;
  24828. s0 = peg$FAILED;
  24829. }
  24830. } else {
  24831. peg$currPos = s0;
  24832. s0 = peg$FAILED;
  24833. }
  24834. } else {
  24835. peg$currPos = s0;
  24836. s0 = peg$FAILED;
  24837. }
  24838. } else {
  24839. peg$currPos = s0;
  24840. s0 = peg$FAILED;
  24841. }
  24842. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24843. return s0;
  24844. }
  24845. function peg$parsebareLiteralArray() {
  24846. var s0, s1, s2, s3, s4;
  24847. var key = peg$currPos * 61 + 19,
  24848. cached = peg$resultsCache[key];
  24849. if (cached) {
  24850. peg$currPos = cached.nextPos;
  24851. return cached.result;
  24852. }
  24853. s0 = peg$currPos;
  24854. if (input.charCodeAt(peg$currPos) === 40) {
  24855. s1 = peg$c57;
  24856. peg$currPos++;
  24857. } else {
  24858. s1 = peg$FAILED;
  24859. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  24860. }
  24861. if (s1 !== peg$FAILED) {
  24862. s2 = peg$parsewsLiteralArrayContents();
  24863. if (s2 !== peg$FAILED) {
  24864. s3 = peg$parsews();
  24865. if (s3 !== peg$FAILED) {
  24866. if (input.charCodeAt(peg$currPos) === 41) {
  24867. s4 = peg$c54;
  24868. peg$currPos++;
  24869. } else {
  24870. s4 = peg$FAILED;
  24871. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  24872. }
  24873. if (s4 !== peg$FAILED) {
  24874. peg$savedPos = s0;
  24875. s1 = peg$c56(s2);
  24876. s0 = s1;
  24877. } else {
  24878. peg$currPos = s0;
  24879. s0 = peg$FAILED;
  24880. }
  24881. } else {
  24882. peg$currPos = s0;
  24883. s0 = peg$FAILED;
  24884. }
  24885. } else {
  24886. peg$currPos = s0;
  24887. s0 = peg$FAILED;
  24888. }
  24889. } else {
  24890. peg$currPos = s0;
  24891. s0 = peg$FAILED;
  24892. }
  24893. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24894. return s0;
  24895. }
  24896. function peg$parseliteralArrayElement() {
  24897. var s0;
  24898. var key = peg$currPos * 61 + 20,
  24899. cached = peg$resultsCache[key];
  24900. if (cached) {
  24901. peg$currPos = cached.nextPos;
  24902. return cached.result;
  24903. }
  24904. s0 = peg$parseparseTimeLiteral();
  24905. if (s0 === peg$FAILED) {
  24906. s0 = peg$parsebareLiteralArray();
  24907. if (s0 === peg$FAILED) {
  24908. s0 = peg$parsebareSymbol();
  24909. }
  24910. }
  24911. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24912. return s0;
  24913. }
  24914. function peg$parsewsLiteralArrayContents() {
  24915. var s0, s1, s2, s3, s4;
  24916. var key = peg$currPos * 61 + 21,
  24917. cached = peg$resultsCache[key];
  24918. if (cached) {
  24919. peg$currPos = cached.nextPos;
  24920. return cached.result;
  24921. }
  24922. s0 = peg$currPos;
  24923. s1 = [];
  24924. s2 = peg$currPos;
  24925. s3 = peg$parsews();
  24926. if (s3 !== peg$FAILED) {
  24927. s4 = peg$parseliteralArrayElement();
  24928. if (s4 !== peg$FAILED) {
  24929. peg$savedPos = s2;
  24930. s3 = peg$c59(s4);
  24931. s2 = s3;
  24932. } else {
  24933. peg$currPos = s2;
  24934. s2 = peg$FAILED;
  24935. }
  24936. } else {
  24937. peg$currPos = s2;
  24938. s2 = peg$FAILED;
  24939. }
  24940. while (s2 !== peg$FAILED) {
  24941. s1.push(s2);
  24942. s2 = peg$currPos;
  24943. s3 = peg$parsews();
  24944. if (s3 !== peg$FAILED) {
  24945. s4 = peg$parseliteralArrayElement();
  24946. if (s4 !== peg$FAILED) {
  24947. peg$savedPos = s2;
  24948. s3 = peg$c59(s4);
  24949. s2 = s3;
  24950. } else {
  24951. peg$currPos = s2;
  24952. s2 = peg$FAILED;
  24953. }
  24954. } else {
  24955. peg$currPos = s2;
  24956. s2 = peg$FAILED;
  24957. }
  24958. }
  24959. if (s1 !== peg$FAILED) {
  24960. peg$savedPos = s0;
  24961. s1 = peg$c60(s1);
  24962. }
  24963. s0 = s1;
  24964. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24965. return s0;
  24966. }
  24967. function peg$parsedynamicArray() {
  24968. var s0, s1, s2, s3, s4, s5;
  24969. var key = peg$currPos * 61 + 22,
  24970. cached = peg$resultsCache[key];
  24971. if (cached) {
  24972. peg$currPos = cached.nextPos;
  24973. return cached.result;
  24974. }
  24975. s0 = peg$currPos;
  24976. if (input.charCodeAt(peg$currPos) === 123) {
  24977. s1 = peg$c61;
  24978. peg$currPos++;
  24979. } else {
  24980. s1 = peg$FAILED;
  24981. if (peg$silentFails === 0) { peg$fail(peg$c62); }
  24982. }
  24983. if (s1 !== peg$FAILED) {
  24984. s2 = peg$parsews();
  24985. if (s2 !== peg$FAILED) {
  24986. s3 = peg$parseexpressions();
  24987. if (s3 === peg$FAILED) {
  24988. s3 = null;
  24989. }
  24990. if (s3 !== peg$FAILED) {
  24991. s4 = peg$parsemaybeDotsWs();
  24992. if (s4 !== peg$FAILED) {
  24993. if (input.charCodeAt(peg$currPos) === 125) {
  24994. s5 = peg$c63;
  24995. peg$currPos++;
  24996. } else {
  24997. s5 = peg$FAILED;
  24998. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  24999. }
  25000. if (s5 !== peg$FAILED) {
  25001. peg$savedPos = s0;
  25002. s1 = peg$c65(s3);
  25003. s0 = s1;
  25004. } else {
  25005. peg$currPos = s0;
  25006. s0 = peg$FAILED;
  25007. }
  25008. } else {
  25009. peg$currPos = s0;
  25010. s0 = peg$FAILED;
  25011. }
  25012. } else {
  25013. peg$currPos = s0;
  25014. s0 = peg$FAILED;
  25015. }
  25016. } else {
  25017. peg$currPos = s0;
  25018. s0 = peg$FAILED;
  25019. }
  25020. } else {
  25021. peg$currPos = s0;
  25022. s0 = peg$FAILED;
  25023. }
  25024. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25025. return s0;
  25026. }
  25027. function peg$parsedynamicDictionary() {
  25028. var s0, s1, s2, s3, s4, s5;
  25029. var key = peg$currPos * 61 + 23,
  25030. cached = peg$resultsCache[key];
  25031. if (cached) {
  25032. peg$currPos = cached.nextPos;
  25033. return cached.result;
  25034. }
  25035. s0 = peg$currPos;
  25036. if (input.substr(peg$currPos, 2) === peg$c66) {
  25037. s1 = peg$c66;
  25038. peg$currPos += 2;
  25039. } else {
  25040. s1 = peg$FAILED;
  25041. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  25042. }
  25043. if (s1 !== peg$FAILED) {
  25044. s2 = peg$parsews();
  25045. if (s2 !== peg$FAILED) {
  25046. s3 = peg$parseassociations();
  25047. if (s3 === peg$FAILED) {
  25048. s3 = null;
  25049. }
  25050. if (s3 !== peg$FAILED) {
  25051. s4 = peg$parsemaybeDotsWs();
  25052. if (s4 !== peg$FAILED) {
  25053. if (input.charCodeAt(peg$currPos) === 125) {
  25054. s5 = peg$c63;
  25055. peg$currPos++;
  25056. } else {
  25057. s5 = peg$FAILED;
  25058. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  25059. }
  25060. if (s5 !== peg$FAILED) {
  25061. peg$savedPos = s0;
  25062. s1 = peg$c68(s3);
  25063. s0 = s1;
  25064. } else {
  25065. peg$currPos = s0;
  25066. s0 = peg$FAILED;
  25067. }
  25068. } else {
  25069. peg$currPos = s0;
  25070. s0 = peg$FAILED;
  25071. }
  25072. } else {
  25073. peg$currPos = s0;
  25074. s0 = peg$FAILED;
  25075. }
  25076. } else {
  25077. peg$currPos = s0;
  25078. s0 = peg$FAILED;
  25079. }
  25080. } else {
  25081. peg$currPos = s0;
  25082. s0 = peg$FAILED;
  25083. }
  25084. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25085. return s0;
  25086. }
  25087. function peg$parsepseudoVariable() {
  25088. var s0, s1, s2;
  25089. var key = peg$currPos * 61 + 24,
  25090. cached = peg$resultsCache[key];
  25091. if (cached) {
  25092. peg$currPos = cached.nextPos;
  25093. return cached.result;
  25094. }
  25095. s0 = peg$currPos;
  25096. s1 = peg$currPos;
  25097. if (input.substr(peg$currPos, 4) === peg$c69) {
  25098. s2 = peg$c69;
  25099. peg$currPos += 4;
  25100. } else {
  25101. s2 = peg$FAILED;
  25102. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  25103. }
  25104. if (s2 !== peg$FAILED) {
  25105. peg$savedPos = s1;
  25106. s2 = peg$c71();
  25107. }
  25108. s1 = s2;
  25109. if (s1 === peg$FAILED) {
  25110. s1 = peg$currPos;
  25111. if (input.substr(peg$currPos, 5) === peg$c72) {
  25112. s2 = peg$c72;
  25113. peg$currPos += 5;
  25114. } else {
  25115. s2 = peg$FAILED;
  25116. if (peg$silentFails === 0) { peg$fail(peg$c73); }
  25117. }
  25118. if (s2 !== peg$FAILED) {
  25119. peg$savedPos = s1;
  25120. s2 = peg$c74();
  25121. }
  25122. s1 = s2;
  25123. if (s1 === peg$FAILED) {
  25124. s1 = peg$currPos;
  25125. if (input.substr(peg$currPos, 3) === peg$c75) {
  25126. s2 = peg$c75;
  25127. peg$currPos += 3;
  25128. } else {
  25129. s2 = peg$FAILED;
  25130. if (peg$silentFails === 0) { peg$fail(peg$c76); }
  25131. }
  25132. if (s2 !== peg$FAILED) {
  25133. peg$savedPos = s1;
  25134. s2 = peg$c77();
  25135. }
  25136. s1 = s2;
  25137. }
  25138. }
  25139. if (s1 !== peg$FAILED) {
  25140. peg$savedPos = s0;
  25141. s1 = peg$c78(s1);
  25142. }
  25143. s0 = s1;
  25144. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25145. return s0;
  25146. }
  25147. function peg$parseparseTimeLiteral() {
  25148. var s0;
  25149. var key = peg$currPos * 61 + 25,
  25150. cached = peg$resultsCache[key];
  25151. if (cached) {
  25152. peg$currPos = cached.nextPos;
  25153. return cached.result;
  25154. }
  25155. s0 = peg$parsepseudoVariable();
  25156. if (s0 === peg$FAILED) {
  25157. s0 = peg$parsenumber();
  25158. if (s0 === peg$FAILED) {
  25159. s0 = peg$parseliteralArray();
  25160. if (s0 === peg$FAILED) {
  25161. s0 = peg$parsestring();
  25162. if (s0 === peg$FAILED) {
  25163. s0 = peg$parsesymbol();
  25164. if (s0 === peg$FAILED) {
  25165. s0 = peg$parsecharacter();
  25166. }
  25167. }
  25168. }
  25169. }
  25170. }
  25171. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25172. return s0;
  25173. }
  25174. function peg$parseruntimeLiteral() {
  25175. var s0;
  25176. var key = peg$currPos * 61 + 26,
  25177. cached = peg$resultsCache[key];
  25178. if (cached) {
  25179. peg$currPos = cached.nextPos;
  25180. return cached.result;
  25181. }
  25182. s0 = peg$parsedynamicDictionary();
  25183. if (s0 === peg$FAILED) {
  25184. s0 = peg$parsedynamicArray();
  25185. if (s0 === peg$FAILED) {
  25186. s0 = peg$parseblock();
  25187. }
  25188. }
  25189. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25190. return s0;
  25191. }
  25192. function peg$parseliteral() {
  25193. var s0;
  25194. var key = peg$currPos * 61 + 27,
  25195. cached = peg$resultsCache[key];
  25196. if (cached) {
  25197. peg$currPos = cached.nextPos;
  25198. return cached.result;
  25199. }
  25200. s0 = peg$parseruntimeLiteral();
  25201. if (s0 === peg$FAILED) {
  25202. s0 = peg$parseparseTimeLiteral();
  25203. }
  25204. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25205. return s0;
  25206. }
  25207. function peg$parsevariable() {
  25208. var s0, s1;
  25209. var key = peg$currPos * 61 + 28,
  25210. cached = peg$resultsCache[key];
  25211. if (cached) {
  25212. peg$currPos = cached.nextPos;
  25213. return cached.result;
  25214. }
  25215. s0 = peg$currPos;
  25216. s1 = peg$parseidentifier();
  25217. if (s1 !== peg$FAILED) {
  25218. peg$savedPos = s0;
  25219. s1 = peg$c79(s1);
  25220. }
  25221. s0 = s1;
  25222. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25223. return s0;
  25224. }
  25225. function peg$parsebinarySelector() {
  25226. var s0, s1, s2;
  25227. var key = peg$currPos * 61 + 29,
  25228. cached = peg$resultsCache[key];
  25229. if (cached) {
  25230. peg$currPos = cached.nextPos;
  25231. return cached.result;
  25232. }
  25233. s0 = peg$currPos;
  25234. s1 = [];
  25235. if (peg$c80.test(input.charAt(peg$currPos))) {
  25236. s2 = input.charAt(peg$currPos);
  25237. peg$currPos++;
  25238. } else {
  25239. s2 = peg$FAILED;
  25240. if (peg$silentFails === 0) { peg$fail(peg$c81); }
  25241. }
  25242. if (s2 !== peg$FAILED) {
  25243. while (s2 !== peg$FAILED) {
  25244. s1.push(s2);
  25245. if (peg$c80.test(input.charAt(peg$currPos))) {
  25246. s2 = input.charAt(peg$currPos);
  25247. peg$currPos++;
  25248. } else {
  25249. s2 = peg$FAILED;
  25250. if (peg$silentFails === 0) { peg$fail(peg$c81); }
  25251. }
  25252. }
  25253. } else {
  25254. s1 = peg$FAILED;
  25255. }
  25256. if (s1 !== peg$FAILED) {
  25257. peg$savedPos = s0;
  25258. s1 = peg$c82(s1);
  25259. }
  25260. s0 = s1;
  25261. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25262. return s0;
  25263. }
  25264. function peg$parsewsKeywordPattern() {
  25265. var s0, s1, s2, s3, s4, s5, s6;
  25266. var key = peg$currPos * 61 + 30,
  25267. cached = peg$resultsCache[key];
  25268. if (cached) {
  25269. peg$currPos = cached.nextPos;
  25270. return cached.result;
  25271. }
  25272. s0 = peg$currPos;
  25273. s1 = [];
  25274. s2 = peg$currPos;
  25275. s3 = peg$parsews();
  25276. if (s3 !== peg$FAILED) {
  25277. s4 = peg$parsekeyword();
  25278. if (s4 !== peg$FAILED) {
  25279. s5 = peg$parsews();
  25280. if (s5 !== peg$FAILED) {
  25281. s6 = peg$parseidentifier();
  25282. if (s6 !== peg$FAILED) {
  25283. peg$savedPos = s2;
  25284. s3 = peg$c83(s4, s6);
  25285. s2 = s3;
  25286. } else {
  25287. peg$currPos = s2;
  25288. s2 = peg$FAILED;
  25289. }
  25290. } else {
  25291. peg$currPos = s2;
  25292. s2 = peg$FAILED;
  25293. }
  25294. } else {
  25295. peg$currPos = s2;
  25296. s2 = peg$FAILED;
  25297. }
  25298. } else {
  25299. peg$currPos = s2;
  25300. s2 = peg$FAILED;
  25301. }
  25302. if (s2 !== peg$FAILED) {
  25303. while (s2 !== peg$FAILED) {
  25304. s1.push(s2);
  25305. s2 = peg$currPos;
  25306. s3 = peg$parsews();
  25307. if (s3 !== peg$FAILED) {
  25308. s4 = peg$parsekeyword();
  25309. if (s4 !== peg$FAILED) {
  25310. s5 = peg$parsews();
  25311. if (s5 !== peg$FAILED) {
  25312. s6 = peg$parseidentifier();
  25313. if (s6 !== peg$FAILED) {
  25314. peg$savedPos = s2;
  25315. s3 = peg$c83(s4, s6);
  25316. s2 = s3;
  25317. } else {
  25318. peg$currPos = s2;
  25319. s2 = peg$FAILED;
  25320. }
  25321. } else {
  25322. peg$currPos = s2;
  25323. s2 = peg$FAILED;
  25324. }
  25325. } else {
  25326. peg$currPos = s2;
  25327. s2 = peg$FAILED;
  25328. }
  25329. } else {
  25330. peg$currPos = s2;
  25331. s2 = peg$FAILED;
  25332. }
  25333. }
  25334. } else {
  25335. s1 = peg$FAILED;
  25336. }
  25337. if (s1 !== peg$FAILED) {
  25338. peg$savedPos = s0;
  25339. s1 = peg$c84(s1);
  25340. }
  25341. s0 = s1;
  25342. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25343. return s0;
  25344. }
  25345. function peg$parsewsBinaryPattern() {
  25346. var s0, s1, s2, s3, s4;
  25347. var key = peg$currPos * 61 + 31,
  25348. cached = peg$resultsCache[key];
  25349. if (cached) {
  25350. peg$currPos = cached.nextPos;
  25351. return cached.result;
  25352. }
  25353. s0 = peg$currPos;
  25354. s1 = peg$parsews();
  25355. if (s1 !== peg$FAILED) {
  25356. s2 = peg$parsebinarySelector();
  25357. if (s2 !== peg$FAILED) {
  25358. s3 = peg$parsews();
  25359. if (s3 !== peg$FAILED) {
  25360. s4 = peg$parseidentifier();
  25361. if (s4 !== peg$FAILED) {
  25362. peg$savedPos = s0;
  25363. s1 = peg$c85(s2, s4);
  25364. s0 = s1;
  25365. } else {
  25366. peg$currPos = s0;
  25367. s0 = peg$FAILED;
  25368. }
  25369. } else {
  25370. peg$currPos = s0;
  25371. s0 = peg$FAILED;
  25372. }
  25373. } else {
  25374. peg$currPos = s0;
  25375. s0 = peg$FAILED;
  25376. }
  25377. } else {
  25378. peg$currPos = s0;
  25379. s0 = peg$FAILED;
  25380. }
  25381. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25382. return s0;
  25383. }
  25384. function peg$parsewsUnaryPattern() {
  25385. var s0, s1, s2;
  25386. var key = peg$currPos * 61 + 32,
  25387. cached = peg$resultsCache[key];
  25388. if (cached) {
  25389. peg$currPos = cached.nextPos;
  25390. return cached.result;
  25391. }
  25392. s0 = peg$currPos;
  25393. s1 = peg$parsews();
  25394. if (s1 !== peg$FAILED) {
  25395. s2 = peg$parseidentifier();
  25396. if (s2 !== peg$FAILED) {
  25397. peg$savedPos = s0;
  25398. s1 = peg$c86(s2);
  25399. s0 = s1;
  25400. } else {
  25401. peg$currPos = s0;
  25402. s0 = peg$FAILED;
  25403. }
  25404. } else {
  25405. peg$currPos = s0;
  25406. s0 = peg$FAILED;
  25407. }
  25408. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25409. return s0;
  25410. }
  25411. function peg$parseexpression() {
  25412. var s0;
  25413. var key = peg$currPos * 61 + 33,
  25414. cached = peg$resultsCache[key];
  25415. if (cached) {
  25416. peg$currPos = cached.nextPos;
  25417. return cached.result;
  25418. }
  25419. s0 = peg$parseassignment();
  25420. if (s0 === peg$FAILED) {
  25421. s0 = peg$parsecascade();
  25422. if (s0 === peg$FAILED) {
  25423. s0 = peg$parsekeywordSend();
  25424. }
  25425. }
  25426. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25427. return s0;
  25428. }
  25429. function peg$parsewsExpressionsRest() {
  25430. var s0, s1, s2, s3, s4;
  25431. var key = peg$currPos * 61 + 34,
  25432. cached = peg$resultsCache[key];
  25433. if (cached) {
  25434. peg$currPos = cached.nextPos;
  25435. return cached.result;
  25436. }
  25437. s0 = peg$currPos;
  25438. s1 = peg$parsews();
  25439. if (s1 !== peg$FAILED) {
  25440. if (input.charCodeAt(peg$currPos) === 46) {
  25441. s2 = peg$c6;
  25442. peg$currPos++;
  25443. } else {
  25444. s2 = peg$FAILED;
  25445. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  25446. }
  25447. if (s2 !== peg$FAILED) {
  25448. s3 = peg$parsemaybeDotsWs();
  25449. if (s3 !== peg$FAILED) {
  25450. s4 = peg$parseexpression();
  25451. if (s4 !== peg$FAILED) {
  25452. peg$savedPos = s0;
  25453. s1 = peg$c87(s4);
  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. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25472. return s0;
  25473. }
  25474. function peg$parseexpressions() {
  25475. var s0, s1, s2, s3;
  25476. var key = peg$currPos * 61 + 35,
  25477. cached = peg$resultsCache[key];
  25478. if (cached) {
  25479. peg$currPos = cached.nextPos;
  25480. return cached.result;
  25481. }
  25482. s0 = peg$currPos;
  25483. s1 = peg$parseexpression();
  25484. if (s1 !== peg$FAILED) {
  25485. s2 = [];
  25486. s3 = peg$parsewsExpressionsRest();
  25487. while (s3 !== peg$FAILED) {
  25488. s2.push(s3);
  25489. s3 = peg$parsewsExpressionsRest();
  25490. }
  25491. if (s2 !== peg$FAILED) {
  25492. peg$savedPos = s0;
  25493. s1 = peg$c88(s1, s2);
  25494. s0 = s1;
  25495. } else {
  25496. peg$currPos = s0;
  25497. s0 = peg$FAILED;
  25498. }
  25499. } else {
  25500. peg$currPos = s0;
  25501. s0 = peg$FAILED;
  25502. }
  25503. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25504. return s0;
  25505. }
  25506. function peg$parseassignment() {
  25507. var s0, s1, s2, s3, s4, s5;
  25508. var key = peg$currPos * 61 + 36,
  25509. cached = peg$resultsCache[key];
  25510. if (cached) {
  25511. peg$currPos = cached.nextPos;
  25512. return cached.result;
  25513. }
  25514. s0 = peg$currPos;
  25515. s1 = peg$parsevariable();
  25516. if (s1 !== peg$FAILED) {
  25517. s2 = peg$parsews();
  25518. if (s2 !== peg$FAILED) {
  25519. if (input.substr(peg$currPos, 2) === peg$c89) {
  25520. s3 = peg$c89;
  25521. peg$currPos += 2;
  25522. } else {
  25523. s3 = peg$FAILED;
  25524. if (peg$silentFails === 0) { peg$fail(peg$c90); }
  25525. }
  25526. if (s3 !== peg$FAILED) {
  25527. s4 = peg$parsews();
  25528. if (s4 !== peg$FAILED) {
  25529. s5 = peg$parseexpression();
  25530. if (s5 !== peg$FAILED) {
  25531. peg$savedPos = s0;
  25532. s1 = peg$c91(s1, s5);
  25533. s0 = s1;
  25534. } else {
  25535. peg$currPos = s0;
  25536. s0 = peg$FAILED;
  25537. }
  25538. } else {
  25539. peg$currPos = s0;
  25540. s0 = peg$FAILED;
  25541. }
  25542. } else {
  25543. peg$currPos = s0;
  25544. s0 = peg$FAILED;
  25545. }
  25546. } else {
  25547. peg$currPos = s0;
  25548. s0 = peg$FAILED;
  25549. }
  25550. } else {
  25551. peg$currPos = s0;
  25552. s0 = peg$FAILED;
  25553. }
  25554. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25555. return s0;
  25556. }
  25557. function peg$parseret() {
  25558. var s0, s1, s2, s3;
  25559. var key = peg$currPos * 61 + 37,
  25560. cached = peg$resultsCache[key];
  25561. if (cached) {
  25562. peg$currPos = cached.nextPos;
  25563. return cached.result;
  25564. }
  25565. s0 = peg$currPos;
  25566. if (input.charCodeAt(peg$currPos) === 94) {
  25567. s1 = peg$c92;
  25568. peg$currPos++;
  25569. } else {
  25570. s1 = peg$FAILED;
  25571. if (peg$silentFails === 0) { peg$fail(peg$c93); }
  25572. }
  25573. if (s1 !== peg$FAILED) {
  25574. s2 = peg$parsews();
  25575. if (s2 !== peg$FAILED) {
  25576. s3 = peg$parseexpression();
  25577. if (s3 !== peg$FAILED) {
  25578. peg$savedPos = s0;
  25579. s1 = peg$c94(s3);
  25580. s0 = s1;
  25581. } else {
  25582. peg$currPos = s0;
  25583. s0 = peg$FAILED;
  25584. }
  25585. } else {
  25586. peg$currPos = s0;
  25587. s0 = peg$FAILED;
  25588. }
  25589. } else {
  25590. peg$currPos = s0;
  25591. s0 = peg$FAILED;
  25592. }
  25593. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25594. return s0;
  25595. }
  25596. function peg$parsetemps() {
  25597. var s0, s1, s2, s3, s4, s5;
  25598. var key = peg$currPos * 61 + 38,
  25599. cached = peg$resultsCache[key];
  25600. if (cached) {
  25601. peg$currPos = cached.nextPos;
  25602. return cached.result;
  25603. }
  25604. s0 = peg$currPos;
  25605. if (input.charCodeAt(peg$currPos) === 124) {
  25606. s1 = peg$c95;
  25607. peg$currPos++;
  25608. } else {
  25609. s1 = peg$FAILED;
  25610. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  25611. }
  25612. if (s1 !== peg$FAILED) {
  25613. s2 = [];
  25614. s3 = peg$currPos;
  25615. s4 = peg$parsews();
  25616. if (s4 !== peg$FAILED) {
  25617. s5 = peg$parseidentifier();
  25618. if (s5 !== peg$FAILED) {
  25619. peg$savedPos = s3;
  25620. s4 = peg$c97(s5);
  25621. s3 = s4;
  25622. } else {
  25623. peg$currPos = s3;
  25624. s3 = peg$FAILED;
  25625. }
  25626. } else {
  25627. peg$currPos = s3;
  25628. s3 = peg$FAILED;
  25629. }
  25630. while (s3 !== peg$FAILED) {
  25631. s2.push(s3);
  25632. s3 = peg$currPos;
  25633. s4 = peg$parsews();
  25634. if (s4 !== peg$FAILED) {
  25635. s5 = peg$parseidentifier();
  25636. if (s5 !== peg$FAILED) {
  25637. peg$savedPos = s3;
  25638. s4 = peg$c97(s5);
  25639. s3 = s4;
  25640. } else {
  25641. peg$currPos = s3;
  25642. s3 = peg$FAILED;
  25643. }
  25644. } else {
  25645. peg$currPos = s3;
  25646. s3 = peg$FAILED;
  25647. }
  25648. }
  25649. if (s2 !== peg$FAILED) {
  25650. s3 = peg$parsews();
  25651. if (s3 !== peg$FAILED) {
  25652. if (input.charCodeAt(peg$currPos) === 124) {
  25653. s4 = peg$c95;
  25654. peg$currPos++;
  25655. } else {
  25656. s4 = peg$FAILED;
  25657. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  25658. }
  25659. if (s4 !== peg$FAILED) {
  25660. peg$savedPos = s0;
  25661. s1 = peg$c98(s2);
  25662. s0 = s1;
  25663. } else {
  25664. peg$currPos = s0;
  25665. s0 = peg$FAILED;
  25666. }
  25667. } else {
  25668. peg$currPos = s0;
  25669. s0 = peg$FAILED;
  25670. }
  25671. } else {
  25672. peg$currPos = s0;
  25673. s0 = peg$FAILED;
  25674. }
  25675. } else {
  25676. peg$currPos = s0;
  25677. s0 = peg$FAILED;
  25678. }
  25679. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25680. return s0;
  25681. }
  25682. function peg$parsewsBlockParamList() {
  25683. var s0, s1, s2, s3, s4, s5, s6;
  25684. var key = peg$currPos * 61 + 39,
  25685. cached = peg$resultsCache[key];
  25686. if (cached) {
  25687. peg$currPos = cached.nextPos;
  25688. return cached.result;
  25689. }
  25690. s0 = peg$currPos;
  25691. s1 = [];
  25692. s2 = peg$currPos;
  25693. s3 = peg$parsews();
  25694. if (s3 !== peg$FAILED) {
  25695. if (input.charCodeAt(peg$currPos) === 58) {
  25696. s4 = peg$c13;
  25697. peg$currPos++;
  25698. } else {
  25699. s4 = peg$FAILED;
  25700. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25701. }
  25702. if (s4 !== peg$FAILED) {
  25703. s5 = peg$parsews();
  25704. if (s5 !== peg$FAILED) {
  25705. s6 = peg$parseidentifier();
  25706. if (s6 !== peg$FAILED) {
  25707. peg$savedPos = s2;
  25708. s3 = peg$c99(s6);
  25709. s2 = s3;
  25710. } else {
  25711. peg$currPos = s2;
  25712. s2 = peg$FAILED;
  25713. }
  25714. } else {
  25715. peg$currPos = s2;
  25716. s2 = peg$FAILED;
  25717. }
  25718. } else {
  25719. peg$currPos = s2;
  25720. s2 = peg$FAILED;
  25721. }
  25722. } else {
  25723. peg$currPos = s2;
  25724. s2 = peg$FAILED;
  25725. }
  25726. if (s2 !== peg$FAILED) {
  25727. while (s2 !== peg$FAILED) {
  25728. s1.push(s2);
  25729. s2 = peg$currPos;
  25730. s3 = peg$parsews();
  25731. if (s3 !== peg$FAILED) {
  25732. if (input.charCodeAt(peg$currPos) === 58) {
  25733. s4 = peg$c13;
  25734. peg$currPos++;
  25735. } else {
  25736. s4 = peg$FAILED;
  25737. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25738. }
  25739. if (s4 !== peg$FAILED) {
  25740. s5 = peg$parsews();
  25741. if (s5 !== peg$FAILED) {
  25742. s6 = peg$parseidentifier();
  25743. if (s6 !== peg$FAILED) {
  25744. peg$savedPos = s2;
  25745. s3 = peg$c99(s6);
  25746. s2 = s3;
  25747. } else {
  25748. peg$currPos = s2;
  25749. s2 = peg$FAILED;
  25750. }
  25751. } else {
  25752. peg$currPos = s2;
  25753. s2 = peg$FAILED;
  25754. }
  25755. } else {
  25756. peg$currPos = s2;
  25757. s2 = peg$FAILED;
  25758. }
  25759. } else {
  25760. peg$currPos = s2;
  25761. s2 = peg$FAILED;
  25762. }
  25763. }
  25764. } else {
  25765. s1 = peg$FAILED;
  25766. }
  25767. if (s1 !== peg$FAILED) {
  25768. s2 = peg$parsews();
  25769. if (s2 !== peg$FAILED) {
  25770. if (input.charCodeAt(peg$currPos) === 124) {
  25771. s3 = peg$c95;
  25772. peg$currPos++;
  25773. } else {
  25774. s3 = peg$FAILED;
  25775. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  25776. }
  25777. if (s3 !== peg$FAILED) {
  25778. peg$savedPos = s0;
  25779. s1 = peg$c100(s1);
  25780. s0 = s1;
  25781. } else {
  25782. peg$currPos = s0;
  25783. s0 = peg$FAILED;
  25784. }
  25785. } else {
  25786. peg$currPos = s0;
  25787. s0 = peg$FAILED;
  25788. }
  25789. } else {
  25790. peg$currPos = s0;
  25791. s0 = peg$FAILED;
  25792. }
  25793. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25794. return s0;
  25795. }
  25796. function peg$parsesubexpression() {
  25797. var s0, s1, s2, s3, s4, s5;
  25798. var key = peg$currPos * 61 + 40,
  25799. cached = peg$resultsCache[key];
  25800. if (cached) {
  25801. peg$currPos = cached.nextPos;
  25802. return cached.result;
  25803. }
  25804. s0 = peg$currPos;
  25805. if (input.charCodeAt(peg$currPos) === 40) {
  25806. s1 = peg$c57;
  25807. peg$currPos++;
  25808. } else {
  25809. s1 = peg$FAILED;
  25810. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  25811. }
  25812. if (s1 !== peg$FAILED) {
  25813. s2 = peg$parsews();
  25814. if (s2 !== peg$FAILED) {
  25815. s3 = peg$parseexpression();
  25816. if (s3 !== peg$FAILED) {
  25817. s4 = peg$parsews();
  25818. if (s4 !== peg$FAILED) {
  25819. if (input.charCodeAt(peg$currPos) === 41) {
  25820. s5 = peg$c54;
  25821. peg$currPos++;
  25822. } else {
  25823. s5 = peg$FAILED;
  25824. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  25825. }
  25826. if (s5 !== peg$FAILED) {
  25827. peg$savedPos = s0;
  25828. s1 = peg$c87(s3);
  25829. s0 = s1;
  25830. } else {
  25831. peg$currPos = s0;
  25832. s0 = peg$FAILED;
  25833. }
  25834. } else {
  25835. peg$currPos = s0;
  25836. s0 = peg$FAILED;
  25837. }
  25838. } else {
  25839. peg$currPos = s0;
  25840. s0 = peg$FAILED;
  25841. }
  25842. } else {
  25843. peg$currPos = s0;
  25844. s0 = peg$FAILED;
  25845. }
  25846. } else {
  25847. peg$currPos = s0;
  25848. s0 = peg$FAILED;
  25849. }
  25850. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25851. return s0;
  25852. }
  25853. function peg$parsestatementsWs() {
  25854. var s0, s1, s2, s3, s4, s5, s6;
  25855. var key = peg$currPos * 61 + 41,
  25856. cached = peg$resultsCache[key];
  25857. if (cached) {
  25858. peg$currPos = cached.nextPos;
  25859. return cached.result;
  25860. }
  25861. s0 = peg$currPos;
  25862. s1 = peg$parseret();
  25863. if (s1 !== peg$FAILED) {
  25864. s2 = peg$parsemaybeDotsWs();
  25865. if (s2 !== peg$FAILED) {
  25866. peg$savedPos = s0;
  25867. s1 = peg$c101(s1);
  25868. s0 = s1;
  25869. } else {
  25870. peg$currPos = s0;
  25871. s0 = peg$FAILED;
  25872. }
  25873. } else {
  25874. peg$currPos = s0;
  25875. s0 = peg$FAILED;
  25876. }
  25877. if (s0 === peg$FAILED) {
  25878. s0 = peg$currPos;
  25879. s1 = peg$parseexpressions();
  25880. if (s1 !== peg$FAILED) {
  25881. s2 = peg$parsews();
  25882. if (s2 !== peg$FAILED) {
  25883. if (input.charCodeAt(peg$currPos) === 46) {
  25884. s3 = peg$c6;
  25885. peg$currPos++;
  25886. } else {
  25887. s3 = peg$FAILED;
  25888. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  25889. }
  25890. if (s3 !== peg$FAILED) {
  25891. s4 = peg$parsemaybeDotsWs();
  25892. if (s4 !== peg$FAILED) {
  25893. s5 = peg$parseret();
  25894. if (s5 !== peg$FAILED) {
  25895. s6 = peg$parsemaybeDotsWs();
  25896. if (s6 !== peg$FAILED) {
  25897. peg$savedPos = s0;
  25898. s1 = peg$c102(s1, s5);
  25899. s0 = s1;
  25900. } else {
  25901. peg$currPos = s0;
  25902. s0 = peg$FAILED;
  25903. }
  25904. } else {
  25905. peg$currPos = s0;
  25906. s0 = peg$FAILED;
  25907. }
  25908. } else {
  25909. peg$currPos = s0;
  25910. s0 = peg$FAILED;
  25911. }
  25912. } else {
  25913. peg$currPos = s0;
  25914. s0 = peg$FAILED;
  25915. }
  25916. } else {
  25917. peg$currPos = s0;
  25918. s0 = peg$FAILED;
  25919. }
  25920. } else {
  25921. peg$currPos = s0;
  25922. s0 = peg$FAILED;
  25923. }
  25924. if (s0 === peg$FAILED) {
  25925. s0 = peg$currPos;
  25926. s1 = peg$parseexpressions();
  25927. if (s1 === peg$FAILED) {
  25928. s1 = null;
  25929. }
  25930. if (s1 !== peg$FAILED) {
  25931. s2 = peg$parsemaybeDotsWs();
  25932. if (s2 !== peg$FAILED) {
  25933. peg$savedPos = s0;
  25934. s1 = peg$c103(s1);
  25935. s0 = s1;
  25936. } else {
  25937. peg$currPos = s0;
  25938. s0 = peg$FAILED;
  25939. }
  25940. } else {
  25941. peg$currPos = s0;
  25942. s0 = peg$FAILED;
  25943. }
  25944. }
  25945. }
  25946. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25947. return s0;
  25948. }
  25949. function peg$parsewsSequenceWs() {
  25950. var s0, s1, s2, s3;
  25951. var key = peg$currPos * 61 + 42,
  25952. cached = peg$resultsCache[key];
  25953. if (cached) {
  25954. peg$currPos = cached.nextPos;
  25955. return cached.result;
  25956. }
  25957. s0 = peg$currPos;
  25958. s1 = peg$parsews();
  25959. if (s1 !== peg$FAILED) {
  25960. s2 = peg$parsejsStatement();
  25961. if (s2 !== peg$FAILED) {
  25962. s3 = peg$parsews();
  25963. if (s3 !== peg$FAILED) {
  25964. peg$savedPos = s0;
  25965. s1 = peg$c104(s2);
  25966. s0 = s1;
  25967. } else {
  25968. peg$currPos = s0;
  25969. s0 = peg$FAILED;
  25970. }
  25971. } else {
  25972. peg$currPos = s0;
  25973. s0 = peg$FAILED;
  25974. }
  25975. } else {
  25976. peg$currPos = s0;
  25977. s0 = peg$FAILED;
  25978. }
  25979. if (s0 === peg$FAILED) {
  25980. s0 = peg$parsewsStSequenceWs();
  25981. }
  25982. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25983. return s0;
  25984. }
  25985. function peg$parsewsStSequenceWs() {
  25986. var s0, s1, s2, s3, s4;
  25987. var key = peg$currPos * 61 + 43,
  25988. cached = peg$resultsCache[key];
  25989. if (cached) {
  25990. peg$currPos = cached.nextPos;
  25991. return cached.result;
  25992. }
  25993. s0 = peg$currPos;
  25994. s1 = peg$parsews();
  25995. if (s1 !== peg$FAILED) {
  25996. s2 = peg$parsetemps();
  25997. if (s2 === peg$FAILED) {
  25998. s2 = null;
  25999. }
  26000. if (s2 !== peg$FAILED) {
  26001. s3 = peg$parsemaybeDotsWs();
  26002. if (s3 !== peg$FAILED) {
  26003. s4 = peg$parsestatementsWs();
  26004. if (s4 === peg$FAILED) {
  26005. s4 = null;
  26006. }
  26007. if (s4 !== peg$FAILED) {
  26008. peg$savedPos = s0;
  26009. s1 = peg$c105(s2, s4);
  26010. s0 = s1;
  26011. } else {
  26012. peg$currPos = s0;
  26013. s0 = peg$FAILED;
  26014. }
  26015. } else {
  26016. peg$currPos = s0;
  26017. s0 = peg$FAILED;
  26018. }
  26019. } else {
  26020. peg$currPos = s0;
  26021. s0 = peg$FAILED;
  26022. }
  26023. } else {
  26024. peg$currPos = s0;
  26025. s0 = peg$FAILED;
  26026. }
  26027. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26028. return s0;
  26029. }
  26030. function peg$parseblock() {
  26031. var s0, s1, s2, s3, s4;
  26032. var key = peg$currPos * 61 + 44,
  26033. cached = peg$resultsCache[key];
  26034. if (cached) {
  26035. peg$currPos = cached.nextPos;
  26036. return cached.result;
  26037. }
  26038. s0 = peg$currPos;
  26039. if (input.charCodeAt(peg$currPos) === 91) {
  26040. s1 = peg$c106;
  26041. peg$currPos++;
  26042. } else {
  26043. s1 = peg$FAILED;
  26044. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  26045. }
  26046. if (s1 !== peg$FAILED) {
  26047. s2 = peg$parsewsBlockParamList();
  26048. if (s2 === peg$FAILED) {
  26049. s2 = null;
  26050. }
  26051. if (s2 !== peg$FAILED) {
  26052. s3 = peg$parsewsSequenceWs();
  26053. if (s3 === peg$FAILED) {
  26054. s3 = null;
  26055. }
  26056. if (s3 !== peg$FAILED) {
  26057. if (input.charCodeAt(peg$currPos) === 93) {
  26058. s4 = peg$c108;
  26059. peg$currPos++;
  26060. } else {
  26061. s4 = peg$FAILED;
  26062. if (peg$silentFails === 0) { peg$fail(peg$c109); }
  26063. }
  26064. if (s4 !== peg$FAILED) {
  26065. peg$savedPos = s0;
  26066. s1 = peg$c110(s2, s3);
  26067. s0 = s1;
  26068. } else {
  26069. peg$currPos = s0;
  26070. s0 = peg$FAILED;
  26071. }
  26072. } else {
  26073. peg$currPos = s0;
  26074. s0 = peg$FAILED;
  26075. }
  26076. } else {
  26077. peg$currPos = s0;
  26078. s0 = peg$FAILED;
  26079. }
  26080. } else {
  26081. peg$currPos = s0;
  26082. s0 = peg$FAILED;
  26083. }
  26084. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26085. return s0;
  26086. }
  26087. function peg$parseoperand() {
  26088. var s0;
  26089. var key = peg$currPos * 61 + 45,
  26090. cached = peg$resultsCache[key];
  26091. if (cached) {
  26092. peg$currPos = cached.nextPos;
  26093. return cached.result;
  26094. }
  26095. s0 = peg$parseliteral();
  26096. if (s0 === peg$FAILED) {
  26097. s0 = peg$parsevariable();
  26098. if (s0 === peg$FAILED) {
  26099. s0 = peg$parsesubexpression();
  26100. }
  26101. }
  26102. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26103. return s0;
  26104. }
  26105. function peg$parsewsUnaryMessage() {
  26106. var s0, s1, s2, s3, s4;
  26107. var key = peg$currPos * 61 + 46,
  26108. cached = peg$resultsCache[key];
  26109. if (cached) {
  26110. peg$currPos = cached.nextPos;
  26111. return cached.result;
  26112. }
  26113. s0 = peg$currPos;
  26114. s1 = peg$parsews();
  26115. if (s1 !== peg$FAILED) {
  26116. s2 = peg$parseidentifier();
  26117. if (s2 !== peg$FAILED) {
  26118. s3 = peg$currPos;
  26119. peg$silentFails++;
  26120. if (input.charCodeAt(peg$currPos) === 58) {
  26121. s4 = peg$c13;
  26122. peg$currPos++;
  26123. } else {
  26124. s4 = peg$FAILED;
  26125. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  26126. }
  26127. peg$silentFails--;
  26128. if (s4 === peg$FAILED) {
  26129. s3 = void 0;
  26130. } else {
  26131. peg$currPos = s3;
  26132. s3 = peg$FAILED;
  26133. }
  26134. if (s3 !== peg$FAILED) {
  26135. peg$savedPos = s0;
  26136. s1 = peg$c111(s2);
  26137. s0 = s1;
  26138. } else {
  26139. peg$currPos = s0;
  26140. s0 = peg$FAILED;
  26141. }
  26142. } else {
  26143. peg$currPos = s0;
  26144. s0 = peg$FAILED;
  26145. }
  26146. } else {
  26147. peg$currPos = s0;
  26148. s0 = peg$FAILED;
  26149. }
  26150. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26151. return s0;
  26152. }
  26153. function peg$parsewsUnaryTail() {
  26154. var s0, s1, s2;
  26155. var key = peg$currPos * 61 + 47,
  26156. cached = peg$resultsCache[key];
  26157. if (cached) {
  26158. peg$currPos = cached.nextPos;
  26159. return cached.result;
  26160. }
  26161. s0 = peg$currPos;
  26162. s1 = peg$parsewsUnaryMessage();
  26163. if (s1 !== peg$FAILED) {
  26164. s2 = peg$parsewsUnaryTail();
  26165. if (s2 === peg$FAILED) {
  26166. s2 = null;
  26167. }
  26168. if (s2 !== peg$FAILED) {
  26169. peg$savedPos = s0;
  26170. s1 = peg$c112(s1, s2);
  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. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26181. return s0;
  26182. }
  26183. function peg$parseunarySend() {
  26184. var s0, s1, s2;
  26185. var key = peg$currPos * 61 + 48,
  26186. cached = peg$resultsCache[key];
  26187. if (cached) {
  26188. peg$currPos = cached.nextPos;
  26189. return cached.result;
  26190. }
  26191. s0 = peg$currPos;
  26192. s1 = peg$parseoperand();
  26193. if (s1 !== peg$FAILED) {
  26194. s2 = peg$parsewsUnaryTail();
  26195. if (s2 === peg$FAILED) {
  26196. s2 = null;
  26197. }
  26198. if (s2 !== peg$FAILED) {
  26199. peg$savedPos = s0;
  26200. s1 = peg$c113(s1, s2);
  26201. s0 = s1;
  26202. } else {
  26203. peg$currPos = s0;
  26204. s0 = peg$FAILED;
  26205. }
  26206. } else {
  26207. peg$currPos = s0;
  26208. s0 = peg$FAILED;
  26209. }
  26210. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26211. return s0;
  26212. }
  26213. function peg$parsewsBinaryMessage() {
  26214. var s0, s1, s2, s3, s4;
  26215. var key = peg$currPos * 61 + 49,
  26216. cached = peg$resultsCache[key];
  26217. if (cached) {
  26218. peg$currPos = cached.nextPos;
  26219. return cached.result;
  26220. }
  26221. s0 = peg$currPos;
  26222. s1 = peg$parsews();
  26223. if (s1 !== peg$FAILED) {
  26224. s2 = peg$parsebinarySelector();
  26225. if (s2 !== peg$FAILED) {
  26226. s3 = peg$parsews();
  26227. if (s3 !== peg$FAILED) {
  26228. s4 = peg$parseunarySend();
  26229. if (s4 !== peg$FAILED) {
  26230. peg$savedPos = s0;
  26231. s1 = peg$c114(s2, s4);
  26232. s0 = s1;
  26233. } else {
  26234. peg$currPos = s0;
  26235. s0 = peg$FAILED;
  26236. }
  26237. } else {
  26238. peg$currPos = s0;
  26239. s0 = peg$FAILED;
  26240. }
  26241. } else {
  26242. peg$currPos = s0;
  26243. s0 = peg$FAILED;
  26244. }
  26245. } else {
  26246. peg$currPos = s0;
  26247. s0 = peg$FAILED;
  26248. }
  26249. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26250. return s0;
  26251. }
  26252. function peg$parsewsBinaryTail() {
  26253. var s0, s1, s2;
  26254. var key = peg$currPos * 61 + 50,
  26255. cached = peg$resultsCache[key];
  26256. if (cached) {
  26257. peg$currPos = cached.nextPos;
  26258. return cached.result;
  26259. }
  26260. s0 = peg$currPos;
  26261. s1 = peg$parsewsBinaryMessage();
  26262. if (s1 !== peg$FAILED) {
  26263. s2 = peg$parsewsBinaryTail();
  26264. if (s2 === peg$FAILED) {
  26265. s2 = null;
  26266. }
  26267. if (s2 !== peg$FAILED) {
  26268. peg$savedPos = s0;
  26269. s1 = peg$c115(s1, s2);
  26270. s0 = s1;
  26271. } else {
  26272. peg$currPos = s0;
  26273. s0 = peg$FAILED;
  26274. }
  26275. } else {
  26276. peg$currPos = s0;
  26277. s0 = peg$FAILED;
  26278. }
  26279. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26280. return s0;
  26281. }
  26282. function peg$parsebinarySend() {
  26283. var s0, s1, s2;
  26284. var key = peg$currPos * 61 + 51,
  26285. cached = peg$resultsCache[key];
  26286. if (cached) {
  26287. peg$currPos = cached.nextPos;
  26288. return cached.result;
  26289. }
  26290. s0 = peg$currPos;
  26291. s1 = peg$parseunarySend();
  26292. if (s1 !== peg$FAILED) {
  26293. s2 = peg$parsewsBinaryTail();
  26294. if (s2 === peg$FAILED) {
  26295. s2 = null;
  26296. }
  26297. if (s2 !== peg$FAILED) {
  26298. peg$savedPos = s0;
  26299. s1 = peg$c113(s1, s2);
  26300. s0 = s1;
  26301. } else {
  26302. peg$currPos = s0;
  26303. s0 = peg$FAILED;
  26304. }
  26305. } else {
  26306. peg$currPos = s0;
  26307. s0 = peg$FAILED;
  26308. }
  26309. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26310. return s0;
  26311. }
  26312. function peg$parsewsKeywordMessage() {
  26313. var s0, s1, s2, s3, s4, s5, s6;
  26314. var key = peg$currPos * 61 + 52,
  26315. cached = peg$resultsCache[key];
  26316. if (cached) {
  26317. peg$currPos = cached.nextPos;
  26318. return cached.result;
  26319. }
  26320. s0 = peg$currPos;
  26321. s1 = [];
  26322. s2 = peg$currPos;
  26323. s3 = peg$parsews();
  26324. if (s3 !== peg$FAILED) {
  26325. s4 = peg$parsekeyword();
  26326. if (s4 !== peg$FAILED) {
  26327. s5 = peg$parsews();
  26328. if (s5 !== peg$FAILED) {
  26329. s6 = peg$parsebinarySend();
  26330. if (s6 !== peg$FAILED) {
  26331. peg$savedPos = s2;
  26332. s3 = peg$c83(s4, s6);
  26333. s2 = s3;
  26334. } else {
  26335. peg$currPos = s2;
  26336. s2 = peg$FAILED;
  26337. }
  26338. } else {
  26339. peg$currPos = s2;
  26340. s2 = peg$FAILED;
  26341. }
  26342. } else {
  26343. peg$currPos = s2;
  26344. s2 = peg$FAILED;
  26345. }
  26346. } else {
  26347. peg$currPos = s2;
  26348. s2 = peg$FAILED;
  26349. }
  26350. if (s2 !== peg$FAILED) {
  26351. while (s2 !== peg$FAILED) {
  26352. s1.push(s2);
  26353. s2 = peg$currPos;
  26354. s3 = peg$parsews();
  26355. if (s3 !== peg$FAILED) {
  26356. s4 = peg$parsekeyword();
  26357. if (s4 !== peg$FAILED) {
  26358. s5 = peg$parsews();
  26359. if (s5 !== peg$FAILED) {
  26360. s6 = peg$parsebinarySend();
  26361. if (s6 !== peg$FAILED) {
  26362. peg$savedPos = s2;
  26363. s3 = peg$c83(s4, s6);
  26364. s2 = s3;
  26365. } else {
  26366. peg$currPos = s2;
  26367. s2 = peg$FAILED;
  26368. }
  26369. } else {
  26370. peg$currPos = s2;
  26371. s2 = peg$FAILED;
  26372. }
  26373. } else {
  26374. peg$currPos = s2;
  26375. s2 = peg$FAILED;
  26376. }
  26377. } else {
  26378. peg$currPos = s2;
  26379. s2 = peg$FAILED;
  26380. }
  26381. }
  26382. } else {
  26383. s1 = peg$FAILED;
  26384. }
  26385. if (s1 !== peg$FAILED) {
  26386. peg$savedPos = s0;
  26387. s1 = peg$c116(s1);
  26388. }
  26389. s0 = s1;
  26390. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26391. return s0;
  26392. }
  26393. function peg$parsekeywordSend() {
  26394. var s0, s1, s2;
  26395. var key = peg$currPos * 61 + 53,
  26396. cached = peg$resultsCache[key];
  26397. if (cached) {
  26398. peg$currPos = cached.nextPos;
  26399. return cached.result;
  26400. }
  26401. s0 = peg$currPos;
  26402. s1 = peg$parsebinarySend();
  26403. if (s1 !== peg$FAILED) {
  26404. s2 = peg$parsewsKeywordMessage();
  26405. if (s2 === peg$FAILED) {
  26406. s2 = null;
  26407. }
  26408. if (s2 !== peg$FAILED) {
  26409. peg$savedPos = s0;
  26410. s1 = peg$c113(s1, s2);
  26411. s0 = s1;
  26412. } else {
  26413. peg$currPos = s0;
  26414. s0 = peg$FAILED;
  26415. }
  26416. } else {
  26417. peg$currPos = s0;
  26418. s0 = peg$FAILED;
  26419. }
  26420. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26421. return s0;
  26422. }
  26423. function peg$parsewsMessage() {
  26424. var s0;
  26425. var key = peg$currPos * 61 + 54,
  26426. cached = peg$resultsCache[key];
  26427. if (cached) {
  26428. peg$currPos = cached.nextPos;
  26429. return cached.result;
  26430. }
  26431. s0 = peg$parsewsBinaryMessage();
  26432. if (s0 === peg$FAILED) {
  26433. s0 = peg$parsewsUnaryMessage();
  26434. if (s0 === peg$FAILED) {
  26435. s0 = peg$parsewsKeywordMessage();
  26436. }
  26437. }
  26438. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26439. return s0;
  26440. }
  26441. function peg$parsecascade() {
  26442. var s0, s1, s2, s3, s4, s5, s6, s7;
  26443. var key = peg$currPos * 61 + 55,
  26444. cached = peg$resultsCache[key];
  26445. if (cached) {
  26446. peg$currPos = cached.nextPos;
  26447. return cached.result;
  26448. }
  26449. s0 = peg$currPos;
  26450. s1 = peg$parsekeywordSend();
  26451. if (s1 !== peg$FAILED) {
  26452. peg$savedPos = peg$currPos;
  26453. s2 = peg$c117(s1);
  26454. if (s2) {
  26455. s2 = void 0;
  26456. } else {
  26457. s2 = peg$FAILED;
  26458. }
  26459. if (s2 !== peg$FAILED) {
  26460. s3 = [];
  26461. s4 = peg$currPos;
  26462. s5 = peg$parsews();
  26463. if (s5 !== peg$FAILED) {
  26464. if (input.charCodeAt(peg$currPos) === 59) {
  26465. s6 = peg$c118;
  26466. peg$currPos++;
  26467. } else {
  26468. s6 = peg$FAILED;
  26469. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  26470. }
  26471. if (s6 !== peg$FAILED) {
  26472. s7 = peg$parsewsMessage();
  26473. if (s7 !== peg$FAILED) {
  26474. peg$savedPos = s4;
  26475. s5 = peg$c120(s1, s7);
  26476. s4 = s5;
  26477. } else {
  26478. peg$currPos = s4;
  26479. s4 = peg$FAILED;
  26480. }
  26481. } else {
  26482. peg$currPos = s4;
  26483. s4 = peg$FAILED;
  26484. }
  26485. } else {
  26486. peg$currPos = s4;
  26487. s4 = peg$FAILED;
  26488. }
  26489. if (s4 !== peg$FAILED) {
  26490. while (s4 !== peg$FAILED) {
  26491. s3.push(s4);
  26492. s4 = peg$currPos;
  26493. s5 = peg$parsews();
  26494. if (s5 !== peg$FAILED) {
  26495. if (input.charCodeAt(peg$currPos) === 59) {
  26496. s6 = peg$c118;
  26497. peg$currPos++;
  26498. } else {
  26499. s6 = peg$FAILED;
  26500. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  26501. }
  26502. if (s6 !== peg$FAILED) {
  26503. s7 = peg$parsewsMessage();
  26504. if (s7 !== peg$FAILED) {
  26505. peg$savedPos = s4;
  26506. s5 = peg$c120(s1, s7);
  26507. s4 = s5;
  26508. } else {
  26509. peg$currPos = s4;
  26510. s4 = peg$FAILED;
  26511. }
  26512. } else {
  26513. peg$currPos = s4;
  26514. s4 = peg$FAILED;
  26515. }
  26516. } else {
  26517. peg$currPos = s4;
  26518. s4 = peg$FAILED;
  26519. }
  26520. }
  26521. } else {
  26522. s3 = peg$FAILED;
  26523. }
  26524. if (s3 !== peg$FAILED) {
  26525. peg$savedPos = s0;
  26526. s1 = peg$c121(s1, s3);
  26527. s0 = s1;
  26528. } else {
  26529. peg$currPos = s0;
  26530. s0 = peg$FAILED;
  26531. }
  26532. } else {
  26533. peg$currPos = s0;
  26534. s0 = peg$FAILED;
  26535. }
  26536. } else {
  26537. peg$currPos = s0;
  26538. s0 = peg$FAILED;
  26539. }
  26540. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26541. return s0;
  26542. }
  26543. function peg$parsejsStatement() {
  26544. var s0, s1, s2, s3, s4;
  26545. var key = peg$currPos * 61 + 56,
  26546. cached = peg$resultsCache[key];
  26547. if (cached) {
  26548. peg$currPos = cached.nextPos;
  26549. return cached.result;
  26550. }
  26551. s0 = peg$currPos;
  26552. if (input.charCodeAt(peg$currPos) === 60) {
  26553. s1 = peg$c122;
  26554. peg$currPos++;
  26555. } else {
  26556. s1 = peg$FAILED;
  26557. if (peg$silentFails === 0) { peg$fail(peg$c123); }
  26558. }
  26559. if (s1 !== peg$FAILED) {
  26560. s2 = [];
  26561. s3 = peg$currPos;
  26562. if (input.substr(peg$currPos, 2) === peg$c124) {
  26563. s4 = peg$c124;
  26564. peg$currPos += 2;
  26565. } else {
  26566. s4 = peg$FAILED;
  26567. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  26568. }
  26569. if (s4 !== peg$FAILED) {
  26570. peg$savedPos = s3;
  26571. s4 = peg$c126();
  26572. }
  26573. s3 = s4;
  26574. if (s3 === peg$FAILED) {
  26575. if (peg$c127.test(input.charAt(peg$currPos))) {
  26576. s3 = input.charAt(peg$currPos);
  26577. peg$currPos++;
  26578. } else {
  26579. s3 = peg$FAILED;
  26580. if (peg$silentFails === 0) { peg$fail(peg$c128); }
  26581. }
  26582. }
  26583. while (s3 !== peg$FAILED) {
  26584. s2.push(s3);
  26585. s3 = peg$currPos;
  26586. if (input.substr(peg$currPos, 2) === peg$c124) {
  26587. s4 = peg$c124;
  26588. peg$currPos += 2;
  26589. } else {
  26590. s4 = peg$FAILED;
  26591. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  26592. }
  26593. if (s4 !== peg$FAILED) {
  26594. peg$savedPos = s3;
  26595. s4 = peg$c126();
  26596. }
  26597. s3 = s4;
  26598. if (s3 === peg$FAILED) {
  26599. if (peg$c127.test(input.charAt(peg$currPos))) {
  26600. s3 = input.charAt(peg$currPos);
  26601. peg$currPos++;
  26602. } else {
  26603. s3 = peg$FAILED;
  26604. if (peg$silentFails === 0) { peg$fail(peg$c128); }
  26605. }
  26606. }
  26607. }
  26608. if (s2 !== peg$FAILED) {
  26609. if (input.charCodeAt(peg$currPos) === 62) {
  26610. s3 = peg$c129;
  26611. peg$currPos++;
  26612. } else {
  26613. s3 = peg$FAILED;
  26614. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  26615. }
  26616. if (s3 !== peg$FAILED) {
  26617. peg$savedPos = s0;
  26618. s1 = peg$c131(s2);
  26619. s0 = s1;
  26620. } else {
  26621. peg$currPos = s0;
  26622. s0 = peg$FAILED;
  26623. }
  26624. } else {
  26625. peg$currPos = s0;
  26626. s0 = peg$FAILED;
  26627. }
  26628. } else {
  26629. peg$currPos = s0;
  26630. s0 = peg$FAILED;
  26631. }
  26632. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26633. return s0;
  26634. }
  26635. function peg$parsemethod() {
  26636. var s0, s1, s2;
  26637. var key = peg$currPos * 61 + 57,
  26638. cached = peg$resultsCache[key];
  26639. if (cached) {
  26640. peg$currPos = cached.nextPos;
  26641. return cached.result;
  26642. }
  26643. s0 = peg$currPos;
  26644. s1 = peg$parsewsKeywordPattern();
  26645. if (s1 === peg$FAILED) {
  26646. s1 = peg$parsewsBinaryPattern();
  26647. if (s1 === peg$FAILED) {
  26648. s1 = peg$parsewsUnaryPattern();
  26649. }
  26650. }
  26651. if (s1 !== peg$FAILED) {
  26652. s2 = peg$parsewsSequenceWs();
  26653. if (s2 === peg$FAILED) {
  26654. s2 = null;
  26655. }
  26656. if (s2 !== peg$FAILED) {
  26657. peg$savedPos = s0;
  26658. s1 = peg$c132(s1, s2);
  26659. s0 = s1;
  26660. } else {
  26661. peg$currPos = s0;
  26662. s0 = peg$FAILED;
  26663. }
  26664. } else {
  26665. peg$currPos = s0;
  26666. s0 = peg$FAILED;
  26667. }
  26668. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26669. return s0;
  26670. }
  26671. function peg$parseassociationSend() {
  26672. var s0, s1, s2;
  26673. var key = peg$currPos * 61 + 58,
  26674. cached = peg$resultsCache[key];
  26675. if (cached) {
  26676. peg$currPos = cached.nextPos;
  26677. return cached.result;
  26678. }
  26679. s0 = peg$currPos;
  26680. s1 = peg$parsebinarySend();
  26681. if (s1 !== peg$FAILED) {
  26682. peg$savedPos = peg$currPos;
  26683. s2 = peg$c133(s1);
  26684. if (s2) {
  26685. s2 = void 0;
  26686. } else {
  26687. s2 = peg$FAILED;
  26688. }
  26689. if (s2 !== peg$FAILED) {
  26690. peg$savedPos = s0;
  26691. s1 = peg$c134(s1);
  26692. s0 = s1;
  26693. } else {
  26694. peg$currPos = s0;
  26695. s0 = peg$FAILED;
  26696. }
  26697. } else {
  26698. peg$currPos = s0;
  26699. s0 = peg$FAILED;
  26700. }
  26701. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26702. return s0;
  26703. }
  26704. function peg$parsewsAssociationsRest() {
  26705. var s0, s1, s2, s3, s4;
  26706. var key = peg$currPos * 61 + 59,
  26707. cached = peg$resultsCache[key];
  26708. if (cached) {
  26709. peg$currPos = cached.nextPos;
  26710. return cached.result;
  26711. }
  26712. s0 = peg$currPos;
  26713. s1 = peg$parsews();
  26714. if (s1 !== peg$FAILED) {
  26715. if (input.charCodeAt(peg$currPos) === 46) {
  26716. s2 = peg$c6;
  26717. peg$currPos++;
  26718. } else {
  26719. s2 = peg$FAILED;
  26720. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  26721. }
  26722. if (s2 !== peg$FAILED) {
  26723. s3 = peg$parsemaybeDotsWs();
  26724. if (s3 !== peg$FAILED) {
  26725. s4 = peg$parseassociationSend();
  26726. if (s4 !== peg$FAILED) {
  26727. peg$savedPos = s0;
  26728. s1 = peg$c87(s4);
  26729. s0 = s1;
  26730. } else {
  26731. peg$currPos = s0;
  26732. s0 = peg$FAILED;
  26733. }
  26734. } else {
  26735. peg$currPos = s0;
  26736. s0 = peg$FAILED;
  26737. }
  26738. } else {
  26739. peg$currPos = s0;
  26740. s0 = peg$FAILED;
  26741. }
  26742. } else {
  26743. peg$currPos = s0;
  26744. s0 = peg$FAILED;
  26745. }
  26746. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26747. return s0;
  26748. }
  26749. function peg$parseassociations() {
  26750. var s0, s1, s2, s3;
  26751. var key = peg$currPos * 61 + 60,
  26752. cached = peg$resultsCache[key];
  26753. if (cached) {
  26754. peg$currPos = cached.nextPos;
  26755. return cached.result;
  26756. }
  26757. s0 = peg$currPos;
  26758. s1 = peg$parseassociationSend();
  26759. if (s1 !== peg$FAILED) {
  26760. s2 = [];
  26761. s3 = peg$parsewsAssociationsRest();
  26762. while (s3 !== peg$FAILED) {
  26763. s2.push(s3);
  26764. s3 = peg$parsewsAssociationsRest();
  26765. }
  26766. if (s2 !== peg$FAILED) {
  26767. peg$savedPos = s0;
  26768. s1 = peg$c135(s1, s2);
  26769. s0 = s1;
  26770. } else {
  26771. peg$currPos = s0;
  26772. s0 = peg$FAILED;
  26773. }
  26774. } else {
  26775. peg$currPos = s0;
  26776. s0 = peg$FAILED;
  26777. }
  26778. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26779. return s0;
  26780. }
  26781. peg$result = peg$startRuleFunction();
  26782. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  26783. return peg$result;
  26784. } else {
  26785. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  26786. peg$fail({ type: "end", description: "end of input" });
  26787. }
  26788. throw peg$buildException(
  26789. null,
  26790. peg$maxFailExpected,
  26791. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  26792. peg$maxFailPos < input.length
  26793. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  26794. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  26795. );
  26796. }
  26797. }
  26798. return {
  26799. SyntaxError: peg$SyntaxError,
  26800. parse: peg$parse
  26801. };
  26802. })();
  26803. });
  26804. 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";
  26805. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  26806. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  26807. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  26808. $core.addPackage('Platform-ImportExport');
  26809. $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  26810. $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  26811. $core.addClass('AbstractExporter', $globals.Object, [], 'Platform-ImportExport');
  26812. $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.";
  26813. $core.addMethod(
  26814. $core.method({
  26815. selector: "classNameFor:",
  26816. protocol: 'convenience',
  26817. fn: function (aClass){
  26818. var self=this;
  26819. return $core.withContext(function($ctx1) {
  26820. var $1,$2,$receiver;
  26821. $1=$recv(aClass)._isMetaclass();
  26822. if($core.assert($1)){
  26823. $2=$recv($recv(aClass)._instanceClass())._name();
  26824. $ctx1.sendIdx["name"]=1;
  26825. return $recv($2).__comma(" class");
  26826. } else {
  26827. if(($receiver = aClass) == null || $receiver.isNil){
  26828. return "nil";
  26829. } else {
  26830. return $recv(aClass)._name();
  26831. };
  26832. };
  26833. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractExporter)});
  26834. },
  26835. args: ["aClass"],
  26836. 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 ] ]",
  26837. referencedClasses: [],
  26838. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "ifNil:ifNotNil:"]
  26839. }),
  26840. $globals.AbstractExporter);
  26841. $core.addMethod(
  26842. $core.method({
  26843. selector: "exportPackage:on:",
  26844. protocol: 'output',
  26845. fn: function (aPackage,aStream){
  26846. var self=this;
  26847. return $core.withContext(function($ctx1) {
  26848. self._subclassResponsibility();
  26849. return self;
  26850. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  26851. },
  26852. args: ["aPackage", "aStream"],
  26853. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  26854. referencedClasses: [],
  26855. messageSends: ["subclassResponsibility"]
  26856. }),
  26857. $globals.AbstractExporter);
  26858. $core.addMethod(
  26859. $core.method({
  26860. selector: "extensionMethodsOfPackage:",
  26861. protocol: 'accessing',
  26862. fn: function (aPackage){
  26863. var self=this;
  26864. var result;
  26865. return $core.withContext(function($ctx1) {
  26866. result=$recv($globals.OrderedCollection)._new();
  26867. $recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  26868. return $core.withContext(function($ctx2) {
  26869. return $recv(result)._addAll_($recv(each)._methods());
  26870. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26871. }));
  26872. return result;
  26873. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  26874. },
  26875. args: ["aPackage"],
  26876. 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",
  26877. referencedClasses: ["OrderedCollection"],
  26878. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"]
  26879. }),
  26880. $globals.AbstractExporter);
  26881. $core.addMethod(
  26882. $core.method({
  26883. selector: "extensionProtocolsOfPackage:",
  26884. protocol: 'accessing',
  26885. fn: function (aPackage){
  26886. var self=this;
  26887. var extensionName,result;
  26888. return $core.withContext(function($ctx1) {
  26889. var $1,$2,$3;
  26890. $1=$recv(aPackage)._name();
  26891. $ctx1.sendIdx["name"]=1;
  26892. extensionName="*".__comma($1);
  26893. result=$recv($globals.OrderedCollection)._new();
  26894. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  26895. return $core.withContext(function($ctx2) {
  26896. $2=$recv(a)._name();
  26897. $ctx2.sendIdx["name"]=2;
  26898. return $recv($2).__lt($recv(b)._name());
  26899. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  26900. })))._do_((function(each){
  26901. return $core.withContext(function($ctx2) {
  26902. return $recv([each,$recv(each)._class()])._do_((function(behavior){
  26903. return $core.withContext(function($ctx3) {
  26904. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  26905. if($core.assert($3)){
  26906. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  26907. };
  26908. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  26909. }));
  26910. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  26911. }));
  26912. $ctx1.sendIdx["do:"]=1;
  26913. return result;
  26914. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  26915. },
  26916. args: ["aPackage"],
  26917. 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",
  26918. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  26919. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  26920. }),
  26921. $globals.AbstractExporter);
  26922. $core.addClass('ChunkExporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  26923. $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.";
  26924. $core.addMethod(
  26925. $core.method({
  26926. selector: "chunkEscape:",
  26927. protocol: 'convenience',
  26928. fn: function (aString){
  26929. var self=this;
  26930. return $core.withContext(function($ctx1) {
  26931. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  26932. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  26933. },
  26934. args: ["aString"],
  26935. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  26936. referencedClasses: [],
  26937. messageSends: ["trimBoth", "replace:with:"]
  26938. }),
  26939. $globals.ChunkExporter);
  26940. $core.addMethod(
  26941. $core.method({
  26942. selector: "exportCategoryEpilogueOf:on:",
  26943. protocol: 'output',
  26944. fn: function (aCategory,aStream){
  26945. var self=this;
  26946. return $core.withContext(function($ctx1) {
  26947. $recv(aStream)._nextPutAll_(" !");
  26948. $recv(aStream)._lf();
  26949. $ctx1.sendIdx["lf"]=1;
  26950. $recv(aStream)._lf();
  26951. return self;
  26952. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  26953. },
  26954. args: ["aCategory", "aStream"],
  26955. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  26956. referencedClasses: [],
  26957. messageSends: ["nextPutAll:", "lf"]
  26958. }),
  26959. $globals.ChunkExporter);
  26960. $core.addMethod(
  26961. $core.method({
  26962. selector: "exportCategoryPrologueOf:on:",
  26963. protocol: 'output',
  26964. fn: function (aCategory,aStream){
  26965. var self=this;
  26966. return $core.withContext(function($ctx1) {
  26967. var $1,$2;
  26968. $1="!".__comma(self._classNameFor_($recv(aCategory)._theClass()));
  26969. $ctx1.sendIdx[","]=1;
  26970. $recv(aStream)._nextPutAll_($1);
  26971. $ctx1.sendIdx["nextPutAll:"]=1;
  26972. $2=$recv(" methodsFor: '".__comma($recv(aCategory)._name())).__comma("'!");
  26973. $ctx1.sendIdx[","]=2;
  26974. $recv(aStream)._nextPutAll_($2);
  26975. return self;
  26976. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  26977. },
  26978. args: ["aCategory", "aStream"],
  26979. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  26980. referencedClasses: [],
  26981. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  26982. }),
  26983. $globals.ChunkExporter);
  26984. $core.addMethod(
  26985. $core.method({
  26986. selector: "exportDefinitionOf:on:",
  26987. protocol: 'output',
  26988. fn: function (aClass,aStream){
  26989. var self=this;
  26990. return $core.withContext(function($ctx1) {
  26991. var $1,$3,$2,$4,$6,$5,$7,$8,$10,$9,$11;
  26992. $1=self._classNameFor_($recv(aClass)._superclass());
  26993. $ctx1.sendIdx["classNameFor:"]=1;
  26994. $recv(aStream)._nextPutAll_($1);
  26995. $ctx1.sendIdx["nextPutAll:"]=1;
  26996. $3=self._classNameFor_(aClass);
  26997. $ctx1.sendIdx["classNameFor:"]=2;
  26998. $2=" subclass: #".__comma($3);
  26999. $ctx1.sendIdx[","]=1;
  27000. $recv(aStream)._nextPutAll_($2);
  27001. $ctx1.sendIdx["nextPutAll:"]=2;
  27002. $recv(aStream)._lf();
  27003. $ctx1.sendIdx["lf"]=1;
  27004. $recv(aStream)._tab();
  27005. $ctx1.sendIdx["tab"]=1;
  27006. $4=$recv(aStream)._nextPutAll_("instanceVariableNames: '");
  27007. $ctx1.sendIdx["nextPutAll:"]=3;
  27008. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27009. return $core.withContext(function($ctx2) {
  27010. return $recv(aStream)._nextPutAll_(each);
  27011. $ctx2.sendIdx["nextPutAll:"]=4;
  27012. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27013. }),(function(){
  27014. return $core.withContext(function($ctx2) {
  27015. return $recv(aStream)._nextPutAll_(" ");
  27016. $ctx2.sendIdx["nextPutAll:"]=5;
  27017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27018. }));
  27019. $recv(aStream)._nextPutAll_("'");
  27020. $ctx1.sendIdx["nextPutAll:"]=6;
  27021. $recv(aStream)._lf();
  27022. $ctx1.sendIdx["lf"]=2;
  27023. $recv(aStream)._tab();
  27024. $6="package: '".__comma($recv(aClass)._category());
  27025. $ctx1.sendIdx[","]=3;
  27026. $5=$recv($6).__comma("'!");
  27027. $ctx1.sendIdx[","]=2;
  27028. $recv(aStream)._nextPutAll_($5);
  27029. $ctx1.sendIdx["nextPutAll:"]=7;
  27030. $7=$recv(aStream)._lf();
  27031. $ctx1.sendIdx["lf"]=3;
  27032. $8=$recv(aClass)._comment();
  27033. $ctx1.sendIdx["comment"]=1;
  27034. $recv($8)._ifNotEmpty_((function(){
  27035. return $core.withContext(function($ctx2) {
  27036. $10="!".__comma(self._classNameFor_(aClass));
  27037. $ctx2.sendIdx[","]=5;
  27038. $9=$recv($10).__comma(" commentStamp!");
  27039. $ctx2.sendIdx[","]=4;
  27040. $recv(aStream)._nextPutAll_($9);
  27041. $ctx2.sendIdx["nextPutAll:"]=8;
  27042. $recv(aStream)._lf();
  27043. $ctx2.sendIdx["lf"]=4;
  27044. $recv(aStream)._nextPutAll_($recv(self._chunkEscape_($recv(aClass)._comment())).__comma("!"));
  27045. $11=$recv(aStream)._lf();
  27046. $ctx2.sendIdx["lf"]=5;
  27047. return $11;
  27048. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27049. }));
  27050. $recv(aStream)._lf();
  27051. return self;
  27052. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27053. },
  27054. args: ["aClass", "aStream"],
  27055. 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",
  27056. referencedClasses: [],
  27057. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  27058. }),
  27059. $globals.ChunkExporter);
  27060. $core.addMethod(
  27061. $core.method({
  27062. selector: "exportMetaDefinitionOf:on:",
  27063. protocol: 'output',
  27064. fn: function (aClass,aStream){
  27065. var self=this;
  27066. return $core.withContext(function($ctx1) {
  27067. var $2,$1,$3;
  27068. $2=$recv(aClass)._class();
  27069. $ctx1.sendIdx["class"]=1;
  27070. $1=$recv($2)._instanceVariableNames();
  27071. $recv($1)._ifNotEmpty_((function(classIvars){
  27072. return $core.withContext(function($ctx2) {
  27073. $recv(aStream)._nextPutAll_(self._classNameFor_($recv(aClass)._class()));
  27074. $ctx2.sendIdx["nextPutAll:"]=1;
  27075. $3=$recv(aStream)._nextPutAll_(" instanceVariableNames: '");
  27076. $ctx2.sendIdx["nextPutAll:"]=2;
  27077. $3;
  27078. $recv(classIvars)._do_separatedBy_((function(each){
  27079. return $core.withContext(function($ctx3) {
  27080. return $recv(aStream)._nextPutAll_(each);
  27081. $ctx3.sendIdx["nextPutAll:"]=3;
  27082. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  27083. }),(function(){
  27084. return $core.withContext(function($ctx3) {
  27085. return $recv(aStream)._nextPutAll_(" ");
  27086. $ctx3.sendIdx["nextPutAll:"]=4;
  27087. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  27088. }));
  27089. $recv(aStream)._nextPutAll_("'!");
  27090. $recv(aStream)._lf();
  27091. $ctx2.sendIdx["lf"]=1;
  27092. return $recv(aStream)._lf();
  27093. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  27094. }));
  27095. return self;
  27096. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27097. },
  27098. args: ["aClass", "aStream"],
  27099. 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 ]",
  27100. referencedClasses: [],
  27101. messageSends: ["ifNotEmpty:", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"]
  27102. }),
  27103. $globals.ChunkExporter);
  27104. $core.addMethod(
  27105. $core.method({
  27106. selector: "exportMethod:on:",
  27107. protocol: 'output',
  27108. fn: function (aMethod,aStream){
  27109. var self=this;
  27110. return $core.withContext(function($ctx1) {
  27111. $recv(aStream)._lf();
  27112. $ctx1.sendIdx["lf"]=1;
  27113. $recv(aStream)._lf();
  27114. $ctx1.sendIdx["lf"]=2;
  27115. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aMethod)._source()));
  27116. $ctx1.sendIdx["nextPutAll:"]=1;
  27117. $recv(aStream)._lf();
  27118. $recv(aStream)._nextPutAll_("!");
  27119. return self;
  27120. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  27121. },
  27122. args: ["aMethod", "aStream"],
  27123. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  27124. referencedClasses: [],
  27125. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]
  27126. }),
  27127. $globals.ChunkExporter);
  27128. $core.addMethod(
  27129. $core.method({
  27130. selector: "exportPackage:on:",
  27131. protocol: 'output',
  27132. fn: function (aPackage,aStream){
  27133. var self=this;
  27134. return $core.withContext(function($ctx1) {
  27135. var $1;
  27136. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27137. self._exportPackageImportsOf_on_(aPackage,aStream);
  27138. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27139. return $core.withContext(function($ctx2) {
  27140. self._exportDefinitionOf_on_(each,aStream);
  27141. $1=self._ownMethodProtocolsOfClass_(each);
  27142. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  27143. self._exportProtocols_on_($1,aStream);
  27144. $ctx2.sendIdx["exportProtocols:on:"]=1;
  27145. self._exportMetaDefinitionOf_on_(each,aStream);
  27146. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_($recv(each)._class()),aStream);
  27147. $ctx2.sendIdx["exportProtocols:on:"]=2;
  27148. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27149. }));
  27150. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  27151. return self;
  27152. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27153. },
  27154. args: ["aPackage", "aStream"],
  27155. 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",
  27156. referencedClasses: [],
  27157. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"]
  27158. }),
  27159. $globals.ChunkExporter);
  27160. $core.addMethod(
  27161. $core.method({
  27162. selector: "exportPackageDefinitionOf:on:",
  27163. protocol: 'output',
  27164. fn: function (aPackage,aStream){
  27165. var self=this;
  27166. return $core.withContext(function($ctx1) {
  27167. var $1;
  27168. $1=$recv("Smalltalk createPackage: '".__comma($recv(aPackage)._name())).__comma("'!");
  27169. $ctx1.sendIdx[","]=1;
  27170. $recv(aStream)._nextPutAll_($1);
  27171. $recv(aStream)._lf();
  27172. return self;
  27173. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27174. },
  27175. args: ["aPackage", "aStream"],
  27176. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  27177. referencedClasses: [],
  27178. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27179. }),
  27180. $globals.ChunkExporter);
  27181. $core.addMethod(
  27182. $core.method({
  27183. selector: "exportPackageImportsOf:on:",
  27184. protocol: 'output',
  27185. fn: function (aPackage,aStream){
  27186. var self=this;
  27187. return $core.withContext(function($ctx1) {
  27188. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  27189. return $core.withContext(function($ctx2) {
  27190. $recv(aStream)._nextPutAll_("(Smalltalk packageAt: '");
  27191. $ctx2.sendIdx["nextPutAll:"]=1;
  27192. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  27193. $ctx2.sendIdx["nextPutAll:"]=2;
  27194. $recv(aStream)._nextPutAll_("') imports: ");
  27195. $ctx2.sendIdx["nextPutAll:"]=3;
  27196. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aPackage)._importsDefinition()));
  27197. $ctx2.sendIdx["nextPutAll:"]=4;
  27198. $recv(aStream)._nextPutAll_("!");
  27199. return $recv(aStream)._lf();
  27200. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27201. }));
  27202. return self;
  27203. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27204. },
  27205. args: ["aPackage", "aStream"],
  27206. 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 ]",
  27207. referencedClasses: [],
  27208. messageSends: ["ifNotEmpty:", "imports", "nextPutAll:", "name", "chunkEscape:", "importsDefinition", "lf"]
  27209. }),
  27210. $globals.ChunkExporter);
  27211. $core.addMethod(
  27212. $core.method({
  27213. selector: "exportProtocol:on:",
  27214. protocol: 'output',
  27215. fn: function (aProtocol,aStream){
  27216. var self=this;
  27217. return $core.withContext(function($ctx1) {
  27218. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  27219. $recv($recv(aProtocol)._methods())._do_((function(method){
  27220. return $core.withContext(function($ctx2) {
  27221. return self._exportMethod_on_(method,aStream);
  27222. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  27223. }));
  27224. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  27225. return self;
  27226. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27227. },
  27228. args: ["aProtocol", "aStream"],
  27229. 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",
  27230. referencedClasses: [],
  27231. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  27232. }),
  27233. $globals.ChunkExporter);
  27234. $core.addMethod(
  27235. $core.method({
  27236. selector: "exportProtocolEpilogueOf:on:",
  27237. protocol: 'output',
  27238. fn: function (aProtocol,aStream){
  27239. var self=this;
  27240. return $core.withContext(function($ctx1) {
  27241. $recv(aStream)._nextPutAll_(" !");
  27242. $recv(aStream)._lf();
  27243. $ctx1.sendIdx["lf"]=1;
  27244. $recv(aStream)._lf();
  27245. return self;
  27246. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27247. },
  27248. args: ["aProtocol", "aStream"],
  27249. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27250. referencedClasses: [],
  27251. messageSends: ["nextPutAll:", "lf"]
  27252. }),
  27253. $globals.ChunkExporter);
  27254. $core.addMethod(
  27255. $core.method({
  27256. selector: "exportProtocolPrologueOf:on:",
  27257. protocol: 'output',
  27258. fn: function (aProtocol,aStream){
  27259. var self=this;
  27260. return $core.withContext(function($ctx1) {
  27261. var $1,$2;
  27262. $1="!".__comma(self._classNameFor_($recv(aProtocol)._theClass()));
  27263. $ctx1.sendIdx[","]=1;
  27264. $recv(aStream)._nextPutAll_($1);
  27265. $ctx1.sendIdx["nextPutAll:"]=1;
  27266. $2=$recv(" methodsFor: '".__comma($recv(aProtocol)._name())).__comma("'!");
  27267. $ctx1.sendIdx[","]=2;
  27268. $recv(aStream)._nextPutAll_($2);
  27269. return self;
  27270. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27271. },
  27272. args: ["aProtocol", "aStream"],
  27273. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  27274. referencedClasses: [],
  27275. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27276. }),
  27277. $globals.ChunkExporter);
  27278. $core.addMethod(
  27279. $core.method({
  27280. selector: "exportProtocols:on:",
  27281. protocol: 'output',
  27282. fn: function (aCollection,aStream){
  27283. var self=this;
  27284. return $core.withContext(function($ctx1) {
  27285. $recv(aCollection)._do_((function(each){
  27286. return $core.withContext(function($ctx2) {
  27287. return self._exportProtocol_on_(each,aStream);
  27288. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27289. }));
  27290. return self;
  27291. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  27292. },
  27293. args: ["aCollection", "aStream"],
  27294. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  27295. referencedClasses: [],
  27296. messageSends: ["do:", "exportProtocol:on:"]
  27297. }),
  27298. $globals.ChunkExporter);
  27299. $core.addMethod(
  27300. $core.method({
  27301. selector: "extensionCategoriesOfPackage:",
  27302. protocol: 'accessing',
  27303. fn: function (aPackage){
  27304. var self=this;
  27305. var name,map,result;
  27306. return $core.withContext(function($ctx1) {
  27307. var $1;
  27308. name=$recv(aPackage)._name();
  27309. result=$recv($globals.OrderedCollection)._new();
  27310. $ctx1.sendIdx["new"]=1;
  27311. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  27312. return $core.withContext(function($ctx2) {
  27313. return $recv([each,$recv(each)._class()])._do_((function(aClass){
  27314. return $core.withContext(function($ctx3) {
  27315. map=$recv($globals.Dictionary)._new();
  27316. map;
  27317. $recv(aClass)._protocolsDo_((function(category,methods){
  27318. return $core.withContext(function($ctx4) {
  27319. $1=$recv(category).__eq("*".__comma(name));
  27320. if($core.assert($1)){
  27321. return $recv(map)._at_put_(category,methods);
  27322. };
  27323. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  27324. }));
  27325. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27326. return $core.withContext(function($ctx4) {
  27327. return $recv(a).__lt_eq(b);
  27328. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  27329. })))._collect_((function(category){
  27330. return $core.withContext(function($ctx4) {
  27331. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  27332. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  27333. })));
  27334. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  27335. }));
  27336. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27337. }));
  27338. $ctx1.sendIdx["do:"]=1;
  27339. return result;
  27340. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  27341. },
  27342. args: ["aPackage"],
  27343. 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",
  27344. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  27345. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27346. }),
  27347. $globals.ChunkExporter);
  27348. $core.addMethod(
  27349. $core.method({
  27350. selector: "ownCategoriesOfClass:",
  27351. protocol: 'accessing',
  27352. fn: function (aClass){
  27353. var self=this;
  27354. var map;
  27355. return $core.withContext(function($ctx1) {
  27356. var $1;
  27357. map=$recv($globals.Dictionary)._new();
  27358. $recv(aClass)._protocolsDo_((function(each,methods){
  27359. return $core.withContext(function($ctx2) {
  27360. $1=$recv(each)._match_("^\x5c*");
  27361. if(!$core.assert($1)){
  27362. return $recv(map)._at_put_(each,methods);
  27363. };
  27364. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  27365. }));
  27366. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27367. return $core.withContext(function($ctx2) {
  27368. return $recv(a).__lt_eq(b);
  27369. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  27370. })))._collect_((function(each){
  27371. return $core.withContext(function($ctx2) {
  27372. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  27373. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27374. }));
  27375. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  27376. },
  27377. args: ["aClass"],
  27378. 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) ]",
  27379. referencedClasses: ["Dictionary", "MethodCategory"],
  27380. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27381. }),
  27382. $globals.ChunkExporter);
  27383. $core.addMethod(
  27384. $core.method({
  27385. selector: "ownCategoriesOfMetaClass:",
  27386. protocol: 'accessing',
  27387. fn: function (aClass){
  27388. var self=this;
  27389. return $core.withContext(function($ctx1) {
  27390. return self._ownCategoriesOfClass_($recv(aClass)._class());
  27391. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  27392. },
  27393. args: ["aClass"],
  27394. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  27395. referencedClasses: [],
  27396. messageSends: ["ownCategoriesOfClass:", "class"]
  27397. }),
  27398. $globals.ChunkExporter);
  27399. $core.addMethod(
  27400. $core.method({
  27401. selector: "ownMethodProtocolsOfClass:",
  27402. protocol: 'accessing',
  27403. fn: function (aClass){
  27404. var self=this;
  27405. return $core.withContext(function($ctx1) {
  27406. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  27407. return $core.withContext(function($ctx2) {
  27408. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  27409. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27410. }));
  27411. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  27412. },
  27413. args: ["aClass"],
  27414. 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 ]",
  27415. referencedClasses: ["ExportMethodProtocol"],
  27416. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  27417. }),
  27418. $globals.ChunkExporter);
  27419. $core.addClass('Exporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27420. $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.).";
  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 $2,$1,$3,$4,$6,$5,$7,$8;
  27429. $recv(aStream)._lf();
  27430. $ctx1.sendIdx["lf"]=1;
  27431. $recv(aStream)._nextPutAll_("$core.addClass(");
  27432. $ctx1.sendIdx["nextPutAll:"]=1;
  27433. $2="'".__comma(self._classNameFor_(aClass));
  27434. $ctx1.sendIdx[","]=2;
  27435. $1=$recv($2).__comma("', ");
  27436. $ctx1.sendIdx[","]=1;
  27437. $recv(aStream)._nextPutAll_($1);
  27438. $ctx1.sendIdx["nextPutAll:"]=2;
  27439. $3=self._jsClassNameFor_($recv(aClass)._superclass());
  27440. $ctx1.sendIdx["jsClassNameFor:"]=1;
  27441. $recv(aStream)._nextPutAll_($3);
  27442. $ctx1.sendIdx["nextPutAll:"]=3;
  27443. $4=$recv(aStream)._nextPutAll_(", [");
  27444. $ctx1.sendIdx["nextPutAll:"]=4;
  27445. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27446. return $core.withContext(function($ctx2) {
  27447. $6="'".__comma(each);
  27448. $ctx2.sendIdx[","]=4;
  27449. $5=$recv($6).__comma("'");
  27450. $ctx2.sendIdx[","]=3;
  27451. return $recv(aStream)._nextPutAll_($5);
  27452. $ctx2.sendIdx["nextPutAll:"]=5;
  27453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27454. }),(function(){
  27455. return $core.withContext(function($ctx2) {
  27456. return $recv(aStream)._nextPutAll_(", ");
  27457. $ctx2.sendIdx["nextPutAll:"]=6;
  27458. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27459. }));
  27460. $recv(aStream)._nextPutAll_("], '");
  27461. $ctx1.sendIdx["nextPutAll:"]=7;
  27462. $recv(aStream)._nextPutAll_($recv($recv(aClass)._category()).__comma("'"));
  27463. $ctx1.sendIdx["nextPutAll:"]=8;
  27464. $7=$recv(aStream)._nextPutAll_(");");
  27465. $ctx1.sendIdx["nextPutAll:"]=9;
  27466. $8=$recv(aClass)._comment();
  27467. $ctx1.sendIdx["comment"]=1;
  27468. $recv($8)._ifNotEmpty_((function(){
  27469. return $core.withContext(function($ctx2) {
  27470. $recv(aStream)._lf();
  27471. $ctx2.sendIdx["lf"]=2;
  27472. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27473. $ctx2.sendIdx["nextPutAll:"]=10;
  27474. $recv(aStream)._lf();
  27475. $ctx2.sendIdx["lf"]=3;
  27476. $recv(aStream)._nextPutAll_(self._jsClassNameFor_(aClass));
  27477. $ctx2.sendIdx["nextPutAll:"]=11;
  27478. $recv(aStream)._nextPutAll_(".comment=");
  27479. $ctx2.sendIdx["nextPutAll:"]=12;
  27480. $recv(aStream)._nextPutAll_($recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavascript());
  27481. $ctx2.sendIdx["nextPutAll:"]=13;
  27482. $recv(aStream)._nextPutAll_(";");
  27483. $ctx2.sendIdx["nextPutAll:"]=14;
  27484. $recv(aStream)._lf();
  27485. $ctx2.sendIdx["lf"]=4;
  27486. return $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27488. }));
  27489. $recv(aStream)._lf();
  27490. return self;
  27491. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27492. },
  27493. args: ["aClass", "aStream"],
  27494. 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",
  27495. referencedClasses: [],
  27496. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "asJavascript", "crlfSanitized"]
  27497. }),
  27498. $globals.Exporter);
  27499. $core.addMethod(
  27500. $core.method({
  27501. selector: "exportMetaDefinitionOf:on:",
  27502. protocol: 'output',
  27503. fn: function (aClass,aStream){
  27504. var self=this;
  27505. return $core.withContext(function($ctx1) {
  27506. var $2,$1,$3,$5,$4;
  27507. $recv(aStream)._lf();
  27508. $ctx1.sendIdx["lf"]=1;
  27509. $2=$recv(aClass)._class();
  27510. $ctx1.sendIdx["class"]=1;
  27511. $1=$recv($2)._instanceVariableNames();
  27512. $recv($1)._ifNotEmpty_((function(classIvars){
  27513. return $core.withContext(function($ctx2) {
  27514. $recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aClass)._class()));
  27515. $ctx2.sendIdx["nextPutAll:"]=1;
  27516. $3=$recv(aStream)._nextPutAll_(".iVarNames = [");
  27517. $ctx2.sendIdx["nextPutAll:"]=2;
  27518. $3;
  27519. $recv(classIvars)._do_separatedBy_((function(each){
  27520. return $core.withContext(function($ctx3) {
  27521. $5="'".__comma(each);
  27522. $ctx3.sendIdx[","]=2;
  27523. $4=$recv($5).__comma("'");
  27524. $ctx3.sendIdx[","]=1;
  27525. return $recv(aStream)._nextPutAll_($4);
  27526. $ctx3.sendIdx["nextPutAll:"]=3;
  27527. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  27528. }),(function(){
  27529. return $core.withContext(function($ctx3) {
  27530. return $recv(aStream)._nextPutAll_(",");
  27531. $ctx3.sendIdx["nextPutAll:"]=4;
  27532. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  27533. }));
  27534. return $recv(aStream)._nextPutAll_("];".__comma($recv($globals.String)._lf()));
  27535. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  27536. }));
  27537. return self;
  27538. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27539. },
  27540. args: ["aClass", "aStream"],
  27541. 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 ]",
  27542. referencedClasses: ["String"],
  27543. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","]
  27544. }),
  27545. $globals.Exporter);
  27546. $core.addMethod(
  27547. $core.method({
  27548. selector: "exportMethod:on:",
  27549. protocol: 'output',
  27550. fn: function (aMethod,aStream){
  27551. var self=this;
  27552. return $core.withContext(function($ctx1) {
  27553. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14;
  27554. $recv(aStream)._nextPutAll_("$core.addMethod(");
  27555. $ctx1.sendIdx["nextPutAll:"]=1;
  27556. $recv(aStream)._lf();
  27557. $ctx1.sendIdx["lf"]=1;
  27558. $recv(aStream)._nextPutAll_("$core.method({");
  27559. $ctx1.sendIdx["nextPutAll:"]=2;
  27560. $recv(aStream)._lf();
  27561. $ctx1.sendIdx["lf"]=2;
  27562. $3=$recv($recv(aMethod)._selector())._asJavascript();
  27563. $ctx1.sendIdx["asJavascript"]=1;
  27564. $2="selector: ".__comma($3);
  27565. $ctx1.sendIdx[","]=2;
  27566. $1=$recv($2).__comma(",");
  27567. $ctx1.sendIdx[","]=1;
  27568. $recv(aStream)._nextPutAll_($1);
  27569. $ctx1.sendIdx["nextPutAll:"]=3;
  27570. $recv(aStream)._lf();
  27571. $ctx1.sendIdx["lf"]=3;
  27572. $5="protocol: '".__comma($recv(aMethod)._protocol());
  27573. $ctx1.sendIdx[","]=4;
  27574. $4=$recv($5).__comma("',");
  27575. $ctx1.sendIdx[","]=3;
  27576. $recv(aStream)._nextPutAll_($4);
  27577. $ctx1.sendIdx["nextPutAll:"]=4;
  27578. $recv(aStream)._lf();
  27579. $ctx1.sendIdx["lf"]=4;
  27580. $7="fn: ".__comma($recv($recv(aMethod)._fn())._compiledSource());
  27581. $ctx1.sendIdx[","]=6;
  27582. $6=$recv($7).__comma(",");
  27583. $ctx1.sendIdx[","]=5;
  27584. $recv(aStream)._nextPutAll_($6);
  27585. $ctx1.sendIdx["nextPutAll:"]=5;
  27586. $recv(aStream)._lf();
  27587. $ctx1.sendIdx["lf"]=5;
  27588. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27589. $ctx1.sendIdx["nextPutAll:"]=6;
  27590. $recv(aStream)._lf();
  27591. $ctx1.sendIdx["lf"]=6;
  27592. $10=$recv($recv(aMethod)._arguments())._asJavascript();
  27593. $ctx1.sendIdx["asJavascript"]=2;
  27594. $9="args: ".__comma($10);
  27595. $ctx1.sendIdx[","]=8;
  27596. $8=$recv($9).__comma(",");
  27597. $ctx1.sendIdx[","]=7;
  27598. $recv(aStream)._nextPutAll_($8);
  27599. $ctx1.sendIdx["nextPutAll:"]=7;
  27600. $recv(aStream)._lf();
  27601. $ctx1.sendIdx["lf"]=7;
  27602. $13=$recv($recv(aMethod)._source())._asJavascript();
  27603. $ctx1.sendIdx["asJavascript"]=3;
  27604. $12="source: ".__comma($13);
  27605. $ctx1.sendIdx[","]=10;
  27606. $11=$recv($12).__comma(",");
  27607. $ctx1.sendIdx[","]=9;
  27608. $recv(aStream)._nextPutAll_($11);
  27609. $ctx1.sendIdx["nextPutAll:"]=8;
  27610. $recv(aStream)._lf();
  27611. $ctx1.sendIdx["lf"]=8;
  27612. $16=$recv($recv(aMethod)._referencedClasses())._asJavascript();
  27613. $ctx1.sendIdx["asJavascript"]=4;
  27614. $15="referencedClasses: ".__comma($16);
  27615. $ctx1.sendIdx[","]=12;
  27616. $14=$recv($15).__comma(",");
  27617. $ctx1.sendIdx[","]=11;
  27618. $recv(aStream)._nextPutAll_($14);
  27619. $ctx1.sendIdx["nextPutAll:"]=9;
  27620. $recv(aStream)._lf();
  27621. $ctx1.sendIdx["lf"]=9;
  27622. $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27623. $ctx1.sendIdx["nextPutAll:"]=10;
  27624. $recv(aStream)._lf();
  27625. $ctx1.sendIdx["lf"]=10;
  27626. $recv(aStream)._nextPutAll_("messageSends: ".__comma($recv($recv(aMethod)._messageSends())._asJavascript()));
  27627. $ctx1.sendIdx["nextPutAll:"]=11;
  27628. $recv(aStream)._lf();
  27629. $ctx1.sendIdx["lf"]=11;
  27630. $recv(aStream)._nextPutAll_("}),");
  27631. $ctx1.sendIdx["nextPutAll:"]=12;
  27632. $recv(aStream)._lf();
  27633. $ctx1.sendIdx["lf"]=12;
  27634. $recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aMethod)._methodClass()));
  27635. $ctx1.sendIdx["nextPutAll:"]=13;
  27636. $recv(aStream)._nextPutAll_(");");
  27637. $recv(aStream)._lf();
  27638. $ctx1.sendIdx["lf"]=13;
  27639. $recv(aStream)._lf();
  27640. return self;
  27641. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  27642. },
  27643. args: ["aMethod", "aStream"],
  27644. 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",
  27645. referencedClasses: [],
  27646. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"]
  27647. }),
  27648. $globals.Exporter);
  27649. $core.addMethod(
  27650. $core.method({
  27651. selector: "exportPackage:on:",
  27652. protocol: 'output',
  27653. fn: function (aPackage,aStream){
  27654. var self=this;
  27655. return $core.withContext(function($ctx1) {
  27656. var $1;
  27657. self._exportPackagePrologueOf_on_(aPackage,aStream);
  27658. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27659. self._exportPackageContextOf_on_(aPackage,aStream);
  27660. self._exportPackageImportsOf_on_(aPackage,aStream);
  27661. self._exportPackageTransportOf_on_(aPackage,aStream);
  27662. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27663. return $core.withContext(function($ctx2) {
  27664. self._exportDefinitionOf_on_(each,aStream);
  27665. $1=$recv(each)._ownMethods();
  27666. $ctx2.sendIdx["ownMethods"]=1;
  27667. $recv($1)._do_((function(method){
  27668. return $core.withContext(function($ctx3) {
  27669. return self._exportMethod_on_(method,aStream);
  27670. $ctx3.sendIdx["exportMethod:on:"]=1;
  27671. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  27672. }));
  27673. $ctx2.sendIdx["do:"]=2;
  27674. self._exportMetaDefinitionOf_on_(each,aStream);
  27675. return $recv($recv($recv(each)._class())._ownMethods())._do_((function(method){
  27676. return $core.withContext(function($ctx3) {
  27677. return self._exportMethod_on_(method,aStream);
  27678. $ctx3.sendIdx["exportMethod:on:"]=2;
  27679. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)});
  27680. }));
  27681. $ctx2.sendIdx["do:"]=3;
  27682. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27683. }));
  27684. $ctx1.sendIdx["do:"]=1;
  27685. $recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  27686. return $core.withContext(function($ctx2) {
  27687. return self._exportMethod_on_(each,aStream);
  27688. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27689. }));
  27690. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  27691. return self;
  27692. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27693. },
  27694. args: ["aPackage", "aStream"],
  27695. 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",
  27696. referencedClasses: [],
  27697. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"]
  27698. }),
  27699. $globals.Exporter);
  27700. $core.addMethod(
  27701. $core.method({
  27702. selector: "exportPackageBodyBlockPrologueOf:on:",
  27703. protocol: 'output',
  27704. fn: function (aPackage,aStream){
  27705. var self=this;
  27706. return $core.withContext(function($ctx1) {
  27707. $recv(aStream)._nextPutAll_("if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;");
  27708. $ctx1.sendIdx["nextPutAll:"]=1;
  27709. $recv(aStream)._lf();
  27710. $ctx1.sendIdx["lf"]=1;
  27711. $recv(aStream)._nextPutAll_("var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  27712. $ctx1.sendIdx["nextPutAll:"]=2;
  27713. $recv(aStream)._lf();
  27714. $ctx1.sendIdx["lf"]=2;
  27715. $recv(aStream)._nextPutAll_("if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;");
  27716. $recv(aStream)._lf();
  27717. return self;
  27718. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27719. },
  27720. args: ["aPackage", "aStream"],
  27721. 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",
  27722. referencedClasses: [],
  27723. messageSends: ["nextPutAll:", "lf"]
  27724. }),
  27725. $globals.Exporter);
  27726. $core.addMethod(
  27727. $core.method({
  27728. selector: "exportPackageContextOf:on:",
  27729. protocol: 'output',
  27730. fn: function (aPackage,aStream){
  27731. var self=this;
  27732. return $core.withContext(function($ctx1) {
  27733. $recv(aStream)._nextPutAll_("$core.packages[");
  27734. $ctx1.sendIdx["nextPutAll:"]=1;
  27735. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27736. $ctx1.sendIdx["nextPutAll:"]=2;
  27737. $recv(aStream)._nextPutAll_("].innerEval = ");
  27738. $ctx1.sendIdx["nextPutAll:"]=3;
  27739. $recv(aStream)._nextPutAll_("function (expr) { return eval(expr); }");
  27740. $ctx1.sendIdx["nextPutAll:"]=4;
  27741. $recv(aStream)._nextPutAll_(";");
  27742. $recv(aStream)._lf();
  27743. return self;
  27744. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27745. },
  27746. args: ["aPackage", "aStream"],
  27747. 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",
  27748. referencedClasses: [],
  27749. messageSends: ["nextPutAll:", "asJavascript", "name", "lf"]
  27750. }),
  27751. $globals.Exporter);
  27752. $core.addMethod(
  27753. $core.method({
  27754. selector: "exportPackageDefinitionOf:on:",
  27755. protocol: 'output',
  27756. fn: function (aPackage,aStream){
  27757. var self=this;
  27758. return $core.withContext(function($ctx1) {
  27759. var $1;
  27760. $recv(aStream)._nextPutAll_("$core.addPackage(");
  27761. $ctx1.sendIdx["nextPutAll:"]=1;
  27762. $1=$recv("'".__comma($recv(aPackage)._name())).__comma("');");
  27763. $ctx1.sendIdx[","]=1;
  27764. $recv(aStream)._nextPutAll_($1);
  27765. $recv(aStream)._lf();
  27766. return self;
  27767. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27768. },
  27769. args: ["aPackage", "aStream"],
  27770. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  27771. referencedClasses: [],
  27772. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27773. }),
  27774. $globals.Exporter);
  27775. $core.addMethod(
  27776. $core.method({
  27777. selector: "exportPackageEpilogueOf:on:",
  27778. protocol: 'output',
  27779. fn: function (aPackage,aStream){
  27780. var self=this;
  27781. return $core.withContext(function($ctx1) {
  27782. self._subclassResponsibility();
  27783. return self;
  27784. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27785. },
  27786. args: ["aPackage", "aStream"],
  27787. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27788. referencedClasses: [],
  27789. messageSends: ["subclassResponsibility"]
  27790. }),
  27791. $globals.Exporter);
  27792. $core.addMethod(
  27793. $core.method({
  27794. selector: "exportPackageImportsOf:on:",
  27795. protocol: 'output',
  27796. fn: function (aPackage,aStream){
  27797. var self=this;
  27798. return $core.withContext(function($ctx1) {
  27799. var $1;
  27800. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  27801. return $core.withContext(function($ctx2) {
  27802. $recv(aStream)._nextPutAll_("$core.packages[");
  27803. $ctx2.sendIdx["nextPutAll:"]=1;
  27804. $1=$recv($recv(aPackage)._name())._asJavascript();
  27805. $ctx2.sendIdx["asJavascript"]=1;
  27806. $recv(aStream)._nextPutAll_($1);
  27807. $ctx2.sendIdx["nextPutAll:"]=2;
  27808. $recv(aStream)._nextPutAll_("].imports = ");
  27809. $ctx2.sendIdx["nextPutAll:"]=3;
  27810. $recv(aStream)._nextPutAll_($recv(imports)._asJavascript());
  27811. $ctx2.sendIdx["nextPutAll:"]=4;
  27812. $recv(aStream)._nextPutAll_(";");
  27813. return $recv(aStream)._lf();
  27814. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27815. }));
  27816. return self;
  27817. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27818. },
  27819. args: ["aPackage", "aStream"],
  27820. 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 ]",
  27821. referencedClasses: [],
  27822. messageSends: ["ifNotEmpty:", "importsAsJson", "nextPutAll:", "asJavascript", "name", "lf"]
  27823. }),
  27824. $globals.Exporter);
  27825. $core.addMethod(
  27826. $core.method({
  27827. selector: "exportPackagePrologueOf:on:",
  27828. protocol: 'output',
  27829. fn: function (aPackage,aStream){
  27830. var self=this;
  27831. return $core.withContext(function($ctx1) {
  27832. self._subclassResponsibility();
  27833. return self;
  27834. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27835. },
  27836. args: ["aPackage", "aStream"],
  27837. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27838. referencedClasses: [],
  27839. messageSends: ["subclassResponsibility"]
  27840. }),
  27841. $globals.Exporter);
  27842. $core.addMethod(
  27843. $core.method({
  27844. selector: "exportPackageTransportOf:on:",
  27845. protocol: 'output',
  27846. fn: function (aPackage,aStream){
  27847. var self=this;
  27848. return $core.withContext(function($ctx1) {
  27849. $recv(aStream)._nextPutAll_("$core.packages[");
  27850. $ctx1.sendIdx["nextPutAll:"]=1;
  27851. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27852. $ctx1.sendIdx["nextPutAll:"]=2;
  27853. $recv(aStream)._nextPutAll_("].transport = ");
  27854. $ctx1.sendIdx["nextPutAll:"]=3;
  27855. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._transport())._asJSONString());
  27856. $ctx1.sendIdx["nextPutAll:"]=4;
  27857. $recv(aStream)._nextPutAll_(";");
  27858. $recv(aStream)._lf();
  27859. return self;
  27860. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27861. },
  27862. args: ["aPackage", "aStream"],
  27863. 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",
  27864. referencedClasses: [],
  27865. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"]
  27866. }),
  27867. $globals.Exporter);
  27868. $core.addMethod(
  27869. $core.method({
  27870. selector: "jsClassNameFor:",
  27871. protocol: 'convenience',
  27872. fn: function (aClass){
  27873. var self=this;
  27874. return $core.withContext(function($ctx1) {
  27875. var $1,$receiver;
  27876. $1=$recv(aClass)._isMetaclass();
  27877. if($core.assert($1)){
  27878. return $recv(self._jsClassNameFor_($recv(aClass)._instanceClass())).__comma(".klass");
  27879. $ctx1.sendIdx[","]=1;
  27880. } else {
  27881. if(($receiver = aClass) == null || $receiver.isNil){
  27882. return "null";
  27883. } else {
  27884. return "$globals.".__comma($recv(aClass)._name());
  27885. };
  27886. };
  27887. }, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},$globals.Exporter)});
  27888. },
  27889. args: ["aClass"],
  27890. 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 ] ]",
  27891. referencedClasses: [],
  27892. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"]
  27893. }),
  27894. $globals.Exporter);
  27895. $core.addMethod(
  27896. $core.method({
  27897. selector: "ownMethodsOfClass:",
  27898. protocol: 'accessing',
  27899. fn: function (aClass){
  27900. var self=this;
  27901. return $core.withContext(function($ctx1) {
  27902. var $1;
  27903. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  27904. return $core.withContext(function($ctx2) {
  27905. $1=$recv(a)._selector();
  27906. $ctx2.sendIdx["selector"]=1;
  27907. return $recv($1).__lt_eq($recv(b)._selector());
  27908. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  27909. })))._reject_((function(each){
  27910. return $core.withContext(function($ctx2) {
  27911. return $recv($recv(each)._protocol())._match_("^\x5c*");
  27912. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27913. }));
  27914. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  27915. },
  27916. args: ["aClass"],
  27917. 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*') ]",
  27918. referencedClasses: [],
  27919. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  27920. }),
  27921. $globals.Exporter);
  27922. $core.addMethod(
  27923. $core.method({
  27924. selector: "ownMethodsOfMetaClass:",
  27925. protocol: 'accessing',
  27926. fn: function (aClass){
  27927. var self=this;
  27928. return $core.withContext(function($ctx1) {
  27929. return self._ownMethodsOfClass_($recv(aClass)._class());
  27930. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  27931. },
  27932. args: ["aClass"],
  27933. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  27934. referencedClasses: [],
  27935. messageSends: ["ownMethodsOfClass:", "class"]
  27936. }),
  27937. $globals.Exporter);
  27938. $core.addClass('AmdExporter', $globals.Exporter, ['namespace'], 'Platform-ImportExport');
  27939. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  27940. $core.addMethod(
  27941. $core.method({
  27942. selector: "amdNamesOfPackages:",
  27943. protocol: 'private',
  27944. fn: function (anArray){
  27945. var self=this;
  27946. return $core.withContext(function($ctx1) {
  27947. var $1;
  27948. return $recv($recv(anArray)._select_((function(each){
  27949. return $core.withContext(function($ctx2) {
  27950. $1=self._amdNamespaceOfPackage_(each);
  27951. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  27952. return $recv($1)._notNil();
  27953. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27954. })))._collect_((function(each){
  27955. return $core.withContext(function($ctx2) {
  27956. return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  27957. $ctx2.sendIdx[","]=1;
  27958. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27959. }));
  27960. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  27961. },
  27962. args: ["anArray"],
  27963. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  27964. referencedClasses: [],
  27965. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  27966. }),
  27967. $globals.AmdExporter);
  27968. $core.addMethod(
  27969. $core.method({
  27970. selector: "amdNamespaceOfPackage:",
  27971. protocol: 'private',
  27972. fn: function (aPackage){
  27973. var self=this;
  27974. return $core.withContext(function($ctx1) {
  27975. var $3,$2,$1;
  27976. $3=$recv(aPackage)._transport();
  27977. $ctx1.sendIdx["transport"]=1;
  27978. $2=$recv($3)._type();
  27979. $1=$recv($2).__eq("amd");
  27980. if($core.assert($1)){
  27981. return $recv($recv(aPackage)._transport())._namespace();
  27982. } else {
  27983. return nil;
  27984. };
  27985. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  27986. },
  27987. args: ["aPackage"],
  27988. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  27989. referencedClasses: [],
  27990. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  27991. }),
  27992. $globals.AmdExporter);
  27993. $core.addMethod(
  27994. $core.method({
  27995. selector: "exportPackageEpilogueOf:on:",
  27996. protocol: 'output',
  27997. fn: function (aPackage,aStream){
  27998. var self=this;
  27999. return $core.withContext(function($ctx1) {
  28000. $recv(aStream)._nextPutAll_("});");
  28001. $recv(aStream)._lf();
  28002. return self;
  28003. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  28004. },
  28005. args: ["aPackage", "aStream"],
  28006. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  28007. referencedClasses: [],
  28008. messageSends: ["nextPutAll:", "lf"]
  28009. }),
  28010. $globals.AmdExporter);
  28011. $core.addMethod(
  28012. $core.method({
  28013. selector: "exportPackagePrologueOf:on:",
  28014. protocol: 'output',
  28015. fn: function (aPackage,aStream){
  28016. var self=this;
  28017. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  28018. return $core.withContext(function($ctx1) {
  28019. var $1,$3,$2,$4,$6,$5,$7,$13,$12,$11,$10,$9,$8,$17,$16,$15,$14;
  28020. pragmaStart="";
  28021. pragmaEnd="";
  28022. importsForOutput=self._importsForOutput_(aPackage);
  28023. loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  28024. $1=$recv(importsForOutput)._value();
  28025. $ctx1.sendIdx["value"]=1;
  28026. $recv($1)._ifNotEmpty_((function(){
  28027. return $core.withContext(function($ctx2) {
  28028. $3=$recv($globals.String)._lf();
  28029. $ctx2.sendIdx["lf"]=1;
  28030. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  28031. $ctx2.sendIdx[","]=2;
  28032. $4=$recv($globals.String)._lf();
  28033. $ctx2.sendIdx["lf"]=2;
  28034. pragmaStart=$recv($2).__comma($4);
  28035. $ctx2.sendIdx[","]=1;
  28036. pragmaStart;
  28037. $6=$recv($globals.String)._lf();
  28038. $ctx2.sendIdx["lf"]=3;
  28039. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  28040. $ctx2.sendIdx[","]=4;
  28041. $7=$recv($globals.String)._lf();
  28042. $ctx2.sendIdx["lf"]=4;
  28043. pragmaEnd=$recv($5).__comma($7);
  28044. $ctx2.sendIdx[","]=3;
  28045. return pragmaEnd;
  28046. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28047. }));
  28048. $recv(aStream)._nextPutAll_("define(");
  28049. $ctx1.sendIdx["nextPutAll:"]=1;
  28050. $13=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  28051. $ctx1.sendIdx[","]=7;
  28052. $12=$recv($13).__comma([":2:"]);
  28053. $ctx1.sendIdx[","]=6;
  28054. $11=$recv($12).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  28055. $ctx1.sendIdx[","]=5;
  28056. $10=$recv($11)._asJavascript();
  28057. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  28058. $ctx1.sendIdx["replace:with:"]=2;
  28059. $8=$recv($9)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  28060. $ctx1.sendIdx["replace:with:"]=1;
  28061. $recv(aStream)._nextPutAll_($8);
  28062. $ctx1.sendIdx["nextPutAll:"]=2;
  28063. $recv(aStream)._nextPutAll_(", function(");
  28064. $ctx1.sendIdx["nextPutAll:"]=3;
  28065. $17=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  28066. $ctx1.sendIdx[","]=8;
  28067. $16=$recv($17)._join_(",");
  28068. $15=$recv($16)._replace_with_(",\x5cs*:1:",pragmaStart);
  28069. $14=$recv($15)._replace_with_(",\x5cs*:2:",pragmaEnd);
  28070. $ctx1.sendIdx["replace:with:"]=3;
  28071. $recv(aStream)._nextPutAll_($14);
  28072. $ctx1.sendIdx["nextPutAll:"]=4;
  28073. $recv(aStream)._nextPutAll_("){\x22use strict\x22;");
  28074. $recv(aStream)._lf();
  28075. self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  28076. return self;
  28077. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  28078. },
  28079. args: ["aPackage", "aStream"],
  28080. 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",
  28081. referencedClasses: ["String"],
  28082. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "nextPutAll:", "replace:with:", "asJavascript", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  28083. }),
  28084. $globals.AmdExporter);
  28085. $core.addMethod(
  28086. $core.method({
  28087. selector: "importsForOutput:",
  28088. protocol: 'private',
  28089. fn: function (aPackage){
  28090. var self=this;
  28091. var namedImports,anonImports,importVarNames;
  28092. return $core.withContext(function($ctx1) {
  28093. var $1;
  28094. namedImports=[];
  28095. anonImports=[];
  28096. importVarNames=[];
  28097. $recv($recv(aPackage)._imports())._do_((function(each){
  28098. return $core.withContext(function($ctx2) {
  28099. $1=$recv(each)._isString();
  28100. if($core.assert($1)){
  28101. return $recv(anonImports)._add_(each);
  28102. $ctx2.sendIdx["add:"]=1;
  28103. } else {
  28104. $recv(namedImports)._add_($recv(each)._value());
  28105. $ctx2.sendIdx["add:"]=2;
  28106. return $recv(importVarNames)._add_($recv(each)._key());
  28107. };
  28108. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28109. }));
  28110. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  28111. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  28112. },
  28113. args: ["aPackage"],
  28114. 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)",
  28115. referencedClasses: [],
  28116. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  28117. }),
  28118. $globals.AmdExporter);
  28119. $core.addClass('ChunkParser', $globals.Object, ['stream', 'last'], 'Platform-ImportExport');
  28120. $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";
  28121. $core.addMethod(
  28122. $core.method({
  28123. selector: "last",
  28124. protocol: 'accessing',
  28125. fn: function (){
  28126. var self=this;
  28127. return self["@last"];
  28128. },
  28129. args: [],
  28130. source: "last\x0a\x09^ last",
  28131. referencedClasses: [],
  28132. messageSends: []
  28133. }),
  28134. $globals.ChunkParser);
  28135. $core.addMethod(
  28136. $core.method({
  28137. selector: "nextChunk",
  28138. protocol: 'reading',
  28139. fn: function (){
  28140. var self=this;
  28141. var char,result,chunk;
  28142. return $core.withContext(function($ctx1) {
  28143. var $1,$2,$3,$4;
  28144. var $early={};
  28145. try {
  28146. result=""._writeStream();
  28147. $recv((function(){
  28148. return $core.withContext(function($ctx2) {
  28149. char=$recv(self["@stream"])._next();
  28150. $ctx2.sendIdx["next"]=1;
  28151. char;
  28152. return $recv(char)._notNil();
  28153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28154. }))._whileTrue_((function(){
  28155. return $core.withContext(function($ctx2) {
  28156. $1=$recv(char).__eq("!");
  28157. $ctx2.sendIdx["="]=1;
  28158. if($core.assert($1)){
  28159. $2=$recv($recv(self["@stream"])._peek()).__eq("!");
  28160. if($core.assert($2)){
  28161. $recv(self["@stream"])._next();
  28162. } else {
  28163. self["@last"]=$recv($recv(result)._contents())._trimBoth();
  28164. $3=self["@last"];
  28165. throw $early=[$3];
  28166. };
  28167. };
  28168. return $recv(result)._nextPut_(char);
  28169. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28170. }));
  28171. self["@last"]=nil;
  28172. $4=self["@last"];
  28173. return $4;
  28174. }
  28175. catch(e) {if(e===$early)return e[0]; throw e}
  28176. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  28177. },
  28178. args: [],
  28179. 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",
  28180. referencedClasses: [],
  28181. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  28182. }),
  28183. $globals.ChunkParser);
  28184. $core.addMethod(
  28185. $core.method({
  28186. selector: "stream:",
  28187. protocol: 'accessing',
  28188. fn: function (aStream){
  28189. var self=this;
  28190. self["@stream"]=aStream;
  28191. return self;
  28192. },
  28193. args: ["aStream"],
  28194. source: "stream: aStream\x0a\x09stream := aStream",
  28195. referencedClasses: [],
  28196. messageSends: []
  28197. }),
  28198. $globals.ChunkParser);
  28199. $core.addMethod(
  28200. $core.method({
  28201. selector: "on:",
  28202. protocol: 'instance creation',
  28203. fn: function (aStream){
  28204. var self=this;
  28205. return $core.withContext(function($ctx1) {
  28206. return $recv(self._new())._stream_(aStream);
  28207. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)});
  28208. },
  28209. args: ["aStream"],
  28210. source: "on: aStream\x0a\x09^ self new stream: aStream",
  28211. referencedClasses: [],
  28212. messageSends: ["stream:", "new"]
  28213. }),
  28214. $globals.ChunkParser.klass);
  28215. $core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Platform-ImportExport');
  28216. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  28217. $core.addMethod(
  28218. $core.method({
  28219. selector: "class:",
  28220. protocol: 'accessing',
  28221. fn: function (aClass){
  28222. var self=this;
  28223. self["@class"]=aClass;
  28224. return self;
  28225. },
  28226. args: ["aClass"],
  28227. source: "class: aClass\x0a\x09class := aClass",
  28228. referencedClasses: [],
  28229. messageSends: []
  28230. }),
  28231. $globals.ClassCommentReader);
  28232. $core.addMethod(
  28233. $core.method({
  28234. selector: "initialize",
  28235. protocol: 'initialization',
  28236. fn: function (){
  28237. var self=this;
  28238. return $core.withContext(function($ctx1) {
  28239. (
  28240. $ctx1.supercall = true,
  28241. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  28242. $ctx1.supercall = false;
  28243. return self;
  28244. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  28245. },
  28246. args: [],
  28247. source: "initialize\x0a\x09super initialize.",
  28248. referencedClasses: [],
  28249. messageSends: ["initialize"]
  28250. }),
  28251. $globals.ClassCommentReader);
  28252. $core.addMethod(
  28253. $core.method({
  28254. selector: "scanFrom:",
  28255. protocol: 'fileIn',
  28256. fn: function (aChunkParser){
  28257. var self=this;
  28258. var chunk;
  28259. return $core.withContext(function($ctx1) {
  28260. chunk=$recv(aChunkParser)._nextChunk();
  28261. $recv(chunk)._ifNotEmpty_((function(){
  28262. return $core.withContext(function($ctx2) {
  28263. return self._setComment_(chunk);
  28264. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28265. }));
  28266. return self;
  28267. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  28268. },
  28269. args: ["aChunkParser"],
  28270. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  28271. referencedClasses: [],
  28272. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  28273. }),
  28274. $globals.ClassCommentReader);
  28275. $core.addMethod(
  28276. $core.method({
  28277. selector: "setComment:",
  28278. protocol: 'private',
  28279. fn: function (aString){
  28280. var self=this;
  28281. return $core.withContext(function($ctx1) {
  28282. $recv(self["@class"])._comment_(aString);
  28283. return self;
  28284. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  28285. },
  28286. args: ["aString"],
  28287. source: "setComment: aString\x0a\x09class comment: aString",
  28288. referencedClasses: [],
  28289. messageSends: ["comment:"]
  28290. }),
  28291. $globals.ClassCommentReader);
  28292. $core.addClass('ClassProtocolReader', $globals.Object, ['class', 'category'], 'Platform-ImportExport');
  28293. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  28294. $core.addMethod(
  28295. $core.method({
  28296. selector: "class:category:",
  28297. protocol: 'accessing',
  28298. fn: function (aClass,aString){
  28299. var self=this;
  28300. self["@class"]=aClass;
  28301. self["@category"]=aString;
  28302. return self;
  28303. },
  28304. args: ["aClass", "aString"],
  28305. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  28306. referencedClasses: [],
  28307. messageSends: []
  28308. }),
  28309. $globals.ClassProtocolReader);
  28310. $core.addMethod(
  28311. $core.method({
  28312. selector: "compileMethod:",
  28313. protocol: 'private',
  28314. fn: function (aString){
  28315. var self=this;
  28316. return $core.withContext(function($ctx1) {
  28317. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  28318. return self;
  28319. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  28320. },
  28321. args: ["aString"],
  28322. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  28323. referencedClasses: ["Compiler"],
  28324. messageSends: ["install:forClass:protocol:", "new"]
  28325. }),
  28326. $globals.ClassProtocolReader);
  28327. $core.addMethod(
  28328. $core.method({
  28329. selector: "initialize",
  28330. protocol: 'initialization',
  28331. fn: function (){
  28332. var self=this;
  28333. return $core.withContext(function($ctx1) {
  28334. (
  28335. $ctx1.supercall = true,
  28336. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  28337. $ctx1.supercall = false;
  28338. return self;
  28339. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  28340. },
  28341. args: [],
  28342. source: "initialize\x0a\x09super initialize.",
  28343. referencedClasses: [],
  28344. messageSends: ["initialize"]
  28345. }),
  28346. $globals.ClassProtocolReader);
  28347. $core.addMethod(
  28348. $core.method({
  28349. selector: "scanFrom:",
  28350. protocol: 'fileIn',
  28351. fn: function (aChunkParser){
  28352. var self=this;
  28353. var chunk;
  28354. return $core.withContext(function($ctx1) {
  28355. $recv((function(){
  28356. return $core.withContext(function($ctx2) {
  28357. chunk=$recv(aChunkParser)._nextChunk();
  28358. chunk;
  28359. return $recv(chunk)._isEmpty();
  28360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28361. }))._whileFalse_((function(){
  28362. return $core.withContext(function($ctx2) {
  28363. return self._compileMethod_(chunk);
  28364. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28365. }));
  28366. return self;
  28367. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  28368. },
  28369. args: ["aChunkParser"],
  28370. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  28371. referencedClasses: [],
  28372. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  28373. }),
  28374. $globals.ClassProtocolReader);
  28375. $core.addClass('ExportMethodProtocol', $globals.Object, ['name', 'theClass'], 'Platform-ImportExport');
  28376. $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.";
  28377. $core.addMethod(
  28378. $core.method({
  28379. selector: "methods",
  28380. protocol: 'accessing',
  28381. fn: function (){
  28382. var self=this;
  28383. return $core.withContext(function($ctx1) {
  28384. var $1;
  28385. return $recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  28386. return $core.withContext(function($ctx2) {
  28387. $1=$recv(a)._selector();
  28388. $ctx2.sendIdx["selector"]=1;
  28389. return $recv($1).__lt_eq($recv(b)._selector());
  28390. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28391. }));
  28392. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  28393. },
  28394. args: [],
  28395. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  28396. referencedClasses: [],
  28397. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  28398. }),
  28399. $globals.ExportMethodProtocol);
  28400. $core.addMethod(
  28401. $core.method({
  28402. selector: "name",
  28403. protocol: 'accessing',
  28404. fn: function (){
  28405. var self=this;
  28406. return self["@name"];
  28407. },
  28408. args: [],
  28409. source: "name\x0a\x09^ name",
  28410. referencedClasses: [],
  28411. messageSends: []
  28412. }),
  28413. $globals.ExportMethodProtocol);
  28414. $core.addMethod(
  28415. $core.method({
  28416. selector: "name:",
  28417. protocol: 'accessing',
  28418. fn: function (aString){
  28419. var self=this;
  28420. self["@name"]=aString;
  28421. return self;
  28422. },
  28423. args: ["aString"],
  28424. source: "name: aString\x0a\x09name := aString",
  28425. referencedClasses: [],
  28426. messageSends: []
  28427. }),
  28428. $globals.ExportMethodProtocol);
  28429. $core.addMethod(
  28430. $core.method({
  28431. selector: "theClass",
  28432. protocol: 'accessing',
  28433. fn: function (){
  28434. var self=this;
  28435. return self["@theClass"];
  28436. },
  28437. args: [],
  28438. source: "theClass\x0a\x09^ theClass",
  28439. referencedClasses: [],
  28440. messageSends: []
  28441. }),
  28442. $globals.ExportMethodProtocol);
  28443. $core.addMethod(
  28444. $core.method({
  28445. selector: "theClass:",
  28446. protocol: 'accessing',
  28447. fn: function (aClass){
  28448. var self=this;
  28449. self["@theClass"]=aClass;
  28450. return self;
  28451. },
  28452. args: ["aClass"],
  28453. source: "theClass: aClass\x0a\x09theClass := aClass",
  28454. referencedClasses: [],
  28455. messageSends: []
  28456. }),
  28457. $globals.ExportMethodProtocol);
  28458. $core.addMethod(
  28459. $core.method({
  28460. selector: "name:theClass:",
  28461. protocol: 'instance creation',
  28462. fn: function (aString,aClass){
  28463. var self=this;
  28464. return $core.withContext(function($ctx1) {
  28465. var $1;
  28466. $1=self._new();
  28467. $recv($1)._name_(aString);
  28468. $recv($1)._theClass_(aClass);
  28469. return $recv($1)._yourself();
  28470. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)});
  28471. },
  28472. args: ["aString", "aClass"],
  28473. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  28474. referencedClasses: [],
  28475. messageSends: ["name:", "new", "theClass:", "yourself"]
  28476. }),
  28477. $globals.ExportMethodProtocol.klass);
  28478. $core.addClass('Importer', $globals.Object, ['lastSection', 'lastChunk'], 'Platform-ImportExport');
  28479. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  28480. $core.addMethod(
  28481. $core.method({
  28482. selector: "import:",
  28483. protocol: 'fileIn',
  28484. fn: function (aStream){
  28485. var self=this;
  28486. var chunk,result,parser,lastEmpty;
  28487. return $core.withContext(function($ctx1) {
  28488. var $1;
  28489. parser=$recv($globals.ChunkParser)._on_(aStream);
  28490. lastEmpty=false;
  28491. self["@lastSection"]="n/a, not started";
  28492. self["@lastChunk"]=nil;
  28493. $recv((function(){
  28494. return $core.withContext(function($ctx2) {
  28495. $recv((function(){
  28496. return $core.withContext(function($ctx3) {
  28497. chunk=$recv(parser)._nextChunk();
  28498. chunk;
  28499. return $recv(chunk)._isNil();
  28500. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28501. }))._whileFalse_((function(){
  28502. return $core.withContext(function($ctx3) {
  28503. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  28504. lastEmpty=true;
  28505. return lastEmpty;
  28506. }),(function(){
  28507. return $core.withContext(function($ctx4) {
  28508. self["@lastSection"]=chunk;
  28509. self["@lastSection"];
  28510. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  28511. result;
  28512. $1=lastEmpty;
  28513. if($core.assert($1)){
  28514. lastEmpty=false;
  28515. lastEmpty;
  28516. return $recv(result)._scanFrom_(parser);
  28517. };
  28518. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  28519. }));
  28520. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28521. }));
  28522. self["@lastSection"]="n/a, finished";
  28523. return self["@lastSection"];
  28524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28525. }))._on_do_($globals.Error,(function(e){
  28526. return $core.withContext(function($ctx2) {
  28527. self["@lastChunk"]=$recv(parser)._last();
  28528. self["@lastChunk"];
  28529. return $recv(e)._resignal();
  28530. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  28531. }));
  28532. return self;
  28533. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  28534. },
  28535. args: ["aStream"],
  28536. 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 ].",
  28537. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  28538. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  28539. }),
  28540. $globals.Importer);
  28541. $core.addMethod(
  28542. $core.method({
  28543. selector: "lastChunk",
  28544. protocol: 'accessing',
  28545. fn: function (){
  28546. var self=this;
  28547. return self["@lastChunk"];
  28548. },
  28549. args: [],
  28550. source: "lastChunk\x0a\x09^ lastChunk",
  28551. referencedClasses: [],
  28552. messageSends: []
  28553. }),
  28554. $globals.Importer);
  28555. $core.addMethod(
  28556. $core.method({
  28557. selector: "lastSection",
  28558. protocol: 'accessing',
  28559. fn: function (){
  28560. var self=this;
  28561. return self["@lastSection"];
  28562. },
  28563. args: [],
  28564. source: "lastSection\x0a\x09^ lastSection",
  28565. referencedClasses: [],
  28566. messageSends: []
  28567. }),
  28568. $globals.Importer);
  28569. $core.addClass('PackageCommitError', $globals.Error, [], 'Platform-ImportExport');
  28570. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  28571. $core.addClass('PackageHandler', $globals.Object, [], 'Platform-ImportExport');
  28572. $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.";
  28573. $core.addMethod(
  28574. $core.method({
  28575. selector: "ajaxPutAt:data:onSuccess:onError:",
  28576. protocol: 'private',
  28577. fn: function (aURL,aString,aBlock,anotherBlock){
  28578. var self=this;
  28579. var xhr;
  28580. return $core.withContext(function($ctx1) {
  28581. var $1,$4,$3,$2;
  28582. xhr=$recv($globals.Platform)._newXhr();
  28583. $recv(xhr)._open_url_async_("PUT",aURL,true);
  28584. $recv(xhr)._onreadystatechange_((function(){
  28585. return $core.withContext(function($ctx2) {
  28586. $1=$recv($recv(xhr)._readyState()).__eq((4));
  28587. if($core.assert($1)){
  28588. $4=$recv(xhr)._status();
  28589. $ctx2.sendIdx["status"]=1;
  28590. $3=$recv($4).__gt_eq((200));
  28591. $2=$recv($3)._and_((function(){
  28592. return $core.withContext(function($ctx3) {
  28593. return $recv($recv(xhr)._status()).__lt((300));
  28594. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28595. }));
  28596. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  28597. };
  28598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28599. }));
  28600. $recv(xhr)._send_(aString);
  28601. return self;
  28602. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  28603. },
  28604. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  28605. 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",
  28606. referencedClasses: ["Platform"],
  28607. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  28608. }),
  28609. $globals.PackageHandler);
  28610. $core.addMethod(
  28611. $core.method({
  28612. selector: "chunkContentsFor:",
  28613. protocol: 'accessing',
  28614. fn: function (aPackage){
  28615. var self=this;
  28616. return $core.withContext(function($ctx1) {
  28617. return $recv($globals.String)._streamContents_((function(str){
  28618. return $core.withContext(function($ctx2) {
  28619. return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str);
  28620. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28621. }));
  28622. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28623. },
  28624. args: ["aPackage"],
  28625. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  28626. referencedClasses: ["String"],
  28627. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  28628. }),
  28629. $globals.PackageHandler);
  28630. $core.addMethod(
  28631. $core.method({
  28632. selector: "chunkExporter",
  28633. protocol: 'factory',
  28634. fn: function (){
  28635. var self=this;
  28636. return $core.withContext(function($ctx1) {
  28637. return $recv(self._chunkExporterClass())._new();
  28638. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  28639. },
  28640. args: [],
  28641. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  28642. referencedClasses: [],
  28643. messageSends: ["new", "chunkExporterClass"]
  28644. }),
  28645. $globals.PackageHandler);
  28646. $core.addMethod(
  28647. $core.method({
  28648. selector: "chunkExporterClass",
  28649. protocol: 'accessing',
  28650. fn: function (){
  28651. var self=this;
  28652. return $globals.ChunkExporter;
  28653. },
  28654. args: [],
  28655. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  28656. referencedClasses: ["ChunkExporter"],
  28657. messageSends: []
  28658. }),
  28659. $globals.PackageHandler);
  28660. $core.addMethod(
  28661. $core.method({
  28662. selector: "commit:",
  28663. protocol: 'committing',
  28664. fn: function (aPackage){
  28665. var self=this;
  28666. return $core.withContext(function($ctx1) {
  28667. var $1,$2;
  28668. self._commit_onSuccess_onError_(aPackage,(function(){
  28669. }),(function(error){
  28670. return $core.withContext(function($ctx2) {
  28671. $1=$recv($globals.PackageCommitError)._new();
  28672. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  28673. $ctx2.sendIdx[","]=1;
  28674. $recv($1)._messageText_($2);
  28675. return $recv($1)._signal();
  28676. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  28677. }));
  28678. return self;
  28679. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  28680. },
  28681. args: ["aPackage"],
  28682. 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 ]",
  28683. referencedClasses: ["PackageCommitError"],
  28684. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  28685. }),
  28686. $globals.PackageHandler);
  28687. $core.addMethod(
  28688. $core.method({
  28689. selector: "commit:onSuccess:onError:",
  28690. protocol: 'committing',
  28691. fn: function (aPackage,aBlock,anotherBlock){
  28692. var self=this;
  28693. return $core.withContext(function($ctx1) {
  28694. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  28695. return $core.withContext(function($ctx2) {
  28696. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  28697. return $core.withContext(function($ctx3) {
  28698. $recv(aPackage)._beClean();
  28699. return $recv(aBlock)._value();
  28700. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28701. }),anotherBlock);
  28702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28703. }),anotherBlock);
  28704. return self;
  28705. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28706. },
  28707. args: ["aPackage", "aBlock", "anotherBlock"],
  28708. 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",
  28709. referencedClasses: [],
  28710. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  28711. }),
  28712. $globals.PackageHandler);
  28713. $core.addMethod(
  28714. $core.method({
  28715. selector: "commitJsFileFor:onSuccess:onError:",
  28716. protocol: 'committing',
  28717. fn: function (aPackage,aBlock,anotherBlock){
  28718. var self=this;
  28719. return $core.withContext(function($ctx1) {
  28720. var $2,$1;
  28721. $2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28722. $ctx1.sendIdx[","]=2;
  28723. $1=$recv($2).__comma(".js");
  28724. $ctx1.sendIdx[","]=1;
  28725. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  28726. return self;
  28727. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28728. },
  28729. args: ["aPackage", "aBlock", "anotherBlock"],
  28730. 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",
  28731. referencedClasses: [],
  28732. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  28733. }),
  28734. $globals.PackageHandler);
  28735. $core.addMethod(
  28736. $core.method({
  28737. selector: "commitPathJsFor:",
  28738. protocol: 'accessing',
  28739. fn: function (aPackage){
  28740. var self=this;
  28741. return $core.withContext(function($ctx1) {
  28742. self._subclassResponsibility();
  28743. return self;
  28744. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28745. },
  28746. args: ["aPackage"],
  28747. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  28748. referencedClasses: [],
  28749. messageSends: ["subclassResponsibility"]
  28750. }),
  28751. $globals.PackageHandler);
  28752. $core.addMethod(
  28753. $core.method({
  28754. selector: "commitPathStFor:",
  28755. protocol: 'accessing',
  28756. fn: function (aPackage){
  28757. var self=this;
  28758. return $core.withContext(function($ctx1) {
  28759. self._subclassResponsibility();
  28760. return self;
  28761. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28762. },
  28763. args: ["aPackage"],
  28764. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  28765. referencedClasses: [],
  28766. messageSends: ["subclassResponsibility"]
  28767. }),
  28768. $globals.PackageHandler);
  28769. $core.addMethod(
  28770. $core.method({
  28771. selector: "commitStFileFor:onSuccess:onError:",
  28772. protocol: 'committing',
  28773. fn: function (aPackage,aBlock,anotherBlock){
  28774. var self=this;
  28775. return $core.withContext(function($ctx1) {
  28776. var $2,$1;
  28777. $2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28778. $ctx1.sendIdx[","]=2;
  28779. $1=$recv($2).__comma(".st");
  28780. $ctx1.sendIdx[","]=1;
  28781. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  28782. return self;
  28783. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28784. },
  28785. args: ["aPackage", "aBlock", "anotherBlock"],
  28786. 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",
  28787. referencedClasses: [],
  28788. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  28789. }),
  28790. $globals.PackageHandler);
  28791. $core.addMethod(
  28792. $core.method({
  28793. selector: "contentsFor:",
  28794. protocol: 'accessing',
  28795. fn: function (aPackage){
  28796. var self=this;
  28797. return $core.withContext(function($ctx1) {
  28798. return $recv($globals.String)._streamContents_((function(str){
  28799. return $core.withContext(function($ctx2) {
  28800. return $recv(self._exporter())._exportPackage_on_(aPackage,str);
  28801. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28802. }));
  28803. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28804. },
  28805. args: ["aPackage"],
  28806. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  28807. referencedClasses: ["String"],
  28808. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  28809. }),
  28810. $globals.PackageHandler);
  28811. $core.addMethod(
  28812. $core.method({
  28813. selector: "exporter",
  28814. protocol: 'factory',
  28815. fn: function (){
  28816. var self=this;
  28817. return $core.withContext(function($ctx1) {
  28818. return $recv(self._exporterClass())._new();
  28819. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  28820. },
  28821. args: [],
  28822. source: "exporter\x0a\x09^ self exporterClass new",
  28823. referencedClasses: [],
  28824. messageSends: ["new", "exporterClass"]
  28825. }),
  28826. $globals.PackageHandler);
  28827. $core.addMethod(
  28828. $core.method({
  28829. selector: "exporterClass",
  28830. protocol: 'accessing',
  28831. fn: function (){
  28832. var self=this;
  28833. return $core.withContext(function($ctx1) {
  28834. self._subclassResponsibility();
  28835. return self;
  28836. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  28837. },
  28838. args: [],
  28839. source: "exporterClass\x0a\x09self subclassResponsibility",
  28840. referencedClasses: [],
  28841. messageSends: ["subclassResponsibility"]
  28842. }),
  28843. $globals.PackageHandler);
  28844. $core.addMethod(
  28845. $core.method({
  28846. selector: "load:",
  28847. protocol: 'loading',
  28848. fn: function (aPackage){
  28849. var self=this;
  28850. return $core.withContext(function($ctx1) {
  28851. self._subclassResponsibility();
  28852. return self;
  28853. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  28854. },
  28855. args: ["aPackage"],
  28856. source: "load: aPackage\x0a\x09self subclassResponsibility",
  28857. referencedClasses: [],
  28858. messageSends: ["subclassResponsibility"]
  28859. }),
  28860. $globals.PackageHandler);
  28861. $core.addMethod(
  28862. $core.method({
  28863. selector: "onCommitError:",
  28864. protocol: 'error handling',
  28865. fn: function (anError){
  28866. var self=this;
  28867. return $core.withContext(function($ctx1) {
  28868. var $1,$2;
  28869. $1=$recv($globals.PackageCommitError)._new();
  28870. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  28871. $ctx1.sendIdx[","]=1;
  28872. $recv($1)._messageText_($2);
  28873. $recv($1)._signal();
  28874. return self;
  28875. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  28876. },
  28877. args: ["anError"],
  28878. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  28879. referencedClasses: ["PackageCommitError"],
  28880. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  28881. }),
  28882. $globals.PackageHandler);
  28883. $core.addClass('AmdPackageHandler', $globals.PackageHandler, [], 'Platform-ImportExport');
  28884. $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.";
  28885. $core.addMethod(
  28886. $core.method({
  28887. selector: "commitPathJsFor:",
  28888. protocol: 'accessing',
  28889. fn: function (aPackage){
  28890. var self=this;
  28891. return $core.withContext(function($ctx1) {
  28892. return self._toUrl_(self._namespaceFor_(aPackage));
  28893. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  28894. },
  28895. args: ["aPackage"],
  28896. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  28897. referencedClasses: [],
  28898. messageSends: ["toUrl:", "namespaceFor:"]
  28899. }),
  28900. $globals.AmdPackageHandler);
  28901. $core.addMethod(
  28902. $core.method({
  28903. selector: "commitPathStFor:",
  28904. protocol: 'accessing',
  28905. fn: function (aPackage){
  28906. var self=this;
  28907. var path,pathWithout;
  28908. return $core.withContext(function($ctx1) {
  28909. var $1,$2;
  28910. $1=$recv(self._namespaceFor_(aPackage)).__comma("/_source");
  28911. $ctx1.sendIdx[","]=1;
  28912. path=self._toUrl_($1);
  28913. pathWithout=self._commitPathJsFor_(aPackage);
  28914. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  28915. if($core.assert($2)){
  28916. return pathWithout;
  28917. } else {
  28918. return path;
  28919. };
  28920. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  28921. },
  28922. args: ["aPackage"],
  28923. 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 ]",
  28924. referencedClasses: [],
  28925. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  28926. }),
  28927. $globals.AmdPackageHandler);
  28928. $core.addMethod(
  28929. $core.method({
  28930. selector: "exporterClass",
  28931. protocol: 'accessing',
  28932. fn: function (){
  28933. var self=this;
  28934. return $globals.AmdExporter;
  28935. },
  28936. args: [],
  28937. source: "exporterClass\x0a\x09^ AmdExporter",
  28938. referencedClasses: ["AmdExporter"],
  28939. messageSends: []
  28940. }),
  28941. $globals.AmdPackageHandler);
  28942. $core.addMethod(
  28943. $core.method({
  28944. selector: "load:",
  28945. protocol: 'loading',
  28946. fn: function (aPackage){
  28947. var self=this;
  28948. return $core.withContext(function($ctx1) {
  28949. var $1,$3,$2,$receiver;
  28950. $1=$recv($globals.Smalltalk)._amdRequire();
  28951. if(($receiver = $1) == null || $receiver.isNil){
  28952. self._error_("AMD loader not present");
  28953. } else {
  28954. var require;
  28955. require=$receiver;
  28956. $3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28957. $ctx1.sendIdx[","]=1;
  28958. $2=$recv($globals.Array)._with_($3);
  28959. $recv(require)._value_($2);
  28960. };
  28961. return self;
  28962. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  28963. },
  28964. args: ["aPackage"],
  28965. 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 ) ]",
  28966. referencedClasses: ["Smalltalk", "Array"],
  28967. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  28968. }),
  28969. $globals.AmdPackageHandler);
  28970. $core.addMethod(
  28971. $core.method({
  28972. selector: "namespaceFor:",
  28973. protocol: 'committing',
  28974. fn: function (aPackage){
  28975. var self=this;
  28976. return $core.withContext(function($ctx1) {
  28977. return $recv($recv(aPackage)._transport())._namespace();
  28978. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  28979. },
  28980. args: ["aPackage"],
  28981. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  28982. referencedClasses: [],
  28983. messageSends: ["namespace", "transport"]
  28984. }),
  28985. $globals.AmdPackageHandler);
  28986. $core.addMethod(
  28987. $core.method({
  28988. selector: "toUrl:",
  28989. protocol: 'private',
  28990. fn: function (aString){
  28991. var self=this;
  28992. return $core.withContext(function($ctx1) {
  28993. var $1,$receiver;
  28994. $1=$recv($globals.Smalltalk)._amdRequire();
  28995. if(($receiver = $1) == null || $receiver.isNil){
  28996. return self._error_("AMD loader not present");
  28997. } else {
  28998. var require;
  28999. require=$receiver;
  29000. return $recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  29001. };
  29002. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  29003. },
  29004. args: ["aString"],
  29005. 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 ]",
  29006. referencedClasses: ["Smalltalk"],
  29007. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  29008. }),
  29009. $globals.AmdPackageHandler);
  29010. $core.addMethod(
  29011. $core.method({
  29012. selector: "defaultNamespace",
  29013. protocol: 'commit paths',
  29014. fn: function (){
  29015. var self=this;
  29016. return $core.withContext(function($ctx1) {
  29017. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  29018. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)});
  29019. },
  29020. args: [],
  29021. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29022. referencedClasses: ["Smalltalk"],
  29023. messageSends: ["defaultAmdNamespace"]
  29024. }),
  29025. $globals.AmdPackageHandler.klass);
  29026. $core.addMethod(
  29027. $core.method({
  29028. selector: "defaultNamespace:",
  29029. protocol: 'commit paths',
  29030. fn: function (aString){
  29031. var self=this;
  29032. return $core.withContext(function($ctx1) {
  29033. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  29034. return self;
  29035. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)});
  29036. },
  29037. args: ["aString"],
  29038. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  29039. referencedClasses: ["Smalltalk"],
  29040. messageSends: ["defaultAmdNamespace:"]
  29041. }),
  29042. $globals.AmdPackageHandler.klass);
  29043. $core.addClass('PackageTransport', $globals.Object, ['package'], 'Platform-ImportExport');
  29044. $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.";
  29045. $core.addMethod(
  29046. $core.method({
  29047. selector: "asJSON",
  29048. protocol: 'converting',
  29049. fn: function (){
  29050. var self=this;
  29051. return $core.withContext(function($ctx1) {
  29052. return $globals.HashedCollection._newFromPairs_(["type",self._type()]);
  29053. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.PackageTransport)});
  29054. },
  29055. args: [],
  29056. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  29057. referencedClasses: [],
  29058. messageSends: ["type"]
  29059. }),
  29060. $globals.PackageTransport);
  29061. $core.addMethod(
  29062. $core.method({
  29063. selector: "commit",
  29064. protocol: 'committing',
  29065. fn: function (){
  29066. var self=this;
  29067. return $core.withContext(function($ctx1) {
  29068. $recv(self._commitHandler())._commit_(self._package());
  29069. return self;
  29070. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  29071. },
  29072. args: [],
  29073. source: "commit\x0a\x09self commitHandler commit: self package",
  29074. referencedClasses: [],
  29075. messageSends: ["commit:", "commitHandler", "package"]
  29076. }),
  29077. $globals.PackageTransport);
  29078. $core.addMethod(
  29079. $core.method({
  29080. selector: "commitHandler",
  29081. protocol: 'factory',
  29082. fn: function (){
  29083. var self=this;
  29084. return $core.withContext(function($ctx1) {
  29085. return $recv(self._commitHandlerClass())._new();
  29086. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  29087. },
  29088. args: [],
  29089. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  29090. referencedClasses: [],
  29091. messageSends: ["new", "commitHandlerClass"]
  29092. }),
  29093. $globals.PackageTransport);
  29094. $core.addMethod(
  29095. $core.method({
  29096. selector: "commitHandlerClass",
  29097. protocol: 'accessing',
  29098. fn: function (){
  29099. var self=this;
  29100. return $core.withContext(function($ctx1) {
  29101. self._subclassResponsibility();
  29102. return self;
  29103. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  29104. },
  29105. args: [],
  29106. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  29107. referencedClasses: [],
  29108. messageSends: ["subclassResponsibility"]
  29109. }),
  29110. $globals.PackageTransport);
  29111. $core.addMethod(
  29112. $core.method({
  29113. selector: "commitOnSuccess:onError:",
  29114. protocol: 'committing',
  29115. fn: function (aBlock,anotherBlock){
  29116. var self=this;
  29117. return $core.withContext(function($ctx1) {
  29118. $recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  29119. return self;
  29120. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  29121. },
  29122. args: ["aBlock", "anotherBlock"],
  29123. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  29124. referencedClasses: [],
  29125. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  29126. }),
  29127. $globals.PackageTransport);
  29128. $core.addMethod(
  29129. $core.method({
  29130. selector: "definition",
  29131. protocol: 'accessing',
  29132. fn: function (){
  29133. var self=this;
  29134. return "";
  29135. },
  29136. args: [],
  29137. source: "definition\x0a\x09^ ''",
  29138. referencedClasses: [],
  29139. messageSends: []
  29140. }),
  29141. $globals.PackageTransport);
  29142. $core.addMethod(
  29143. $core.method({
  29144. selector: "load",
  29145. protocol: 'loading',
  29146. fn: function (){
  29147. var self=this;
  29148. return $core.withContext(function($ctx1) {
  29149. $recv(self._commitHandler())._load_(self._package());
  29150. return self;
  29151. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  29152. },
  29153. args: [],
  29154. source: "load\x0a\x09self commitHandler load: self package",
  29155. referencedClasses: [],
  29156. messageSends: ["load:", "commitHandler", "package"]
  29157. }),
  29158. $globals.PackageTransport);
  29159. $core.addMethod(
  29160. $core.method({
  29161. selector: "package",
  29162. protocol: 'accessing',
  29163. fn: function (){
  29164. var self=this;
  29165. return self["@package"];
  29166. },
  29167. args: [],
  29168. source: "package\x0a\x09^ package",
  29169. referencedClasses: [],
  29170. messageSends: []
  29171. }),
  29172. $globals.PackageTransport);
  29173. $core.addMethod(
  29174. $core.method({
  29175. selector: "package:",
  29176. protocol: 'accessing',
  29177. fn: function (aPackage){
  29178. var self=this;
  29179. self["@package"]=aPackage;
  29180. return self;
  29181. },
  29182. args: ["aPackage"],
  29183. source: "package: aPackage\x0a\x09package := aPackage",
  29184. referencedClasses: [],
  29185. messageSends: []
  29186. }),
  29187. $globals.PackageTransport);
  29188. $core.addMethod(
  29189. $core.method({
  29190. selector: "setupFromJson:",
  29191. protocol: 'initialization',
  29192. fn: function (anObject){
  29193. var self=this;
  29194. return self;
  29195. },
  29196. args: ["anObject"],
  29197. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  29198. referencedClasses: [],
  29199. messageSends: []
  29200. }),
  29201. $globals.PackageTransport);
  29202. $core.addMethod(
  29203. $core.method({
  29204. selector: "type",
  29205. protocol: 'accessing',
  29206. fn: function (){
  29207. var self=this;
  29208. return $core.withContext(function($ctx1) {
  29209. return $recv(self._class())._type();
  29210. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  29211. },
  29212. args: [],
  29213. source: "type\x0a\x09^ self class type",
  29214. referencedClasses: [],
  29215. messageSends: ["type", "class"]
  29216. }),
  29217. $globals.PackageTransport);
  29218. $globals.PackageTransport.klass.iVarNames = ['registry'];
  29219. $core.addMethod(
  29220. $core.method({
  29221. selector: "classRegisteredFor:",
  29222. protocol: 'accessing',
  29223. fn: function (aString){
  29224. var self=this;
  29225. return $core.withContext(function($ctx1) {
  29226. return $recv(self["@registry"])._at_(aString);
  29227. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)});
  29228. },
  29229. args: ["aString"],
  29230. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  29231. referencedClasses: [],
  29232. messageSends: ["at:"]
  29233. }),
  29234. $globals.PackageTransport.klass);
  29235. $core.addMethod(
  29236. $core.method({
  29237. selector: "defaultType",
  29238. protocol: 'accessing',
  29239. fn: function (){
  29240. var self=this;
  29241. return $core.withContext(function($ctx1) {
  29242. return $recv($globals.AmdPackageTransport)._type();
  29243. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)});
  29244. },
  29245. args: [],
  29246. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  29247. referencedClasses: ["AmdPackageTransport"],
  29248. messageSends: ["type"]
  29249. }),
  29250. $globals.PackageTransport.klass);
  29251. $core.addMethod(
  29252. $core.method({
  29253. selector: "for:",
  29254. protocol: 'instance creation',
  29255. fn: function (aString){
  29256. var self=this;
  29257. return $core.withContext(function($ctx1) {
  29258. return $recv(self._classRegisteredFor_(aString))._new();
  29259. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)});
  29260. },
  29261. args: ["aString"],
  29262. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  29263. referencedClasses: [],
  29264. messageSends: ["new", "classRegisteredFor:"]
  29265. }),
  29266. $globals.PackageTransport.klass);
  29267. $core.addMethod(
  29268. $core.method({
  29269. selector: "fromJson:",
  29270. protocol: 'instance creation',
  29271. fn: function (anObject){
  29272. var self=this;
  29273. return $core.withContext(function($ctx1) {
  29274. var $1,$2,$receiver;
  29275. if(($receiver = anObject) == null || $receiver.isNil){
  29276. $1=self._for_(self._defaultType());
  29277. $ctx1.sendIdx["for:"]=1;
  29278. return $1;
  29279. } else {
  29280. anObject;
  29281. };
  29282. $2=self._for_($recv(anObject)._type());
  29283. $recv($2)._setupFromJson_(anObject);
  29284. return $recv($2)._yourself();
  29285. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)});
  29286. },
  29287. args: ["anObject"],
  29288. 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",
  29289. referencedClasses: [],
  29290. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  29291. }),
  29292. $globals.PackageTransport.klass);
  29293. $core.addMethod(
  29294. $core.method({
  29295. selector: "initialize",
  29296. protocol: 'initialization',
  29297. fn: function (){
  29298. var self=this;
  29299. return $core.withContext(function($ctx1) {
  29300. var $1;
  29301. (
  29302. $ctx1.supercall = true,
  29303. ($globals.PackageTransport.klass.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  29304. $ctx1.supercall = false;
  29305. $1=self.__eq_eq($globals.PackageTransport);
  29306. if($core.assert($1)){
  29307. self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  29308. self["@registry"];
  29309. } else {
  29310. self._register();
  29311. };
  29312. return self;
  29313. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)});
  29314. },
  29315. args: [],
  29316. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  29317. referencedClasses: ["PackageTransport"],
  29318. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  29319. }),
  29320. $globals.PackageTransport.klass);
  29321. $core.addMethod(
  29322. $core.method({
  29323. selector: "register",
  29324. protocol: 'registration',
  29325. fn: function (){
  29326. var self=this;
  29327. return $core.withContext(function($ctx1) {
  29328. $recv($globals.PackageTransport)._register_(self);
  29329. return self;
  29330. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)});
  29331. },
  29332. args: [],
  29333. source: "register\x0a\x09PackageTransport register: self",
  29334. referencedClasses: ["PackageTransport"],
  29335. messageSends: ["register:"]
  29336. }),
  29337. $globals.PackageTransport.klass);
  29338. $core.addMethod(
  29339. $core.method({
  29340. selector: "register:",
  29341. protocol: 'registration',
  29342. fn: function (aClass){
  29343. var self=this;
  29344. return $core.withContext(function($ctx1) {
  29345. var $1,$receiver;
  29346. $1=$recv(aClass)._type();
  29347. $ctx1.sendIdx["type"]=1;
  29348. if(($receiver = $1) == null || $receiver.isNil){
  29349. $1;
  29350. } else {
  29351. $recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  29352. };
  29353. return self;
  29354. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)});
  29355. },
  29356. args: ["aClass"],
  29357. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  29358. referencedClasses: [],
  29359. messageSends: ["ifNotNil:", "type", "at:put:"]
  29360. }),
  29361. $globals.PackageTransport.klass);
  29362. $core.addMethod(
  29363. $core.method({
  29364. selector: "type",
  29365. protocol: 'accessing',
  29366. fn: function (){
  29367. var self=this;
  29368. return nil;
  29369. },
  29370. args: [],
  29371. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  29372. referencedClasses: [],
  29373. messageSends: []
  29374. }),
  29375. $globals.PackageTransport.klass);
  29376. $core.addClass('AmdPackageTransport', $globals.PackageTransport, ['namespace'], 'Platform-ImportExport');
  29377. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  29378. $core.addMethod(
  29379. $core.method({
  29380. selector: "asJSON",
  29381. protocol: 'converting',
  29382. fn: function (){
  29383. var self=this;
  29384. return $core.withContext(function($ctx1) {
  29385. var $1;
  29386. $1=(
  29387. $ctx1.supercall = true,
  29388. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJSON.apply($recv(self), []));
  29389. $ctx1.supercall = false;
  29390. $recv($1)._at_put_("amdNamespace",self._namespace());
  29391. return $recv($1)._yourself();
  29392. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.AmdPackageTransport)});
  29393. },
  29394. args: [],
  29395. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  29396. referencedClasses: [],
  29397. messageSends: ["at:put:", "asJSON", "namespace", "yourself"]
  29398. }),
  29399. $globals.AmdPackageTransport);
  29400. $core.addMethod(
  29401. $core.method({
  29402. selector: "commitHandlerClass",
  29403. protocol: 'accessing',
  29404. fn: function (){
  29405. var self=this;
  29406. return $globals.AmdPackageHandler;
  29407. },
  29408. args: [],
  29409. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  29410. referencedClasses: ["AmdPackageHandler"],
  29411. messageSends: []
  29412. }),
  29413. $globals.AmdPackageTransport);
  29414. $core.addMethod(
  29415. $core.method({
  29416. selector: "defaultNamespace",
  29417. protocol: 'defaults',
  29418. fn: function (){
  29419. var self=this;
  29420. return $core.withContext(function($ctx1) {
  29421. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  29422. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  29423. },
  29424. args: [],
  29425. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29426. referencedClasses: ["Smalltalk"],
  29427. messageSends: ["defaultAmdNamespace"]
  29428. }),
  29429. $globals.AmdPackageTransport);
  29430. $core.addMethod(
  29431. $core.method({
  29432. selector: "definition",
  29433. protocol: 'accessing',
  29434. fn: function (){
  29435. var self=this;
  29436. return $core.withContext(function($ctx1) {
  29437. var $1;
  29438. return $recv($globals.String)._streamContents_((function(stream){
  29439. return $core.withContext(function($ctx2) {
  29440. $recv(stream)._nextPutAll_($recv(self._class())._name());
  29441. $ctx2.sendIdx["nextPutAll:"]=1;
  29442. $recv(stream)._nextPutAll_(" namespace: ");
  29443. $ctx2.sendIdx["nextPutAll:"]=2;
  29444. $1=$recv("'".__comma(self._namespace())).__comma("'");
  29445. $ctx2.sendIdx[","]=1;
  29446. return $recv(stream)._nextPutAll_($1);
  29447. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  29448. }));
  29449. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  29450. },
  29451. args: [],
  29452. 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, '''' ]",
  29453. referencedClasses: ["String"],
  29454. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"]
  29455. }),
  29456. $globals.AmdPackageTransport);
  29457. $core.addMethod(
  29458. $core.method({
  29459. selector: "namespace",
  29460. protocol: 'accessing',
  29461. fn: function (){
  29462. var self=this;
  29463. return $core.withContext(function($ctx1) {
  29464. var $1,$receiver;
  29465. $1=self["@namespace"];
  29466. if(($receiver = $1) == null || $receiver.isNil){
  29467. return self._defaultNamespace();
  29468. } else {
  29469. return $1;
  29470. };
  29471. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  29472. },
  29473. args: [],
  29474. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  29475. referencedClasses: [],
  29476. messageSends: ["ifNil:", "defaultNamespace"]
  29477. }),
  29478. $globals.AmdPackageTransport);
  29479. $core.addMethod(
  29480. $core.method({
  29481. selector: "namespace:",
  29482. protocol: 'accessing',
  29483. fn: function (aString){
  29484. var self=this;
  29485. self["@namespace"]=aString;
  29486. return self;
  29487. },
  29488. args: ["aString"],
  29489. source: "namespace: aString\x0a\x09namespace := aString",
  29490. referencedClasses: [],
  29491. messageSends: []
  29492. }),
  29493. $globals.AmdPackageTransport);
  29494. $core.addMethod(
  29495. $core.method({
  29496. selector: "printOn:",
  29497. protocol: 'printing',
  29498. fn: function (aStream){
  29499. var self=this;
  29500. return $core.withContext(function($ctx1) {
  29501. (
  29502. $ctx1.supercall = true,
  29503. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  29504. $ctx1.supercall = false;
  29505. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  29506. $ctx1.sendIdx["nextPutAll:"]=1;
  29507. $recv(aStream)._nextPutAll_(self._namespace());
  29508. $ctx1.sendIdx["nextPutAll:"]=2;
  29509. $recv(aStream)._nextPutAll_(")");
  29510. return self;
  29511. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  29512. },
  29513. args: ["aStream"],
  29514. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  29515. referencedClasses: [],
  29516. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  29517. }),
  29518. $globals.AmdPackageTransport);
  29519. $core.addMethod(
  29520. $core.method({
  29521. selector: "setPath:",
  29522. protocol: 'actions',
  29523. fn: function (aString){
  29524. var self=this;
  29525. return $core.withContext(function($ctx1) {
  29526. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  29527. return self;
  29528. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  29529. },
  29530. args: ["aString"],
  29531. 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}.",
  29532. referencedClasses: [],
  29533. messageSends: ["value:", "basicAt:", "namespace"]
  29534. }),
  29535. $globals.AmdPackageTransport);
  29536. $core.addMethod(
  29537. $core.method({
  29538. selector: "setupFromJson:",
  29539. protocol: 'initialization',
  29540. fn: function (anObject){
  29541. var self=this;
  29542. return $core.withContext(function($ctx1) {
  29543. self._namespace_($recv(anObject)._at_("amdNamespace"));
  29544. return self;
  29545. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  29546. },
  29547. args: ["anObject"],
  29548. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  29549. referencedClasses: [],
  29550. messageSends: ["namespace:", "at:"]
  29551. }),
  29552. $globals.AmdPackageTransport);
  29553. $core.addMethod(
  29554. $core.method({
  29555. selector: "namespace:",
  29556. protocol: 'instance creation',
  29557. fn: function (aString){
  29558. var self=this;
  29559. return $core.withContext(function($ctx1) {
  29560. var $1;
  29561. $1=self._new();
  29562. $recv($1)._namespace_(aString);
  29563. return $recv($1)._yourself();
  29564. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)});
  29565. },
  29566. args: ["aString"],
  29567. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  29568. referencedClasses: [],
  29569. messageSends: ["namespace:", "new", "yourself"]
  29570. }),
  29571. $globals.AmdPackageTransport.klass);
  29572. $core.addMethod(
  29573. $core.method({
  29574. selector: "type",
  29575. protocol: 'accessing',
  29576. fn: function (){
  29577. var self=this;
  29578. return "amd";
  29579. },
  29580. args: [],
  29581. source: "type\x0a\x09^ 'amd'",
  29582. referencedClasses: [],
  29583. messageSends: []
  29584. }),
  29585. $globals.AmdPackageTransport.klass);
  29586. $core.addMethod(
  29587. $core.method({
  29588. selector: "commentStamp",
  29589. protocol: '*Platform-ImportExport',
  29590. fn: function (){
  29591. var self=this;
  29592. return $core.withContext(function($ctx1) {
  29593. var $1;
  29594. $1=$recv($globals.ClassCommentReader)._new();
  29595. $recv($1)._class_(self);
  29596. return $recv($1)._yourself();
  29597. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)});
  29598. },
  29599. args: [],
  29600. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  29601. referencedClasses: ["ClassCommentReader"],
  29602. messageSends: ["class:", "new", "yourself"]
  29603. }),
  29604. $globals.Behavior);
  29605. $core.addMethod(
  29606. $core.method({
  29607. selector: "commentStamp:prior:",
  29608. protocol: '*Platform-ImportExport',
  29609. fn: function (aStamp,prior){
  29610. var self=this;
  29611. return $core.withContext(function($ctx1) {
  29612. return self._commentStamp();
  29613. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)});
  29614. },
  29615. args: ["aStamp", "prior"],
  29616. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  29617. referencedClasses: [],
  29618. messageSends: ["commentStamp"]
  29619. }),
  29620. $globals.Behavior);
  29621. $core.addMethod(
  29622. $core.method({
  29623. selector: "methodsFor:",
  29624. protocol: '*Platform-ImportExport',
  29625. fn: function (aString){
  29626. var self=this;
  29627. return $core.withContext(function($ctx1) {
  29628. var $1;
  29629. $1=$recv($globals.ClassProtocolReader)._new();
  29630. $recv($1)._class_category_(self,aString);
  29631. return $recv($1)._yourself();
  29632. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)});
  29633. },
  29634. args: ["aString"],
  29635. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  29636. referencedClasses: ["ClassProtocolReader"],
  29637. messageSends: ["class:category:", "new", "yourself"]
  29638. }),
  29639. $globals.Behavior);
  29640. $core.addMethod(
  29641. $core.method({
  29642. selector: "methodsFor:stamp:",
  29643. protocol: '*Platform-ImportExport',
  29644. fn: function (aString,aStamp){
  29645. var self=this;
  29646. return $core.withContext(function($ctx1) {
  29647. return self._methodsFor_(aString);
  29648. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)});
  29649. },
  29650. args: ["aString", "aStamp"],
  29651. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  29652. referencedClasses: [],
  29653. messageSends: ["methodsFor:"]
  29654. }),
  29655. $globals.Behavior);
  29656. $core.addMethod(
  29657. $core.method({
  29658. selector: "commit",
  29659. protocol: '*Platform-ImportExport',
  29660. fn: function (){
  29661. var self=this;
  29662. return $core.withContext(function($ctx1) {
  29663. return $recv(self._transport())._commit();
  29664. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  29665. },
  29666. args: [],
  29667. source: "commit\x0a\x09^ self transport commit",
  29668. referencedClasses: [],
  29669. messageSends: ["commit", "transport"]
  29670. }),
  29671. $globals.Package);
  29672. $core.addMethod(
  29673. $core.method({
  29674. selector: "load",
  29675. protocol: '*Platform-ImportExport',
  29676. fn: function (){
  29677. var self=this;
  29678. return $core.withContext(function($ctx1) {
  29679. return $recv(self._transport())._load();
  29680. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  29681. },
  29682. args: [],
  29683. source: "load\x0a\x09^ self transport load",
  29684. referencedClasses: [],
  29685. messageSends: ["load", "transport"]
  29686. }),
  29687. $globals.Package);
  29688. $core.addMethod(
  29689. $core.method({
  29690. selector: "loadFromNamespace:",
  29691. protocol: '*Platform-ImportExport',
  29692. fn: function (aString){
  29693. var self=this;
  29694. return $core.withContext(function($ctx1) {
  29695. var $1;
  29696. $1=self._transport();
  29697. $recv($1)._namespace_(aString);
  29698. return $recv($1)._load();
  29699. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  29700. },
  29701. args: ["aString"],
  29702. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  29703. referencedClasses: [],
  29704. messageSends: ["namespace:", "transport", "load"]
  29705. }),
  29706. $globals.Package);
  29707. $core.addMethod(
  29708. $core.method({
  29709. selector: "load:",
  29710. protocol: '*Platform-ImportExport',
  29711. fn: function (aPackageName){
  29712. var self=this;
  29713. return $core.withContext(function($ctx1) {
  29714. $recv(self._named_(aPackageName))._load();
  29715. return self;
  29716. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)});
  29717. },
  29718. args: ["aPackageName"],
  29719. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  29720. referencedClasses: [],
  29721. messageSends: ["load", "named:"]
  29722. }),
  29723. $globals.Package.klass);
  29724. $core.addMethod(
  29725. $core.method({
  29726. selector: "load:fromNamespace:",
  29727. protocol: '*Platform-ImportExport',
  29728. fn: function (aPackageName,aString){
  29729. var self=this;
  29730. return $core.withContext(function($ctx1) {
  29731. $recv(self._named_(aPackageName))._loadFromNamespace_(aString);
  29732. return self;
  29733. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)});
  29734. },
  29735. args: ["aPackageName", "aString"],
  29736. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  29737. referencedClasses: [],
  29738. messageSends: ["loadFromNamespace:", "named:"]
  29739. }),
  29740. $globals.Package.klass);
  29741. });
  29742. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Objects"], function($boot){"use strict";
  29743. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  29744. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  29745. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  29746. $core.addPackage('Compiler-Core');
  29747. $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  29748. $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  29749. $core.addClass('AbstractCodeGenerator', $globals.Object, ['currentClass', 'currentPackage', 'source'], 'Compiler-Core');
  29750. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  29751. $core.addMethod(
  29752. $core.method({
  29753. selector: "compileNode:",
  29754. protocol: 'compiling',
  29755. fn: function (aNode){
  29756. var self=this;
  29757. return $core.withContext(function($ctx1) {
  29758. self._subclassResponsibility();
  29759. return self;
  29760. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  29761. },
  29762. args: ["aNode"],
  29763. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  29764. referencedClasses: [],
  29765. messageSends: ["subclassResponsibility"]
  29766. }),
  29767. $globals.AbstractCodeGenerator);
  29768. $core.addMethod(
  29769. $core.method({
  29770. selector: "currentClass",
  29771. protocol: 'accessing',
  29772. fn: function (){
  29773. var self=this;
  29774. return self["@currentClass"];
  29775. },
  29776. args: [],
  29777. source: "currentClass\x0a\x09^ currentClass",
  29778. referencedClasses: [],
  29779. messageSends: []
  29780. }),
  29781. $globals.AbstractCodeGenerator);
  29782. $core.addMethod(
  29783. $core.method({
  29784. selector: "currentClass:",
  29785. protocol: 'accessing',
  29786. fn: function (aClass){
  29787. var self=this;
  29788. self["@currentClass"]=aClass;
  29789. return self;
  29790. },
  29791. args: ["aClass"],
  29792. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  29793. referencedClasses: [],
  29794. messageSends: []
  29795. }),
  29796. $globals.AbstractCodeGenerator);
  29797. $core.addMethod(
  29798. $core.method({
  29799. selector: "currentPackage",
  29800. protocol: 'accessing',
  29801. fn: function (){
  29802. var self=this;
  29803. return self["@currentPackage"];
  29804. },
  29805. args: [],
  29806. source: "currentPackage\x0a\x09^ currentPackage",
  29807. referencedClasses: [],
  29808. messageSends: []
  29809. }),
  29810. $globals.AbstractCodeGenerator);
  29811. $core.addMethod(
  29812. $core.method({
  29813. selector: "currentPackage:",
  29814. protocol: 'accessing',
  29815. fn: function (anObject){
  29816. var self=this;
  29817. self["@currentPackage"]=anObject;
  29818. return self;
  29819. },
  29820. args: ["anObject"],
  29821. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  29822. referencedClasses: [],
  29823. messageSends: []
  29824. }),
  29825. $globals.AbstractCodeGenerator);
  29826. $core.addMethod(
  29827. $core.method({
  29828. selector: "pseudoVariables",
  29829. protocol: 'accessing',
  29830. fn: function (){
  29831. var self=this;
  29832. return $core.withContext(function($ctx1) {
  29833. return $recv($globals.Smalltalk)._pseudoVariableNames();
  29834. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  29835. },
  29836. args: [],
  29837. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  29838. referencedClasses: ["Smalltalk"],
  29839. messageSends: ["pseudoVariableNames"]
  29840. }),
  29841. $globals.AbstractCodeGenerator);
  29842. $core.addMethod(
  29843. $core.method({
  29844. selector: "source",
  29845. protocol: 'accessing',
  29846. fn: function (){
  29847. var self=this;
  29848. return $core.withContext(function($ctx1) {
  29849. var $1,$receiver;
  29850. $1=self["@source"];
  29851. if(($receiver = $1) == null || $receiver.isNil){
  29852. return "";
  29853. } else {
  29854. return $1;
  29855. };
  29856. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  29857. },
  29858. args: [],
  29859. source: "source\x0a\x09^ source ifNil: [ '' ]",
  29860. referencedClasses: [],
  29861. messageSends: ["ifNil:"]
  29862. }),
  29863. $globals.AbstractCodeGenerator);
  29864. $core.addMethod(
  29865. $core.method({
  29866. selector: "source:",
  29867. protocol: 'accessing',
  29868. fn: function (aString){
  29869. var self=this;
  29870. self["@source"]=aString;
  29871. return self;
  29872. },
  29873. args: ["aString"],
  29874. source: "source: aString\x0a\x09source := aString",
  29875. referencedClasses: [],
  29876. messageSends: []
  29877. }),
  29878. $globals.AbstractCodeGenerator);
  29879. $core.addClass('CodeGenerator', $globals.AbstractCodeGenerator, [], 'Compiler-Core');
  29880. $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.";
  29881. $core.addMethod(
  29882. $core.method({
  29883. selector: "compileNode:",
  29884. protocol: 'compiling',
  29885. fn: function (aNode){
  29886. var self=this;
  29887. var ir,stream;
  29888. return $core.withContext(function($ctx1) {
  29889. var $1;
  29890. $recv(self._semanticAnalyzer())._visit_(aNode);
  29891. $ctx1.sendIdx["visit:"]=1;
  29892. ir=$recv(self._translator())._visit_(aNode);
  29893. $ctx1.sendIdx["visit:"]=2;
  29894. $1=self._irTranslator();
  29895. $recv($1)._currentClass_(self._currentClass());
  29896. $recv($1)._visit_(ir);
  29897. return $recv($1)._contents();
  29898. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.CodeGenerator)});
  29899. },
  29900. args: ["aNode"],
  29901. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  29902. referencedClasses: [],
  29903. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"]
  29904. }),
  29905. $globals.CodeGenerator);
  29906. $core.addMethod(
  29907. $core.method({
  29908. selector: "irTranslator",
  29909. protocol: 'compiling',
  29910. fn: function (){
  29911. var self=this;
  29912. return $core.withContext(function($ctx1) {
  29913. return $recv($globals.IRJSTranslator)._new();
  29914. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  29915. },
  29916. args: [],
  29917. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  29918. referencedClasses: ["IRJSTranslator"],
  29919. messageSends: ["new"]
  29920. }),
  29921. $globals.CodeGenerator);
  29922. $core.addMethod(
  29923. $core.method({
  29924. selector: "semanticAnalyzer",
  29925. protocol: 'compiling',
  29926. fn: function (){
  29927. var self=this;
  29928. return $core.withContext(function($ctx1) {
  29929. var $1;
  29930. $1=$recv($globals.SemanticAnalyzer)._on_(self._currentClass());
  29931. $recv($1)._thePackage_(self._currentPackage());
  29932. return $recv($1)._yourself();
  29933. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  29934. },
  29935. args: [],
  29936. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  29937. referencedClasses: ["SemanticAnalyzer"],
  29938. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  29939. }),
  29940. $globals.CodeGenerator);
  29941. $core.addMethod(
  29942. $core.method({
  29943. selector: "translator",
  29944. protocol: 'compiling',
  29945. fn: function (){
  29946. var self=this;
  29947. return $core.withContext(function($ctx1) {
  29948. var $1;
  29949. $1=$recv($globals.IRASTTranslator)._new();
  29950. $recv($1)._source_(self._source());
  29951. $recv($1)._theClass_(self._currentClass());
  29952. return $recv($1)._yourself();
  29953. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  29954. },
  29955. args: [],
  29956. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  29957. referencedClasses: ["IRASTTranslator"],
  29958. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  29959. }),
  29960. $globals.CodeGenerator);
  29961. $core.addClass('Compiler', $globals.Object, ['currentClass', 'currentPackage', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  29962. $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`";
  29963. $core.addMethod(
  29964. $core.method({
  29965. selector: "codeGeneratorClass",
  29966. protocol: 'accessing',
  29967. fn: function (){
  29968. var self=this;
  29969. return $core.withContext(function($ctx1) {
  29970. var $1,$receiver;
  29971. $1=self["@codeGeneratorClass"];
  29972. if(($receiver = $1) == null || $receiver.isNil){
  29973. return $globals.InliningCodeGenerator;
  29974. } else {
  29975. return $1;
  29976. };
  29977. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  29978. },
  29979. args: [],
  29980. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  29981. referencedClasses: ["InliningCodeGenerator"],
  29982. messageSends: ["ifNil:"]
  29983. }),
  29984. $globals.Compiler);
  29985. $core.addMethod(
  29986. $core.method({
  29987. selector: "codeGeneratorClass:",
  29988. protocol: 'accessing',
  29989. fn: function (aClass){
  29990. var self=this;
  29991. self["@codeGeneratorClass"]=aClass;
  29992. return self;
  29993. },
  29994. args: ["aClass"],
  29995. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  29996. referencedClasses: [],
  29997. messageSends: []
  29998. }),
  29999. $globals.Compiler);
  30000. $core.addMethod(
  30001. $core.method({
  30002. selector: "compile:forClass:protocol:",
  30003. protocol: 'compiling',
  30004. fn: function (aString,aClass,anotherString){
  30005. var self=this;
  30006. return $core.withContext(function($ctx1) {
  30007. self._source_(aString);
  30008. return self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  30009. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  30010. },
  30011. args: ["aString", "aClass", "anotherString"],
  30012. 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)",
  30013. referencedClasses: [],
  30014. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  30015. }),
  30016. $globals.Compiler);
  30017. $core.addMethod(
  30018. $core.method({
  30019. selector: "compileExpression:on:",
  30020. protocol: 'compiling',
  30021. fn: function (aString,anObject){
  30022. var self=this;
  30023. return $core.withContext(function($ctx1) {
  30024. var $1;
  30025. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  30026. $ctx1.sendIdx[","]=1;
  30027. return self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  30028. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  30029. },
  30030. args: ["aString", "anObject"],
  30031. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  30032. referencedClasses: [],
  30033. messageSends: ["compile:forClass:protocol:", ",", "class"]
  30034. }),
  30035. $globals.Compiler);
  30036. $core.addMethod(
  30037. $core.method({
  30038. selector: "compileNode:",
  30039. protocol: 'compiling',
  30040. fn: function (aNode){
  30041. var self=this;
  30042. var generator,result;
  30043. return $core.withContext(function($ctx1) {
  30044. var $1;
  30045. generator=$recv(self._codeGeneratorClass())._new();
  30046. $1=generator;
  30047. $recv($1)._source_(self._source());
  30048. $recv($1)._currentClass_(self._currentClass());
  30049. $recv($1)._currentPackage_(self._currentPackage());
  30050. result=$recv(generator)._compileNode_(aNode);
  30051. self._unknownVariables_([]);
  30052. return result;
  30053. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  30054. },
  30055. args: ["aNode"],
  30056. 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",
  30057. referencedClasses: [],
  30058. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"]
  30059. }),
  30060. $globals.Compiler);
  30061. $core.addMethod(
  30062. $core.method({
  30063. selector: "compileNode:forClass:package:",
  30064. protocol: 'compiling',
  30065. fn: function (aNode,aClass,aPackage){
  30066. var self=this;
  30067. return $core.withContext(function($ctx1) {
  30068. self._currentClass_(aClass);
  30069. self._currentPackage_(aPackage);
  30070. return self._compileNode_(aNode);
  30071. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  30072. },
  30073. args: ["aNode", "aClass", "aPackage"],
  30074. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  30075. referencedClasses: [],
  30076. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  30077. }),
  30078. $globals.Compiler);
  30079. $core.addMethod(
  30080. $core.method({
  30081. selector: "currentClass",
  30082. protocol: 'accessing',
  30083. fn: function (){
  30084. var self=this;
  30085. return self["@currentClass"];
  30086. },
  30087. args: [],
  30088. source: "currentClass\x0a\x09^ currentClass",
  30089. referencedClasses: [],
  30090. messageSends: []
  30091. }),
  30092. $globals.Compiler);
  30093. $core.addMethod(
  30094. $core.method({
  30095. selector: "currentClass:",
  30096. protocol: 'accessing',
  30097. fn: function (aClass){
  30098. var self=this;
  30099. self["@currentClass"]=aClass;
  30100. return self;
  30101. },
  30102. args: ["aClass"],
  30103. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30104. referencedClasses: [],
  30105. messageSends: []
  30106. }),
  30107. $globals.Compiler);
  30108. $core.addMethod(
  30109. $core.method({
  30110. selector: "currentPackage",
  30111. protocol: 'accessing',
  30112. fn: function (){
  30113. var self=this;
  30114. return self["@currentPackage"];
  30115. },
  30116. args: [],
  30117. source: "currentPackage\x0a\x09^ currentPackage",
  30118. referencedClasses: [],
  30119. messageSends: []
  30120. }),
  30121. $globals.Compiler);
  30122. $core.addMethod(
  30123. $core.method({
  30124. selector: "currentPackage:",
  30125. protocol: 'accessing',
  30126. fn: function (anObject){
  30127. var self=this;
  30128. self["@currentPackage"]=anObject;
  30129. return self;
  30130. },
  30131. args: ["anObject"],
  30132. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30133. referencedClasses: [],
  30134. messageSends: []
  30135. }),
  30136. $globals.Compiler);
  30137. $core.addMethod(
  30138. $core.method({
  30139. selector: "eval:",
  30140. protocol: 'compiling',
  30141. fn: function (aString){
  30142. var self=this;
  30143. return $core.withContext(function($ctx1) {
  30144. return eval(aString);
  30145. return self;
  30146. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  30147. },
  30148. args: ["aString"],
  30149. source: "eval: aString\x0a\x09<return eval(aString)>",
  30150. referencedClasses: [],
  30151. messageSends: []
  30152. }),
  30153. $globals.Compiler);
  30154. $core.addMethod(
  30155. $core.method({
  30156. selector: "eval:forPackage:",
  30157. protocol: 'compiling',
  30158. fn: function (aString,aPackage){
  30159. var self=this;
  30160. return $core.withContext(function($ctx1) {
  30161. return aPackage && aPackage.innerEval
  30162. ? aPackage.innerEval(aString)
  30163. : eval(aString);
  30164. return self;
  30165. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  30166. },
  30167. args: ["aString", "aPackage"],
  30168. source: "eval: aString forPackage: aPackage\x0a\x09<return aPackage && aPackage.innerEval\x0a\x09\x09? aPackage.innerEval(aString)\x0a\x09\x09: eval(aString)>",
  30169. referencedClasses: [],
  30170. messageSends: []
  30171. }),
  30172. $globals.Compiler);
  30173. $core.addMethod(
  30174. $core.method({
  30175. selector: "evaluateExpression:",
  30176. protocol: 'compiling',
  30177. fn: function (aString){
  30178. var self=this;
  30179. return $core.withContext(function($ctx1) {
  30180. return self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  30181. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  30182. },
  30183. args: ["aString"],
  30184. 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",
  30185. referencedClasses: ["DoIt"],
  30186. messageSends: ["evaluateExpression:on:", "new"]
  30187. }),
  30188. $globals.Compiler);
  30189. $core.addMethod(
  30190. $core.method({
  30191. selector: "evaluateExpression:on:",
  30192. protocol: 'compiling',
  30193. fn: function (aString,anObject){
  30194. var self=this;
  30195. var result,method;
  30196. return $core.withContext(function($ctx1) {
  30197. var $1;
  30198. method=self._eval_(self._compileExpression_on_(aString,anObject));
  30199. $recv(method)._protocol_("**xxxDoIt");
  30200. $1=$recv(anObject)._class();
  30201. $ctx1.sendIdx["class"]=1;
  30202. $recv($1)._addCompiledMethod_(method);
  30203. result=$recv(anObject)._xxxDoIt();
  30204. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  30205. return result;
  30206. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  30207. },
  30208. args: ["aString", "anObject"],
  30209. 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",
  30210. referencedClasses: [],
  30211. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  30212. }),
  30213. $globals.Compiler);
  30214. $core.addMethod(
  30215. $core.method({
  30216. selector: "install:forClass:protocol:",
  30217. protocol: 'compiling',
  30218. fn: function (aString,aBehavior,anotherString){
  30219. var self=this;
  30220. var compiledMethod;
  30221. return $core.withContext(function($ctx1) {
  30222. compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  30223. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  30224. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  30225. },
  30226. args: ["aString", "aBehavior", "anotherString"],
  30227. 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",
  30228. referencedClasses: ["ClassBuilder"],
  30229. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  30230. }),
  30231. $globals.Compiler);
  30232. $core.addMethod(
  30233. $core.method({
  30234. selector: "parse:",
  30235. protocol: 'compiling',
  30236. fn: function (aString){
  30237. var self=this;
  30238. return $core.withContext(function($ctx1) {
  30239. return $recv($globals.Smalltalk)._parse_(aString);
  30240. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  30241. },
  30242. args: ["aString"],
  30243. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  30244. referencedClasses: ["Smalltalk"],
  30245. messageSends: ["parse:"]
  30246. }),
  30247. $globals.Compiler);
  30248. $core.addMethod(
  30249. $core.method({
  30250. selector: "parseExpression:",
  30251. protocol: 'compiling',
  30252. fn: function (aString){
  30253. var self=this;
  30254. return $core.withContext(function($ctx1) {
  30255. var $1;
  30256. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  30257. $ctx1.sendIdx[","]=1;
  30258. return self._parse_($1);
  30259. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  30260. },
  30261. args: ["aString"],
  30262. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  30263. referencedClasses: [],
  30264. messageSends: ["parse:", ","]
  30265. }),
  30266. $globals.Compiler);
  30267. $core.addMethod(
  30268. $core.method({
  30269. selector: "recompile:",
  30270. protocol: 'compiling',
  30271. fn: function (aClass){
  30272. var self=this;
  30273. return $core.withContext(function($ctx1) {
  30274. var $1;
  30275. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  30276. return $core.withContext(function($ctx2) {
  30277. return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  30278. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30279. }),"Recompiling ".__comma($recv(aClass)._name()));
  30280. $1=$recv(aClass)._isMetaclass();
  30281. if(!$core.assert($1)){
  30282. self._recompile_($recv(aClass)._class());
  30283. };
  30284. return self;
  30285. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  30286. },
  30287. args: ["aClass"],
  30288. 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 ]",
  30289. referencedClasses: [],
  30290. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"]
  30291. }),
  30292. $globals.Compiler);
  30293. $core.addMethod(
  30294. $core.method({
  30295. selector: "recompileAll",
  30296. protocol: 'compiling',
  30297. fn: function (){
  30298. var self=this;
  30299. return $core.withContext(function($ctx1) {
  30300. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  30301. return $core.withContext(function($ctx2) {
  30302. return self._recompile_(each);
  30303. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30304. }),"Compiling all classes...");
  30305. return self;
  30306. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  30307. },
  30308. args: [],
  30309. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  30310. referencedClasses: ["Smalltalk"],
  30311. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  30312. }),
  30313. $globals.Compiler);
  30314. $core.addMethod(
  30315. $core.method({
  30316. selector: "source",
  30317. protocol: 'accessing',
  30318. fn: function (){
  30319. var self=this;
  30320. return $core.withContext(function($ctx1) {
  30321. var $1,$receiver;
  30322. $1=self["@source"];
  30323. if(($receiver = $1) == null || $receiver.isNil){
  30324. return "";
  30325. } else {
  30326. return $1;
  30327. };
  30328. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  30329. },
  30330. args: [],
  30331. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30332. referencedClasses: [],
  30333. messageSends: ["ifNil:"]
  30334. }),
  30335. $globals.Compiler);
  30336. $core.addMethod(
  30337. $core.method({
  30338. selector: "source:",
  30339. protocol: 'accessing',
  30340. fn: function (aString){
  30341. var self=this;
  30342. self["@source"]=aString;
  30343. return self;
  30344. },
  30345. args: ["aString"],
  30346. source: "source: aString\x0a\x09source := aString",
  30347. referencedClasses: [],
  30348. messageSends: []
  30349. }),
  30350. $globals.Compiler);
  30351. $core.addMethod(
  30352. $core.method({
  30353. selector: "unknownVariables",
  30354. protocol: 'accessing',
  30355. fn: function (){
  30356. var self=this;
  30357. return self["@unknownVariables"];
  30358. },
  30359. args: [],
  30360. source: "unknownVariables\x0a\x09^ unknownVariables",
  30361. referencedClasses: [],
  30362. messageSends: []
  30363. }),
  30364. $globals.Compiler);
  30365. $core.addMethod(
  30366. $core.method({
  30367. selector: "unknownVariables:",
  30368. protocol: 'accessing',
  30369. fn: function (aCollection){
  30370. var self=this;
  30371. self["@unknownVariables"]=aCollection;
  30372. return self;
  30373. },
  30374. args: ["aCollection"],
  30375. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  30376. referencedClasses: [],
  30377. messageSends: []
  30378. }),
  30379. $globals.Compiler);
  30380. $core.addMethod(
  30381. $core.method({
  30382. selector: "recompile:",
  30383. protocol: 'compiling',
  30384. fn: function (aClass){
  30385. var self=this;
  30386. return $core.withContext(function($ctx1) {
  30387. $recv(self._new())._recompile_(aClass);
  30388. return self;
  30389. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)});
  30390. },
  30391. args: ["aClass"],
  30392. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  30393. referencedClasses: [],
  30394. messageSends: ["recompile:", "new"]
  30395. }),
  30396. $globals.Compiler.klass);
  30397. $core.addMethod(
  30398. $core.method({
  30399. selector: "recompileAll",
  30400. protocol: 'compiling',
  30401. fn: function (){
  30402. var self=this;
  30403. return $core.withContext(function($ctx1) {
  30404. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  30405. return $core.withContext(function($ctx2) {
  30406. return self._recompile_(each);
  30407. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30408. }));
  30409. return self;
  30410. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)});
  30411. },
  30412. args: [],
  30413. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  30414. referencedClasses: ["Smalltalk"],
  30415. messageSends: ["do:", "classes", "recompile:"]
  30416. }),
  30417. $globals.Compiler.klass);
  30418. $core.addClass('CompilerError', $globals.Error, [], 'Compiler-Core');
  30419. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  30420. $core.addClass('DoIt', $globals.Object, [], 'Compiler-Core');
  30421. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  30422. $core.addClass('Evaluator', $globals.Object, [], 'Compiler-Core');
  30423. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  30424. $core.addMethod(
  30425. $core.method({
  30426. selector: "evaluate:context:",
  30427. protocol: 'evaluating',
  30428. fn: function (aString,aContext){
  30429. var self=this;
  30430. var compiler,ast;
  30431. return $core.withContext(function($ctx1) {
  30432. var $1;
  30433. var $early={};
  30434. try {
  30435. compiler=$recv($globals.Compiler)._new();
  30436. $recv((function(){
  30437. return $core.withContext(function($ctx2) {
  30438. ast=$recv(compiler)._parseExpression_(aString);
  30439. return ast;
  30440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30441. }))._on_do_($globals.Error,(function(ex){
  30442. return $core.withContext(function($ctx2) {
  30443. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  30444. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30445. }));
  30446. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  30447. $recv($1)._context_(aContext);
  30448. $recv($1)._visit_(ast);
  30449. return $recv(aContext)._evaluateNode_(ast);
  30450. }
  30451. catch(e) {if(e===$early)return e[0]; throw e}
  30452. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  30453. },
  30454. args: ["aString", "aContext"],
  30455. 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",
  30456. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  30457. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  30458. }),
  30459. $globals.Evaluator);
  30460. $core.addMethod(
  30461. $core.method({
  30462. selector: "evaluate:for:",
  30463. protocol: 'evaluating',
  30464. fn: function (aString,anObject){
  30465. var self=this;
  30466. return $core.withContext(function($ctx1) {
  30467. return $recv(anObject)._evaluate_on_(aString,self);
  30468. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  30469. },
  30470. args: ["aString", "anObject"],
  30471. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  30472. referencedClasses: [],
  30473. messageSends: ["evaluate:on:"]
  30474. }),
  30475. $globals.Evaluator);
  30476. $core.addMethod(
  30477. $core.method({
  30478. selector: "evaluate:receiver:",
  30479. protocol: 'evaluating',
  30480. fn: function (aString,anObject){
  30481. var self=this;
  30482. var compiler;
  30483. return $core.withContext(function($ctx1) {
  30484. var $early={};
  30485. try {
  30486. compiler=$recv($globals.Compiler)._new();
  30487. $recv((function(){
  30488. return $core.withContext(function($ctx2) {
  30489. return $recv(compiler)._parseExpression_(aString);
  30490. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30491. }))._on_do_($globals.Error,(function(ex){
  30492. return $core.withContext(function($ctx2) {
  30493. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  30494. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30495. }));
  30496. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  30497. }
  30498. catch(e) {if(e===$early)return e[0]; throw e}
  30499. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  30500. },
  30501. args: ["aString", "anObject"],
  30502. 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",
  30503. referencedClasses: ["Compiler", "Error", "Terminal"],
  30504. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  30505. }),
  30506. $globals.Evaluator);
  30507. $core.addMethod(
  30508. $core.method({
  30509. selector: "evaluate:for:",
  30510. protocol: 'instance creation',
  30511. fn: function (aString,anObject){
  30512. var self=this;
  30513. return $core.withContext(function($ctx1) {
  30514. return $recv(self._new())._evaluate_for_(aString,anObject);
  30515. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)});
  30516. },
  30517. args: ["aString", "anObject"],
  30518. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  30519. referencedClasses: [],
  30520. messageSends: ["evaluate:for:", "new"]
  30521. }),
  30522. $globals.Evaluator.klass);
  30523. $core.addMethod(
  30524. $core.method({
  30525. selector: "asVariableName",
  30526. protocol: '*Compiler-Core',
  30527. fn: function (){
  30528. var self=this;
  30529. return $core.withContext(function($ctx1) {
  30530. var $1;
  30531. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  30532. if($core.assert($1)){
  30533. return self.__comma("_");
  30534. } else {
  30535. return self;
  30536. };
  30537. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  30538. },
  30539. args: [],
  30540. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  30541. referencedClasses: ["Smalltalk"],
  30542. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  30543. }),
  30544. $globals.String);
  30545. });
  30546. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  30547. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  30548. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30549. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  30550. $core.addPackage('Compiler-AST');
  30551. $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  30552. $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30553. $core.addClass('Node', $globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  30554. $globals.Node.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.";
  30555. $core.addMethod(
  30556. $core.method({
  30557. selector: "accept:",
  30558. protocol: 'visiting',
  30559. fn: function (aVisitor){
  30560. var self=this;
  30561. return $core.withContext(function($ctx1) {
  30562. return $recv(aVisitor)._visitNode_(self);
  30563. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.Node)});
  30564. },
  30565. args: ["aVisitor"],
  30566. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  30567. referencedClasses: [],
  30568. messageSends: ["visitNode:"]
  30569. }),
  30570. $globals.Node);
  30571. $core.addMethod(
  30572. $core.method({
  30573. selector: "addNode:",
  30574. protocol: 'accessing',
  30575. fn: function (aNode){
  30576. var self=this;
  30577. return $core.withContext(function($ctx1) {
  30578. $recv(self._nodes())._add_(aNode);
  30579. $recv(aNode)._parent_(self);
  30580. return self;
  30581. }, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},$globals.Node)});
  30582. },
  30583. args: ["aNode"],
  30584. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  30585. referencedClasses: [],
  30586. messageSends: ["add:", "nodes", "parent:"]
  30587. }),
  30588. $globals.Node);
  30589. $core.addMethod(
  30590. $core.method({
  30591. selector: "allNodes",
  30592. protocol: 'accessing',
  30593. fn: function (){
  30594. var self=this;
  30595. var allNodes;
  30596. return $core.withContext(function($ctx1) {
  30597. var $1;
  30598. $1=self._nodes();
  30599. $ctx1.sendIdx["nodes"]=1;
  30600. allNodes=$recv($1)._asSet();
  30601. $recv(self._nodes())._do_((function(each){
  30602. return $core.withContext(function($ctx2) {
  30603. return $recv(allNodes)._addAll_($recv(each)._allNodes());
  30604. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30605. }));
  30606. return allNodes;
  30607. }, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},$globals.Node)});
  30608. },
  30609. args: [],
  30610. source: "allNodes\x0a\x09| allNodes |\x0a\x09\x0a\x09allNodes := self nodes asSet.\x0a\x09self nodes do: [ :each | \x0a\x09\x09allNodes addAll: each allNodes ].\x0a\x09\x0a\x09^ allNodes",
  30611. referencedClasses: [],
  30612. messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"]
  30613. }),
  30614. $globals.Node);
  30615. $core.addMethod(
  30616. $core.method({
  30617. selector: "inPosition:",
  30618. protocol: 'testing',
  30619. fn: function (aPoint){
  30620. var self=this;
  30621. return $core.withContext(function($ctx1) {
  30622. return $recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  30623. return $core.withContext(function($ctx2) {
  30624. return $recv(self._positionEnd()).__gt_eq(aPoint);
  30625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30626. }));
  30627. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.Node)});
  30628. },
  30629. args: ["aPoint"],
  30630. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  30631. referencedClasses: [],
  30632. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  30633. }),
  30634. $globals.Node);
  30635. $core.addMethod(
  30636. $core.method({
  30637. selector: "isAssignmentNode",
  30638. protocol: 'testing',
  30639. fn: function (){
  30640. var self=this;
  30641. return false;
  30642. },
  30643. args: [],
  30644. source: "isAssignmentNode\x0a\x09^ false",
  30645. referencedClasses: [],
  30646. messageSends: []
  30647. }),
  30648. $globals.Node);
  30649. $core.addMethod(
  30650. $core.method({
  30651. selector: "isBlockNode",
  30652. protocol: 'testing',
  30653. fn: function (){
  30654. var self=this;
  30655. return false;
  30656. },
  30657. args: [],
  30658. source: "isBlockNode\x0a\x09^ false",
  30659. referencedClasses: [],
  30660. messageSends: []
  30661. }),
  30662. $globals.Node);
  30663. $core.addMethod(
  30664. $core.method({
  30665. selector: "isBlockSequenceNode",
  30666. protocol: 'testing',
  30667. fn: function (){
  30668. var self=this;
  30669. return false;
  30670. },
  30671. args: [],
  30672. source: "isBlockSequenceNode\x0a\x09^ false",
  30673. referencedClasses: [],
  30674. messageSends: []
  30675. }),
  30676. $globals.Node);
  30677. $core.addMethod(
  30678. $core.method({
  30679. selector: "isCascadeNode",
  30680. protocol: 'testing',
  30681. fn: function (){
  30682. var self=this;
  30683. return false;
  30684. },
  30685. args: [],
  30686. source: "isCascadeNode\x0a\x09^ false",
  30687. referencedClasses: [],
  30688. messageSends: []
  30689. }),
  30690. $globals.Node);
  30691. $core.addMethod(
  30692. $core.method({
  30693. selector: "isImmutable",
  30694. protocol: 'testing',
  30695. fn: function (){
  30696. var self=this;
  30697. return false;
  30698. },
  30699. args: [],
  30700. source: "isImmutable\x0a\x09^ false",
  30701. referencedClasses: [],
  30702. messageSends: []
  30703. }),
  30704. $globals.Node);
  30705. $core.addMethod(
  30706. $core.method({
  30707. selector: "isJSStatementNode",
  30708. protocol: 'testing',
  30709. fn: function (){
  30710. var self=this;
  30711. return false;
  30712. },
  30713. args: [],
  30714. source: "isJSStatementNode\x0a\x09^ false",
  30715. referencedClasses: [],
  30716. messageSends: []
  30717. }),
  30718. $globals.Node);
  30719. $core.addMethod(
  30720. $core.method({
  30721. selector: "isLastChild",
  30722. protocol: 'testing',
  30723. fn: function (){
  30724. var self=this;
  30725. return $core.withContext(function($ctx1) {
  30726. return $recv($recv($recv(self._parent())._nodes())._last()).__eq(self);
  30727. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.Node)});
  30728. },
  30729. args: [],
  30730. source: "isLastChild\x0a\x09^ self parent nodes last = self",
  30731. referencedClasses: [],
  30732. messageSends: ["=", "last", "nodes", "parent"]
  30733. }),
  30734. $globals.Node);
  30735. $core.addMethod(
  30736. $core.method({
  30737. selector: "isNavigationNode",
  30738. protocol: 'testing',
  30739. fn: function (){
  30740. var self=this;
  30741. return false;
  30742. },
  30743. args: [],
  30744. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  30745. referencedClasses: [],
  30746. messageSends: []
  30747. }),
  30748. $globals.Node);
  30749. $core.addMethod(
  30750. $core.method({
  30751. selector: "isNode",
  30752. protocol: 'testing',
  30753. fn: function (){
  30754. var self=this;
  30755. return true;
  30756. },
  30757. args: [],
  30758. source: "isNode\x0a\x09^ true",
  30759. referencedClasses: [],
  30760. messageSends: []
  30761. }),
  30762. $globals.Node);
  30763. $core.addMethod(
  30764. $core.method({
  30765. selector: "isReferenced",
  30766. protocol: 'testing',
  30767. fn: function (){
  30768. var self=this;
  30769. return $core.withContext(function($ctx1) {
  30770. var $3,$2,$1;
  30771. $3=self._parent();
  30772. $ctx1.sendIdx["parent"]=1;
  30773. $2=$recv($3)._isSequenceNode();
  30774. $1=$recv($2)._or_((function(){
  30775. return $core.withContext(function($ctx2) {
  30776. return $recv(self._parent())._isAssignmentNode();
  30777. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30778. }));
  30779. return $recv($1)._not();
  30780. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.Node)});
  30781. },
  30782. args: [],
  30783. 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",
  30784. referencedClasses: [],
  30785. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  30786. }),
  30787. $globals.Node);
  30788. $core.addMethod(
  30789. $core.method({
  30790. selector: "isReturnNode",
  30791. protocol: 'testing',
  30792. fn: function (){
  30793. var self=this;
  30794. return false;
  30795. },
  30796. args: [],
  30797. source: "isReturnNode\x0a\x09^ false",
  30798. referencedClasses: [],
  30799. messageSends: []
  30800. }),
  30801. $globals.Node);
  30802. $core.addMethod(
  30803. $core.method({
  30804. selector: "isSendNode",
  30805. protocol: 'testing',
  30806. fn: function (){
  30807. var self=this;
  30808. return false;
  30809. },
  30810. args: [],
  30811. source: "isSendNode\x0a\x09^ false",
  30812. referencedClasses: [],
  30813. messageSends: []
  30814. }),
  30815. $globals.Node);
  30816. $core.addMethod(
  30817. $core.method({
  30818. selector: "isSequenceNode",
  30819. protocol: 'testing',
  30820. fn: function (){
  30821. var self=this;
  30822. return false;
  30823. },
  30824. args: [],
  30825. source: "isSequenceNode\x0a\x09^ false",
  30826. referencedClasses: [],
  30827. messageSends: []
  30828. }),
  30829. $globals.Node);
  30830. $core.addMethod(
  30831. $core.method({
  30832. selector: "isSuperKeyword",
  30833. protocol: 'testing',
  30834. fn: function (){
  30835. var self=this;
  30836. return false;
  30837. },
  30838. args: [],
  30839. source: "isSuperKeyword\x0a\x09^ false",
  30840. referencedClasses: [],
  30841. messageSends: []
  30842. }),
  30843. $globals.Node);
  30844. $core.addMethod(
  30845. $core.method({
  30846. selector: "isValueNode",
  30847. protocol: 'testing',
  30848. fn: function (){
  30849. var self=this;
  30850. return false;
  30851. },
  30852. args: [],
  30853. source: "isValueNode\x0a\x09^ false",
  30854. referencedClasses: [],
  30855. messageSends: []
  30856. }),
  30857. $globals.Node);
  30858. $core.addMethod(
  30859. $core.method({
  30860. selector: "isVariableNode",
  30861. protocol: 'testing',
  30862. fn: function (){
  30863. var self=this;
  30864. return false;
  30865. },
  30866. args: [],
  30867. source: "isVariableNode\x0a\x09^ false",
  30868. referencedClasses: [],
  30869. messageSends: []
  30870. }),
  30871. $globals.Node);
  30872. $core.addMethod(
  30873. $core.method({
  30874. selector: "location:",
  30875. protocol: 'accessing',
  30876. fn: function (aLocation){
  30877. var self=this;
  30878. return $core.withContext(function($ctx1) {
  30879. var $3,$2,$1;
  30880. $3=$recv(aLocation)._start();
  30881. $ctx1.sendIdx["start"]=1;
  30882. $2=$recv($3)._line();
  30883. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  30884. self._position_($1);
  30885. return self;
  30886. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.Node)});
  30887. },
  30888. args: ["aLocation"],
  30889. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  30890. referencedClasses: [],
  30891. messageSends: ["position:", "@", "line", "start", "column"]
  30892. }),
  30893. $globals.Node);
  30894. $core.addMethod(
  30895. $core.method({
  30896. selector: "method",
  30897. protocol: 'accessing',
  30898. fn: function (){
  30899. var self=this;
  30900. return $core.withContext(function($ctx1) {
  30901. var $1,$receiver;
  30902. $1=self._parent();
  30903. if(($receiver = $1) == null || $receiver.isNil){
  30904. return $1;
  30905. } else {
  30906. var node;
  30907. node=$receiver;
  30908. return $recv(node)._method();
  30909. };
  30910. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.Node)});
  30911. },
  30912. args: [],
  30913. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  30914. referencedClasses: [],
  30915. messageSends: ["ifNotNil:", "parent", "method"]
  30916. }),
  30917. $globals.Node);
  30918. $core.addMethod(
  30919. $core.method({
  30920. selector: "navigationNodeAt:ifAbsent:",
  30921. protocol: 'accessing',
  30922. fn: function (aPoint,aBlock){
  30923. var self=this;
  30924. var children;
  30925. return $core.withContext(function($ctx1) {
  30926. var $2,$1;
  30927. var $early={};
  30928. try {
  30929. children=$recv(self._allNodes())._select_((function(each){
  30930. return $core.withContext(function($ctx2) {
  30931. return $recv($recv(each)._isNavigationNode())._and_((function(){
  30932. return $core.withContext(function($ctx3) {
  30933. return $recv(each)._inPosition_(aPoint);
  30934. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  30935. }));
  30936. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30937. }));
  30938. $recv(children)._ifEmpty_((function(){
  30939. return $core.withContext(function($ctx2) {
  30940. throw $early=[$recv(aBlock)._value()];
  30941. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  30942. }));
  30943. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  30944. return $core.withContext(function($ctx2) {
  30945. $2=$recv(a)._positionStart();
  30946. $ctx2.sendIdx["positionStart"]=1;
  30947. $1=$recv($2)._dist_(aPoint);
  30948. $ctx2.sendIdx["dist:"]=1;
  30949. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  30950. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  30951. })))._first();
  30952. }
  30953. catch(e) {if(e===$early)return e[0]; throw e}
  30954. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.Node)});
  30955. },
  30956. args: ["aPoint", "aBlock"],
  30957. 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 allNodes 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",
  30958. referencedClasses: [],
  30959. messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  30960. }),
  30961. $globals.Node);
  30962. $core.addMethod(
  30963. $core.method({
  30964. selector: "nodes",
  30965. protocol: 'accessing',
  30966. fn: function (){
  30967. var self=this;
  30968. return $core.withContext(function($ctx1) {
  30969. var $1,$receiver;
  30970. $1=self["@nodes"];
  30971. if(($receiver = $1) == null || $receiver.isNil){
  30972. self["@nodes"]=$recv($globals.Array)._new();
  30973. return self["@nodes"];
  30974. } else {
  30975. return $1;
  30976. };
  30977. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.Node)});
  30978. },
  30979. args: [],
  30980. source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  30981. referencedClasses: ["Array"],
  30982. messageSends: ["ifNil:", "new"]
  30983. }),
  30984. $globals.Node);
  30985. $core.addMethod(
  30986. $core.method({
  30987. selector: "nodes:",
  30988. protocol: 'building',
  30989. fn: function (aCollection){
  30990. var self=this;
  30991. return $core.withContext(function($ctx1) {
  30992. self["@nodes"]=aCollection;
  30993. $recv(aCollection)._do_((function(each){
  30994. return $core.withContext(function($ctx2) {
  30995. return $recv(each)._parent_(self);
  30996. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30997. }));
  30998. return self;
  30999. }, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},$globals.Node)});
  31000. },
  31001. args: ["aCollection"],
  31002. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  31003. referencedClasses: [],
  31004. messageSends: ["do:", "parent:"]
  31005. }),
  31006. $globals.Node);
  31007. $core.addMethod(
  31008. $core.method({
  31009. selector: "parent",
  31010. protocol: 'accessing',
  31011. fn: function (){
  31012. var self=this;
  31013. return self["@parent"];
  31014. },
  31015. args: [],
  31016. source: "parent\x0a\x09^ parent",
  31017. referencedClasses: [],
  31018. messageSends: []
  31019. }),
  31020. $globals.Node);
  31021. $core.addMethod(
  31022. $core.method({
  31023. selector: "parent:",
  31024. protocol: 'accessing',
  31025. fn: function (aNode){
  31026. var self=this;
  31027. self["@parent"]=aNode;
  31028. return self;
  31029. },
  31030. args: ["aNode"],
  31031. source: "parent: aNode\x0a\x09parent := aNode",
  31032. referencedClasses: [],
  31033. messageSends: []
  31034. }),
  31035. $globals.Node);
  31036. $core.addMethod(
  31037. $core.method({
  31038. selector: "position",
  31039. protocol: 'accessing',
  31040. fn: function (){
  31041. var self=this;
  31042. return $core.withContext(function($ctx1) {
  31043. var $1,$2,$receiver;
  31044. $1=self["@position"];
  31045. if(($receiver = $1) == null || $receiver.isNil){
  31046. $2=self._parent();
  31047. if(($receiver = $2) == null || $receiver.isNil){
  31048. return $2;
  31049. } else {
  31050. var node;
  31051. node=$receiver;
  31052. return $recv(node)._position();
  31053. };
  31054. } else {
  31055. return $1;
  31056. };
  31057. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Node)});
  31058. },
  31059. args: [],
  31060. 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 ] ]",
  31061. referencedClasses: [],
  31062. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  31063. }),
  31064. $globals.Node);
  31065. $core.addMethod(
  31066. $core.method({
  31067. selector: "position:",
  31068. protocol: 'accessing',
  31069. fn: function (aPosition){
  31070. var self=this;
  31071. self["@position"]=aPosition;
  31072. return self;
  31073. },
  31074. args: ["aPosition"],
  31075. source: "position: aPosition\x0a\x09position := aPosition",
  31076. referencedClasses: [],
  31077. messageSends: []
  31078. }),
  31079. $globals.Node);
  31080. $core.addMethod(
  31081. $core.method({
  31082. selector: "positionEnd",
  31083. protocol: 'accessing',
  31084. fn: function (){
  31085. var self=this;
  31086. return $core.withContext(function($ctx1) {
  31087. var $1,$6,$5,$4,$3,$2;
  31088. $1=self._positionStart();
  31089. $6=self._source();
  31090. $ctx1.sendIdx["source"]=1;
  31091. $5=$recv($6)._lines();
  31092. $ctx1.sendIdx["lines"]=1;
  31093. $4=$recv($5)._size();
  31094. $ctx1.sendIdx["size"]=1;
  31095. $3=$recv($4).__minus((1));
  31096. $ctx1.sendIdx["-"]=1;
  31097. $2=$recv($3).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1)));
  31098. return $recv($1).__plus($2);
  31099. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.Node)});
  31100. },
  31101. args: [],
  31102. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  31103. referencedClasses: [],
  31104. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  31105. }),
  31106. $globals.Node);
  31107. $core.addMethod(
  31108. $core.method({
  31109. selector: "positionStart",
  31110. protocol: 'accessing',
  31111. fn: function (){
  31112. var self=this;
  31113. return $core.withContext(function($ctx1) {
  31114. return self._position();
  31115. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.Node)});
  31116. },
  31117. args: [],
  31118. source: "positionStart\x0a\x09^ self position",
  31119. referencedClasses: [],
  31120. messageSends: ["position"]
  31121. }),
  31122. $globals.Node);
  31123. $core.addMethod(
  31124. $core.method({
  31125. selector: "postCopy",
  31126. protocol: 'copying',
  31127. fn: function (){
  31128. var self=this;
  31129. return $core.withContext(function($ctx1) {
  31130. (
  31131. $ctx1.supercall = true,
  31132. ($globals.Node.superclass||$boot.nilAsClass).fn.prototype._postCopy.apply($recv(self), []));
  31133. $ctx1.supercall = false;
  31134. $recv(self._nodes())._do_((function(each){
  31135. return $core.withContext(function($ctx2) {
  31136. return $recv(each)._parent_(self);
  31137. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31138. }));
  31139. return self;
  31140. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.Node)});
  31141. },
  31142. args: [],
  31143. source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
  31144. referencedClasses: [],
  31145. messageSends: ["postCopy", "do:", "nodes", "parent:"]
  31146. }),
  31147. $globals.Node);
  31148. $core.addMethod(
  31149. $core.method({
  31150. selector: "requiresSmalltalkContext",
  31151. protocol: 'testing',
  31152. fn: function (){
  31153. var self=this;
  31154. return $core.withContext(function($ctx1) {
  31155. return $recv($recv(self._nodes())._detect_ifNone_((function(each){
  31156. return $core.withContext(function($ctx2) {
  31157. return $recv(each)._requiresSmalltalkContext();
  31158. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31159. }),(function(){
  31160. return nil;
  31161. })))._notNil();
  31162. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.Node)});
  31163. },
  31164. args: [],
  31165. 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 nodes \x0a\x09\x09detect: [ :each | each requiresSmalltalkContext ]\x0a\x09\x09ifNone: [ nil ]) notNil",
  31166. referencedClasses: [],
  31167. messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"]
  31168. }),
  31169. $globals.Node);
  31170. $core.addMethod(
  31171. $core.method({
  31172. selector: "shouldBeAliased",
  31173. protocol: 'accessing',
  31174. fn: function (){
  31175. var self=this;
  31176. return $core.withContext(function($ctx1) {
  31177. var $1,$receiver;
  31178. $1=self["@shouldBeAliased"];
  31179. if(($receiver = $1) == null || $receiver.isNil){
  31180. return false;
  31181. } else {
  31182. return $1;
  31183. };
  31184. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.Node)});
  31185. },
  31186. args: [],
  31187. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  31188. referencedClasses: [],
  31189. messageSends: ["ifNil:"]
  31190. }),
  31191. $globals.Node);
  31192. $core.addMethod(
  31193. $core.method({
  31194. selector: "shouldBeAliased:",
  31195. protocol: 'accessing',
  31196. fn: function (aBoolean){
  31197. var self=this;
  31198. self["@shouldBeAliased"]=aBoolean;
  31199. return self;
  31200. },
  31201. args: ["aBoolean"],
  31202. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  31203. referencedClasses: [],
  31204. messageSends: []
  31205. }),
  31206. $globals.Node);
  31207. $core.addMethod(
  31208. $core.method({
  31209. selector: "shouldBeInlined",
  31210. protocol: 'accessing',
  31211. fn: function (){
  31212. var self=this;
  31213. return $core.withContext(function($ctx1) {
  31214. var $1,$receiver;
  31215. $1=self["@shouldBeInlined"];
  31216. if(($receiver = $1) == null || $receiver.isNil){
  31217. return false;
  31218. } else {
  31219. return $1;
  31220. };
  31221. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.Node)});
  31222. },
  31223. args: [],
  31224. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  31225. referencedClasses: [],
  31226. messageSends: ["ifNil:"]
  31227. }),
  31228. $globals.Node);
  31229. $core.addMethod(
  31230. $core.method({
  31231. selector: "shouldBeInlined:",
  31232. protocol: 'accessing',
  31233. fn: function (aBoolean){
  31234. var self=this;
  31235. self["@shouldBeInlined"]=aBoolean;
  31236. return self;
  31237. },
  31238. args: ["aBoolean"],
  31239. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  31240. referencedClasses: [],
  31241. messageSends: []
  31242. }),
  31243. $globals.Node);
  31244. $core.addMethod(
  31245. $core.method({
  31246. selector: "size",
  31247. protocol: 'accessing',
  31248. fn: function (){
  31249. var self=this;
  31250. return $core.withContext(function($ctx1) {
  31251. return $recv(self._source())._size();
  31252. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Node)});
  31253. },
  31254. args: [],
  31255. source: "size\x0a\x09^ self source size",
  31256. referencedClasses: [],
  31257. messageSends: ["size", "source"]
  31258. }),
  31259. $globals.Node);
  31260. $core.addMethod(
  31261. $core.method({
  31262. selector: "source",
  31263. protocol: 'accessing',
  31264. fn: function (){
  31265. var self=this;
  31266. return $core.withContext(function($ctx1) {
  31267. var $1,$receiver;
  31268. $1=self["@source"];
  31269. if(($receiver = $1) == null || $receiver.isNil){
  31270. return "";
  31271. } else {
  31272. return $1;
  31273. };
  31274. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Node)});
  31275. },
  31276. args: [],
  31277. source: "source\x0a\x09^ source ifNil: [ '' ]",
  31278. referencedClasses: [],
  31279. messageSends: ["ifNil:"]
  31280. }),
  31281. $globals.Node);
  31282. $core.addMethod(
  31283. $core.method({
  31284. selector: "source:",
  31285. protocol: 'accessing',
  31286. fn: function (aString){
  31287. var self=this;
  31288. self["@source"]=aString;
  31289. return self;
  31290. },
  31291. args: ["aString"],
  31292. source: "source: aString\x0a\x09source := aString",
  31293. referencedClasses: [],
  31294. messageSends: []
  31295. }),
  31296. $globals.Node);
  31297. $core.addMethod(
  31298. $core.method({
  31299. selector: "subtreeNeedsAliasing",
  31300. protocol: 'testing',
  31301. fn: function (){
  31302. var self=this;
  31303. return $core.withContext(function($ctx1) {
  31304. var $1;
  31305. $1=$recv($recv(self._shouldBeAliased())._or_((function(){
  31306. return $core.withContext(function($ctx2) {
  31307. return self._shouldBeInlined();
  31308. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31309. })))._or_((function(){
  31310. return $core.withContext(function($ctx2) {
  31311. return $recv(self._nodes())._anySatisfy_((function(each){
  31312. return $core.withContext(function($ctx3) {
  31313. return $recv(each)._subtreeNeedsAliasing();
  31314. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  31315. }));
  31316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31317. }));
  31318. $ctx1.sendIdx["or:"]=1;
  31319. return $1;
  31320. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.Node)});
  31321. },
  31322. args: [],
  31323. source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  31324. referencedClasses: [],
  31325. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"]
  31326. }),
  31327. $globals.Node);
  31328. $core.addClass('AssignmentNode', $globals.Node, ['left', 'right'], 'Compiler-AST');
  31329. $globals.AssignmentNode.comment="I represent an assignment node.";
  31330. $core.addMethod(
  31331. $core.method({
  31332. selector: "accept:",
  31333. protocol: 'visiting',
  31334. fn: function (aVisitor){
  31335. var self=this;
  31336. return $core.withContext(function($ctx1) {
  31337. return $recv(aVisitor)._visitAssignmentNode_(self);
  31338. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  31339. },
  31340. args: ["aVisitor"],
  31341. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  31342. referencedClasses: [],
  31343. messageSends: ["visitAssignmentNode:"]
  31344. }),
  31345. $globals.AssignmentNode);
  31346. $core.addMethod(
  31347. $core.method({
  31348. selector: "isAssignmentNode",
  31349. protocol: 'testing',
  31350. fn: function (){
  31351. var self=this;
  31352. return true;
  31353. },
  31354. args: [],
  31355. source: "isAssignmentNode\x0a\x09^ true",
  31356. referencedClasses: [],
  31357. messageSends: []
  31358. }),
  31359. $globals.AssignmentNode);
  31360. $core.addMethod(
  31361. $core.method({
  31362. selector: "left",
  31363. protocol: 'accessing',
  31364. fn: function (){
  31365. var self=this;
  31366. return self["@left"];
  31367. },
  31368. args: [],
  31369. source: "left\x0a\x09^ left",
  31370. referencedClasses: [],
  31371. messageSends: []
  31372. }),
  31373. $globals.AssignmentNode);
  31374. $core.addMethod(
  31375. $core.method({
  31376. selector: "left:",
  31377. protocol: 'accessing',
  31378. fn: function (aNode){
  31379. var self=this;
  31380. return $core.withContext(function($ctx1) {
  31381. self["@left"]=aNode;
  31382. $recv(aNode)._parent_(self);
  31383. return self;
  31384. }, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},$globals.AssignmentNode)});
  31385. },
  31386. args: ["aNode"],
  31387. source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
  31388. referencedClasses: [],
  31389. messageSends: ["parent:"]
  31390. }),
  31391. $globals.AssignmentNode);
  31392. $core.addMethod(
  31393. $core.method({
  31394. selector: "nodes",
  31395. protocol: 'accessing',
  31396. fn: function (){
  31397. var self=this;
  31398. return $core.withContext(function($ctx1) {
  31399. return $recv($globals.Array)._with_with_(self._left(),self._right());
  31400. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.AssignmentNode)});
  31401. },
  31402. args: [],
  31403. source: "nodes\x0a\x09^ Array with: self left with: self right",
  31404. referencedClasses: ["Array"],
  31405. messageSends: ["with:with:", "left", "right"]
  31406. }),
  31407. $globals.AssignmentNode);
  31408. $core.addMethod(
  31409. $core.method({
  31410. selector: "right",
  31411. protocol: 'accessing',
  31412. fn: function (){
  31413. var self=this;
  31414. return self["@right"];
  31415. },
  31416. args: [],
  31417. source: "right\x0a\x09^ right",
  31418. referencedClasses: [],
  31419. messageSends: []
  31420. }),
  31421. $globals.AssignmentNode);
  31422. $core.addMethod(
  31423. $core.method({
  31424. selector: "right:",
  31425. protocol: 'accessing',
  31426. fn: function (aNode){
  31427. var self=this;
  31428. return $core.withContext(function($ctx1) {
  31429. self["@right"]=aNode;
  31430. $recv(aNode)._parent_(self);
  31431. return self;
  31432. }, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},$globals.AssignmentNode)});
  31433. },
  31434. args: ["aNode"],
  31435. source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
  31436. referencedClasses: [],
  31437. messageSends: ["parent:"]
  31438. }),
  31439. $globals.AssignmentNode);
  31440. $core.addMethod(
  31441. $core.method({
  31442. selector: "shouldBeAliased",
  31443. protocol: 'testing',
  31444. fn: function (){
  31445. var self=this;
  31446. return $core.withContext(function($ctx1) {
  31447. var $1;
  31448. $1=(
  31449. $ctx1.supercall = true,
  31450. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($recv(self), []));
  31451. $ctx1.supercall = false;
  31452. return $recv($1)._or_((function(){
  31453. return $core.withContext(function($ctx2) {
  31454. return self._isReferenced();
  31455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31456. }));
  31457. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  31458. },
  31459. args: [],
  31460. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  31461. referencedClasses: [],
  31462. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  31463. }),
  31464. $globals.AssignmentNode);
  31465. $core.addClass('BlockNode', $globals.Node, ['parameters', 'scope'], 'Compiler-AST');
  31466. $globals.BlockNode.comment="I represent an block closure node.";
  31467. $core.addMethod(
  31468. $core.method({
  31469. selector: "accept:",
  31470. protocol: 'visiting',
  31471. fn: function (aVisitor){
  31472. var self=this;
  31473. return $core.withContext(function($ctx1) {
  31474. return $recv(aVisitor)._visitBlockNode_(self);
  31475. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockNode)});
  31476. },
  31477. args: ["aVisitor"],
  31478. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  31479. referencedClasses: [],
  31480. messageSends: ["visitBlockNode:"]
  31481. }),
  31482. $globals.BlockNode);
  31483. $core.addMethod(
  31484. $core.method({
  31485. selector: "isBlockNode",
  31486. protocol: 'testing',
  31487. fn: function (){
  31488. var self=this;
  31489. return true;
  31490. },
  31491. args: [],
  31492. source: "isBlockNode\x0a\x09^ true",
  31493. referencedClasses: [],
  31494. messageSends: []
  31495. }),
  31496. $globals.BlockNode);
  31497. $core.addMethod(
  31498. $core.method({
  31499. selector: "parameters",
  31500. protocol: 'accessing',
  31501. fn: function (){
  31502. var self=this;
  31503. return $core.withContext(function($ctx1) {
  31504. var $1,$receiver;
  31505. $1=self["@parameters"];
  31506. if(($receiver = $1) == null || $receiver.isNil){
  31507. self["@parameters"]=$recv($globals.Array)._new();
  31508. return self["@parameters"];
  31509. } else {
  31510. return $1;
  31511. };
  31512. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  31513. },
  31514. args: [],
  31515. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  31516. referencedClasses: ["Array"],
  31517. messageSends: ["ifNil:", "new"]
  31518. }),
  31519. $globals.BlockNode);
  31520. $core.addMethod(
  31521. $core.method({
  31522. selector: "parameters:",
  31523. protocol: 'accessing',
  31524. fn: function (aCollection){
  31525. var self=this;
  31526. self["@parameters"]=aCollection;
  31527. return self;
  31528. },
  31529. args: ["aCollection"],
  31530. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  31531. referencedClasses: [],
  31532. messageSends: []
  31533. }),
  31534. $globals.BlockNode);
  31535. $core.addMethod(
  31536. $core.method({
  31537. selector: "scope",
  31538. protocol: 'accessing',
  31539. fn: function (){
  31540. var self=this;
  31541. return self["@scope"];
  31542. },
  31543. args: [],
  31544. source: "scope\x0a\x09^ scope",
  31545. referencedClasses: [],
  31546. messageSends: []
  31547. }),
  31548. $globals.BlockNode);
  31549. $core.addMethod(
  31550. $core.method({
  31551. selector: "scope:",
  31552. protocol: 'accessing',
  31553. fn: function (aLexicalScope){
  31554. var self=this;
  31555. self["@scope"]=aLexicalScope;
  31556. return self;
  31557. },
  31558. args: ["aLexicalScope"],
  31559. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  31560. referencedClasses: [],
  31561. messageSends: []
  31562. }),
  31563. $globals.BlockNode);
  31564. $core.addMethod(
  31565. $core.method({
  31566. selector: "subtreeNeedsAliasing",
  31567. protocol: 'testing',
  31568. fn: function (){
  31569. var self=this;
  31570. return $core.withContext(function($ctx1) {
  31571. return $recv(self._shouldBeAliased())._or_((function(){
  31572. return $core.withContext(function($ctx2) {
  31573. return self._shouldBeInlined();
  31574. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31575. }));
  31576. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  31577. },
  31578. args: [],
  31579. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  31580. referencedClasses: [],
  31581. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"]
  31582. }),
  31583. $globals.BlockNode);
  31584. $core.addClass('CascadeNode', $globals.Node, ['receiver'], 'Compiler-AST');
  31585. $globals.CascadeNode.comment="I represent an cascade node.";
  31586. $core.addMethod(
  31587. $core.method({
  31588. selector: "accept:",
  31589. protocol: 'visiting',
  31590. fn: function (aVisitor){
  31591. var self=this;
  31592. return $core.withContext(function($ctx1) {
  31593. return $recv(aVisitor)._visitCascadeNode_(self);
  31594. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.CascadeNode)});
  31595. },
  31596. args: ["aVisitor"],
  31597. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  31598. referencedClasses: [],
  31599. messageSends: ["visitCascadeNode:"]
  31600. }),
  31601. $globals.CascadeNode);
  31602. $core.addMethod(
  31603. $core.method({
  31604. selector: "isCascadeNode",
  31605. protocol: 'testing',
  31606. fn: function (){
  31607. var self=this;
  31608. return true;
  31609. },
  31610. args: [],
  31611. source: "isCascadeNode\x0a\x09^ true",
  31612. referencedClasses: [],
  31613. messageSends: []
  31614. }),
  31615. $globals.CascadeNode);
  31616. $core.addMethod(
  31617. $core.method({
  31618. selector: "receiver",
  31619. protocol: 'accessing',
  31620. fn: function (){
  31621. var self=this;
  31622. return self["@receiver"];
  31623. },
  31624. args: [],
  31625. source: "receiver\x0a\x09^ receiver",
  31626. referencedClasses: [],
  31627. messageSends: []
  31628. }),
  31629. $globals.CascadeNode);
  31630. $core.addMethod(
  31631. $core.method({
  31632. selector: "receiver:",
  31633. protocol: 'accessing',
  31634. fn: function (aNode){
  31635. var self=this;
  31636. self["@receiver"]=aNode;
  31637. return self;
  31638. },
  31639. args: ["aNode"],
  31640. source: "receiver: aNode\x0a\x09receiver := aNode",
  31641. referencedClasses: [],
  31642. messageSends: []
  31643. }),
  31644. $globals.CascadeNode);
  31645. $core.addMethod(
  31646. $core.method({
  31647. selector: "subtreeNeedsAliasing",
  31648. protocol: 'testing',
  31649. fn: function (){
  31650. var self=this;
  31651. return $core.withContext(function($ctx1) {
  31652. return $recv($recv(self._parent())._isSequenceNode())._not();
  31653. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  31654. },
  31655. args: [],
  31656. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  31657. referencedClasses: [],
  31658. messageSends: ["not", "isSequenceNode", "parent"]
  31659. }),
  31660. $globals.CascadeNode);
  31661. $core.addClass('DynamicArrayNode', $globals.Node, [], 'Compiler-AST');
  31662. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  31663. $core.addMethod(
  31664. $core.method({
  31665. selector: "accept:",
  31666. protocol: 'visiting',
  31667. fn: function (aVisitor){
  31668. var self=this;
  31669. return $core.withContext(function($ctx1) {
  31670. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  31671. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  31672. },
  31673. args: ["aVisitor"],
  31674. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  31675. referencedClasses: [],
  31676. messageSends: ["visitDynamicArrayNode:"]
  31677. }),
  31678. $globals.DynamicArrayNode);
  31679. $core.addClass('DynamicDictionaryNode', $globals.Node, [], 'Compiler-AST');
  31680. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  31681. $core.addMethod(
  31682. $core.method({
  31683. selector: "accept:",
  31684. protocol: 'visiting',
  31685. fn: function (aVisitor){
  31686. var self=this;
  31687. return $core.withContext(function($ctx1) {
  31688. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  31689. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  31690. },
  31691. args: ["aVisitor"],
  31692. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  31693. referencedClasses: [],
  31694. messageSends: ["visitDynamicDictionaryNode:"]
  31695. }),
  31696. $globals.DynamicDictionaryNode);
  31697. $core.addClass('JSStatementNode', $globals.Node, [], 'Compiler-AST');
  31698. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  31699. $core.addMethod(
  31700. $core.method({
  31701. selector: "accept:",
  31702. protocol: 'visiting',
  31703. fn: function (aVisitor){
  31704. var self=this;
  31705. return $core.withContext(function($ctx1) {
  31706. return $recv(aVisitor)._visitJSStatementNode_(self);
  31707. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  31708. },
  31709. args: ["aVisitor"],
  31710. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  31711. referencedClasses: [],
  31712. messageSends: ["visitJSStatementNode:"]
  31713. }),
  31714. $globals.JSStatementNode);
  31715. $core.addMethod(
  31716. $core.method({
  31717. selector: "isJSStatementNode",
  31718. protocol: 'testing',
  31719. fn: function (){
  31720. var self=this;
  31721. return true;
  31722. },
  31723. args: [],
  31724. source: "isJSStatementNode\x0a\x09^ true",
  31725. referencedClasses: [],
  31726. messageSends: []
  31727. }),
  31728. $globals.JSStatementNode);
  31729. $core.addMethod(
  31730. $core.method({
  31731. selector: "requiresSmalltalkContext",
  31732. protocol: 'testing',
  31733. fn: function (){
  31734. var self=this;
  31735. return true;
  31736. },
  31737. args: [],
  31738. source: "requiresSmalltalkContext\x0a\x09^ true",
  31739. referencedClasses: [],
  31740. messageSends: []
  31741. }),
  31742. $globals.JSStatementNode);
  31743. $core.addClass('MethodNode', $globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes'], 'Compiler-AST');
  31744. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  31745. $core.addMethod(
  31746. $core.method({
  31747. selector: "accept:",
  31748. protocol: 'visiting',
  31749. fn: function (aVisitor){
  31750. var self=this;
  31751. return $core.withContext(function($ctx1) {
  31752. return $recv(aVisitor)._visitMethodNode_(self);
  31753. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.MethodNode)});
  31754. },
  31755. args: ["aVisitor"],
  31756. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  31757. referencedClasses: [],
  31758. messageSends: ["visitMethodNode:"]
  31759. }),
  31760. $globals.MethodNode);
  31761. $core.addMethod(
  31762. $core.method({
  31763. selector: "arguments",
  31764. protocol: 'accessing',
  31765. fn: function (){
  31766. var self=this;
  31767. return $core.withContext(function($ctx1) {
  31768. var $1,$receiver;
  31769. $1=self["@arguments"];
  31770. if(($receiver = $1) == null || $receiver.isNil){
  31771. return [];
  31772. } else {
  31773. return $1;
  31774. };
  31775. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  31776. },
  31777. args: [],
  31778. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  31779. referencedClasses: [],
  31780. messageSends: ["ifNil:"]
  31781. }),
  31782. $globals.MethodNode);
  31783. $core.addMethod(
  31784. $core.method({
  31785. selector: "arguments:",
  31786. protocol: 'accessing',
  31787. fn: function (aCollection){
  31788. var self=this;
  31789. self["@arguments"]=aCollection;
  31790. return self;
  31791. },
  31792. args: ["aCollection"],
  31793. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  31794. referencedClasses: [],
  31795. messageSends: []
  31796. }),
  31797. $globals.MethodNode);
  31798. $core.addMethod(
  31799. $core.method({
  31800. selector: "classReferences",
  31801. protocol: 'accessing',
  31802. fn: function (){
  31803. var self=this;
  31804. return self["@classReferences"];
  31805. },
  31806. args: [],
  31807. source: "classReferences\x0a\x09^ classReferences",
  31808. referencedClasses: [],
  31809. messageSends: []
  31810. }),
  31811. $globals.MethodNode);
  31812. $core.addMethod(
  31813. $core.method({
  31814. selector: "classReferences:",
  31815. protocol: 'accessing',
  31816. fn: function (aCollection){
  31817. var self=this;
  31818. self["@classReferences"]=aCollection;
  31819. return self;
  31820. },
  31821. args: ["aCollection"],
  31822. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  31823. referencedClasses: [],
  31824. messageSends: []
  31825. }),
  31826. $globals.MethodNode);
  31827. $core.addMethod(
  31828. $core.method({
  31829. selector: "messageSends",
  31830. protocol: 'accessing',
  31831. fn: function (){
  31832. var self=this;
  31833. return $core.withContext(function($ctx1) {
  31834. return $recv(self._sendIndexes())._keys();
  31835. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  31836. },
  31837. args: [],
  31838. source: "messageSends\x0a\x09^ self sendIndexes keys",
  31839. referencedClasses: [],
  31840. messageSends: ["keys", "sendIndexes"]
  31841. }),
  31842. $globals.MethodNode);
  31843. $core.addMethod(
  31844. $core.method({
  31845. selector: "method",
  31846. protocol: 'accessing',
  31847. fn: function (){
  31848. var self=this;
  31849. return self;
  31850. },
  31851. args: [],
  31852. source: "method\x0a\x09^ self",
  31853. referencedClasses: [],
  31854. messageSends: []
  31855. }),
  31856. $globals.MethodNode);
  31857. $core.addMethod(
  31858. $core.method({
  31859. selector: "scope",
  31860. protocol: 'accessing',
  31861. fn: function (){
  31862. var self=this;
  31863. return self["@scope"];
  31864. },
  31865. args: [],
  31866. source: "scope\x0a\x09^ scope",
  31867. referencedClasses: [],
  31868. messageSends: []
  31869. }),
  31870. $globals.MethodNode);
  31871. $core.addMethod(
  31872. $core.method({
  31873. selector: "scope:",
  31874. protocol: 'accessing',
  31875. fn: function (aMethodScope){
  31876. var self=this;
  31877. self["@scope"]=aMethodScope;
  31878. return self;
  31879. },
  31880. args: ["aMethodScope"],
  31881. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  31882. referencedClasses: [],
  31883. messageSends: []
  31884. }),
  31885. $globals.MethodNode);
  31886. $core.addMethod(
  31887. $core.method({
  31888. selector: "selector",
  31889. protocol: 'accessing',
  31890. fn: function (){
  31891. var self=this;
  31892. return self["@selector"];
  31893. },
  31894. args: [],
  31895. source: "selector\x0a\x09^ selector",
  31896. referencedClasses: [],
  31897. messageSends: []
  31898. }),
  31899. $globals.MethodNode);
  31900. $core.addMethod(
  31901. $core.method({
  31902. selector: "selector:",
  31903. protocol: 'accessing',
  31904. fn: function (aString){
  31905. var self=this;
  31906. self["@selector"]=aString;
  31907. return self;
  31908. },
  31909. args: ["aString"],
  31910. source: "selector: aString\x0a\x09selector := aString",
  31911. referencedClasses: [],
  31912. messageSends: []
  31913. }),
  31914. $globals.MethodNode);
  31915. $core.addMethod(
  31916. $core.method({
  31917. selector: "sendIndexes",
  31918. protocol: 'accessing',
  31919. fn: function (){
  31920. var self=this;
  31921. return self["@sendIndexes"];
  31922. },
  31923. args: [],
  31924. source: "sendIndexes\x0a\x09^ sendIndexes",
  31925. referencedClasses: [],
  31926. messageSends: []
  31927. }),
  31928. $globals.MethodNode);
  31929. $core.addMethod(
  31930. $core.method({
  31931. selector: "sendIndexes:",
  31932. protocol: 'accessing',
  31933. fn: function (aDictionary){
  31934. var self=this;
  31935. self["@sendIndexes"]=aDictionary;
  31936. return self;
  31937. },
  31938. args: ["aDictionary"],
  31939. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  31940. referencedClasses: [],
  31941. messageSends: []
  31942. }),
  31943. $globals.MethodNode);
  31944. $core.addMethod(
  31945. $core.method({
  31946. selector: "sequenceNode",
  31947. protocol: 'accessing',
  31948. fn: function (){
  31949. var self=this;
  31950. return $core.withContext(function($ctx1) {
  31951. var $1;
  31952. var $early={};
  31953. try {
  31954. $recv(self._nodes())._do_((function(each){
  31955. return $core.withContext(function($ctx2) {
  31956. $1=$recv(each)._isSequenceNode();
  31957. if($core.assert($1)){
  31958. throw $early=[each];
  31959. };
  31960. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31961. }));
  31962. return nil;
  31963. }
  31964. catch(e) {if(e===$early)return e[0]; throw e}
  31965. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  31966. },
  31967. args: [],
  31968. source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  31969. referencedClasses: [],
  31970. messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"]
  31971. }),
  31972. $globals.MethodNode);
  31973. $core.addMethod(
  31974. $core.method({
  31975. selector: "source",
  31976. protocol: 'accessing',
  31977. fn: function (){
  31978. var self=this;
  31979. return self["@source"];
  31980. },
  31981. args: [],
  31982. source: "source\x0a\x09^ source",
  31983. referencedClasses: [],
  31984. messageSends: []
  31985. }),
  31986. $globals.MethodNode);
  31987. $core.addMethod(
  31988. $core.method({
  31989. selector: "source:",
  31990. protocol: 'accessing',
  31991. fn: function (aString){
  31992. var self=this;
  31993. self["@source"]=aString;
  31994. return self;
  31995. },
  31996. args: ["aString"],
  31997. source: "source: aString\x0a\x09source := aString",
  31998. referencedClasses: [],
  31999. messageSends: []
  32000. }),
  32001. $globals.MethodNode);
  32002. $core.addClass('ReturnNode', $globals.Node, ['scope'], 'Compiler-AST');
  32003. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  32004. $core.addMethod(
  32005. $core.method({
  32006. selector: "accept:",
  32007. protocol: 'visiting',
  32008. fn: function (aVisitor){
  32009. var self=this;
  32010. return $core.withContext(function($ctx1) {
  32011. return $recv(aVisitor)._visitReturnNode_(self);
  32012. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ReturnNode)});
  32013. },
  32014. args: ["aVisitor"],
  32015. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  32016. referencedClasses: [],
  32017. messageSends: ["visitReturnNode:"]
  32018. }),
  32019. $globals.ReturnNode);
  32020. $core.addMethod(
  32021. $core.method({
  32022. selector: "isReturnNode",
  32023. protocol: 'testing',
  32024. fn: function (){
  32025. var self=this;
  32026. return true;
  32027. },
  32028. args: [],
  32029. source: "isReturnNode\x0a\x09^ true",
  32030. referencedClasses: [],
  32031. messageSends: []
  32032. }),
  32033. $globals.ReturnNode);
  32034. $core.addMethod(
  32035. $core.method({
  32036. selector: "nonLocalReturn",
  32037. protocol: 'testing',
  32038. fn: function (){
  32039. var self=this;
  32040. return $core.withContext(function($ctx1) {
  32041. return $recv($recv(self._scope())._isMethodScope())._not();
  32042. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  32043. },
  32044. args: [],
  32045. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  32046. referencedClasses: [],
  32047. messageSends: ["not", "isMethodScope", "scope"]
  32048. }),
  32049. $globals.ReturnNode);
  32050. $core.addMethod(
  32051. $core.method({
  32052. selector: "scope",
  32053. protocol: 'accessing',
  32054. fn: function (){
  32055. var self=this;
  32056. return self["@scope"];
  32057. },
  32058. args: [],
  32059. source: "scope\x0a\x09^ scope",
  32060. referencedClasses: [],
  32061. messageSends: []
  32062. }),
  32063. $globals.ReturnNode);
  32064. $core.addMethod(
  32065. $core.method({
  32066. selector: "scope:",
  32067. protocol: 'accessing',
  32068. fn: function (aLexicalScope){
  32069. var self=this;
  32070. self["@scope"]=aLexicalScope;
  32071. return self;
  32072. },
  32073. args: ["aLexicalScope"],
  32074. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32075. referencedClasses: [],
  32076. messageSends: []
  32077. }),
  32078. $globals.ReturnNode);
  32079. $core.addClass('SendNode', $globals.Node, ['selector', 'arguments', 'receiver', 'index'], 'Compiler-AST');
  32080. $globals.SendNode.comment="I represent an message send node.";
  32081. $core.addMethod(
  32082. $core.method({
  32083. selector: "accept:",
  32084. protocol: 'visiting',
  32085. fn: function (aVisitor){
  32086. var self=this;
  32087. return $core.withContext(function($ctx1) {
  32088. return $recv(aVisitor)._visitSendNode_(self);
  32089. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SendNode)});
  32090. },
  32091. args: ["aVisitor"],
  32092. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  32093. referencedClasses: [],
  32094. messageSends: ["visitSendNode:"]
  32095. }),
  32096. $globals.SendNode);
  32097. $core.addMethod(
  32098. $core.method({
  32099. selector: "arguments",
  32100. protocol: 'accessing',
  32101. fn: function (){
  32102. var self=this;
  32103. return $core.withContext(function($ctx1) {
  32104. var $1,$receiver;
  32105. $1=self["@arguments"];
  32106. if(($receiver = $1) == null || $receiver.isNil){
  32107. self["@arguments"]=[];
  32108. return self["@arguments"];
  32109. } else {
  32110. return $1;
  32111. };
  32112. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  32113. },
  32114. args: [],
  32115. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  32116. referencedClasses: [],
  32117. messageSends: ["ifNil:"]
  32118. }),
  32119. $globals.SendNode);
  32120. $core.addMethod(
  32121. $core.method({
  32122. selector: "arguments:",
  32123. protocol: 'accessing',
  32124. fn: function (aCollection){
  32125. var self=this;
  32126. return $core.withContext(function($ctx1) {
  32127. self["@arguments"]=aCollection;
  32128. $recv(aCollection)._do_((function(each){
  32129. return $core.withContext(function($ctx2) {
  32130. return $recv(each)._parent_(self);
  32131. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32132. }));
  32133. return self;
  32134. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.SendNode)});
  32135. },
  32136. args: ["aCollection"],
  32137. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  32138. referencedClasses: [],
  32139. messageSends: ["do:", "parent:"]
  32140. }),
  32141. $globals.SendNode);
  32142. $core.addMethod(
  32143. $core.method({
  32144. selector: "cascadeNodeWithMessages:",
  32145. protocol: 'accessing',
  32146. fn: function (aCollection){
  32147. var self=this;
  32148. var first;
  32149. return $core.withContext(function($ctx1) {
  32150. var $1,$2,$3;
  32151. $1=$recv($globals.SendNode)._new();
  32152. $ctx1.sendIdx["new"]=1;
  32153. $recv($1)._selector_(self._selector());
  32154. $recv($1)._arguments_(self._arguments());
  32155. $2=$recv($1)._yourself();
  32156. $ctx1.sendIdx["yourself"]=1;
  32157. first=$2;
  32158. $3=$recv($globals.CascadeNode)._new();
  32159. $recv($3)._receiver_(self._receiver());
  32160. $recv($3)._nodes_($recv($recv($globals.Array)._with_(first)).__comma(aCollection));
  32161. return $recv($3)._yourself();
  32162. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},$globals.SendNode)});
  32163. },
  32164. args: ["aCollection"],
  32165. source: "cascadeNodeWithMessages: aCollection\x0a\x09| first |\x0a\x09first := SendNode new\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself.\x0a\x09^ CascadeNode new\x0a\x09\x09receiver: self receiver;\x0a\x09\x09nodes: (Array with: first), aCollection;\x0a\x09\x09yourself",
  32166. referencedClasses: ["SendNode", "CascadeNode", "Array"],
  32167. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"]
  32168. }),
  32169. $globals.SendNode);
  32170. $core.addMethod(
  32171. $core.method({
  32172. selector: "index",
  32173. protocol: 'accessing',
  32174. fn: function (){
  32175. var self=this;
  32176. return self["@index"];
  32177. },
  32178. args: [],
  32179. source: "index\x0a\x09^ index",
  32180. referencedClasses: [],
  32181. messageSends: []
  32182. }),
  32183. $globals.SendNode);
  32184. $core.addMethod(
  32185. $core.method({
  32186. selector: "index:",
  32187. protocol: 'accessing',
  32188. fn: function (anInteger){
  32189. var self=this;
  32190. self["@index"]=anInteger;
  32191. return self;
  32192. },
  32193. args: ["anInteger"],
  32194. source: "index: anInteger\x0a\x09index := anInteger",
  32195. referencedClasses: [],
  32196. messageSends: []
  32197. }),
  32198. $globals.SendNode);
  32199. $core.addMethod(
  32200. $core.method({
  32201. selector: "isCascadeSendNode",
  32202. protocol: 'testing',
  32203. fn: function (){
  32204. var self=this;
  32205. return $core.withContext(function($ctx1) {
  32206. return $recv(self._parent())._isCascadeNode();
  32207. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  32208. },
  32209. args: [],
  32210. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  32211. referencedClasses: [],
  32212. messageSends: ["isCascadeNode", "parent"]
  32213. }),
  32214. $globals.SendNode);
  32215. $core.addMethod(
  32216. $core.method({
  32217. selector: "isNavigationNode",
  32218. protocol: 'testing',
  32219. fn: function (){
  32220. var self=this;
  32221. return true;
  32222. },
  32223. args: [],
  32224. source: "isNavigationNode\x0a\x09^ true",
  32225. referencedClasses: [],
  32226. messageSends: []
  32227. }),
  32228. $globals.SendNode);
  32229. $core.addMethod(
  32230. $core.method({
  32231. selector: "isSendNode",
  32232. protocol: 'testing',
  32233. fn: function (){
  32234. var self=this;
  32235. return true;
  32236. },
  32237. args: [],
  32238. source: "isSendNode\x0a\x09^ true",
  32239. referencedClasses: [],
  32240. messageSends: []
  32241. }),
  32242. $globals.SendNode);
  32243. $core.addMethod(
  32244. $core.method({
  32245. selector: "navigationLink",
  32246. protocol: 'accessing',
  32247. fn: function (){
  32248. var self=this;
  32249. return $core.withContext(function($ctx1) {
  32250. return self._selector();
  32251. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  32252. },
  32253. args: [],
  32254. source: "navigationLink\x0a\x09^ self selector",
  32255. referencedClasses: [],
  32256. messageSends: ["selector"]
  32257. }),
  32258. $globals.SendNode);
  32259. $core.addMethod(
  32260. $core.method({
  32261. selector: "nodes",
  32262. protocol: 'accessing',
  32263. fn: function (){
  32264. var self=this;
  32265. return $core.withContext(function($ctx1) {
  32266. var $1,$2,$3,$receiver;
  32267. $1=self._receiver();
  32268. $ctx1.sendIdx["receiver"]=1;
  32269. if(($receiver = $1) == null || $receiver.isNil){
  32270. $2=self._arguments();
  32271. $ctx1.sendIdx["arguments"]=1;
  32272. return $recv($2)._copy();
  32273. } else {
  32274. $1;
  32275. };
  32276. $3=$recv($globals.Array)._with_(self._receiver());
  32277. $recv($3)._addAll_(self._arguments());
  32278. return $recv($3)._yourself();
  32279. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.SendNode)});
  32280. },
  32281. args: [],
  32282. source: "nodes\x0a\x09self receiver ifNil: [ ^ self arguments copy ].\x0a\x09\x0a\x09^ (Array with: self receiver)\x0a\x09\x09addAll: self arguments;\x0a\x09\x09yourself",
  32283. referencedClasses: ["Array"],
  32284. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  32285. }),
  32286. $globals.SendNode);
  32287. $core.addMethod(
  32288. $core.method({
  32289. selector: "receiver",
  32290. protocol: 'accessing',
  32291. fn: function (){
  32292. var self=this;
  32293. return self["@receiver"];
  32294. },
  32295. args: [],
  32296. source: "receiver\x0a\x09^ receiver",
  32297. referencedClasses: [],
  32298. messageSends: []
  32299. }),
  32300. $globals.SendNode);
  32301. $core.addMethod(
  32302. $core.method({
  32303. selector: "receiver:",
  32304. protocol: 'accessing',
  32305. fn: function (aNode){
  32306. var self=this;
  32307. return $core.withContext(function($ctx1) {
  32308. var $1;
  32309. self["@receiver"]=aNode;
  32310. $1=$recv(aNode)._isNode();
  32311. if($core.assert($1)){
  32312. $recv(aNode)._parent_(self);
  32313. };
  32314. return self;
  32315. }, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},$globals.SendNode)});
  32316. },
  32317. args: ["aNode"],
  32318. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  32319. referencedClasses: [],
  32320. messageSends: ["ifTrue:", "isNode", "parent:"]
  32321. }),
  32322. $globals.SendNode);
  32323. $core.addMethod(
  32324. $core.method({
  32325. selector: "requiresSmalltalkContext",
  32326. protocol: 'testing',
  32327. fn: function (){
  32328. var self=this;
  32329. return true;
  32330. },
  32331. args: [],
  32332. source: "requiresSmalltalkContext\x0a\x09^ true",
  32333. referencedClasses: [],
  32334. messageSends: []
  32335. }),
  32336. $globals.SendNode);
  32337. $core.addMethod(
  32338. $core.method({
  32339. selector: "selector",
  32340. protocol: 'accessing',
  32341. fn: function (){
  32342. var self=this;
  32343. return self["@selector"];
  32344. },
  32345. args: [],
  32346. source: "selector\x0a\x09^ selector",
  32347. referencedClasses: [],
  32348. messageSends: []
  32349. }),
  32350. $globals.SendNode);
  32351. $core.addMethod(
  32352. $core.method({
  32353. selector: "selector:",
  32354. protocol: 'accessing',
  32355. fn: function (aString){
  32356. var self=this;
  32357. self["@selector"]=aString;
  32358. return self;
  32359. },
  32360. args: ["aString"],
  32361. source: "selector: aString\x0a\x09selector := aString",
  32362. referencedClasses: [],
  32363. messageSends: []
  32364. }),
  32365. $globals.SendNode);
  32366. $core.addMethod(
  32367. $core.method({
  32368. selector: "shouldBeAliased",
  32369. protocol: 'testing',
  32370. fn: function (){
  32371. var self=this;
  32372. var sends;
  32373. return $core.withContext(function($ctx1) {
  32374. var $2,$1;
  32375. sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size();
  32376. $2=(
  32377. $ctx1.supercall = true,
  32378. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($recv(self), []));
  32379. $ctx1.supercall = false;
  32380. $1=$recv($2)._or_((function(){
  32381. return $core.withContext(function($ctx2) {
  32382. return $recv(self._isReferenced())._and_((function(){
  32383. return $core.withContext(function($ctx3) {
  32384. return $recv($recv(self._index()).__lt(sends))._or_((function(){
  32385. return $core.withContext(function($ctx4) {
  32386. return self._superSend();
  32387. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  32388. }));
  32389. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32390. }));
  32391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32392. }));
  32393. $ctx1.sendIdx["or:"]=1;
  32394. return $1;
  32395. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  32396. },
  32397. args: [],
  32398. 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 ] ] ])",
  32399. referencedClasses: [],
  32400. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  32401. }),
  32402. $globals.SendNode);
  32403. $core.addMethod(
  32404. $core.method({
  32405. selector: "superSend",
  32406. protocol: 'accessing',
  32407. fn: function (){
  32408. var self=this;
  32409. return $core.withContext(function($ctx1) {
  32410. var $2,$1;
  32411. $2=self._receiver();
  32412. $ctx1.sendIdx["receiver"]=1;
  32413. $1=$recv($2)._notNil();
  32414. return $recv($1)._and_((function(){
  32415. return $core.withContext(function($ctx2) {
  32416. return $recv(self._receiver())._isSuperKeyword();
  32417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32418. }));
  32419. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  32420. },
  32421. args: [],
  32422. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  32423. referencedClasses: [],
  32424. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  32425. }),
  32426. $globals.SendNode);
  32427. $core.addMethod(
  32428. $core.method({
  32429. selector: "valueForReceiver:",
  32430. protocol: 'building',
  32431. fn: function (anObject){
  32432. var self=this;
  32433. return $core.withContext(function($ctx1) {
  32434. var $1,$3,$2,$receiver;
  32435. $1=$recv($globals.SendNode)._new();
  32436. $recv($1)._position_(self._position());
  32437. $recv($1)._source_(self._source());
  32438. $3=self._receiver();
  32439. $ctx1.sendIdx["receiver"]=1;
  32440. if(($receiver = $3) == null || $receiver.isNil){
  32441. $2=anObject;
  32442. } else {
  32443. $2=$recv(self._receiver())._valueForReceiver_(anObject);
  32444. };
  32445. $recv($1)._receiver_($2);
  32446. $recv($1)._selector_(self._selector());
  32447. $recv($1)._arguments_(self._arguments());
  32448. return $recv($1)._yourself();
  32449. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},$globals.SendNode)});
  32450. },
  32451. args: ["anObject"],
  32452. source: "valueForReceiver: anObject\x0a\x09^ SendNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09receiver: (self receiver\x0a\x09\x09ifNil: [ anObject ] \x0a\x09\x09ifNotNil: [ self receiver valueForReceiver: anObject ]);\x0a\x09\x09selector: self selector;\x0a\x09\x09arguments: self arguments;\x0a\x09\x09yourself",
  32453. referencedClasses: ["SendNode"],
  32454. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  32455. }),
  32456. $globals.SendNode);
  32457. $core.addClass('SequenceNode', $globals.Node, ['temps', 'scope'], 'Compiler-AST');
  32458. $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).";
  32459. $core.addMethod(
  32460. $core.method({
  32461. selector: "accept:",
  32462. protocol: 'visiting',
  32463. fn: function (aVisitor){
  32464. var self=this;
  32465. return $core.withContext(function($ctx1) {
  32466. return $recv(aVisitor)._visitSequenceNode_(self);
  32467. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SequenceNode)});
  32468. },
  32469. args: ["aVisitor"],
  32470. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  32471. referencedClasses: [],
  32472. messageSends: ["visitSequenceNode:"]
  32473. }),
  32474. $globals.SequenceNode);
  32475. $core.addMethod(
  32476. $core.method({
  32477. selector: "asBlockSequenceNode",
  32478. protocol: 'building',
  32479. fn: function (){
  32480. var self=this;
  32481. return $core.withContext(function($ctx1) {
  32482. var $1;
  32483. $1=$recv($globals.BlockSequenceNode)._new();
  32484. $recv($1)._position_(self._position());
  32485. $recv($1)._source_(self._source());
  32486. $recv($1)._nodes_(self._nodes());
  32487. $recv($1)._temps_(self._temps());
  32488. return $recv($1)._yourself();
  32489. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  32490. },
  32491. args: [],
  32492. source: "asBlockSequenceNode\x0a\x09^ BlockSequenceNode new\x0a\x09\x09position: self position;\x0a\x09\x09source: self source;\x0a\x09\x09nodes: self nodes;\x0a\x09\x09temps: self temps;\x0a\x09\x09yourself",
  32493. referencedClasses: ["BlockSequenceNode"],
  32494. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"]
  32495. }),
  32496. $globals.SequenceNode);
  32497. $core.addMethod(
  32498. $core.method({
  32499. selector: "isSequenceNode",
  32500. protocol: 'testing',
  32501. fn: function (){
  32502. var self=this;
  32503. return true;
  32504. },
  32505. args: [],
  32506. source: "isSequenceNode\x0a\x09^ true",
  32507. referencedClasses: [],
  32508. messageSends: []
  32509. }),
  32510. $globals.SequenceNode);
  32511. $core.addMethod(
  32512. $core.method({
  32513. selector: "scope",
  32514. protocol: 'accessing',
  32515. fn: function (){
  32516. var self=this;
  32517. return self["@scope"];
  32518. },
  32519. args: [],
  32520. source: "scope\x0a\x09^ scope",
  32521. referencedClasses: [],
  32522. messageSends: []
  32523. }),
  32524. $globals.SequenceNode);
  32525. $core.addMethod(
  32526. $core.method({
  32527. selector: "scope:",
  32528. protocol: 'accessing',
  32529. fn: function (aLexicalScope){
  32530. var self=this;
  32531. self["@scope"]=aLexicalScope;
  32532. return self;
  32533. },
  32534. args: ["aLexicalScope"],
  32535. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32536. referencedClasses: [],
  32537. messageSends: []
  32538. }),
  32539. $globals.SequenceNode);
  32540. $core.addMethod(
  32541. $core.method({
  32542. selector: "temps",
  32543. protocol: 'accessing',
  32544. fn: function (){
  32545. var self=this;
  32546. return $core.withContext(function($ctx1) {
  32547. var $1,$receiver;
  32548. $1=self["@temps"];
  32549. if(($receiver = $1) == null || $receiver.isNil){
  32550. return [];
  32551. } else {
  32552. return $1;
  32553. };
  32554. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  32555. },
  32556. args: [],
  32557. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  32558. referencedClasses: [],
  32559. messageSends: ["ifNil:"]
  32560. }),
  32561. $globals.SequenceNode);
  32562. $core.addMethod(
  32563. $core.method({
  32564. selector: "temps:",
  32565. protocol: 'accessing',
  32566. fn: function (aCollection){
  32567. var self=this;
  32568. self["@temps"]=aCollection;
  32569. return self;
  32570. },
  32571. args: ["aCollection"],
  32572. source: "temps: aCollection\x0a\x09temps := aCollection",
  32573. referencedClasses: [],
  32574. messageSends: []
  32575. }),
  32576. $globals.SequenceNode);
  32577. $core.addClass('BlockSequenceNode', $globals.SequenceNode, [], 'Compiler-AST');
  32578. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  32579. $core.addMethod(
  32580. $core.method({
  32581. selector: "accept:",
  32582. protocol: 'visiting',
  32583. fn: function (aVisitor){
  32584. var self=this;
  32585. return $core.withContext(function($ctx1) {
  32586. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  32587. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  32588. },
  32589. args: ["aVisitor"],
  32590. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  32591. referencedClasses: [],
  32592. messageSends: ["visitBlockSequenceNode:"]
  32593. }),
  32594. $globals.BlockSequenceNode);
  32595. $core.addMethod(
  32596. $core.method({
  32597. selector: "isBlockSequenceNode",
  32598. protocol: 'testing',
  32599. fn: function (){
  32600. var self=this;
  32601. return true;
  32602. },
  32603. args: [],
  32604. source: "isBlockSequenceNode\x0a\x09^ true",
  32605. referencedClasses: [],
  32606. messageSends: []
  32607. }),
  32608. $globals.BlockSequenceNode);
  32609. $core.addClass('ValueNode', $globals.Node, ['value'], 'Compiler-AST');
  32610. $globals.ValueNode.comment="I represent a value node.";
  32611. $core.addMethod(
  32612. $core.method({
  32613. selector: "accept:",
  32614. protocol: 'visiting',
  32615. fn: function (aVisitor){
  32616. var self=this;
  32617. return $core.withContext(function($ctx1) {
  32618. return $recv(aVisitor)._visitValueNode_(self);
  32619. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ValueNode)});
  32620. },
  32621. args: ["aVisitor"],
  32622. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  32623. referencedClasses: [],
  32624. messageSends: ["visitValueNode:"]
  32625. }),
  32626. $globals.ValueNode);
  32627. $core.addMethod(
  32628. $core.method({
  32629. selector: "isImmutable",
  32630. protocol: 'testing',
  32631. fn: function (){
  32632. var self=this;
  32633. return $core.withContext(function($ctx1) {
  32634. return $recv(self._value())._isImmutable();
  32635. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  32636. },
  32637. args: [],
  32638. source: "isImmutable\x0a\x09^ self value isImmutable",
  32639. referencedClasses: [],
  32640. messageSends: ["isImmutable", "value"]
  32641. }),
  32642. $globals.ValueNode);
  32643. $core.addMethod(
  32644. $core.method({
  32645. selector: "isValueNode",
  32646. protocol: 'testing',
  32647. fn: function (){
  32648. var self=this;
  32649. return true;
  32650. },
  32651. args: [],
  32652. source: "isValueNode\x0a\x09^ true",
  32653. referencedClasses: [],
  32654. messageSends: []
  32655. }),
  32656. $globals.ValueNode);
  32657. $core.addMethod(
  32658. $core.method({
  32659. selector: "value",
  32660. protocol: 'accessing',
  32661. fn: function (){
  32662. var self=this;
  32663. return self["@value"];
  32664. },
  32665. args: [],
  32666. source: "value\x0a\x09^ value",
  32667. referencedClasses: [],
  32668. messageSends: []
  32669. }),
  32670. $globals.ValueNode);
  32671. $core.addMethod(
  32672. $core.method({
  32673. selector: "value:",
  32674. protocol: 'accessing',
  32675. fn: function (anObject){
  32676. var self=this;
  32677. self["@value"]=anObject;
  32678. return self;
  32679. },
  32680. args: ["anObject"],
  32681. source: "value: anObject\x0a\x09value := anObject",
  32682. referencedClasses: [],
  32683. messageSends: []
  32684. }),
  32685. $globals.ValueNode);
  32686. $core.addClass('VariableNode', $globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  32687. $globals.VariableNode.comment="I represent an variable node.";
  32688. $core.addMethod(
  32689. $core.method({
  32690. selector: "accept:",
  32691. protocol: 'visiting',
  32692. fn: function (aVisitor){
  32693. var self=this;
  32694. return $core.withContext(function($ctx1) {
  32695. return $recv(aVisitor)._visitVariableNode_(self);
  32696. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.VariableNode)});
  32697. },
  32698. args: ["aVisitor"],
  32699. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  32700. referencedClasses: [],
  32701. messageSends: ["visitVariableNode:"]
  32702. }),
  32703. $globals.VariableNode);
  32704. $core.addMethod(
  32705. $core.method({
  32706. selector: "alias",
  32707. protocol: 'accessing',
  32708. fn: function (){
  32709. var self=this;
  32710. return $core.withContext(function($ctx1) {
  32711. return $recv(self._binding())._alias();
  32712. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  32713. },
  32714. args: [],
  32715. source: "alias\x0a\x09^ self binding alias",
  32716. referencedClasses: [],
  32717. messageSends: ["alias", "binding"]
  32718. }),
  32719. $globals.VariableNode);
  32720. $core.addMethod(
  32721. $core.method({
  32722. selector: "assigned",
  32723. protocol: 'accessing',
  32724. fn: function (){
  32725. var self=this;
  32726. return $core.withContext(function($ctx1) {
  32727. var $1,$receiver;
  32728. $1=self["@assigned"];
  32729. if(($receiver = $1) == null || $receiver.isNil){
  32730. return false;
  32731. } else {
  32732. return $1;
  32733. };
  32734. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  32735. },
  32736. args: [],
  32737. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  32738. referencedClasses: [],
  32739. messageSends: ["ifNil:"]
  32740. }),
  32741. $globals.VariableNode);
  32742. $core.addMethod(
  32743. $core.method({
  32744. selector: "assigned:",
  32745. protocol: 'accessing',
  32746. fn: function (aBoolean){
  32747. var self=this;
  32748. self["@assigned"]=aBoolean;
  32749. return self;
  32750. },
  32751. args: ["aBoolean"],
  32752. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  32753. referencedClasses: [],
  32754. messageSends: []
  32755. }),
  32756. $globals.VariableNode);
  32757. $core.addMethod(
  32758. $core.method({
  32759. selector: "beAssigned",
  32760. protocol: 'accessing',
  32761. fn: function (){
  32762. var self=this;
  32763. return $core.withContext(function($ctx1) {
  32764. $recv(self._binding())._validateAssignment();
  32765. self["@assigned"]=true;
  32766. return self;
  32767. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  32768. },
  32769. args: [],
  32770. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  32771. referencedClasses: [],
  32772. messageSends: ["validateAssignment", "binding"]
  32773. }),
  32774. $globals.VariableNode);
  32775. $core.addMethod(
  32776. $core.method({
  32777. selector: "binding",
  32778. protocol: 'accessing',
  32779. fn: function (){
  32780. var self=this;
  32781. return self["@binding"];
  32782. },
  32783. args: [],
  32784. source: "binding\x0a\x09^ binding",
  32785. referencedClasses: [],
  32786. messageSends: []
  32787. }),
  32788. $globals.VariableNode);
  32789. $core.addMethod(
  32790. $core.method({
  32791. selector: "binding:",
  32792. protocol: 'accessing',
  32793. fn: function (aScopeVar){
  32794. var self=this;
  32795. self["@binding"]=aScopeVar;
  32796. return self;
  32797. },
  32798. args: ["aScopeVar"],
  32799. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  32800. referencedClasses: [],
  32801. messageSends: []
  32802. }),
  32803. $globals.VariableNode);
  32804. $core.addMethod(
  32805. $core.method({
  32806. selector: "isArgument",
  32807. protocol: 'testing',
  32808. fn: function (){
  32809. var self=this;
  32810. return $core.withContext(function($ctx1) {
  32811. return $recv(self._binding())._isArgVar();
  32812. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  32813. },
  32814. args: [],
  32815. source: "isArgument\x0a\x09^ self binding isArgVar",
  32816. referencedClasses: [],
  32817. messageSends: ["isArgVar", "binding"]
  32818. }),
  32819. $globals.VariableNode);
  32820. $core.addMethod(
  32821. $core.method({
  32822. selector: "isImmutable",
  32823. protocol: 'testing',
  32824. fn: function (){
  32825. var self=this;
  32826. return $core.withContext(function($ctx1) {
  32827. return $recv(self._binding())._isImmutable();
  32828. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  32829. },
  32830. args: [],
  32831. source: "isImmutable\x0a\x09^ self binding isImmutable",
  32832. referencedClasses: [],
  32833. messageSends: ["isImmutable", "binding"]
  32834. }),
  32835. $globals.VariableNode);
  32836. $core.addMethod(
  32837. $core.method({
  32838. selector: "isNavigationNode",
  32839. protocol: 'testing',
  32840. fn: function (){
  32841. var self=this;
  32842. return true;
  32843. },
  32844. args: [],
  32845. source: "isNavigationNode\x0a\x09^ true",
  32846. referencedClasses: [],
  32847. messageSends: []
  32848. }),
  32849. $globals.VariableNode);
  32850. $core.addMethod(
  32851. $core.method({
  32852. selector: "isSuperKeyword",
  32853. protocol: 'testing',
  32854. fn: function (){
  32855. var self=this;
  32856. return $core.withContext(function($ctx1) {
  32857. return $recv(self._value()).__eq("super");
  32858. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  32859. },
  32860. args: [],
  32861. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  32862. referencedClasses: [],
  32863. messageSends: ["=", "value"]
  32864. }),
  32865. $globals.VariableNode);
  32866. $core.addMethod(
  32867. $core.method({
  32868. selector: "isVariableNode",
  32869. protocol: 'testing',
  32870. fn: function (){
  32871. var self=this;
  32872. return true;
  32873. },
  32874. args: [],
  32875. source: "isVariableNode\x0a\x09^ true",
  32876. referencedClasses: [],
  32877. messageSends: []
  32878. }),
  32879. $globals.VariableNode);
  32880. $core.addMethod(
  32881. $core.method({
  32882. selector: "navigationLink",
  32883. protocol: 'accessing',
  32884. fn: function (){
  32885. var self=this;
  32886. return $core.withContext(function($ctx1) {
  32887. return self._value();
  32888. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  32889. },
  32890. args: [],
  32891. source: "navigationLink\x0a\x09^ self value",
  32892. referencedClasses: [],
  32893. messageSends: ["value"]
  32894. }),
  32895. $globals.VariableNode);
  32896. $core.addClass('NodeVisitor', $globals.Object, [], 'Compiler-AST');
  32897. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  32898. $core.addMethod(
  32899. $core.method({
  32900. selector: "visit:",
  32901. protocol: 'visiting',
  32902. fn: function (aNode){
  32903. var self=this;
  32904. return $core.withContext(function($ctx1) {
  32905. return $recv(aNode)._accept_(self);
  32906. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.NodeVisitor)});
  32907. },
  32908. args: ["aNode"],
  32909. source: "visit: aNode\x0a\x09^ aNode accept: self",
  32910. referencedClasses: [],
  32911. messageSends: ["accept:"]
  32912. }),
  32913. $globals.NodeVisitor);
  32914. $core.addMethod(
  32915. $core.method({
  32916. selector: "visitAll:",
  32917. protocol: 'visiting',
  32918. fn: function (aCollection){
  32919. var self=this;
  32920. return $core.withContext(function($ctx1) {
  32921. return $recv(aCollection)._collect_((function(each){
  32922. return $core.withContext(function($ctx2) {
  32923. return self._visit_(each);
  32924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32925. }));
  32926. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.NodeVisitor)});
  32927. },
  32928. args: ["aCollection"],
  32929. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  32930. referencedClasses: [],
  32931. messageSends: ["collect:", "visit:"]
  32932. }),
  32933. $globals.NodeVisitor);
  32934. $core.addMethod(
  32935. $core.method({
  32936. selector: "visitAssignmentNode:",
  32937. protocol: 'visiting',
  32938. fn: function (aNode){
  32939. var self=this;
  32940. return $core.withContext(function($ctx1) {
  32941. return self._visitNode_(aNode);
  32942. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  32943. },
  32944. args: ["aNode"],
  32945. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  32946. referencedClasses: [],
  32947. messageSends: ["visitNode:"]
  32948. }),
  32949. $globals.NodeVisitor);
  32950. $core.addMethod(
  32951. $core.method({
  32952. selector: "visitBlockNode:",
  32953. protocol: 'visiting',
  32954. fn: function (aNode){
  32955. var self=this;
  32956. return $core.withContext(function($ctx1) {
  32957. return self._visitNode_(aNode);
  32958. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  32959. },
  32960. args: ["aNode"],
  32961. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  32962. referencedClasses: [],
  32963. messageSends: ["visitNode:"]
  32964. }),
  32965. $globals.NodeVisitor);
  32966. $core.addMethod(
  32967. $core.method({
  32968. selector: "visitBlockSequenceNode:",
  32969. protocol: 'visiting',
  32970. fn: function (aNode){
  32971. var self=this;
  32972. return $core.withContext(function($ctx1) {
  32973. return self._visitSequenceNode_(aNode);
  32974. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  32975. },
  32976. args: ["aNode"],
  32977. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  32978. referencedClasses: [],
  32979. messageSends: ["visitSequenceNode:"]
  32980. }),
  32981. $globals.NodeVisitor);
  32982. $core.addMethod(
  32983. $core.method({
  32984. selector: "visitCascadeNode:",
  32985. protocol: 'visiting',
  32986. fn: function (aNode){
  32987. var self=this;
  32988. return $core.withContext(function($ctx1) {
  32989. return self._visitNode_(aNode);
  32990. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  32991. },
  32992. args: ["aNode"],
  32993. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  32994. referencedClasses: [],
  32995. messageSends: ["visitNode:"]
  32996. }),
  32997. $globals.NodeVisitor);
  32998. $core.addMethod(
  32999. $core.method({
  33000. selector: "visitDynamicArrayNode:",
  33001. protocol: 'visiting',
  33002. fn: function (aNode){
  33003. var self=this;
  33004. return $core.withContext(function($ctx1) {
  33005. return self._visitNode_(aNode);
  33006. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  33007. },
  33008. args: ["aNode"],
  33009. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  33010. referencedClasses: [],
  33011. messageSends: ["visitNode:"]
  33012. }),
  33013. $globals.NodeVisitor);
  33014. $core.addMethod(
  33015. $core.method({
  33016. selector: "visitDynamicDictionaryNode:",
  33017. protocol: 'visiting',
  33018. fn: function (aNode){
  33019. var self=this;
  33020. return $core.withContext(function($ctx1) {
  33021. return self._visitNode_(aNode);
  33022. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  33023. },
  33024. args: ["aNode"],
  33025. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  33026. referencedClasses: [],
  33027. messageSends: ["visitNode:"]
  33028. }),
  33029. $globals.NodeVisitor);
  33030. $core.addMethod(
  33031. $core.method({
  33032. selector: "visitJSStatementNode:",
  33033. protocol: 'visiting',
  33034. fn: function (aNode){
  33035. var self=this;
  33036. return $core.withContext(function($ctx1) {
  33037. return self._visitNode_(aNode);
  33038. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  33039. },
  33040. args: ["aNode"],
  33041. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  33042. referencedClasses: [],
  33043. messageSends: ["visitNode:"]
  33044. }),
  33045. $globals.NodeVisitor);
  33046. $core.addMethod(
  33047. $core.method({
  33048. selector: "visitMethodNode:",
  33049. protocol: 'visiting',
  33050. fn: function (aNode){
  33051. var self=this;
  33052. return $core.withContext(function($ctx1) {
  33053. return self._visitNode_(aNode);
  33054. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  33055. },
  33056. args: ["aNode"],
  33057. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  33058. referencedClasses: [],
  33059. messageSends: ["visitNode:"]
  33060. }),
  33061. $globals.NodeVisitor);
  33062. $core.addMethod(
  33063. $core.method({
  33064. selector: "visitNode:",
  33065. protocol: 'visiting',
  33066. fn: function (aNode){
  33067. var self=this;
  33068. return $core.withContext(function($ctx1) {
  33069. self._visitAll_($recv(aNode)._nodes());
  33070. return aNode;
  33071. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.NodeVisitor)});
  33072. },
  33073. args: ["aNode"],
  33074. source: "visitNode: aNode\x0a\x09self visitAll: aNode nodes.\x0a\x09^ aNode",
  33075. referencedClasses: [],
  33076. messageSends: ["visitAll:", "nodes"]
  33077. }),
  33078. $globals.NodeVisitor);
  33079. $core.addMethod(
  33080. $core.method({
  33081. selector: "visitReturnNode:",
  33082. protocol: 'visiting',
  33083. fn: function (aNode){
  33084. var self=this;
  33085. return $core.withContext(function($ctx1) {
  33086. return self._visitNode_(aNode);
  33087. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  33088. },
  33089. args: ["aNode"],
  33090. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  33091. referencedClasses: [],
  33092. messageSends: ["visitNode:"]
  33093. }),
  33094. $globals.NodeVisitor);
  33095. $core.addMethod(
  33096. $core.method({
  33097. selector: "visitSendNode:",
  33098. protocol: 'visiting',
  33099. fn: function (aNode){
  33100. var self=this;
  33101. return $core.withContext(function($ctx1) {
  33102. return self._visitNode_(aNode);
  33103. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  33104. },
  33105. args: ["aNode"],
  33106. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  33107. referencedClasses: [],
  33108. messageSends: ["visitNode:"]
  33109. }),
  33110. $globals.NodeVisitor);
  33111. $core.addMethod(
  33112. $core.method({
  33113. selector: "visitSequenceNode:",
  33114. protocol: 'visiting',
  33115. fn: function (aNode){
  33116. var self=this;
  33117. return $core.withContext(function($ctx1) {
  33118. return self._visitNode_(aNode);
  33119. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  33120. },
  33121. args: ["aNode"],
  33122. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  33123. referencedClasses: [],
  33124. messageSends: ["visitNode:"]
  33125. }),
  33126. $globals.NodeVisitor);
  33127. $core.addMethod(
  33128. $core.method({
  33129. selector: "visitValueNode:",
  33130. protocol: 'visiting',
  33131. fn: function (aNode){
  33132. var self=this;
  33133. return $core.withContext(function($ctx1) {
  33134. return self._visitNode_(aNode);
  33135. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  33136. },
  33137. args: ["aNode"],
  33138. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  33139. referencedClasses: [],
  33140. messageSends: ["visitNode:"]
  33141. }),
  33142. $globals.NodeVisitor);
  33143. $core.addMethod(
  33144. $core.method({
  33145. selector: "visitVariableNode:",
  33146. protocol: 'visiting',
  33147. fn: function (aNode){
  33148. var self=this;
  33149. return $core.withContext(function($ctx1) {
  33150. return self._visitNode_(aNode);
  33151. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  33152. },
  33153. args: ["aNode"],
  33154. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  33155. referencedClasses: [],
  33156. messageSends: ["visitNode:"]
  33157. }),
  33158. $globals.NodeVisitor);
  33159. $core.addMethod(
  33160. $core.method({
  33161. selector: "ast",
  33162. protocol: '*Compiler-AST',
  33163. fn: function (){
  33164. var self=this;
  33165. return $core.withContext(function($ctx1) {
  33166. var $1;
  33167. $1=self._source();
  33168. $ctx1.sendIdx["source"]=1;
  33169. $recv($1)._ifEmpty_((function(){
  33170. return $core.withContext(function($ctx2) {
  33171. return self._error_("Method source is empty");
  33172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33173. }));
  33174. return $recv($globals.Smalltalk)._parse_(self._source());
  33175. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  33176. },
  33177. args: [],
  33178. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  33179. referencedClasses: ["Smalltalk"],
  33180. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  33181. }),
  33182. $globals.CompiledMethod);
  33183. $core.addMethod(
  33184. $core.method({
  33185. selector: "isNode",
  33186. protocol: '*Compiler-AST',
  33187. fn: function (){
  33188. var self=this;
  33189. return false;
  33190. },
  33191. args: [],
  33192. source: "isNode\x0a\x09^ false",
  33193. referencedClasses: [],
  33194. messageSends: []
  33195. }),
  33196. $globals.Object);
  33197. });
  33198. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  33199. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  33200. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33201. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  33202. $core.addPackage('Compiler-Semantic');
  33203. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  33204. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33205. $core.addClass('LexicalScope', $globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  33206. $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.";
  33207. $core.addMethod(
  33208. $core.method({
  33209. selector: "addArg:",
  33210. protocol: 'adding',
  33211. fn: function (aString){
  33212. var self=this;
  33213. return $core.withContext(function($ctx1) {
  33214. var $1;
  33215. $1=self._args();
  33216. $ctx1.sendIdx["args"]=1;
  33217. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  33218. $recv($recv(self._args())._at_(aString))._scope_(self);
  33219. return self;
  33220. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  33221. },
  33222. args: ["aString"],
  33223. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  33224. referencedClasses: ["ArgVar"],
  33225. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  33226. }),
  33227. $globals.LexicalScope);
  33228. $core.addMethod(
  33229. $core.method({
  33230. selector: "addTemp:",
  33231. protocol: 'adding',
  33232. fn: function (aString){
  33233. var self=this;
  33234. return $core.withContext(function($ctx1) {
  33235. var $1;
  33236. $1=self._temps();
  33237. $ctx1.sendIdx["temps"]=1;
  33238. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  33239. $recv($recv(self._temps())._at_(aString))._scope_(self);
  33240. return self;
  33241. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  33242. },
  33243. args: ["aString"],
  33244. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  33245. referencedClasses: ["TempVar"],
  33246. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  33247. }),
  33248. $globals.LexicalScope);
  33249. $core.addMethod(
  33250. $core.method({
  33251. selector: "alias",
  33252. protocol: 'accessing',
  33253. fn: function (){
  33254. var self=this;
  33255. return $core.withContext(function($ctx1) {
  33256. return "$ctx".__comma($recv(self._scopeLevel())._asString());
  33257. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  33258. },
  33259. args: [],
  33260. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  33261. referencedClasses: [],
  33262. messageSends: [",", "asString", "scopeLevel"]
  33263. }),
  33264. $globals.LexicalScope);
  33265. $core.addMethod(
  33266. $core.method({
  33267. selector: "allVariableNames",
  33268. protocol: 'accessing',
  33269. fn: function (){
  33270. var self=this;
  33271. return $core.withContext(function($ctx1) {
  33272. var $1;
  33273. $1=$recv(self._args())._keys();
  33274. $ctx1.sendIdx["keys"]=1;
  33275. return $recv($1).__comma($recv(self._temps())._keys());
  33276. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  33277. },
  33278. args: [],
  33279. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  33280. referencedClasses: [],
  33281. messageSends: [",", "keys", "args", "temps"]
  33282. }),
  33283. $globals.LexicalScope);
  33284. $core.addMethod(
  33285. $core.method({
  33286. selector: "args",
  33287. protocol: 'accessing',
  33288. fn: function (){
  33289. var self=this;
  33290. return $core.withContext(function($ctx1) {
  33291. var $1,$receiver;
  33292. $1=self["@args"];
  33293. if(($receiver = $1) == null || $receiver.isNil){
  33294. self["@args"]=$recv($globals.Dictionary)._new();
  33295. return self["@args"];
  33296. } else {
  33297. return $1;
  33298. };
  33299. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  33300. },
  33301. args: [],
  33302. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  33303. referencedClasses: ["Dictionary"],
  33304. messageSends: ["ifNil:", "new"]
  33305. }),
  33306. $globals.LexicalScope);
  33307. $core.addMethod(
  33308. $core.method({
  33309. selector: "bindingFor:",
  33310. protocol: 'accessing',
  33311. fn: function (aStringOrNode){
  33312. var self=this;
  33313. return $core.withContext(function($ctx1) {
  33314. var $2,$3,$4,$5,$1;
  33315. $2=self._pseudoVars();
  33316. $3=$recv(aStringOrNode)._value();
  33317. $ctx1.sendIdx["value"]=1;
  33318. $1=$recv($2)._at_ifAbsent_($3,(function(){
  33319. return $core.withContext(function($ctx2) {
  33320. $4=self._args();
  33321. $5=$recv(aStringOrNode)._value();
  33322. $ctx2.sendIdx["value"]=2;
  33323. return $recv($4)._at_ifAbsent_($5,(function(){
  33324. return $core.withContext(function($ctx3) {
  33325. return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  33326. return nil;
  33327. }));
  33328. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33329. }));
  33330. $ctx2.sendIdx["at:ifAbsent:"]=2;
  33331. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33332. }));
  33333. $ctx1.sendIdx["at:ifAbsent:"]=1;
  33334. return $1;
  33335. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  33336. },
  33337. args: ["aStringOrNode"],
  33338. 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 ]]]",
  33339. referencedClasses: [],
  33340. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  33341. }),
  33342. $globals.LexicalScope);
  33343. $core.addMethod(
  33344. $core.method({
  33345. selector: "blockIndex",
  33346. protocol: 'accessing',
  33347. fn: function (){
  33348. var self=this;
  33349. return $core.withContext(function($ctx1) {
  33350. var $1,$receiver;
  33351. $1=self["@blockIndex"];
  33352. if(($receiver = $1) == null || $receiver.isNil){
  33353. return (0);
  33354. } else {
  33355. return $1;
  33356. };
  33357. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  33358. },
  33359. args: [],
  33360. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  33361. referencedClasses: [],
  33362. messageSends: ["ifNil:"]
  33363. }),
  33364. $globals.LexicalScope);
  33365. $core.addMethod(
  33366. $core.method({
  33367. selector: "blockIndex:",
  33368. protocol: 'accessing',
  33369. fn: function (anInteger){
  33370. var self=this;
  33371. self["@blockIndex"]=anInteger;
  33372. return self;
  33373. },
  33374. args: ["anInteger"],
  33375. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  33376. referencedClasses: [],
  33377. messageSends: []
  33378. }),
  33379. $globals.LexicalScope);
  33380. $core.addMethod(
  33381. $core.method({
  33382. selector: "canInlineNonLocalReturns",
  33383. protocol: 'testing',
  33384. fn: function (){
  33385. var self=this;
  33386. return $core.withContext(function($ctx1) {
  33387. return $recv(self._isInlined())._and_((function(){
  33388. return $core.withContext(function($ctx2) {
  33389. return $recv(self._outerScope())._canInlineNonLocalReturns();
  33390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33391. }));
  33392. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  33393. },
  33394. args: [],
  33395. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  33396. referencedClasses: [],
  33397. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  33398. }),
  33399. $globals.LexicalScope);
  33400. $core.addMethod(
  33401. $core.method({
  33402. selector: "instruction",
  33403. protocol: 'accessing',
  33404. fn: function (){
  33405. var self=this;
  33406. return self["@instruction"];
  33407. },
  33408. args: [],
  33409. source: "instruction\x0a\x09^ instruction",
  33410. referencedClasses: [],
  33411. messageSends: []
  33412. }),
  33413. $globals.LexicalScope);
  33414. $core.addMethod(
  33415. $core.method({
  33416. selector: "instruction:",
  33417. protocol: 'accessing',
  33418. fn: function (anIRInstruction){
  33419. var self=this;
  33420. self["@instruction"]=anIRInstruction;
  33421. return self;
  33422. },
  33423. args: ["anIRInstruction"],
  33424. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  33425. referencedClasses: [],
  33426. messageSends: []
  33427. }),
  33428. $globals.LexicalScope);
  33429. $core.addMethod(
  33430. $core.method({
  33431. selector: "isBlockScope",
  33432. protocol: 'testing',
  33433. fn: function (){
  33434. var self=this;
  33435. return $core.withContext(function($ctx1) {
  33436. return $recv(self._isMethodScope())._not();
  33437. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  33438. },
  33439. args: [],
  33440. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  33441. referencedClasses: [],
  33442. messageSends: ["not", "isMethodScope"]
  33443. }),
  33444. $globals.LexicalScope);
  33445. $core.addMethod(
  33446. $core.method({
  33447. selector: "isInlined",
  33448. protocol: 'testing',
  33449. fn: function (){
  33450. var self=this;
  33451. return $core.withContext(function($ctx1) {
  33452. var $2,$1;
  33453. $2=self._instruction();
  33454. $ctx1.sendIdx["instruction"]=1;
  33455. $1=$recv($2)._notNil();
  33456. return $recv($1)._and_((function(){
  33457. return $core.withContext(function($ctx2) {
  33458. return $recv(self._instruction())._isInlined();
  33459. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33460. }));
  33461. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  33462. },
  33463. args: [],
  33464. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  33465. referencedClasses: [],
  33466. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  33467. }),
  33468. $globals.LexicalScope);
  33469. $core.addMethod(
  33470. $core.method({
  33471. selector: "isMethodScope",
  33472. protocol: 'testing',
  33473. fn: function (){
  33474. var self=this;
  33475. return false;
  33476. },
  33477. args: [],
  33478. source: "isMethodScope\x0a\x09^ false",
  33479. referencedClasses: [],
  33480. messageSends: []
  33481. }),
  33482. $globals.LexicalScope);
  33483. $core.addMethod(
  33484. $core.method({
  33485. selector: "lookupVariable:",
  33486. protocol: 'accessing',
  33487. fn: function (aNode){
  33488. var self=this;
  33489. var lookup;
  33490. return $core.withContext(function($ctx1) {
  33491. var $1,$2,$receiver;
  33492. lookup=self._bindingFor_(aNode);
  33493. $1=lookup;
  33494. if(($receiver = $1) == null || $receiver.isNil){
  33495. $2=self._outerScope();
  33496. $ctx1.sendIdx["outerScope"]=1;
  33497. if(($receiver = $2) == null || $receiver.isNil){
  33498. lookup=$2;
  33499. } else {
  33500. lookup=$recv(self._outerScope())._lookupVariable_(aNode);
  33501. };
  33502. lookup;
  33503. } else {
  33504. $1;
  33505. };
  33506. return lookup;
  33507. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  33508. },
  33509. args: ["aNode"],
  33510. 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",
  33511. referencedClasses: [],
  33512. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  33513. }),
  33514. $globals.LexicalScope);
  33515. $core.addMethod(
  33516. $core.method({
  33517. selector: "methodScope",
  33518. protocol: 'accessing',
  33519. fn: function (){
  33520. var self=this;
  33521. return $core.withContext(function($ctx1) {
  33522. var $1,$receiver;
  33523. $1=self._outerScope();
  33524. $ctx1.sendIdx["outerScope"]=1;
  33525. if(($receiver = $1) == null || $receiver.isNil){
  33526. return $1;
  33527. } else {
  33528. return $recv(self._outerScope())._methodScope();
  33529. };
  33530. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  33531. },
  33532. args: [],
  33533. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  33534. referencedClasses: [],
  33535. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  33536. }),
  33537. $globals.LexicalScope);
  33538. $core.addMethod(
  33539. $core.method({
  33540. selector: "node",
  33541. protocol: 'accessing',
  33542. fn: function (){
  33543. var self=this;
  33544. return self["@node"];
  33545. },
  33546. args: [],
  33547. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  33548. referencedClasses: [],
  33549. messageSends: []
  33550. }),
  33551. $globals.LexicalScope);
  33552. $core.addMethod(
  33553. $core.method({
  33554. selector: "node:",
  33555. protocol: 'accessing',
  33556. fn: function (aNode){
  33557. var self=this;
  33558. self["@node"]=aNode;
  33559. return self;
  33560. },
  33561. args: ["aNode"],
  33562. source: "node: aNode\x0a\x09node := aNode",
  33563. referencedClasses: [],
  33564. messageSends: []
  33565. }),
  33566. $globals.LexicalScope);
  33567. $core.addMethod(
  33568. $core.method({
  33569. selector: "outerScope",
  33570. protocol: 'accessing',
  33571. fn: function (){
  33572. var self=this;
  33573. return self["@outerScope"];
  33574. },
  33575. args: [],
  33576. source: "outerScope\x0a\x09^ outerScope",
  33577. referencedClasses: [],
  33578. messageSends: []
  33579. }),
  33580. $globals.LexicalScope);
  33581. $core.addMethod(
  33582. $core.method({
  33583. selector: "outerScope:",
  33584. protocol: 'accessing',
  33585. fn: function (aLexicalScope){
  33586. var self=this;
  33587. self["@outerScope"]=aLexicalScope;
  33588. return self;
  33589. },
  33590. args: ["aLexicalScope"],
  33591. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  33592. referencedClasses: [],
  33593. messageSends: []
  33594. }),
  33595. $globals.LexicalScope);
  33596. $core.addMethod(
  33597. $core.method({
  33598. selector: "pseudoVars",
  33599. protocol: 'accessing',
  33600. fn: function (){
  33601. var self=this;
  33602. return $core.withContext(function($ctx1) {
  33603. return $recv(self._methodScope())._pseudoVars();
  33604. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  33605. },
  33606. args: [],
  33607. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  33608. referencedClasses: [],
  33609. messageSends: ["pseudoVars", "methodScope"]
  33610. }),
  33611. $globals.LexicalScope);
  33612. $core.addMethod(
  33613. $core.method({
  33614. selector: "scopeLevel",
  33615. protocol: 'accessing',
  33616. fn: function (){
  33617. var self=this;
  33618. return $core.withContext(function($ctx1) {
  33619. var $1,$2,$4,$3,$receiver;
  33620. $1=self._outerScope();
  33621. $ctx1.sendIdx["outerScope"]=1;
  33622. if(($receiver = $1) == null || $receiver.isNil){
  33623. return (1);
  33624. } else {
  33625. $1;
  33626. };
  33627. $2=self._isInlined();
  33628. if($core.assert($2)){
  33629. $4=self._outerScope();
  33630. $ctx1.sendIdx["outerScope"]=2;
  33631. $3=$recv($4)._scopeLevel();
  33632. $ctx1.sendIdx["scopeLevel"]=1;
  33633. return $3;
  33634. };
  33635. return $recv($recv(self._outerScope())._scopeLevel()).__plus((1));
  33636. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  33637. },
  33638. args: [],
  33639. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  33640. referencedClasses: [],
  33641. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  33642. }),
  33643. $globals.LexicalScope);
  33644. $core.addMethod(
  33645. $core.method({
  33646. selector: "temps",
  33647. protocol: 'accessing',
  33648. fn: function (){
  33649. var self=this;
  33650. return $core.withContext(function($ctx1) {
  33651. var $1,$receiver;
  33652. $1=self["@temps"];
  33653. if(($receiver = $1) == null || $receiver.isNil){
  33654. self["@temps"]=$recv($globals.Dictionary)._new();
  33655. return self["@temps"];
  33656. } else {
  33657. return $1;
  33658. };
  33659. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  33660. },
  33661. args: [],
  33662. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  33663. referencedClasses: ["Dictionary"],
  33664. messageSends: ["ifNil:", "new"]
  33665. }),
  33666. $globals.LexicalScope);
  33667. $core.addClass('MethodLexicalScope', $globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  33668. $globals.MethodLexicalScope.comment="I represent a method scope.";
  33669. $core.addMethod(
  33670. $core.method({
  33671. selector: "addIVar:",
  33672. protocol: 'adding',
  33673. fn: function (aString){
  33674. var self=this;
  33675. return $core.withContext(function($ctx1) {
  33676. var $1;
  33677. $1=self._iVars();
  33678. $ctx1.sendIdx["iVars"]=1;
  33679. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  33680. $recv($recv(self._iVars())._at_(aString))._scope_(self);
  33681. return self;
  33682. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  33683. },
  33684. args: ["aString"],
  33685. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  33686. referencedClasses: ["InstanceVar"],
  33687. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  33688. }),
  33689. $globals.MethodLexicalScope);
  33690. $core.addMethod(
  33691. $core.method({
  33692. selector: "addNonLocalReturn:",
  33693. protocol: 'adding',
  33694. fn: function (aScope){
  33695. var self=this;
  33696. return $core.withContext(function($ctx1) {
  33697. $recv(self._nonLocalReturns())._add_(aScope);
  33698. return self;
  33699. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  33700. },
  33701. args: ["aScope"],
  33702. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  33703. referencedClasses: [],
  33704. messageSends: ["add:", "nonLocalReturns"]
  33705. }),
  33706. $globals.MethodLexicalScope);
  33707. $core.addMethod(
  33708. $core.method({
  33709. selector: "allVariableNames",
  33710. protocol: 'accessing',
  33711. fn: function (){
  33712. var self=this;
  33713. return $core.withContext(function($ctx1) {
  33714. var $1;
  33715. $1=(
  33716. $ctx1.supercall = true,
  33717. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($recv(self), []));
  33718. $ctx1.supercall = false;
  33719. return $recv($1).__comma($recv(self._iVars())._keys());
  33720. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  33721. },
  33722. args: [],
  33723. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  33724. referencedClasses: [],
  33725. messageSends: [",", "allVariableNames", "keys", "iVars"]
  33726. }),
  33727. $globals.MethodLexicalScope);
  33728. $core.addMethod(
  33729. $core.method({
  33730. selector: "bindingFor:",
  33731. protocol: 'accessing',
  33732. fn: function (aNode){
  33733. var self=this;
  33734. return $core.withContext(function($ctx1) {
  33735. var $1,$receiver;
  33736. $1=(
  33737. $ctx1.supercall = true,
  33738. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($recv(self), [aNode]));
  33739. $ctx1.supercall = false;
  33740. if(($receiver = $1) == null || $receiver.isNil){
  33741. return $recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  33742. return nil;
  33743. }));
  33744. } else {
  33745. return $1;
  33746. };
  33747. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  33748. },
  33749. args: ["aNode"],
  33750. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  33751. referencedClasses: [],
  33752. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  33753. }),
  33754. $globals.MethodLexicalScope);
  33755. $core.addMethod(
  33756. $core.method({
  33757. selector: "canInlineNonLocalReturns",
  33758. protocol: 'testing',
  33759. fn: function (){
  33760. var self=this;
  33761. return true;
  33762. },
  33763. args: [],
  33764. source: "canInlineNonLocalReturns\x0a\x09^ true",
  33765. referencedClasses: [],
  33766. messageSends: []
  33767. }),
  33768. $globals.MethodLexicalScope);
  33769. $core.addMethod(
  33770. $core.method({
  33771. selector: "hasLocalReturn",
  33772. protocol: 'testing',
  33773. fn: function (){
  33774. var self=this;
  33775. return $core.withContext(function($ctx1) {
  33776. return self._localReturn();
  33777. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  33778. },
  33779. args: [],
  33780. source: "hasLocalReturn\x0a\x09^ self localReturn",
  33781. referencedClasses: [],
  33782. messageSends: ["localReturn"]
  33783. }),
  33784. $globals.MethodLexicalScope);
  33785. $core.addMethod(
  33786. $core.method({
  33787. selector: "hasNonLocalReturn",
  33788. protocol: 'testing',
  33789. fn: function (){
  33790. var self=this;
  33791. return $core.withContext(function($ctx1) {
  33792. return $recv(self._nonLocalReturns())._notEmpty();
  33793. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  33794. },
  33795. args: [],
  33796. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  33797. referencedClasses: [],
  33798. messageSends: ["notEmpty", "nonLocalReturns"]
  33799. }),
  33800. $globals.MethodLexicalScope);
  33801. $core.addMethod(
  33802. $core.method({
  33803. selector: "iVars",
  33804. protocol: 'accessing',
  33805. fn: function (){
  33806. var self=this;
  33807. return $core.withContext(function($ctx1) {
  33808. var $1,$receiver;
  33809. $1=self["@iVars"];
  33810. if(($receiver = $1) == null || $receiver.isNil){
  33811. self["@iVars"]=$recv($globals.Dictionary)._new();
  33812. return self["@iVars"];
  33813. } else {
  33814. return $1;
  33815. };
  33816. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  33817. },
  33818. args: [],
  33819. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  33820. referencedClasses: ["Dictionary"],
  33821. messageSends: ["ifNil:", "new"]
  33822. }),
  33823. $globals.MethodLexicalScope);
  33824. $core.addMethod(
  33825. $core.method({
  33826. selector: "isMethodScope",
  33827. protocol: 'testing',
  33828. fn: function (){
  33829. var self=this;
  33830. return true;
  33831. },
  33832. args: [],
  33833. source: "isMethodScope\x0a\x09^ true",
  33834. referencedClasses: [],
  33835. messageSends: []
  33836. }),
  33837. $globals.MethodLexicalScope);
  33838. $core.addMethod(
  33839. $core.method({
  33840. selector: "localReturn",
  33841. protocol: 'accessing',
  33842. fn: function (){
  33843. var self=this;
  33844. return $core.withContext(function($ctx1) {
  33845. var $1,$receiver;
  33846. $1=self["@localReturn"];
  33847. if(($receiver = $1) == null || $receiver.isNil){
  33848. return false;
  33849. } else {
  33850. return $1;
  33851. };
  33852. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  33853. },
  33854. args: [],
  33855. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  33856. referencedClasses: [],
  33857. messageSends: ["ifNil:"]
  33858. }),
  33859. $globals.MethodLexicalScope);
  33860. $core.addMethod(
  33861. $core.method({
  33862. selector: "localReturn:",
  33863. protocol: 'accessing',
  33864. fn: function (aBoolean){
  33865. var self=this;
  33866. self["@localReturn"]=aBoolean;
  33867. return self;
  33868. },
  33869. args: ["aBoolean"],
  33870. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  33871. referencedClasses: [],
  33872. messageSends: []
  33873. }),
  33874. $globals.MethodLexicalScope);
  33875. $core.addMethod(
  33876. $core.method({
  33877. selector: "methodScope",
  33878. protocol: 'accessing',
  33879. fn: function (){
  33880. var self=this;
  33881. return self;
  33882. },
  33883. args: [],
  33884. source: "methodScope\x0a\x09^ self",
  33885. referencedClasses: [],
  33886. messageSends: []
  33887. }),
  33888. $globals.MethodLexicalScope);
  33889. $core.addMethod(
  33890. $core.method({
  33891. selector: "nonLocalReturns",
  33892. protocol: 'accessing',
  33893. fn: function (){
  33894. var self=this;
  33895. return $core.withContext(function($ctx1) {
  33896. var $1,$receiver;
  33897. $1=self["@nonLocalReturns"];
  33898. if(($receiver = $1) == null || $receiver.isNil){
  33899. self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  33900. return self["@nonLocalReturns"];
  33901. } else {
  33902. return $1;
  33903. };
  33904. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  33905. },
  33906. args: [],
  33907. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  33908. referencedClasses: ["OrderedCollection"],
  33909. messageSends: ["ifNil:", "new"]
  33910. }),
  33911. $globals.MethodLexicalScope);
  33912. $core.addMethod(
  33913. $core.method({
  33914. selector: "pseudoVars",
  33915. protocol: 'accessing',
  33916. fn: function (){
  33917. var self=this;
  33918. return $core.withContext(function($ctx1) {
  33919. var $1,$2,$4,$3,$receiver;
  33920. $1=self["@pseudoVars"];
  33921. if(($receiver = $1) == null || $receiver.isNil){
  33922. self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  33923. self["@pseudoVars"];
  33924. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  33925. return $core.withContext(function($ctx2) {
  33926. $2=self["@pseudoVars"];
  33927. $4=$recv($globals.PseudoVar)._on_(each);
  33928. $recv($4)._scope_(self._methodScope());
  33929. $3=$recv($4)._yourself();
  33930. return $recv($2)._at_put_(each,$3);
  33931. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  33932. }));
  33933. } else {
  33934. $1;
  33935. };
  33936. return self["@pseudoVars"];
  33937. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  33938. },
  33939. args: [],
  33940. 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",
  33941. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  33942. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  33943. }),
  33944. $globals.MethodLexicalScope);
  33945. $core.addMethod(
  33946. $core.method({
  33947. selector: "removeNonLocalReturn:",
  33948. protocol: 'adding',
  33949. fn: function (aScope){
  33950. var self=this;
  33951. return $core.withContext(function($ctx1) {
  33952. $recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  33953. }));
  33954. return self;
  33955. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  33956. },
  33957. args: ["aScope"],
  33958. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  33959. referencedClasses: [],
  33960. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  33961. }),
  33962. $globals.MethodLexicalScope);
  33963. $core.addMethod(
  33964. $core.method({
  33965. selector: "unknownVariables",
  33966. protocol: 'accessing',
  33967. fn: function (){
  33968. var self=this;
  33969. return $core.withContext(function($ctx1) {
  33970. var $1,$receiver;
  33971. $1=self["@unknownVariables"];
  33972. if(($receiver = $1) == null || $receiver.isNil){
  33973. self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  33974. return self["@unknownVariables"];
  33975. } else {
  33976. return $1;
  33977. };
  33978. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  33979. },
  33980. args: [],
  33981. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  33982. referencedClasses: ["OrderedCollection"],
  33983. messageSends: ["ifNil:", "new"]
  33984. }),
  33985. $globals.MethodLexicalScope);
  33986. $core.addClass('ScopeVar', $globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  33987. $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.";
  33988. $core.addMethod(
  33989. $core.method({
  33990. selector: "alias",
  33991. protocol: 'accessing',
  33992. fn: function (){
  33993. var self=this;
  33994. return $core.withContext(function($ctx1) {
  33995. return $recv(self._name())._asVariableName();
  33996. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  33997. },
  33998. args: [],
  33999. source: "alias\x0a\x09^ self name asVariableName",
  34000. referencedClasses: [],
  34001. messageSends: ["asVariableName", "name"]
  34002. }),
  34003. $globals.ScopeVar);
  34004. $core.addMethod(
  34005. $core.method({
  34006. selector: "isArgVar",
  34007. protocol: 'testing',
  34008. fn: function (){
  34009. var self=this;
  34010. return false;
  34011. },
  34012. args: [],
  34013. source: "isArgVar\x0a\x09^ false",
  34014. referencedClasses: [],
  34015. messageSends: []
  34016. }),
  34017. $globals.ScopeVar);
  34018. $core.addMethod(
  34019. $core.method({
  34020. selector: "isClassRefVar",
  34021. protocol: 'testing',
  34022. fn: function (){
  34023. var self=this;
  34024. return false;
  34025. },
  34026. args: [],
  34027. source: "isClassRefVar\x0a\x09^ false",
  34028. referencedClasses: [],
  34029. messageSends: []
  34030. }),
  34031. $globals.ScopeVar);
  34032. $core.addMethod(
  34033. $core.method({
  34034. selector: "isImmutable",
  34035. protocol: 'testing',
  34036. fn: function (){
  34037. var self=this;
  34038. return false;
  34039. },
  34040. args: [],
  34041. source: "isImmutable\x0a\x09^ false",
  34042. referencedClasses: [],
  34043. messageSends: []
  34044. }),
  34045. $globals.ScopeVar);
  34046. $core.addMethod(
  34047. $core.method({
  34048. selector: "isInstanceVar",
  34049. protocol: 'testing',
  34050. fn: function (){
  34051. var self=this;
  34052. return false;
  34053. },
  34054. args: [],
  34055. source: "isInstanceVar\x0a\x09^ false",
  34056. referencedClasses: [],
  34057. messageSends: []
  34058. }),
  34059. $globals.ScopeVar);
  34060. $core.addMethod(
  34061. $core.method({
  34062. selector: "isPseudoVar",
  34063. protocol: 'testing',
  34064. fn: function (){
  34065. var self=this;
  34066. return false;
  34067. },
  34068. args: [],
  34069. source: "isPseudoVar\x0a\x09^ false",
  34070. referencedClasses: [],
  34071. messageSends: []
  34072. }),
  34073. $globals.ScopeVar);
  34074. $core.addMethod(
  34075. $core.method({
  34076. selector: "isTempVar",
  34077. protocol: 'testing',
  34078. fn: function (){
  34079. var self=this;
  34080. return false;
  34081. },
  34082. args: [],
  34083. source: "isTempVar\x0a\x09^ false",
  34084. referencedClasses: [],
  34085. messageSends: []
  34086. }),
  34087. $globals.ScopeVar);
  34088. $core.addMethod(
  34089. $core.method({
  34090. selector: "isUnknownVar",
  34091. protocol: 'testing',
  34092. fn: function (){
  34093. var self=this;
  34094. return false;
  34095. },
  34096. args: [],
  34097. source: "isUnknownVar\x0a\x09^ false",
  34098. referencedClasses: [],
  34099. messageSends: []
  34100. }),
  34101. $globals.ScopeVar);
  34102. $core.addMethod(
  34103. $core.method({
  34104. selector: "name",
  34105. protocol: 'accessing',
  34106. fn: function (){
  34107. var self=this;
  34108. return self["@name"];
  34109. },
  34110. args: [],
  34111. source: "name\x0a\x09^ name",
  34112. referencedClasses: [],
  34113. messageSends: []
  34114. }),
  34115. $globals.ScopeVar);
  34116. $core.addMethod(
  34117. $core.method({
  34118. selector: "name:",
  34119. protocol: 'accessing',
  34120. fn: function (aString){
  34121. var self=this;
  34122. self["@name"]=aString;
  34123. return self;
  34124. },
  34125. args: ["aString"],
  34126. source: "name: aString\x0a\x09name := aString",
  34127. referencedClasses: [],
  34128. messageSends: []
  34129. }),
  34130. $globals.ScopeVar);
  34131. $core.addMethod(
  34132. $core.method({
  34133. selector: "scope",
  34134. protocol: 'accessing',
  34135. fn: function (){
  34136. var self=this;
  34137. return self["@scope"];
  34138. },
  34139. args: [],
  34140. source: "scope\x0a\x09^ scope",
  34141. referencedClasses: [],
  34142. messageSends: []
  34143. }),
  34144. $globals.ScopeVar);
  34145. $core.addMethod(
  34146. $core.method({
  34147. selector: "scope:",
  34148. protocol: 'accessing',
  34149. fn: function (aScope){
  34150. var self=this;
  34151. self["@scope"]=aScope;
  34152. return self;
  34153. },
  34154. args: ["aScope"],
  34155. source: "scope: aScope\x0a\x09scope := aScope",
  34156. referencedClasses: [],
  34157. messageSends: []
  34158. }),
  34159. $globals.ScopeVar);
  34160. $core.addMethod(
  34161. $core.method({
  34162. selector: "validateAssignment",
  34163. protocol: 'testing',
  34164. fn: function (){
  34165. var self=this;
  34166. return $core.withContext(function($ctx1) {
  34167. var $1,$2;
  34168. $1=$recv(self._isArgVar())._or_((function(){
  34169. return $core.withContext(function($ctx2) {
  34170. return self._isPseudoVar();
  34171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34172. }));
  34173. if($core.assert($1)){
  34174. $2=$recv($globals.InvalidAssignmentError)._new();
  34175. $recv($2)._variableName_(self._name());
  34176. $recv($2)._signal();
  34177. };
  34178. return self;
  34179. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  34180. },
  34181. args: [],
  34182. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  34183. referencedClasses: ["InvalidAssignmentError"],
  34184. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  34185. }),
  34186. $globals.ScopeVar);
  34187. $core.addMethod(
  34188. $core.method({
  34189. selector: "on:",
  34190. protocol: 'instance creation',
  34191. fn: function (aString){
  34192. var self=this;
  34193. return $core.withContext(function($ctx1) {
  34194. var $1;
  34195. $1=self._new();
  34196. $recv($1)._name_(aString);
  34197. return $recv($1)._yourself();
  34198. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)});
  34199. },
  34200. args: ["aString"],
  34201. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  34202. referencedClasses: [],
  34203. messageSends: ["name:", "new", "yourself"]
  34204. }),
  34205. $globals.ScopeVar.klass);
  34206. $core.addClass('AliasVar', $globals.ScopeVar, ['node'], 'Compiler-Semantic');
  34207. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  34208. $core.addMethod(
  34209. $core.method({
  34210. selector: "isImmutable",
  34211. protocol: 'testing',
  34212. fn: function (){
  34213. var self=this;
  34214. return true;
  34215. },
  34216. args: [],
  34217. source: "isImmutable\x0a\x09^ true",
  34218. referencedClasses: [],
  34219. messageSends: []
  34220. }),
  34221. $globals.AliasVar);
  34222. $core.addMethod(
  34223. $core.method({
  34224. selector: "node",
  34225. protocol: 'accessing',
  34226. fn: function (){
  34227. var self=this;
  34228. return self["@node"];
  34229. },
  34230. args: [],
  34231. source: "node\x0a\x09^ node",
  34232. referencedClasses: [],
  34233. messageSends: []
  34234. }),
  34235. $globals.AliasVar);
  34236. $core.addMethod(
  34237. $core.method({
  34238. selector: "node:",
  34239. protocol: 'accessing',
  34240. fn: function (aNode){
  34241. var self=this;
  34242. self["@node"]=aNode;
  34243. return self;
  34244. },
  34245. args: ["aNode"],
  34246. source: "node: aNode\x0a\x09node := aNode",
  34247. referencedClasses: [],
  34248. messageSends: []
  34249. }),
  34250. $globals.AliasVar);
  34251. $core.addClass('ArgVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34252. $globals.ArgVar.comment="I am an argument of a method or block.";
  34253. $core.addMethod(
  34254. $core.method({
  34255. selector: "isArgVar",
  34256. protocol: 'testing',
  34257. fn: function (){
  34258. var self=this;
  34259. return true;
  34260. },
  34261. args: [],
  34262. source: "isArgVar\x0a\x09^ true",
  34263. referencedClasses: [],
  34264. messageSends: []
  34265. }),
  34266. $globals.ArgVar);
  34267. $core.addMethod(
  34268. $core.method({
  34269. selector: "isImmutable",
  34270. protocol: 'testing',
  34271. fn: function (){
  34272. var self=this;
  34273. return true;
  34274. },
  34275. args: [],
  34276. source: "isImmutable\x0a\x09^ true",
  34277. referencedClasses: [],
  34278. messageSends: []
  34279. }),
  34280. $globals.ArgVar);
  34281. $core.addClass('ClassRefVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34282. $globals.ClassRefVar.comment="I am an class reference variable";
  34283. $core.addMethod(
  34284. $core.method({
  34285. selector: "alias",
  34286. protocol: 'accessing',
  34287. fn: function (){
  34288. var self=this;
  34289. return $core.withContext(function($ctx1) {
  34290. return "$globals.".__comma(self._name());
  34291. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  34292. },
  34293. args: [],
  34294. 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",
  34295. referencedClasses: [],
  34296. messageSends: [",", "name"]
  34297. }),
  34298. $globals.ClassRefVar);
  34299. $core.addMethod(
  34300. $core.method({
  34301. selector: "isClassRefVar",
  34302. protocol: 'testing',
  34303. fn: function (){
  34304. var self=this;
  34305. return true;
  34306. },
  34307. args: [],
  34308. source: "isClassRefVar\x0a\x09^ true",
  34309. referencedClasses: [],
  34310. messageSends: []
  34311. }),
  34312. $globals.ClassRefVar);
  34313. $core.addMethod(
  34314. $core.method({
  34315. selector: "isImmutable",
  34316. protocol: 'testing',
  34317. fn: function (){
  34318. var self=this;
  34319. return true;
  34320. },
  34321. args: [],
  34322. source: "isImmutable\x0a\x09^ true",
  34323. referencedClasses: [],
  34324. messageSends: []
  34325. }),
  34326. $globals.ClassRefVar);
  34327. $core.addClass('InstanceVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34328. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  34329. $core.addMethod(
  34330. $core.method({
  34331. selector: "alias",
  34332. protocol: 'testing',
  34333. fn: function (){
  34334. var self=this;
  34335. return $core.withContext(function($ctx1) {
  34336. var $1;
  34337. $1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]");
  34338. $ctx1.sendIdx[","]=1;
  34339. return $1;
  34340. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  34341. },
  34342. args: [],
  34343. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  34344. referencedClasses: [],
  34345. messageSends: [",", "name"]
  34346. }),
  34347. $globals.InstanceVar);
  34348. $core.addMethod(
  34349. $core.method({
  34350. selector: "isInstanceVar",
  34351. protocol: 'testing',
  34352. fn: function (){
  34353. var self=this;
  34354. return true;
  34355. },
  34356. args: [],
  34357. source: "isInstanceVar\x0a\x09^ true",
  34358. referencedClasses: [],
  34359. messageSends: []
  34360. }),
  34361. $globals.InstanceVar);
  34362. $core.addClass('PseudoVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34363. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  34364. $core.addMethod(
  34365. $core.method({
  34366. selector: "alias",
  34367. protocol: 'accessing',
  34368. fn: function (){
  34369. var self=this;
  34370. return $core.withContext(function($ctx1) {
  34371. return self._name();
  34372. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  34373. },
  34374. args: [],
  34375. source: "alias\x0a\x09^ self name",
  34376. referencedClasses: [],
  34377. messageSends: ["name"]
  34378. }),
  34379. $globals.PseudoVar);
  34380. $core.addMethod(
  34381. $core.method({
  34382. selector: "isImmutable",
  34383. protocol: 'testing',
  34384. fn: function (){
  34385. var self=this;
  34386. return true;
  34387. },
  34388. args: [],
  34389. source: "isImmutable\x0a\x09^ true",
  34390. referencedClasses: [],
  34391. messageSends: []
  34392. }),
  34393. $globals.PseudoVar);
  34394. $core.addMethod(
  34395. $core.method({
  34396. selector: "isPseudoVar",
  34397. protocol: 'testing',
  34398. fn: function (){
  34399. var self=this;
  34400. return true;
  34401. },
  34402. args: [],
  34403. source: "isPseudoVar\x0a\x09^ true",
  34404. referencedClasses: [],
  34405. messageSends: []
  34406. }),
  34407. $globals.PseudoVar);
  34408. $core.addClass('TempVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34409. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  34410. $core.addMethod(
  34411. $core.method({
  34412. selector: "isTempVar",
  34413. protocol: 'testing',
  34414. fn: function (){
  34415. var self=this;
  34416. return true;
  34417. },
  34418. args: [],
  34419. source: "isTempVar\x0a\x09^ true",
  34420. referencedClasses: [],
  34421. messageSends: []
  34422. }),
  34423. $globals.TempVar);
  34424. $core.addClass('UnknownVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34425. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  34426. $core.addMethod(
  34427. $core.method({
  34428. selector: "isUnknownVar",
  34429. protocol: 'testing',
  34430. fn: function (){
  34431. var self=this;
  34432. return true;
  34433. },
  34434. args: [],
  34435. source: "isUnknownVar\x0a\x09^ true",
  34436. referencedClasses: [],
  34437. messageSends: []
  34438. }),
  34439. $globals.UnknownVar);
  34440. $core.addClass('SemanticAnalyzer', $globals.NodeVisitor, ['currentScope', 'blockIndex', 'thePackage', 'theClass', 'classReferences', 'messageSends'], 'Compiler-Semantic');
  34441. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  34442. $core.addMethod(
  34443. $core.method({
  34444. selector: "classReferences",
  34445. protocol: 'accessing',
  34446. fn: function (){
  34447. var self=this;
  34448. return $core.withContext(function($ctx1) {
  34449. var $1,$receiver;
  34450. $1=self["@classReferences"];
  34451. if(($receiver = $1) == null || $receiver.isNil){
  34452. self["@classReferences"]=$recv($globals.Set)._new();
  34453. return self["@classReferences"];
  34454. } else {
  34455. return $1;
  34456. };
  34457. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  34458. },
  34459. args: [],
  34460. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  34461. referencedClasses: ["Set"],
  34462. messageSends: ["ifNil:", "new"]
  34463. }),
  34464. $globals.SemanticAnalyzer);
  34465. $core.addMethod(
  34466. $core.method({
  34467. selector: "errorShadowingVariable:",
  34468. protocol: 'error handling',
  34469. fn: function (aString){
  34470. var self=this;
  34471. return $core.withContext(function($ctx1) {
  34472. var $1;
  34473. $1=$recv($globals.ShadowingVariableError)._new();
  34474. $recv($1)._variableName_(aString);
  34475. $recv($1)._signal();
  34476. return self;
  34477. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  34478. },
  34479. args: ["aString"],
  34480. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  34481. referencedClasses: ["ShadowingVariableError"],
  34482. messageSends: ["variableName:", "new", "signal"]
  34483. }),
  34484. $globals.SemanticAnalyzer);
  34485. $core.addMethod(
  34486. $core.method({
  34487. selector: "errorUnknownVariable:",
  34488. protocol: 'error handling',
  34489. fn: function (aNode){
  34490. var self=this;
  34491. var identifier;
  34492. return $core.withContext(function($ctx1) {
  34493. var $1,$2,$3;
  34494. identifier=$recv(aNode)._value();
  34495. $ctx1.sendIdx["value"]=1;
  34496. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  34497. return $core.withContext(function($ctx2) {
  34498. return self._isVariableUndefined_inPackage_(identifier,self._thePackage());
  34499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34500. }));
  34501. if($core.assert($1)){
  34502. $2=$recv($globals.UnknownVariableError)._new();
  34503. $3=$recv(aNode)._value();
  34504. $ctx1.sendIdx["value"]=2;
  34505. $recv($2)._variableName_($3);
  34506. $recv($2)._signal();
  34507. } else {
  34508. $recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  34509. };
  34510. return self;
  34511. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  34512. },
  34513. args: ["aNode"],
  34514. 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 ]",
  34515. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  34516. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  34517. }),
  34518. $globals.SemanticAnalyzer);
  34519. $core.addMethod(
  34520. $core.method({
  34521. selector: "isVariableUndefined:inPackage:",
  34522. protocol: 'testing',
  34523. fn: function (aString,aPackage){
  34524. var self=this;
  34525. return $core.withContext(function($ctx1) {
  34526. var $1,$2,$3,$receiver;
  34527. if(($receiver = aPackage) == null || $receiver.isNil){
  34528. aPackage;
  34529. } else {
  34530. var packageKnownVars;
  34531. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  34532. packageKnownVars;
  34533. $1=$recv(packageKnownVars)._includes_(aString);
  34534. if($core.assert($1)){
  34535. return false;
  34536. };
  34537. };
  34538. $2=$recv($globals.Compiler)._new();
  34539. $3=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
  34540. $ctx1.sendIdx[","]=1;
  34541. return $recv($2)._eval_($3);
  34542. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  34543. },
  34544. args: ["aString", "aPackage"],
  34545. 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'",
  34546. referencedClasses: ["Compiler"],
  34547. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","]
  34548. }),
  34549. $globals.SemanticAnalyzer);
  34550. $core.addMethod(
  34551. $core.method({
  34552. selector: "messageSends",
  34553. protocol: 'accessing',
  34554. fn: function (){
  34555. var self=this;
  34556. return $core.withContext(function($ctx1) {
  34557. var $1,$receiver;
  34558. $1=self["@messageSends"];
  34559. if(($receiver = $1) == null || $receiver.isNil){
  34560. self["@messageSends"]=$recv($globals.Dictionary)._new();
  34561. return self["@messageSends"];
  34562. } else {
  34563. return $1;
  34564. };
  34565. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  34566. },
  34567. args: [],
  34568. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  34569. referencedClasses: ["Dictionary"],
  34570. messageSends: ["ifNil:", "new"]
  34571. }),
  34572. $globals.SemanticAnalyzer);
  34573. $core.addMethod(
  34574. $core.method({
  34575. selector: "newBlockScope",
  34576. protocol: 'factory',
  34577. fn: function (){
  34578. var self=this;
  34579. return $core.withContext(function($ctx1) {
  34580. return self._newScopeOfClass_($globals.LexicalScope);
  34581. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  34582. },
  34583. args: [],
  34584. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  34585. referencedClasses: ["LexicalScope"],
  34586. messageSends: ["newScopeOfClass:"]
  34587. }),
  34588. $globals.SemanticAnalyzer);
  34589. $core.addMethod(
  34590. $core.method({
  34591. selector: "newMethodScope",
  34592. protocol: 'factory',
  34593. fn: function (){
  34594. var self=this;
  34595. return $core.withContext(function($ctx1) {
  34596. return self._newScopeOfClass_($globals.MethodLexicalScope);
  34597. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  34598. },
  34599. args: [],
  34600. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  34601. referencedClasses: ["MethodLexicalScope"],
  34602. messageSends: ["newScopeOfClass:"]
  34603. }),
  34604. $globals.SemanticAnalyzer);
  34605. $core.addMethod(
  34606. $core.method({
  34607. selector: "newScopeOfClass:",
  34608. protocol: 'factory',
  34609. fn: function (aLexicalScopeClass){
  34610. var self=this;
  34611. return $core.withContext(function($ctx1) {
  34612. var $1;
  34613. $1=$recv(aLexicalScopeClass)._new();
  34614. $recv($1)._outerScope_(self["@currentScope"]);
  34615. return $recv($1)._yourself();
  34616. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  34617. },
  34618. args: ["aLexicalScopeClass"],
  34619. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  34620. referencedClasses: [],
  34621. messageSends: ["outerScope:", "new", "yourself"]
  34622. }),
  34623. $globals.SemanticAnalyzer);
  34624. $core.addMethod(
  34625. $core.method({
  34626. selector: "nextBlockIndex",
  34627. protocol: 'private',
  34628. fn: function (){
  34629. var self=this;
  34630. return $core.withContext(function($ctx1) {
  34631. var $1,$receiver;
  34632. $1=self["@blockIndex"];
  34633. if(($receiver = $1) == null || $receiver.isNil){
  34634. self["@blockIndex"]=(0);
  34635. self["@blockIndex"];
  34636. } else {
  34637. $1;
  34638. };
  34639. self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
  34640. return self["@blockIndex"];
  34641. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  34642. },
  34643. args: [],
  34644. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  34645. referencedClasses: [],
  34646. messageSends: ["ifNil:", "+"]
  34647. }),
  34648. $globals.SemanticAnalyzer);
  34649. $core.addMethod(
  34650. $core.method({
  34651. selector: "popScope",
  34652. protocol: 'scope',
  34653. fn: function (){
  34654. var self=this;
  34655. return $core.withContext(function($ctx1) {
  34656. var $1,$receiver;
  34657. $1=self["@currentScope"];
  34658. if(($receiver = $1) == null || $receiver.isNil){
  34659. $1;
  34660. } else {
  34661. self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
  34662. self["@currentScope"];
  34663. };
  34664. return self;
  34665. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  34666. },
  34667. args: [],
  34668. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  34669. referencedClasses: [],
  34670. messageSends: ["ifNotNil:", "outerScope"]
  34671. }),
  34672. $globals.SemanticAnalyzer);
  34673. $core.addMethod(
  34674. $core.method({
  34675. selector: "pushScope:",
  34676. protocol: 'scope',
  34677. fn: function (aScope){
  34678. var self=this;
  34679. return $core.withContext(function($ctx1) {
  34680. $recv(aScope)._outerScope_(self["@currentScope"]);
  34681. self["@currentScope"]=aScope;
  34682. return self;
  34683. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  34684. },
  34685. args: ["aScope"],
  34686. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  34687. referencedClasses: [],
  34688. messageSends: ["outerScope:"]
  34689. }),
  34690. $globals.SemanticAnalyzer);
  34691. $core.addMethod(
  34692. $core.method({
  34693. selector: "theClass",
  34694. protocol: 'accessing',
  34695. fn: function (){
  34696. var self=this;
  34697. return self["@theClass"];
  34698. },
  34699. args: [],
  34700. source: "theClass\x0a\x09^ theClass",
  34701. referencedClasses: [],
  34702. messageSends: []
  34703. }),
  34704. $globals.SemanticAnalyzer);
  34705. $core.addMethod(
  34706. $core.method({
  34707. selector: "theClass:",
  34708. protocol: 'accessing',
  34709. fn: function (aClass){
  34710. var self=this;
  34711. self["@theClass"]=aClass;
  34712. return self;
  34713. },
  34714. args: ["aClass"],
  34715. source: "theClass: aClass\x0a\x09theClass := aClass",
  34716. referencedClasses: [],
  34717. messageSends: []
  34718. }),
  34719. $globals.SemanticAnalyzer);
  34720. $core.addMethod(
  34721. $core.method({
  34722. selector: "thePackage",
  34723. protocol: 'accessing',
  34724. fn: function (){
  34725. var self=this;
  34726. return self["@thePackage"];
  34727. },
  34728. args: [],
  34729. source: "thePackage\x0a\x09^ thePackage",
  34730. referencedClasses: [],
  34731. messageSends: []
  34732. }),
  34733. $globals.SemanticAnalyzer);
  34734. $core.addMethod(
  34735. $core.method({
  34736. selector: "thePackage:",
  34737. protocol: 'accessing',
  34738. fn: function (aPackage){
  34739. var self=this;
  34740. self["@thePackage"]=aPackage;
  34741. return self;
  34742. },
  34743. args: ["aPackage"],
  34744. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  34745. referencedClasses: [],
  34746. messageSends: []
  34747. }),
  34748. $globals.SemanticAnalyzer);
  34749. $core.addMethod(
  34750. $core.method({
  34751. selector: "validateVariableScope:",
  34752. protocol: 'scope',
  34753. fn: function (aString){
  34754. var self=this;
  34755. return $core.withContext(function($ctx1) {
  34756. var $1,$receiver;
  34757. $1=$recv(self["@currentScope"])._lookupVariable_(aString);
  34758. if(($receiver = $1) == null || $receiver.isNil){
  34759. $1;
  34760. } else {
  34761. self._errorShadowingVariable_(aString);
  34762. };
  34763. return self;
  34764. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  34765. },
  34766. args: ["aString"],
  34767. 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 ]",
  34768. referencedClasses: [],
  34769. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  34770. }),
  34771. $globals.SemanticAnalyzer);
  34772. $core.addMethod(
  34773. $core.method({
  34774. selector: "visitAssignmentNode:",
  34775. protocol: 'visiting',
  34776. fn: function (aNode){
  34777. var self=this;
  34778. return $core.withContext(function($ctx1) {
  34779. (
  34780. $ctx1.supercall = true,
  34781. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
  34782. $ctx1.supercall = false;
  34783. $recv($recv(aNode)._left())._beAssigned();
  34784. return self;
  34785. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34786. },
  34787. args: ["aNode"],
  34788. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  34789. referencedClasses: [],
  34790. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  34791. }),
  34792. $globals.SemanticAnalyzer);
  34793. $core.addMethod(
  34794. $core.method({
  34795. selector: "visitBlockNode:",
  34796. protocol: 'visiting',
  34797. fn: function (aNode){
  34798. var self=this;
  34799. return $core.withContext(function($ctx1) {
  34800. self._pushScope_(self._newBlockScope());
  34801. $recv(aNode)._scope_(self["@currentScope"]);
  34802. $recv(self["@currentScope"])._node_(aNode);
  34803. $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  34804. $recv($recv(aNode)._parameters())._do_((function(each){
  34805. return $core.withContext(function($ctx2) {
  34806. self._validateVariableScope_(each);
  34807. return $recv(self["@currentScope"])._addArg_(each);
  34808. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34809. }));
  34810. (
  34811. $ctx1.supercall = true,
  34812. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
  34813. $ctx1.supercall = false;
  34814. self._popScope();
  34815. return self;
  34816. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34817. },
  34818. args: ["aNode"],
  34819. 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",
  34820. referencedClasses: [],
  34821. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  34822. }),
  34823. $globals.SemanticAnalyzer);
  34824. $core.addMethod(
  34825. $core.method({
  34826. selector: "visitCascadeNode:",
  34827. protocol: 'visiting',
  34828. fn: function (aNode){
  34829. var self=this;
  34830. return $core.withContext(function($ctx1) {
  34831. $recv(aNode)._receiver_($recv($recv($recv(aNode)._nodes())._first())._receiver());
  34832. (
  34833. $ctx1.supercall = true,
  34834. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
  34835. $ctx1.supercall = false;
  34836. return self;
  34837. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34838. },
  34839. args: ["aNode"],
  34840. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode nodes first receiver.\x0a\x09super visitCascadeNode: aNode",
  34841. referencedClasses: [],
  34842. messageSends: ["receiver:", "receiver", "first", "nodes", "visitCascadeNode:"]
  34843. }),
  34844. $globals.SemanticAnalyzer);
  34845. $core.addMethod(
  34846. $core.method({
  34847. selector: "visitMethodNode:",
  34848. protocol: 'visiting',
  34849. fn: function (aNode){
  34850. var self=this;
  34851. return $core.withContext(function($ctx1) {
  34852. self._pushScope_(self._newMethodScope());
  34853. $recv(aNode)._scope_(self["@currentScope"]);
  34854. $recv(self["@currentScope"])._node_(aNode);
  34855. $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
  34856. return $core.withContext(function($ctx2) {
  34857. return $recv(self["@currentScope"])._addIVar_(each);
  34858. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34859. }));
  34860. $ctx1.sendIdx["do:"]=1;
  34861. $recv($recv(aNode)._arguments())._do_((function(each){
  34862. return $core.withContext(function($ctx2) {
  34863. self._validateVariableScope_(each);
  34864. return $recv(self["@currentScope"])._addArg_(each);
  34865. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  34866. }));
  34867. (
  34868. $ctx1.supercall = true,
  34869. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
  34870. $ctx1.supercall = false;
  34871. $recv(aNode)._classReferences_(self._classReferences());
  34872. $recv(aNode)._sendIndexes_(self._messageSends());
  34873. self._popScope();
  34874. return self;
  34875. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34876. },
  34877. args: ["aNode"],
  34878. 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",
  34879. referencedClasses: [],
  34880. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  34881. }),
  34882. $globals.SemanticAnalyzer);
  34883. $core.addMethod(
  34884. $core.method({
  34885. selector: "visitReturnNode:",
  34886. protocol: 'visiting',
  34887. fn: function (aNode){
  34888. var self=this;
  34889. return $core.withContext(function($ctx1) {
  34890. var $1;
  34891. $recv(aNode)._scope_(self["@currentScope"]);
  34892. $1=$recv(self["@currentScope"])._isMethodScope();
  34893. if($core.assert($1)){
  34894. $recv(self["@currentScope"])._localReturn_(true);
  34895. } else {
  34896. $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  34897. };
  34898. (
  34899. $ctx1.supercall = true,
  34900. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
  34901. $ctx1.supercall = false;
  34902. return self;
  34903. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34904. },
  34905. args: ["aNode"],
  34906. 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",
  34907. referencedClasses: [],
  34908. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  34909. }),
  34910. $globals.SemanticAnalyzer);
  34911. $core.addMethod(
  34912. $core.method({
  34913. selector: "visitSendNode:",
  34914. protocol: 'visiting',
  34915. fn: function (aNode){
  34916. var self=this;
  34917. return $core.withContext(function($ctx1) {
  34918. var $1,$3,$4,$2,$5,$6,$7,$9,$10,$8,$receiver;
  34919. $1=$recv(aNode)._superSend();
  34920. if(!$core.assert($1)){
  34921. $3=$recv($globals.IRSendInliner)._inlinedSelectors();
  34922. $4=$recv(aNode)._selector();
  34923. $ctx1.sendIdx["selector"]=1;
  34924. $2=$recv($3)._includes_($4);
  34925. if($core.assert($2)){
  34926. $recv(aNode)._shouldBeInlined_(true);
  34927. $5=$recv(aNode)._receiver();
  34928. if(($receiver = $5) == null || $receiver.isNil){
  34929. $5;
  34930. } else {
  34931. var receiver;
  34932. receiver=$receiver;
  34933. $recv(receiver)._shouldBeAliased_(true);
  34934. };
  34935. };
  34936. };
  34937. $6=self._messageSends();
  34938. $ctx1.sendIdx["messageSends"]=1;
  34939. $7=$recv(aNode)._selector();
  34940. $ctx1.sendIdx["selector"]=2;
  34941. $recv($6)._at_ifAbsentPut_($7,(function(){
  34942. return $core.withContext(function($ctx2) {
  34943. return $recv($globals.Set)._new();
  34944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  34945. }));
  34946. $9=self._messageSends();
  34947. $ctx1.sendIdx["messageSends"]=2;
  34948. $10=$recv(aNode)._selector();
  34949. $ctx1.sendIdx["selector"]=3;
  34950. $8=$recv($9)._at_($10);
  34951. $ctx1.sendIdx["at:"]=1;
  34952. $recv($8)._add_(aNode);
  34953. $recv(aNode)._index_($recv($recv(self._messageSends())._at_($recv(aNode)._selector()))._size());
  34954. (
  34955. $ctx1.supercall = true,
  34956. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  34957. $ctx1.supercall = false;
  34958. return self;
  34959. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34960. },
  34961. args: ["aNode"],
  34962. 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\x09self messageSends at: aNode selector ifAbsentPut: [ Set new ].\x0a\x09(self messageSends at: aNode selector) add: aNode.\x0a\x0a\x09aNode index: (self messageSends at: aNode selector) size.\x0a\x0a\x09super visitSendNode: aNode",
  34963. referencedClasses: ["IRSendInliner", "Set"],
  34964. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "at:ifAbsentPut:", "messageSends", "new", "add:", "at:", "index:", "size", "visitSendNode:"]
  34965. }),
  34966. $globals.SemanticAnalyzer);
  34967. $core.addMethod(
  34968. $core.method({
  34969. selector: "visitSequenceNode:",
  34970. protocol: 'visiting',
  34971. fn: function (aNode){
  34972. var self=this;
  34973. return $core.withContext(function($ctx1) {
  34974. $recv($recv(aNode)._temps())._do_((function(each){
  34975. return $core.withContext(function($ctx2) {
  34976. self._validateVariableScope_(each);
  34977. return $recv(self["@currentScope"])._addTemp_(each);
  34978. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34979. }));
  34980. (
  34981. $ctx1.supercall = true,
  34982. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  34983. $ctx1.supercall = false;
  34984. return self;
  34985. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34986. },
  34987. args: ["aNode"],
  34988. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  34989. referencedClasses: [],
  34990. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  34991. }),
  34992. $globals.SemanticAnalyzer);
  34993. $core.addMethod(
  34994. $core.method({
  34995. selector: "visitVariableNode:",
  34996. protocol: 'visiting',
  34997. fn: function (aNode){
  34998. var self=this;
  34999. var binding;
  35000. return $core.withContext(function($ctx1) {
  35001. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  35002. binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
  35003. $1=binding;
  35004. if(($receiver = $1) == null || $receiver.isNil){
  35005. $3=$recv(aNode)._value();
  35006. $ctx1.sendIdx["value"]=1;
  35007. $2=$recv($3)._isCapitalized();
  35008. if($core.assert($2)){
  35009. $4=$recv($globals.ClassRefVar)._new();
  35010. $ctx1.sendIdx["new"]=1;
  35011. $5=$recv(aNode)._value();
  35012. $ctx1.sendIdx["value"]=2;
  35013. $recv($4)._name_($5);
  35014. $ctx1.sendIdx["name:"]=1;
  35015. $6=$recv($4)._yourself();
  35016. $ctx1.sendIdx["yourself"]=1;
  35017. binding=$6;
  35018. binding;
  35019. $7=self._classReferences();
  35020. $8=$recv(aNode)._value();
  35021. $ctx1.sendIdx["value"]=3;
  35022. $recv($7)._add_($8);
  35023. } else {
  35024. self._errorUnknownVariable_(aNode);
  35025. $9=$recv($globals.UnknownVar)._new();
  35026. $recv($9)._name_($recv(aNode)._value());
  35027. binding=$recv($9)._yourself();
  35028. binding;
  35029. };
  35030. } else {
  35031. $1;
  35032. };
  35033. $recv(aNode)._binding_(binding);
  35034. return self;
  35035. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  35036. },
  35037. args: ["aNode"],
  35038. 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.",
  35039. referencedClasses: ["ClassRefVar", "UnknownVar"],
  35040. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  35041. }),
  35042. $globals.SemanticAnalyzer);
  35043. $core.addMethod(
  35044. $core.method({
  35045. selector: "on:",
  35046. protocol: 'instance creation',
  35047. fn: function (aClass){
  35048. var self=this;
  35049. return $core.withContext(function($ctx1) {
  35050. var $1;
  35051. $1=self._new();
  35052. $recv($1)._theClass_(aClass);
  35053. return $recv($1)._yourself();
  35054. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
  35055. },
  35056. args: ["aClass"],
  35057. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  35058. referencedClasses: [],
  35059. messageSends: ["theClass:", "new", "yourself"]
  35060. }),
  35061. $globals.SemanticAnalyzer.klass);
  35062. $core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Semantic');
  35063. $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";
  35064. $core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35065. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  35066. $core.addMethod(
  35067. $core.method({
  35068. selector: "messageText",
  35069. protocol: 'accessing',
  35070. fn: function (){
  35071. var self=this;
  35072. return $core.withContext(function($ctx1) {
  35073. return " Invalid assignment to variable: ".__comma(self._variableName());
  35074. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  35075. },
  35076. args: [],
  35077. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  35078. referencedClasses: [],
  35079. messageSends: [",", "variableName"]
  35080. }),
  35081. $globals.InvalidAssignmentError);
  35082. $core.addMethod(
  35083. $core.method({
  35084. selector: "variableName",
  35085. protocol: 'accessing',
  35086. fn: function (){
  35087. var self=this;
  35088. return self["@variableName"];
  35089. },
  35090. args: [],
  35091. source: "variableName\x0a\x09^ variableName",
  35092. referencedClasses: [],
  35093. messageSends: []
  35094. }),
  35095. $globals.InvalidAssignmentError);
  35096. $core.addMethod(
  35097. $core.method({
  35098. selector: "variableName:",
  35099. protocol: 'accessing',
  35100. fn: function (aString){
  35101. var self=this;
  35102. self["@variableName"]=aString;
  35103. return self;
  35104. },
  35105. args: ["aString"],
  35106. source: "variableName: aString\x0a\x09variableName := aString",
  35107. referencedClasses: [],
  35108. messageSends: []
  35109. }),
  35110. $globals.InvalidAssignmentError);
  35111. $core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35112. $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.";
  35113. $core.addMethod(
  35114. $core.method({
  35115. selector: "messageText",
  35116. protocol: 'accessing',
  35117. fn: function (){
  35118. var self=this;
  35119. return $core.withContext(function($ctx1) {
  35120. var $1;
  35121. $1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  35122. $ctx1.sendIdx[","]=1;
  35123. return $1;
  35124. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  35125. },
  35126. args: [],
  35127. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  35128. referencedClasses: [],
  35129. messageSends: [",", "variableName"]
  35130. }),
  35131. $globals.ShadowingVariableError);
  35132. $core.addMethod(
  35133. $core.method({
  35134. selector: "variableName",
  35135. protocol: 'accessing',
  35136. fn: function (){
  35137. var self=this;
  35138. return self["@variableName"];
  35139. },
  35140. args: [],
  35141. source: "variableName\x0a\x09^ variableName",
  35142. referencedClasses: [],
  35143. messageSends: []
  35144. }),
  35145. $globals.ShadowingVariableError);
  35146. $core.addMethod(
  35147. $core.method({
  35148. selector: "variableName:",
  35149. protocol: 'accessing',
  35150. fn: function (aString){
  35151. var self=this;
  35152. self["@variableName"]=aString;
  35153. return self;
  35154. },
  35155. args: ["aString"],
  35156. source: "variableName: aString\x0a\x09variableName := aString",
  35157. referencedClasses: [],
  35158. messageSends: []
  35159. }),
  35160. $globals.ShadowingVariableError);
  35161. $core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35162. $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.";
  35163. $core.addMethod(
  35164. $core.method({
  35165. selector: "messageText",
  35166. protocol: 'accessing',
  35167. fn: function (){
  35168. var self=this;
  35169. return $core.withContext(function($ctx1) {
  35170. var $1;
  35171. $1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  35172. $ctx1.sendIdx[","]=1;
  35173. return $1;
  35174. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  35175. },
  35176. args: [],
  35177. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  35178. referencedClasses: [],
  35179. messageSends: [",", "variableName"]
  35180. }),
  35181. $globals.UnknownVariableError);
  35182. $core.addMethod(
  35183. $core.method({
  35184. selector: "variableName",
  35185. protocol: 'accessing',
  35186. fn: function (){
  35187. var self=this;
  35188. return self["@variableName"];
  35189. },
  35190. args: [],
  35191. source: "variableName\x0a\x09^ variableName",
  35192. referencedClasses: [],
  35193. messageSends: []
  35194. }),
  35195. $globals.UnknownVariableError);
  35196. $core.addMethod(
  35197. $core.method({
  35198. selector: "variableName:",
  35199. protocol: 'accessing',
  35200. fn: function (aString){
  35201. var self=this;
  35202. self["@variableName"]=aString;
  35203. return self;
  35204. },
  35205. args: ["aString"],
  35206. source: "variableName: aString\x0a\x09variableName := aString",
  35207. referencedClasses: [],
  35208. messageSends: []
  35209. }),
  35210. $globals.UnknownVariableError);
  35211. });
  35212. define('amber_core/Compiler-IR',["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Methods", "amber_core/Kernel-Objects"], function($boot){"use strict";
  35213. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  35214. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  35215. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  35216. $core.addPackage('Compiler-IR');
  35217. $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  35218. $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35219. $core.addClass('IRASTTranslator', $globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  35220. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  35221. $core.addMethod(
  35222. $core.method({
  35223. selector: "alias:",
  35224. protocol: 'visiting',
  35225. fn: function (aNode){
  35226. var self=this;
  35227. var variable;
  35228. return $core.withContext(function($ctx1) {
  35229. var $1,$2,$3,$5,$4,$6,$7,$9,$8;
  35230. $1=$recv(aNode)._isImmutable();
  35231. if($core.assert($1)){
  35232. $2=self._visit_(aNode);
  35233. $ctx1.sendIdx["visit:"]=1;
  35234. return $2;
  35235. };
  35236. $3=$recv($globals.IRVariable)._new();
  35237. $ctx1.sendIdx["new"]=1;
  35238. $5=$recv($globals.AliasVar)._new();
  35239. $ctx1.sendIdx["new"]=2;
  35240. $4=$recv($5)._name_("$".__comma(self._nextAlias()));
  35241. $recv($3)._variable_($4);
  35242. $6=$recv($3)._yourself();
  35243. $ctx1.sendIdx["yourself"]=1;
  35244. variable=$6;
  35245. $7=self._sequence();
  35246. $9=$recv($globals.IRAssignment)._new();
  35247. $recv($9)._add_(variable);
  35248. $ctx1.sendIdx["add:"]=2;
  35249. $recv($9)._add_(self._visit_(aNode));
  35250. $ctx1.sendIdx["add:"]=3;
  35251. $8=$recv($9)._yourself();
  35252. $recv($7)._add_($8);
  35253. $ctx1.sendIdx["add:"]=1;
  35254. $recv($recv(self._method())._internalVariables())._add_(variable);
  35255. return variable;
  35256. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  35257. },
  35258. args: ["aNode"],
  35259. 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",
  35260. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  35261. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  35262. }),
  35263. $globals.IRASTTranslator);
  35264. $core.addMethod(
  35265. $core.method({
  35266. selector: "aliasTemporally:",
  35267. protocol: 'visiting',
  35268. fn: function (aCollection){
  35269. var self=this;
  35270. var threshold,result;
  35271. return $core.withContext(function($ctx1) {
  35272. var $1,$2,$4,$3;
  35273. threshold=(0);
  35274. $recv(aCollection)._withIndexDo_((function(each,i){
  35275. return $core.withContext(function($ctx2) {
  35276. $1=$recv(each)._subtreeNeedsAliasing();
  35277. if($core.assert($1)){
  35278. threshold=i;
  35279. return threshold;
  35280. };
  35281. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  35282. }));
  35283. $ctx1.sendIdx["withIndexDo:"]=1;
  35284. result=$recv($globals.OrderedCollection)._new();
  35285. $recv(aCollection)._withIndexDo_((function(each,i){
  35286. return $core.withContext(function($ctx2) {
  35287. $2=result;
  35288. $4=$recv(i).__lt_eq(threshold);
  35289. if($core.assert($4)){
  35290. $3=self._alias_(each);
  35291. } else {
  35292. $3=self._visit_(each);
  35293. };
  35294. return $recv($2)._add_($3);
  35295. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  35296. }));
  35297. return result;
  35298. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  35299. },
  35300. args: ["aCollection"],
  35301. 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",
  35302. referencedClasses: ["OrderedCollection"],
  35303. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  35304. }),
  35305. $globals.IRASTTranslator);
  35306. $core.addMethod(
  35307. $core.method({
  35308. selector: "method",
  35309. protocol: 'accessing',
  35310. fn: function (){
  35311. var self=this;
  35312. return self["@method"];
  35313. },
  35314. args: [],
  35315. source: "method\x0a\x09^ method",
  35316. referencedClasses: [],
  35317. messageSends: []
  35318. }),
  35319. $globals.IRASTTranslator);
  35320. $core.addMethod(
  35321. $core.method({
  35322. selector: "method:",
  35323. protocol: 'accessing',
  35324. fn: function (anIRMethod){
  35325. var self=this;
  35326. self["@method"]=anIRMethod;
  35327. return self;
  35328. },
  35329. args: ["anIRMethod"],
  35330. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  35331. referencedClasses: [],
  35332. messageSends: []
  35333. }),
  35334. $globals.IRASTTranslator);
  35335. $core.addMethod(
  35336. $core.method({
  35337. selector: "nextAlias",
  35338. protocol: 'accessing',
  35339. fn: function (){
  35340. var self=this;
  35341. return $core.withContext(function($ctx1) {
  35342. var $1,$receiver;
  35343. $1=self["@nextAlias"];
  35344. if(($receiver = $1) == null || $receiver.isNil){
  35345. self["@nextAlias"]=(0);
  35346. self["@nextAlias"];
  35347. } else {
  35348. $1;
  35349. };
  35350. self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1));
  35351. return $recv(self["@nextAlias"])._asString();
  35352. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  35353. },
  35354. args: [],
  35355. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  35356. referencedClasses: [],
  35357. messageSends: ["ifNil:", "+", "asString"]
  35358. }),
  35359. $globals.IRASTTranslator);
  35360. $core.addMethod(
  35361. $core.method({
  35362. selector: "sequence",
  35363. protocol: 'accessing',
  35364. fn: function (){
  35365. var self=this;
  35366. return self["@sequence"];
  35367. },
  35368. args: [],
  35369. source: "sequence\x0a\x09^ sequence",
  35370. referencedClasses: [],
  35371. messageSends: []
  35372. }),
  35373. $globals.IRASTTranslator);
  35374. $core.addMethod(
  35375. $core.method({
  35376. selector: "sequence:",
  35377. protocol: 'accessing',
  35378. fn: function (anIRSequence){
  35379. var self=this;
  35380. self["@sequence"]=anIRSequence;
  35381. return self;
  35382. },
  35383. args: ["anIRSequence"],
  35384. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  35385. referencedClasses: [],
  35386. messageSends: []
  35387. }),
  35388. $globals.IRASTTranslator);
  35389. $core.addMethod(
  35390. $core.method({
  35391. selector: "source",
  35392. protocol: 'accessing',
  35393. fn: function (){
  35394. var self=this;
  35395. return self["@source"];
  35396. },
  35397. args: [],
  35398. source: "source\x0a\x09^ source",
  35399. referencedClasses: [],
  35400. messageSends: []
  35401. }),
  35402. $globals.IRASTTranslator);
  35403. $core.addMethod(
  35404. $core.method({
  35405. selector: "source:",
  35406. protocol: 'accessing',
  35407. fn: function (aString){
  35408. var self=this;
  35409. self["@source"]=aString;
  35410. return self;
  35411. },
  35412. args: ["aString"],
  35413. source: "source: aString\x0a\x09source := aString",
  35414. referencedClasses: [],
  35415. messageSends: []
  35416. }),
  35417. $globals.IRASTTranslator);
  35418. $core.addMethod(
  35419. $core.method({
  35420. selector: "theClass",
  35421. protocol: 'accessing',
  35422. fn: function (){
  35423. var self=this;
  35424. return self["@theClass"];
  35425. },
  35426. args: [],
  35427. source: "theClass\x0a\x09^ theClass",
  35428. referencedClasses: [],
  35429. messageSends: []
  35430. }),
  35431. $globals.IRASTTranslator);
  35432. $core.addMethod(
  35433. $core.method({
  35434. selector: "theClass:",
  35435. protocol: 'accessing',
  35436. fn: function (aClass){
  35437. var self=this;
  35438. self["@theClass"]=aClass;
  35439. return self;
  35440. },
  35441. args: ["aClass"],
  35442. source: "theClass: aClass\x0a\x09theClass := aClass",
  35443. referencedClasses: [],
  35444. messageSends: []
  35445. }),
  35446. $globals.IRASTTranslator);
  35447. $core.addMethod(
  35448. $core.method({
  35449. selector: "visitAssignmentNode:",
  35450. protocol: 'visiting',
  35451. fn: function (aNode){
  35452. var self=this;
  35453. var left,right,assignment;
  35454. return $core.withContext(function($ctx1) {
  35455. var $1,$3,$2;
  35456. right=self._visit_($recv(aNode)._right());
  35457. $ctx1.sendIdx["visit:"]=1;
  35458. left=self._visit_($recv(aNode)._left());
  35459. $1=self._sequence();
  35460. $3=$recv($globals.IRAssignment)._new();
  35461. $recv($3)._add_(left);
  35462. $ctx1.sendIdx["add:"]=2;
  35463. $recv($3)._add_(right);
  35464. $2=$recv($3)._yourself();
  35465. $recv($1)._add_($2);
  35466. $ctx1.sendIdx["add:"]=1;
  35467. return left;
  35468. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  35469. },
  35470. args: ["aNode"],
  35471. 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",
  35472. referencedClasses: ["IRAssignment"],
  35473. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  35474. }),
  35475. $globals.IRASTTranslator);
  35476. $core.addMethod(
  35477. $core.method({
  35478. selector: "visitBlockNode:",
  35479. protocol: 'visiting',
  35480. fn: function (aNode){
  35481. var self=this;
  35482. var closure;
  35483. return $core.withContext(function($ctx1) {
  35484. var $1,$2,$3,$5,$4,$6,$8,$7;
  35485. $1=$recv($globals.IRClosure)._new();
  35486. $ctx1.sendIdx["new"]=1;
  35487. $recv($1)._arguments_($recv(aNode)._parameters());
  35488. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  35489. $2=$recv(aNode)._scope();
  35490. $ctx1.sendIdx["scope"]=1;
  35491. $recv($1)._scope_($2);
  35492. $ctx1.sendIdx["scope:"]=1;
  35493. $3=$recv($1)._yourself();
  35494. $ctx1.sendIdx["yourself"]=1;
  35495. closure=$3;
  35496. $5=$recv(aNode)._scope();
  35497. $ctx1.sendIdx["scope"]=2;
  35498. $4=$recv($5)._temps();
  35499. $recv($4)._do_((function(each){
  35500. return $core.withContext(function($ctx2) {
  35501. $6=closure;
  35502. $8=$recv($globals.IRTempDeclaration)._new();
  35503. $recv($8)._name_($recv(each)._name());
  35504. $recv($8)._scope_($recv(aNode)._scope());
  35505. $7=$recv($8)._yourself();
  35506. return $recv($6)._add_($7);
  35507. $ctx2.sendIdx["add:"]=1;
  35508. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35509. }));
  35510. $ctx1.sendIdx["do:"]=1;
  35511. $recv($recv(aNode)._nodes())._do_((function(each){
  35512. return $core.withContext(function($ctx2) {
  35513. return $recv(closure)._add_(self._visit_(each));
  35514. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35515. }));
  35516. return closure;
  35517. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  35518. },
  35519. args: ["aNode"],
  35520. 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 nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
  35521. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  35522. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"]
  35523. }),
  35524. $globals.IRASTTranslator);
  35525. $core.addMethod(
  35526. $core.method({
  35527. selector: "visitBlockSequenceNode:",
  35528. protocol: 'visiting',
  35529. fn: function (aNode){
  35530. var self=this;
  35531. return $core.withContext(function($ctx1) {
  35532. var $1,$2,$4,$3,$5,$6,$9,$8,$7,$10,$12,$15,$14,$13,$11;
  35533. $1=$recv($globals.IRBlockSequence)._new();
  35534. $ctx1.sendIdx["new"]=1;
  35535. return self._withSequence_do_($1,(function(){
  35536. return $core.withContext(function($ctx2) {
  35537. $2=$recv(aNode)._nodes();
  35538. $ctx2.sendIdx["nodes"]=1;
  35539. return $recv($2)._ifNotEmpty_((function(){
  35540. return $core.withContext(function($ctx3) {
  35541. $4=$recv(aNode)._nodes();
  35542. $ctx3.sendIdx["nodes"]=2;
  35543. $3=$recv($4)._allButLast();
  35544. $recv($3)._do_((function(each){
  35545. return $core.withContext(function($ctx4) {
  35546. $5=self._sequence();
  35547. $ctx4.sendIdx["sequence"]=1;
  35548. $6=self._visitOrAlias_(each);
  35549. $ctx4.sendIdx["visitOrAlias:"]=1;
  35550. return $recv($5)._add_($6);
  35551. $ctx4.sendIdx["add:"]=1;
  35552. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  35553. }));
  35554. $9=$recv(aNode)._nodes();
  35555. $ctx3.sendIdx["nodes"]=3;
  35556. $8=$recv($9)._last();
  35557. $ctx3.sendIdx["last"]=1;
  35558. $7=$recv($8)._isReturnNode();
  35559. if($core.assert($7)){
  35560. return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._nodes())._last()));
  35561. } else {
  35562. $10=self._sequence();
  35563. $ctx3.sendIdx["sequence"]=2;
  35564. $12=$recv($globals.IRBlockReturn)._new();
  35565. $15=$recv(aNode)._nodes();
  35566. $ctx3.sendIdx["nodes"]=4;
  35567. $14=$recv($15)._last();
  35568. $ctx3.sendIdx["last"]=2;
  35569. $13=self._visitOrAlias_($14);
  35570. $ctx3.sendIdx["visitOrAlias:"]=2;
  35571. $recv($12)._add_($13);
  35572. $ctx3.sendIdx["add:"]=3;
  35573. $11=$recv($12)._yourself();
  35574. return $recv($10)._add_($11);
  35575. $ctx3.sendIdx["add:"]=2;
  35576. };
  35577. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  35578. }));
  35579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35580. }));
  35581. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35582. },
  35583. args: ["aNode"],
  35584. source: "visitBlockSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRBlockSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes ifNotEmpty: [\x0a\x09\x09\x09\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09\x09\x09\x09self sequence add: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode nodes last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self sequence add: (IRBlockReturn new add: (self visitOrAlias: aNode nodes last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self sequence add: (self visitOrAlias: aNode nodes last) ] ]]",
  35585. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  35586. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  35587. }),
  35588. $globals.IRASTTranslator);
  35589. $core.addMethod(
  35590. $core.method({
  35591. selector: "visitCascadeNode:",
  35592. protocol: 'visiting',
  35593. fn: function (aNode){
  35594. var self=this;
  35595. var receiver;
  35596. return $core.withContext(function($ctx1) {
  35597. var $1,$2,$4,$3;
  35598. receiver=$recv(aNode)._receiver();
  35599. $1=$recv(receiver)._isImmutable();
  35600. if(!$core.assert($1)){
  35601. var alias;
  35602. alias=self._alias_(receiver);
  35603. alias;
  35604. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  35605. receiver;
  35606. };
  35607. $2=$recv(aNode)._nodes();
  35608. $ctx1.sendIdx["nodes"]=1;
  35609. $recv($2)._do_((function(each){
  35610. return $core.withContext(function($ctx2) {
  35611. return $recv(each)._receiver_(receiver);
  35612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35613. }));
  35614. $ctx1.sendIdx["do:"]=1;
  35615. $4=$recv(aNode)._nodes();
  35616. $ctx1.sendIdx["nodes"]=2;
  35617. $3=$recv($4)._allButLast();
  35618. $recv($3)._do_((function(each){
  35619. return $core.withContext(function($ctx2) {
  35620. return $recv(self._sequence())._add_(self._visit_(each));
  35621. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  35622. }));
  35623. return self._visitOrAlias_($recv($recv(aNode)._nodes())._last());
  35624. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  35625. },
  35626. args: ["aNode"],
  35627. 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 nodes do: [ :each | each receiver: receiver ].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode nodes last",
  35628. referencedClasses: ["VariableNode"],
  35629. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "nodes", "receiver:", "allButLast", "add:", "sequence", "visit:", "visitOrAlias:", "last"]
  35630. }),
  35631. $globals.IRASTTranslator);
  35632. $core.addMethod(
  35633. $core.method({
  35634. selector: "visitDynamicArrayNode:",
  35635. protocol: 'visiting',
  35636. fn: function (aNode){
  35637. var self=this;
  35638. var array;
  35639. return $core.withContext(function($ctx1) {
  35640. array=$recv($globals.IRDynamicArray)._new();
  35641. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  35642. return $core.withContext(function($ctx2) {
  35643. return $recv(array)._add_(each);
  35644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35645. }));
  35646. return array;
  35647. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  35648. },
  35649. args: ["aNode"],
  35650. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
  35651. referencedClasses: ["IRDynamicArray"],
  35652. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  35653. }),
  35654. $globals.IRASTTranslator);
  35655. $core.addMethod(
  35656. $core.method({
  35657. selector: "visitDynamicDictionaryNode:",
  35658. protocol: 'visiting',
  35659. fn: function (aNode){
  35660. var self=this;
  35661. var dictionary;
  35662. return $core.withContext(function($ctx1) {
  35663. dictionary=$recv($globals.IRDynamicDictionary)._new();
  35664. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  35665. return $core.withContext(function($ctx2) {
  35666. return $recv(dictionary)._add_(each);
  35667. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35668. }));
  35669. return dictionary;
  35670. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  35671. },
  35672. args: ["aNode"],
  35673. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  35674. referencedClasses: ["IRDynamicDictionary"],
  35675. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  35676. }),
  35677. $globals.IRASTTranslator);
  35678. $core.addMethod(
  35679. $core.method({
  35680. selector: "visitJSStatementNode:",
  35681. protocol: 'visiting',
  35682. fn: function (aNode){
  35683. var self=this;
  35684. return $core.withContext(function($ctx1) {
  35685. var $1;
  35686. $1=$recv($globals.IRVerbatim)._new();
  35687. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  35688. return $recv($1)._yourself();
  35689. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35690. },
  35691. args: ["aNode"],
  35692. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  35693. referencedClasses: ["IRVerbatim"],
  35694. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  35695. }),
  35696. $globals.IRASTTranslator);
  35697. $core.addMethod(
  35698. $core.method({
  35699. selector: "visitMethodNode:",
  35700. protocol: 'visiting',
  35701. fn: function (aNode){
  35702. var self=this;
  35703. return $core.withContext(function($ctx1) {
  35704. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  35705. $2=$recv($globals.IRMethod)._new();
  35706. $ctx1.sendIdx["new"]=1;
  35707. $recv($2)._source_($recv(self._source())._crlfSanitized());
  35708. $ctx1.sendIdx["source:"]=1;
  35709. $recv($2)._theClass_(self._theClass());
  35710. $recv($2)._arguments_($recv(aNode)._arguments());
  35711. $recv($2)._selector_($recv(aNode)._selector());
  35712. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  35713. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  35714. $recv($2)._classReferences_($recv(aNode)._classReferences());
  35715. $3=$recv(aNode)._scope();
  35716. $ctx1.sendIdx["scope"]=1;
  35717. $recv($2)._scope_($3);
  35718. $ctx1.sendIdx["scope:"]=1;
  35719. $4=$recv($2)._yourself();
  35720. $ctx1.sendIdx["yourself"]=1;
  35721. $1=$4;
  35722. self._method_($1);
  35723. $6=$recv(aNode)._scope();
  35724. $ctx1.sendIdx["scope"]=2;
  35725. $5=$recv($6)._temps();
  35726. $recv($5)._do_((function(each){
  35727. return $core.withContext(function($ctx2) {
  35728. $7=self._method();
  35729. $ctx2.sendIdx["method"]=1;
  35730. $9=$recv($globals.IRTempDeclaration)._new();
  35731. $ctx2.sendIdx["new"]=2;
  35732. $recv($9)._name_($recv(each)._name());
  35733. $10=$recv(aNode)._scope();
  35734. $ctx2.sendIdx["scope"]=3;
  35735. $recv($9)._scope_($10);
  35736. $11=$recv($9)._yourself();
  35737. $ctx2.sendIdx["yourself"]=2;
  35738. $8=$11;
  35739. return $recv($7)._add_($8);
  35740. $ctx2.sendIdx["add:"]=1;
  35741. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35742. }));
  35743. $ctx1.sendIdx["do:"]=1;
  35744. $recv($recv(aNode)._nodes())._do_((function(each){
  35745. return $core.withContext(function($ctx2) {
  35746. $12=self._method();
  35747. $ctx2.sendIdx["method"]=2;
  35748. return $recv($12)._add_(self._visit_(each));
  35749. $ctx2.sendIdx["add:"]=2;
  35750. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35751. }));
  35752. $14=$recv(aNode)._scope();
  35753. $ctx1.sendIdx["scope"]=4;
  35754. $13=$recv($14)._hasLocalReturn();
  35755. if(!$core.assert($13)){
  35756. $15=self._method();
  35757. $ctx1.sendIdx["method"]=3;
  35758. $17=$recv($globals.IRReturn)._new();
  35759. $ctx1.sendIdx["new"]=3;
  35760. $19=$recv($globals.IRVariable)._new();
  35761. $ctx1.sendIdx["new"]=4;
  35762. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  35763. $20=$recv($19)._yourself();
  35764. $ctx1.sendIdx["yourself"]=3;
  35765. $18=$20;
  35766. $recv($17)._add_($18);
  35767. $ctx1.sendIdx["add:"]=4;
  35768. $21=$recv($17)._yourself();
  35769. $ctx1.sendIdx["yourself"]=4;
  35770. $16=$21;
  35771. $recv($15)._add_($16);
  35772. $ctx1.sendIdx["add:"]=3;
  35773. $23=$recv($globals.IRVerbatim)._new();
  35774. $recv($23)._source_("");
  35775. $22=$recv($23)._yourself();
  35776. $recv($15)._add_($22);
  35777. };
  35778. return self._method();
  35779. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35780. },
  35781. args: ["aNode"],
  35782. 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 nodes 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",
  35783. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  35784. 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", "nodes", "visit:", "ifFalse:", "hasLocalReturn", "variable:", "at:", "pseudoVars"]
  35785. }),
  35786. $globals.IRASTTranslator);
  35787. $core.addMethod(
  35788. $core.method({
  35789. selector: "visitOrAlias:",
  35790. protocol: 'visiting',
  35791. fn: function (aNode){
  35792. var self=this;
  35793. return $core.withContext(function($ctx1) {
  35794. var $1;
  35795. $1=$recv(aNode)._shouldBeAliased();
  35796. if($core.assert($1)){
  35797. return self._alias_(aNode);
  35798. } else {
  35799. return self._visit_(aNode);
  35800. };
  35801. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  35802. },
  35803. args: ["aNode"],
  35804. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  35805. referencedClasses: [],
  35806. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  35807. }),
  35808. $globals.IRASTTranslator);
  35809. $core.addMethod(
  35810. $core.method({
  35811. selector: "visitReturnNode:",
  35812. protocol: 'visiting',
  35813. fn: function (aNode){
  35814. var self=this;
  35815. var return_;
  35816. return $core.withContext(function($ctx1) {
  35817. var $1;
  35818. $1=$recv(aNode)._nonLocalReturn();
  35819. if($core.assert($1)){
  35820. return_=$recv($globals.IRNonLocalReturn)._new();
  35821. $ctx1.sendIdx["new"]=1;
  35822. } else {
  35823. return_=$recv($globals.IRReturn)._new();
  35824. };
  35825. $recv(return_)._scope_($recv(aNode)._scope());
  35826. $recv($recv(aNode)._nodes())._do_((function(each){
  35827. return $core.withContext(function($ctx2) {
  35828. return $recv(return_)._add_(self._visitOrAlias_(each));
  35829. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  35830. }));
  35831. return return_;
  35832. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  35833. },
  35834. args: ["aNode"],
  35835. 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 nodes do: [ :each |\x0a\x09\x09return add: (self visitOrAlias: each) ].\x0a\x09^ return",
  35836. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  35837. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "visitOrAlias:"]
  35838. }),
  35839. $globals.IRASTTranslator);
  35840. $core.addMethod(
  35841. $core.method({
  35842. selector: "visitSendNode:",
  35843. protocol: 'visiting',
  35844. fn: function (aNode){
  35845. var self=this;
  35846. var send;
  35847. return $core.withContext(function($ctx1) {
  35848. var $1;
  35849. send=$recv($globals.IRSend)._new();
  35850. $1=send;
  35851. $recv($1)._selector_($recv(aNode)._selector());
  35852. $recv($1)._index_($recv(aNode)._index());
  35853. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  35854. return $core.withContext(function($ctx2) {
  35855. return $recv(send)._add_(each);
  35856. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35857. }));
  35858. return send;
  35859. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  35860. },
  35861. args: ["aNode"],
  35862. 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 nodes) do: [ :each | send add: each ].\x0a\x0a\x09^ send",
  35863. referencedClasses: ["IRSend"],
  35864. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "nodes", "add:"]
  35865. }),
  35866. $globals.IRASTTranslator);
  35867. $core.addMethod(
  35868. $core.method({
  35869. selector: "visitSequenceNode:",
  35870. protocol: 'visiting',
  35871. fn: function (aNode){
  35872. var self=this;
  35873. return $core.withContext(function($ctx1) {
  35874. var $1;
  35875. return self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  35876. return $core.withContext(function($ctx2) {
  35877. return $recv($recv(aNode)._nodes())._do_((function(each){
  35878. var instruction;
  35879. return $core.withContext(function($ctx3) {
  35880. instruction=self._visitOrAlias_(each);
  35881. instruction;
  35882. $1=$recv(instruction)._isVariable();
  35883. if(!$core.assert($1)){
  35884. return $recv(self._sequence())._add_(instruction);
  35885. };
  35886. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  35887. }));
  35888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35889. }));
  35890. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35891. },
  35892. args: ["aNode"],
  35893. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [\x0a\x09\x09\x09aNode nodes 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 ] ]]",
  35894. referencedClasses: ["IRSequence"],
  35895. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  35896. }),
  35897. $globals.IRASTTranslator);
  35898. $core.addMethod(
  35899. $core.method({
  35900. selector: "visitValueNode:",
  35901. protocol: 'visiting',
  35902. fn: function (aNode){
  35903. var self=this;
  35904. return $core.withContext(function($ctx1) {
  35905. var $1;
  35906. $1=$recv($globals.IRValue)._new();
  35907. $recv($1)._value_($recv(aNode)._value());
  35908. return $recv($1)._yourself();
  35909. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35910. },
  35911. args: ["aNode"],
  35912. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  35913. referencedClasses: ["IRValue"],
  35914. messageSends: ["value:", "new", "value", "yourself"]
  35915. }),
  35916. $globals.IRASTTranslator);
  35917. $core.addMethod(
  35918. $core.method({
  35919. selector: "visitVariableNode:",
  35920. protocol: 'visiting',
  35921. fn: function (aNode){
  35922. var self=this;
  35923. return $core.withContext(function($ctx1) {
  35924. var $1;
  35925. $1=$recv($globals.IRVariable)._new();
  35926. $recv($1)._variable_($recv(aNode)._binding());
  35927. return $recv($1)._yourself();
  35928. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35929. },
  35930. args: ["aNode"],
  35931. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  35932. referencedClasses: ["IRVariable"],
  35933. messageSends: ["variable:", "new", "binding", "yourself"]
  35934. }),
  35935. $globals.IRASTTranslator);
  35936. $core.addMethod(
  35937. $core.method({
  35938. selector: "withSequence:do:",
  35939. protocol: 'accessing',
  35940. fn: function (aSequence,aBlock){
  35941. var self=this;
  35942. var outerSequence;
  35943. return $core.withContext(function($ctx1) {
  35944. outerSequence=self._sequence();
  35945. self._sequence_(aSequence);
  35946. $ctx1.sendIdx["sequence:"]=1;
  35947. $recv(aBlock)._value();
  35948. self._sequence_(outerSequence);
  35949. return aSequence;
  35950. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  35951. },
  35952. args: ["aSequence", "aBlock"],
  35953. 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",
  35954. referencedClasses: [],
  35955. messageSends: ["sequence", "sequence:", "value"]
  35956. }),
  35957. $globals.IRASTTranslator);
  35958. $core.addClass('IRInstruction', $globals.Object, ['parent', 'instructions'], 'Compiler-IR');
  35959. $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.";
  35960. $core.addMethod(
  35961. $core.method({
  35962. selector: "accept:",
  35963. protocol: 'visiting',
  35964. fn: function (aVisitor){
  35965. var self=this;
  35966. return $core.withContext(function($ctx1) {
  35967. return $recv(aVisitor)._visitIRInstruction_(self);
  35968. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInstruction)});
  35969. },
  35970. args: ["aVisitor"],
  35971. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  35972. referencedClasses: [],
  35973. messageSends: ["visitIRInstruction:"]
  35974. }),
  35975. $globals.IRInstruction);
  35976. $core.addMethod(
  35977. $core.method({
  35978. selector: "add:",
  35979. protocol: 'building',
  35980. fn: function (anObject){
  35981. var self=this;
  35982. return $core.withContext(function($ctx1) {
  35983. $recv(anObject)._parent_(self);
  35984. return $recv(self._instructions())._add_(anObject);
  35985. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  35986. },
  35987. args: ["anObject"],
  35988. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  35989. referencedClasses: [],
  35990. messageSends: ["parent:", "add:", "instructions"]
  35991. }),
  35992. $globals.IRInstruction);
  35993. $core.addMethod(
  35994. $core.method({
  35995. selector: "canBeAssigned",
  35996. protocol: 'testing',
  35997. fn: function (){
  35998. var self=this;
  35999. return true;
  36000. },
  36001. args: [],
  36002. source: "canBeAssigned\x0a\x09^ true",
  36003. referencedClasses: [],
  36004. messageSends: []
  36005. }),
  36006. $globals.IRInstruction);
  36007. $core.addMethod(
  36008. $core.method({
  36009. selector: "instructions",
  36010. protocol: 'accessing',
  36011. fn: function (){
  36012. var self=this;
  36013. return $core.withContext(function($ctx1) {
  36014. var $1,$receiver;
  36015. $1=self["@instructions"];
  36016. if(($receiver = $1) == null || $receiver.isNil){
  36017. self["@instructions"]=$recv($globals.OrderedCollection)._new();
  36018. return self["@instructions"];
  36019. } else {
  36020. return $1;
  36021. };
  36022. }, function($ctx1) {$ctx1.fill(self,"instructions",{},$globals.IRInstruction)});
  36023. },
  36024. args: [],
  36025. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  36026. referencedClasses: ["OrderedCollection"],
  36027. messageSends: ["ifNil:", "new"]
  36028. }),
  36029. $globals.IRInstruction);
  36030. $core.addMethod(
  36031. $core.method({
  36032. selector: "isClosure",
  36033. protocol: 'testing',
  36034. fn: function (){
  36035. var self=this;
  36036. return false;
  36037. },
  36038. args: [],
  36039. source: "isClosure\x0a\x09^ false",
  36040. referencedClasses: [],
  36041. messageSends: []
  36042. }),
  36043. $globals.IRInstruction);
  36044. $core.addMethod(
  36045. $core.method({
  36046. selector: "isInlined",
  36047. protocol: 'testing',
  36048. fn: function (){
  36049. var self=this;
  36050. return false;
  36051. },
  36052. args: [],
  36053. source: "isInlined\x0a\x09^ false",
  36054. referencedClasses: [],
  36055. messageSends: []
  36056. }),
  36057. $globals.IRInstruction);
  36058. $core.addMethod(
  36059. $core.method({
  36060. selector: "isLocalReturn",
  36061. protocol: 'testing',
  36062. fn: function (){
  36063. var self=this;
  36064. return false;
  36065. },
  36066. args: [],
  36067. source: "isLocalReturn\x0a\x09^ false",
  36068. referencedClasses: [],
  36069. messageSends: []
  36070. }),
  36071. $globals.IRInstruction);
  36072. $core.addMethod(
  36073. $core.method({
  36074. selector: "isMethod",
  36075. protocol: 'testing',
  36076. fn: function (){
  36077. var self=this;
  36078. return false;
  36079. },
  36080. args: [],
  36081. source: "isMethod\x0a\x09^ false",
  36082. referencedClasses: [],
  36083. messageSends: []
  36084. }),
  36085. $globals.IRInstruction);
  36086. $core.addMethod(
  36087. $core.method({
  36088. selector: "isReturn",
  36089. protocol: 'testing',
  36090. fn: function (){
  36091. var self=this;
  36092. return false;
  36093. },
  36094. args: [],
  36095. source: "isReturn\x0a\x09^ false",
  36096. referencedClasses: [],
  36097. messageSends: []
  36098. }),
  36099. $globals.IRInstruction);
  36100. $core.addMethod(
  36101. $core.method({
  36102. selector: "isSend",
  36103. protocol: 'testing',
  36104. fn: function (){
  36105. var self=this;
  36106. return false;
  36107. },
  36108. args: [],
  36109. source: "isSend\x0a\x09^ false",
  36110. referencedClasses: [],
  36111. messageSends: []
  36112. }),
  36113. $globals.IRInstruction);
  36114. $core.addMethod(
  36115. $core.method({
  36116. selector: "isSequence",
  36117. protocol: 'testing',
  36118. fn: function (){
  36119. var self=this;
  36120. return false;
  36121. },
  36122. args: [],
  36123. source: "isSequence\x0a\x09^ false",
  36124. referencedClasses: [],
  36125. messageSends: []
  36126. }),
  36127. $globals.IRInstruction);
  36128. $core.addMethod(
  36129. $core.method({
  36130. selector: "isTempDeclaration",
  36131. protocol: 'testing',
  36132. fn: function (){
  36133. var self=this;
  36134. return false;
  36135. },
  36136. args: [],
  36137. source: "isTempDeclaration\x0a\x09^ false",
  36138. referencedClasses: [],
  36139. messageSends: []
  36140. }),
  36141. $globals.IRInstruction);
  36142. $core.addMethod(
  36143. $core.method({
  36144. selector: "isVariable",
  36145. protocol: 'testing',
  36146. fn: function (){
  36147. var self=this;
  36148. return false;
  36149. },
  36150. args: [],
  36151. source: "isVariable\x0a\x09^ false",
  36152. referencedClasses: [],
  36153. messageSends: []
  36154. }),
  36155. $globals.IRInstruction);
  36156. $core.addMethod(
  36157. $core.method({
  36158. selector: "method",
  36159. protocol: 'accessing',
  36160. fn: function (){
  36161. var self=this;
  36162. return $core.withContext(function($ctx1) {
  36163. return $recv(self._parent())._method();
  36164. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  36165. },
  36166. args: [],
  36167. source: "method\x0a\x09^ self parent method",
  36168. referencedClasses: [],
  36169. messageSends: ["method", "parent"]
  36170. }),
  36171. $globals.IRInstruction);
  36172. $core.addMethod(
  36173. $core.method({
  36174. selector: "needsBoxingAsReceiver",
  36175. protocol: 'testing',
  36176. fn: function (){
  36177. var self=this;
  36178. return true;
  36179. },
  36180. args: [],
  36181. source: "needsBoxingAsReceiver\x0a\x09^ true",
  36182. referencedClasses: [],
  36183. messageSends: []
  36184. }),
  36185. $globals.IRInstruction);
  36186. $core.addMethod(
  36187. $core.method({
  36188. selector: "parent",
  36189. protocol: 'accessing',
  36190. fn: function (){
  36191. var self=this;
  36192. return self["@parent"];
  36193. },
  36194. args: [],
  36195. source: "parent\x0a\x09^ parent",
  36196. referencedClasses: [],
  36197. messageSends: []
  36198. }),
  36199. $globals.IRInstruction);
  36200. $core.addMethod(
  36201. $core.method({
  36202. selector: "parent:",
  36203. protocol: 'accessing',
  36204. fn: function (anIRInstruction){
  36205. var self=this;
  36206. self["@parent"]=anIRInstruction;
  36207. return self;
  36208. },
  36209. args: ["anIRInstruction"],
  36210. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  36211. referencedClasses: [],
  36212. messageSends: []
  36213. }),
  36214. $globals.IRInstruction);
  36215. $core.addMethod(
  36216. $core.method({
  36217. selector: "remove",
  36218. protocol: 'building',
  36219. fn: function (){
  36220. var self=this;
  36221. return $core.withContext(function($ctx1) {
  36222. $recv(self._parent())._remove_(self);
  36223. return self;
  36224. }, function($ctx1) {$ctx1.fill(self,"remove",{},$globals.IRInstruction)});
  36225. },
  36226. args: [],
  36227. source: "remove\x0a\x09self parent remove: self",
  36228. referencedClasses: [],
  36229. messageSends: ["remove:", "parent"]
  36230. }),
  36231. $globals.IRInstruction);
  36232. $core.addMethod(
  36233. $core.method({
  36234. selector: "remove:",
  36235. protocol: 'building',
  36236. fn: function (anIRInstruction){
  36237. var self=this;
  36238. return $core.withContext(function($ctx1) {
  36239. $recv(self._instructions())._remove_(anIRInstruction);
  36240. return self;
  36241. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  36242. },
  36243. args: ["anIRInstruction"],
  36244. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  36245. referencedClasses: [],
  36246. messageSends: ["remove:", "instructions"]
  36247. }),
  36248. $globals.IRInstruction);
  36249. $core.addMethod(
  36250. $core.method({
  36251. selector: "replace:with:",
  36252. protocol: 'building',
  36253. fn: function (anIRInstruction,anotherIRInstruction){
  36254. var self=this;
  36255. return $core.withContext(function($ctx1) {
  36256. var $1;
  36257. $recv(anotherIRInstruction)._parent_(self);
  36258. $1=self._instructions();
  36259. $ctx1.sendIdx["instructions"]=1;
  36260. $recv($1)._at_put_($recv(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  36261. return self;
  36262. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  36263. },
  36264. args: ["anIRInstruction", "anotherIRInstruction"],
  36265. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  36266. referencedClasses: [],
  36267. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"]
  36268. }),
  36269. $globals.IRInstruction);
  36270. $core.addMethod(
  36271. $core.method({
  36272. selector: "replaceWith:",
  36273. protocol: 'building',
  36274. fn: function (anIRInstruction){
  36275. var self=this;
  36276. return $core.withContext(function($ctx1) {
  36277. $recv(self._parent())._replace_with_(self,anIRInstruction);
  36278. return self;
  36279. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  36280. },
  36281. args: ["anIRInstruction"],
  36282. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  36283. referencedClasses: [],
  36284. messageSends: ["replace:with:", "parent"]
  36285. }),
  36286. $globals.IRInstruction);
  36287. $core.addMethod(
  36288. $core.method({
  36289. selector: "scope",
  36290. protocol: 'accessing',
  36291. fn: function (){
  36292. var self=this;
  36293. return $core.withContext(function($ctx1) {
  36294. var $1,$receiver;
  36295. $1=self._parent();
  36296. if(($receiver = $1) == null || $receiver.isNil){
  36297. return $1;
  36298. } else {
  36299. var node;
  36300. node=$receiver;
  36301. return $recv(node)._scope();
  36302. };
  36303. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  36304. },
  36305. args: [],
  36306. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  36307. referencedClasses: [],
  36308. messageSends: ["ifNotNil:", "parent", "scope"]
  36309. }),
  36310. $globals.IRInstruction);
  36311. $core.addMethod(
  36312. $core.method({
  36313. selector: "on:",
  36314. protocol: 'instance creation',
  36315. fn: function (aBuilder){
  36316. var self=this;
  36317. return $core.withContext(function($ctx1) {
  36318. var $1;
  36319. $1=self._new();
  36320. $recv($1)._builder_(aBuilder);
  36321. return $recv($1)._yourself();
  36322. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)});
  36323. },
  36324. args: ["aBuilder"],
  36325. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  36326. referencedClasses: [],
  36327. messageSends: ["builder:", "new", "yourself"]
  36328. }),
  36329. $globals.IRInstruction.klass);
  36330. $core.addClass('IRAssignment', $globals.IRInstruction, [], 'Compiler-IR');
  36331. $core.addMethod(
  36332. $core.method({
  36333. selector: "accept:",
  36334. protocol: 'visiting',
  36335. fn: function (aVisitor){
  36336. var self=this;
  36337. return $core.withContext(function($ctx1) {
  36338. return $recv(aVisitor)._visitIRAssignment_(self);
  36339. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRAssignment)});
  36340. },
  36341. args: ["aVisitor"],
  36342. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  36343. referencedClasses: [],
  36344. messageSends: ["visitIRAssignment:"]
  36345. }),
  36346. $globals.IRAssignment);
  36347. $core.addMethod(
  36348. $core.method({
  36349. selector: "left",
  36350. protocol: 'accessing',
  36351. fn: function (){
  36352. var self=this;
  36353. return $core.withContext(function($ctx1) {
  36354. return $recv(self._instructions())._first();
  36355. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  36356. },
  36357. args: [],
  36358. source: "left\x0a\x09^ self instructions first",
  36359. referencedClasses: [],
  36360. messageSends: ["first", "instructions"]
  36361. }),
  36362. $globals.IRAssignment);
  36363. $core.addMethod(
  36364. $core.method({
  36365. selector: "right",
  36366. protocol: 'accessing',
  36367. fn: function (){
  36368. var self=this;
  36369. return $core.withContext(function($ctx1) {
  36370. return $recv(self._instructions())._last();
  36371. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  36372. },
  36373. args: [],
  36374. source: "right\x0a\x09^ self instructions last",
  36375. referencedClasses: [],
  36376. messageSends: ["last", "instructions"]
  36377. }),
  36378. $globals.IRAssignment);
  36379. $core.addClass('IRDynamicArray', $globals.IRInstruction, [], 'Compiler-IR');
  36380. $core.addMethod(
  36381. $core.method({
  36382. selector: "accept:",
  36383. protocol: 'visiting',
  36384. fn: function (aVisitor){
  36385. var self=this;
  36386. return $core.withContext(function($ctx1) {
  36387. return $recv(aVisitor)._visitIRDynamicArray_(self);
  36388. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  36389. },
  36390. args: ["aVisitor"],
  36391. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  36392. referencedClasses: [],
  36393. messageSends: ["visitIRDynamicArray:"]
  36394. }),
  36395. $globals.IRDynamicArray);
  36396. $core.addClass('IRDynamicDictionary', $globals.IRInstruction, [], 'Compiler-IR');
  36397. $core.addMethod(
  36398. $core.method({
  36399. selector: "accept:",
  36400. protocol: 'visiting',
  36401. fn: function (aVisitor){
  36402. var self=this;
  36403. return $core.withContext(function($ctx1) {
  36404. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  36405. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  36406. },
  36407. args: ["aVisitor"],
  36408. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  36409. referencedClasses: [],
  36410. messageSends: ["visitIRDynamicDictionary:"]
  36411. }),
  36412. $globals.IRDynamicDictionary);
  36413. $core.addClass('IRScopedInstruction', $globals.IRInstruction, ['scope'], 'Compiler-IR');
  36414. $core.addMethod(
  36415. $core.method({
  36416. selector: "scope",
  36417. protocol: 'accessing',
  36418. fn: function (){
  36419. var self=this;
  36420. return self["@scope"];
  36421. },
  36422. args: [],
  36423. source: "scope\x0a\x09^ scope",
  36424. referencedClasses: [],
  36425. messageSends: []
  36426. }),
  36427. $globals.IRScopedInstruction);
  36428. $core.addMethod(
  36429. $core.method({
  36430. selector: "scope:",
  36431. protocol: 'accessing',
  36432. fn: function (aScope){
  36433. var self=this;
  36434. self["@scope"]=aScope;
  36435. return self;
  36436. },
  36437. args: ["aScope"],
  36438. source: "scope: aScope\x0a\x09scope := aScope",
  36439. referencedClasses: [],
  36440. messageSends: []
  36441. }),
  36442. $globals.IRScopedInstruction);
  36443. $core.addClass('IRClosureInstruction', $globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  36444. $core.addMethod(
  36445. $core.method({
  36446. selector: "arguments",
  36447. protocol: 'accessing',
  36448. fn: function (){
  36449. var self=this;
  36450. return $core.withContext(function($ctx1) {
  36451. var $1,$receiver;
  36452. $1=self["@arguments"];
  36453. if(($receiver = $1) == null || $receiver.isNil){
  36454. return [];
  36455. } else {
  36456. return $1;
  36457. };
  36458. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  36459. },
  36460. args: [],
  36461. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  36462. referencedClasses: [],
  36463. messageSends: ["ifNil:"]
  36464. }),
  36465. $globals.IRClosureInstruction);
  36466. $core.addMethod(
  36467. $core.method({
  36468. selector: "arguments:",
  36469. protocol: 'accessing',
  36470. fn: function (aCollection){
  36471. var self=this;
  36472. self["@arguments"]=aCollection;
  36473. return self;
  36474. },
  36475. args: ["aCollection"],
  36476. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  36477. referencedClasses: [],
  36478. messageSends: []
  36479. }),
  36480. $globals.IRClosureInstruction);
  36481. $core.addMethod(
  36482. $core.method({
  36483. selector: "locals",
  36484. protocol: 'accessing',
  36485. fn: function (){
  36486. var self=this;
  36487. return $core.withContext(function($ctx1) {
  36488. var $1;
  36489. $1=$recv(self._arguments())._copy();
  36490. $recv($1)._addAll_($recv(self._tempDeclarations())._collect_((function(each){
  36491. return $core.withContext(function($ctx2) {
  36492. return $recv(each)._name();
  36493. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36494. })));
  36495. return $recv($1)._yourself();
  36496. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  36497. },
  36498. args: [],
  36499. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  36500. referencedClasses: [],
  36501. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  36502. }),
  36503. $globals.IRClosureInstruction);
  36504. $core.addMethod(
  36505. $core.method({
  36506. selector: "requiresSmalltalkContext",
  36507. protocol: 'accessing',
  36508. fn: function (){
  36509. var self=this;
  36510. return $core.withContext(function($ctx1) {
  36511. var $1,$receiver;
  36512. $1=self["@requiresSmalltalkContext"];
  36513. if(($receiver = $1) == null || $receiver.isNil){
  36514. return false;
  36515. } else {
  36516. return $1;
  36517. };
  36518. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  36519. },
  36520. args: [],
  36521. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  36522. referencedClasses: [],
  36523. messageSends: ["ifNil:"]
  36524. }),
  36525. $globals.IRClosureInstruction);
  36526. $core.addMethod(
  36527. $core.method({
  36528. selector: "requiresSmalltalkContext:",
  36529. protocol: 'accessing',
  36530. fn: function (anObject){
  36531. var self=this;
  36532. self["@requiresSmalltalkContext"]=anObject;
  36533. return self;
  36534. },
  36535. args: ["anObject"],
  36536. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  36537. referencedClasses: [],
  36538. messageSends: []
  36539. }),
  36540. $globals.IRClosureInstruction);
  36541. $core.addMethod(
  36542. $core.method({
  36543. selector: "scope:",
  36544. protocol: 'accessing',
  36545. fn: function (aScope){
  36546. var self=this;
  36547. return $core.withContext(function($ctx1) {
  36548. (
  36549. $ctx1.supercall = true,
  36550. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($recv(self), [aScope]));
  36551. $ctx1.supercall = false;
  36552. $recv(aScope)._instruction_(self);
  36553. return self;
  36554. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  36555. },
  36556. args: ["aScope"],
  36557. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  36558. referencedClasses: [],
  36559. messageSends: ["scope:", "instruction:"]
  36560. }),
  36561. $globals.IRClosureInstruction);
  36562. $core.addMethod(
  36563. $core.method({
  36564. selector: "tempDeclarations",
  36565. protocol: 'accessing',
  36566. fn: function (){
  36567. var self=this;
  36568. return $core.withContext(function($ctx1) {
  36569. return $recv(self._instructions())._select_((function(each){
  36570. return $core.withContext(function($ctx2) {
  36571. return $recv(each)._isTempDeclaration();
  36572. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36573. }));
  36574. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  36575. },
  36576. args: [],
  36577. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  36578. referencedClasses: [],
  36579. messageSends: ["select:", "instructions", "isTempDeclaration"]
  36580. }),
  36581. $globals.IRClosureInstruction);
  36582. $core.addClass('IRClosure', $globals.IRClosureInstruction, [], 'Compiler-IR');
  36583. $core.addMethod(
  36584. $core.method({
  36585. selector: "accept:",
  36586. protocol: 'visiting',
  36587. fn: function (aVisitor){
  36588. var self=this;
  36589. return $core.withContext(function($ctx1) {
  36590. return $recv(aVisitor)._visitIRClosure_(self);
  36591. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRClosure)});
  36592. },
  36593. args: ["aVisitor"],
  36594. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  36595. referencedClasses: [],
  36596. messageSends: ["visitIRClosure:"]
  36597. }),
  36598. $globals.IRClosure);
  36599. $core.addMethod(
  36600. $core.method({
  36601. selector: "isClosure",
  36602. protocol: 'testing',
  36603. fn: function (){
  36604. var self=this;
  36605. return true;
  36606. },
  36607. args: [],
  36608. source: "isClosure\x0a\x09^ true",
  36609. referencedClasses: [],
  36610. messageSends: []
  36611. }),
  36612. $globals.IRClosure);
  36613. $core.addMethod(
  36614. $core.method({
  36615. selector: "sequence",
  36616. protocol: 'accessing',
  36617. fn: function (){
  36618. var self=this;
  36619. return $core.withContext(function($ctx1) {
  36620. return $recv(self._instructions())._last();
  36621. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  36622. },
  36623. args: [],
  36624. source: "sequence\x0a\x09^ self instructions last",
  36625. referencedClasses: [],
  36626. messageSends: ["last", "instructions"]
  36627. }),
  36628. $globals.IRClosure);
  36629. $core.addClass('IRMethod', $globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  36630. $globals.IRMethod.comment="I am a method instruction";
  36631. $core.addMethod(
  36632. $core.method({
  36633. selector: "accept:",
  36634. protocol: 'visiting',
  36635. fn: function (aVisitor){
  36636. var self=this;
  36637. return $core.withContext(function($ctx1) {
  36638. return $recv(aVisitor)._visitIRMethod_(self);
  36639. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRMethod)});
  36640. },
  36641. args: ["aVisitor"],
  36642. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  36643. referencedClasses: [],
  36644. messageSends: ["visitIRMethod:"]
  36645. }),
  36646. $globals.IRMethod);
  36647. $core.addMethod(
  36648. $core.method({
  36649. selector: "classReferences",
  36650. protocol: 'accessing',
  36651. fn: function (){
  36652. var self=this;
  36653. return self["@classReferences"];
  36654. },
  36655. args: [],
  36656. source: "classReferences\x0a\x09^ classReferences",
  36657. referencedClasses: [],
  36658. messageSends: []
  36659. }),
  36660. $globals.IRMethod);
  36661. $core.addMethod(
  36662. $core.method({
  36663. selector: "classReferences:",
  36664. protocol: 'accessing',
  36665. fn: function (aCollection){
  36666. var self=this;
  36667. self["@classReferences"]=aCollection;
  36668. return self;
  36669. },
  36670. args: ["aCollection"],
  36671. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  36672. referencedClasses: [],
  36673. messageSends: []
  36674. }),
  36675. $globals.IRMethod);
  36676. $core.addMethod(
  36677. $core.method({
  36678. selector: "internalVariables",
  36679. protocol: 'accessing',
  36680. fn: function (){
  36681. var self=this;
  36682. return $core.withContext(function($ctx1) {
  36683. var $1,$receiver;
  36684. $1=self["@internalVariables"];
  36685. if(($receiver = $1) == null || $receiver.isNil){
  36686. self["@internalVariables"]=$recv($globals.Set)._new();
  36687. return self["@internalVariables"];
  36688. } else {
  36689. return $1;
  36690. };
  36691. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  36692. },
  36693. args: [],
  36694. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  36695. referencedClasses: ["Set"],
  36696. messageSends: ["ifNil:", "new"]
  36697. }),
  36698. $globals.IRMethod);
  36699. $core.addMethod(
  36700. $core.method({
  36701. selector: "isMethod",
  36702. protocol: 'testing',
  36703. fn: function (){
  36704. var self=this;
  36705. return true;
  36706. },
  36707. args: [],
  36708. source: "isMethod\x0a\x09^ true",
  36709. referencedClasses: [],
  36710. messageSends: []
  36711. }),
  36712. $globals.IRMethod);
  36713. $core.addMethod(
  36714. $core.method({
  36715. selector: "messageSends",
  36716. protocol: 'accessing',
  36717. fn: function (){
  36718. var self=this;
  36719. return $core.withContext(function($ctx1) {
  36720. return $recv(self._sendIndexes())._keys();
  36721. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  36722. },
  36723. args: [],
  36724. source: "messageSends\x0a\x09^ self sendIndexes keys",
  36725. referencedClasses: [],
  36726. messageSends: ["keys", "sendIndexes"]
  36727. }),
  36728. $globals.IRMethod);
  36729. $core.addMethod(
  36730. $core.method({
  36731. selector: "method",
  36732. protocol: 'accessing',
  36733. fn: function (){
  36734. var self=this;
  36735. return self;
  36736. },
  36737. args: [],
  36738. source: "method\x0a\x09^ self",
  36739. referencedClasses: [],
  36740. messageSends: []
  36741. }),
  36742. $globals.IRMethod);
  36743. $core.addMethod(
  36744. $core.method({
  36745. selector: "selector",
  36746. protocol: 'accessing',
  36747. fn: function (){
  36748. var self=this;
  36749. return self["@selector"];
  36750. },
  36751. args: [],
  36752. source: "selector\x0a\x09^ selector",
  36753. referencedClasses: [],
  36754. messageSends: []
  36755. }),
  36756. $globals.IRMethod);
  36757. $core.addMethod(
  36758. $core.method({
  36759. selector: "selector:",
  36760. protocol: 'accessing',
  36761. fn: function (aString){
  36762. var self=this;
  36763. self["@selector"]=aString;
  36764. return self;
  36765. },
  36766. args: ["aString"],
  36767. source: "selector: aString\x0a\x09selector := aString",
  36768. referencedClasses: [],
  36769. messageSends: []
  36770. }),
  36771. $globals.IRMethod);
  36772. $core.addMethod(
  36773. $core.method({
  36774. selector: "sendIndexes",
  36775. protocol: 'accessing',
  36776. fn: function (){
  36777. var self=this;
  36778. return self["@sendIndexes"];
  36779. },
  36780. args: [],
  36781. source: "sendIndexes\x0a\x09^ sendIndexes",
  36782. referencedClasses: [],
  36783. messageSends: []
  36784. }),
  36785. $globals.IRMethod);
  36786. $core.addMethod(
  36787. $core.method({
  36788. selector: "sendIndexes:",
  36789. protocol: 'accessing',
  36790. fn: function (aDictionary){
  36791. var self=this;
  36792. self["@sendIndexes"]=aDictionary;
  36793. return self;
  36794. },
  36795. args: ["aDictionary"],
  36796. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  36797. referencedClasses: [],
  36798. messageSends: []
  36799. }),
  36800. $globals.IRMethod);
  36801. $core.addMethod(
  36802. $core.method({
  36803. selector: "source",
  36804. protocol: 'accessing',
  36805. fn: function (){
  36806. var self=this;
  36807. return self["@source"];
  36808. },
  36809. args: [],
  36810. source: "source\x0a\x09^ source",
  36811. referencedClasses: [],
  36812. messageSends: []
  36813. }),
  36814. $globals.IRMethod);
  36815. $core.addMethod(
  36816. $core.method({
  36817. selector: "source:",
  36818. protocol: 'accessing',
  36819. fn: function (aString){
  36820. var self=this;
  36821. self["@source"]=aString;
  36822. return self;
  36823. },
  36824. args: ["aString"],
  36825. source: "source: aString\x0a\x09source := aString",
  36826. referencedClasses: [],
  36827. messageSends: []
  36828. }),
  36829. $globals.IRMethod);
  36830. $core.addMethod(
  36831. $core.method({
  36832. selector: "theClass",
  36833. protocol: 'accessing',
  36834. fn: function (){
  36835. var self=this;
  36836. return self["@theClass"];
  36837. },
  36838. args: [],
  36839. source: "theClass\x0a\x09^ theClass",
  36840. referencedClasses: [],
  36841. messageSends: []
  36842. }),
  36843. $globals.IRMethod);
  36844. $core.addMethod(
  36845. $core.method({
  36846. selector: "theClass:",
  36847. protocol: 'accessing',
  36848. fn: function (aClass){
  36849. var self=this;
  36850. self["@theClass"]=aClass;
  36851. return self;
  36852. },
  36853. args: ["aClass"],
  36854. source: "theClass: aClass\x0a\x09theClass := aClass",
  36855. referencedClasses: [],
  36856. messageSends: []
  36857. }),
  36858. $globals.IRMethod);
  36859. $core.addClass('IRReturn', $globals.IRScopedInstruction, [], 'Compiler-IR');
  36860. $globals.IRReturn.comment="I am a local return instruction.";
  36861. $core.addMethod(
  36862. $core.method({
  36863. selector: "accept:",
  36864. protocol: 'visiting',
  36865. fn: function (aVisitor){
  36866. var self=this;
  36867. return $core.withContext(function($ctx1) {
  36868. return $recv(aVisitor)._visitIRReturn_(self);
  36869. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRReturn)});
  36870. },
  36871. args: ["aVisitor"],
  36872. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  36873. referencedClasses: [],
  36874. messageSends: ["visitIRReturn:"]
  36875. }),
  36876. $globals.IRReturn);
  36877. $core.addMethod(
  36878. $core.method({
  36879. selector: "canBeAssigned",
  36880. protocol: 'testing',
  36881. fn: function (){
  36882. var self=this;
  36883. return false;
  36884. },
  36885. args: [],
  36886. source: "canBeAssigned\x0a\x09^ false",
  36887. referencedClasses: [],
  36888. messageSends: []
  36889. }),
  36890. $globals.IRReturn);
  36891. $core.addMethod(
  36892. $core.method({
  36893. selector: "expression",
  36894. protocol: 'accessing',
  36895. fn: function (){
  36896. var self=this;
  36897. return $core.withContext(function($ctx1) {
  36898. return $recv(self._instructions())._single();
  36899. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  36900. },
  36901. args: [],
  36902. source: "expression\x0a\x09^ self instructions single",
  36903. referencedClasses: [],
  36904. messageSends: ["single", "instructions"]
  36905. }),
  36906. $globals.IRReturn);
  36907. $core.addMethod(
  36908. $core.method({
  36909. selector: "isBlockReturn",
  36910. protocol: 'testing',
  36911. fn: function (){
  36912. var self=this;
  36913. return false;
  36914. },
  36915. args: [],
  36916. source: "isBlockReturn\x0a\x09^ false",
  36917. referencedClasses: [],
  36918. messageSends: []
  36919. }),
  36920. $globals.IRReturn);
  36921. $core.addMethod(
  36922. $core.method({
  36923. selector: "isLocalReturn",
  36924. protocol: 'testing',
  36925. fn: function (){
  36926. var self=this;
  36927. return true;
  36928. },
  36929. args: [],
  36930. source: "isLocalReturn\x0a\x09^ true",
  36931. referencedClasses: [],
  36932. messageSends: []
  36933. }),
  36934. $globals.IRReturn);
  36935. $core.addMethod(
  36936. $core.method({
  36937. selector: "isNonLocalReturn",
  36938. protocol: 'testing',
  36939. fn: function (){
  36940. var self=this;
  36941. return $core.withContext(function($ctx1) {
  36942. return $recv(self._isLocalReturn())._not();
  36943. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},$globals.IRReturn)});
  36944. },
  36945. args: [],
  36946. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  36947. referencedClasses: [],
  36948. messageSends: ["not", "isLocalReturn"]
  36949. }),
  36950. $globals.IRReturn);
  36951. $core.addMethod(
  36952. $core.method({
  36953. selector: "isReturn",
  36954. protocol: 'testing',
  36955. fn: function (){
  36956. var self=this;
  36957. return true;
  36958. },
  36959. args: [],
  36960. source: "isReturn\x0a\x09^ true",
  36961. referencedClasses: [],
  36962. messageSends: []
  36963. }),
  36964. $globals.IRReturn);
  36965. $core.addMethod(
  36966. $core.method({
  36967. selector: "scope",
  36968. protocol: 'accessing',
  36969. fn: function (){
  36970. var self=this;
  36971. return $core.withContext(function($ctx1) {
  36972. var $1,$receiver;
  36973. $1=self["@scope"];
  36974. if(($receiver = $1) == null || $receiver.isNil){
  36975. return $recv(self._parent())._scope();
  36976. } else {
  36977. return $1;
  36978. };
  36979. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  36980. },
  36981. args: [],
  36982. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  36983. referencedClasses: [],
  36984. messageSends: ["ifNil:", "scope", "parent"]
  36985. }),
  36986. $globals.IRReturn);
  36987. $core.addClass('IRBlockReturn', $globals.IRReturn, [], 'Compiler-IR');
  36988. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  36989. $core.addMethod(
  36990. $core.method({
  36991. selector: "accept:",
  36992. protocol: 'visiting',
  36993. fn: function (aVisitor){
  36994. var self=this;
  36995. return $core.withContext(function($ctx1) {
  36996. return $recv(aVisitor)._visitIRBlockReturn_(self);
  36997. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  36998. },
  36999. args: ["aVisitor"],
  37000. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  37001. referencedClasses: [],
  37002. messageSends: ["visitIRBlockReturn:"]
  37003. }),
  37004. $globals.IRBlockReturn);
  37005. $core.addMethod(
  37006. $core.method({
  37007. selector: "isBlockReturn",
  37008. protocol: 'testing',
  37009. fn: function (){
  37010. var self=this;
  37011. return true;
  37012. },
  37013. args: [],
  37014. source: "isBlockReturn\x0a\x09^ true",
  37015. referencedClasses: [],
  37016. messageSends: []
  37017. }),
  37018. $globals.IRBlockReturn);
  37019. $core.addClass('IRNonLocalReturn', $globals.IRReturn, [], 'Compiler-IR');
  37020. $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.";
  37021. $core.addMethod(
  37022. $core.method({
  37023. selector: "accept:",
  37024. protocol: 'visiting',
  37025. fn: function (aVisitor){
  37026. var self=this;
  37027. return $core.withContext(function($ctx1) {
  37028. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  37029. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  37030. },
  37031. args: ["aVisitor"],
  37032. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  37033. referencedClasses: [],
  37034. messageSends: ["visitIRNonLocalReturn:"]
  37035. }),
  37036. $globals.IRNonLocalReturn);
  37037. $core.addMethod(
  37038. $core.method({
  37039. selector: "isLocalReturn",
  37040. protocol: 'testing',
  37041. fn: function (){
  37042. var self=this;
  37043. return false;
  37044. },
  37045. args: [],
  37046. source: "isLocalReturn\x0a\x09^ false",
  37047. referencedClasses: [],
  37048. messageSends: []
  37049. }),
  37050. $globals.IRNonLocalReturn);
  37051. $core.addClass('IRTempDeclaration', $globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  37052. $core.addMethod(
  37053. $core.method({
  37054. selector: "accept:",
  37055. protocol: 'visiting',
  37056. fn: function (aVisitor){
  37057. var self=this;
  37058. return $core.withContext(function($ctx1) {
  37059. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  37060. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  37061. },
  37062. args: ["aVisitor"],
  37063. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  37064. referencedClasses: [],
  37065. messageSends: ["visitIRTempDeclaration:"]
  37066. }),
  37067. $globals.IRTempDeclaration);
  37068. $core.addMethod(
  37069. $core.method({
  37070. selector: "isTempDeclaration",
  37071. protocol: 'testing',
  37072. fn: function (){
  37073. var self=this;
  37074. return true;
  37075. },
  37076. args: [],
  37077. source: "isTempDeclaration\x0a\x09^ true",
  37078. referencedClasses: [],
  37079. messageSends: []
  37080. }),
  37081. $globals.IRTempDeclaration);
  37082. $core.addMethod(
  37083. $core.method({
  37084. selector: "name",
  37085. protocol: 'accessing',
  37086. fn: function (){
  37087. var self=this;
  37088. return self["@name"];
  37089. },
  37090. args: [],
  37091. source: "name\x0a\x09^ name",
  37092. referencedClasses: [],
  37093. messageSends: []
  37094. }),
  37095. $globals.IRTempDeclaration);
  37096. $core.addMethod(
  37097. $core.method({
  37098. selector: "name:",
  37099. protocol: 'accessing',
  37100. fn: function (aString){
  37101. var self=this;
  37102. self["@name"]=aString;
  37103. return self;
  37104. },
  37105. args: ["aString"],
  37106. source: "name: aString\x0a\x09name := aString",
  37107. referencedClasses: [],
  37108. messageSends: []
  37109. }),
  37110. $globals.IRTempDeclaration);
  37111. $core.addClass('IRSend', $globals.IRInstruction, ['selector', 'index'], 'Compiler-IR');
  37112. $globals.IRSend.comment="I am a message send instruction.";
  37113. $core.addMethod(
  37114. $core.method({
  37115. selector: "accept:",
  37116. protocol: 'visiting',
  37117. fn: function (aVisitor){
  37118. var self=this;
  37119. return $core.withContext(function($ctx1) {
  37120. return $recv(aVisitor)._visitIRSend_(self);
  37121. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSend)});
  37122. },
  37123. args: ["aVisitor"],
  37124. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  37125. referencedClasses: [],
  37126. messageSends: ["visitIRSend:"]
  37127. }),
  37128. $globals.IRSend);
  37129. $core.addMethod(
  37130. $core.method({
  37131. selector: "arguments",
  37132. protocol: 'accessing',
  37133. fn: function (){
  37134. var self=this;
  37135. return $core.withContext(function($ctx1) {
  37136. return $recv(self._instructions())._allButFirst();
  37137. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  37138. },
  37139. args: [],
  37140. source: "arguments\x0a\x09^ self instructions allButFirst",
  37141. referencedClasses: [],
  37142. messageSends: ["allButFirst", "instructions"]
  37143. }),
  37144. $globals.IRSend);
  37145. $core.addMethod(
  37146. $core.method({
  37147. selector: "index",
  37148. protocol: 'accessing',
  37149. fn: function (){
  37150. var self=this;
  37151. return self["@index"];
  37152. },
  37153. args: [],
  37154. source: "index\x0a\x09^ index",
  37155. referencedClasses: [],
  37156. messageSends: []
  37157. }),
  37158. $globals.IRSend);
  37159. $core.addMethod(
  37160. $core.method({
  37161. selector: "index:",
  37162. protocol: 'accessing',
  37163. fn: function (anInteger){
  37164. var self=this;
  37165. self["@index"]=anInteger;
  37166. return self;
  37167. },
  37168. args: ["anInteger"],
  37169. source: "index: anInteger\x0a\x09index := anInteger",
  37170. referencedClasses: [],
  37171. messageSends: []
  37172. }),
  37173. $globals.IRSend);
  37174. $core.addMethod(
  37175. $core.method({
  37176. selector: "isSend",
  37177. protocol: 'testing',
  37178. fn: function (){
  37179. var self=this;
  37180. return true;
  37181. },
  37182. args: [],
  37183. source: "isSend\x0a\x09^ true",
  37184. referencedClasses: [],
  37185. messageSends: []
  37186. }),
  37187. $globals.IRSend);
  37188. $core.addMethod(
  37189. $core.method({
  37190. selector: "isSuperSend",
  37191. protocol: 'testing',
  37192. fn: function (){
  37193. var self=this;
  37194. var receiver;
  37195. return $core.withContext(function($ctx1) {
  37196. receiver=self._receiver();
  37197. return $recv($recv(receiver)._isVariable())._and_((function(){
  37198. return $core.withContext(function($ctx2) {
  37199. return $recv($recv($recv(receiver)._variable())._name()).__eq("super");
  37200. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37201. }));
  37202. }, function($ctx1) {$ctx1.fill(self,"isSuperSend",{receiver:receiver},$globals.IRSend)});
  37203. },
  37204. args: [],
  37205. source: "isSuperSend\x0a\x09| receiver |\x0a\x09receiver := self receiver.\x0a\x09^ receiver isVariable and: [ receiver variable name = 'super' ]",
  37206. referencedClasses: [],
  37207. messageSends: ["receiver", "and:", "isVariable", "=", "name", "variable"]
  37208. }),
  37209. $globals.IRSend);
  37210. $core.addMethod(
  37211. $core.method({
  37212. selector: "receiver",
  37213. protocol: 'accessing',
  37214. fn: function (){
  37215. var self=this;
  37216. return $core.withContext(function($ctx1) {
  37217. return $recv(self._instructions())._first();
  37218. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  37219. },
  37220. args: [],
  37221. source: "receiver\x0a\x09^ self instructions first",
  37222. referencedClasses: [],
  37223. messageSends: ["first", "instructions"]
  37224. }),
  37225. $globals.IRSend);
  37226. $core.addMethod(
  37227. $core.method({
  37228. selector: "selector",
  37229. protocol: 'accessing',
  37230. fn: function (){
  37231. var self=this;
  37232. return self["@selector"];
  37233. },
  37234. args: [],
  37235. source: "selector\x0a\x09^ selector",
  37236. referencedClasses: [],
  37237. messageSends: []
  37238. }),
  37239. $globals.IRSend);
  37240. $core.addMethod(
  37241. $core.method({
  37242. selector: "selector:",
  37243. protocol: 'accessing',
  37244. fn: function (aString){
  37245. var self=this;
  37246. self["@selector"]=aString;
  37247. return self;
  37248. },
  37249. args: ["aString"],
  37250. source: "selector: aString\x0a\x09selector := aString",
  37251. referencedClasses: [],
  37252. messageSends: []
  37253. }),
  37254. $globals.IRSend);
  37255. $core.addClass('IRSequence', $globals.IRInstruction, [], 'Compiler-IR');
  37256. $core.addMethod(
  37257. $core.method({
  37258. selector: "accept:",
  37259. protocol: 'visiting',
  37260. fn: function (aVisitor){
  37261. var self=this;
  37262. return $core.withContext(function($ctx1) {
  37263. return $recv(aVisitor)._visitIRSequence_(self);
  37264. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSequence)});
  37265. },
  37266. args: ["aVisitor"],
  37267. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  37268. referencedClasses: [],
  37269. messageSends: ["visitIRSequence:"]
  37270. }),
  37271. $globals.IRSequence);
  37272. $core.addMethod(
  37273. $core.method({
  37274. selector: "isSequence",
  37275. protocol: 'testing',
  37276. fn: function (){
  37277. var self=this;
  37278. return true;
  37279. },
  37280. args: [],
  37281. source: "isSequence\x0a\x09^ true",
  37282. referencedClasses: [],
  37283. messageSends: []
  37284. }),
  37285. $globals.IRSequence);
  37286. $core.addClass('IRBlockSequence', $globals.IRSequence, [], 'Compiler-IR');
  37287. $core.addMethod(
  37288. $core.method({
  37289. selector: "accept:",
  37290. protocol: 'visiting',
  37291. fn: function (aVisitor){
  37292. var self=this;
  37293. return $core.withContext(function($ctx1) {
  37294. return $recv(aVisitor)._visitIRBlockSequence_(self);
  37295. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  37296. },
  37297. args: ["aVisitor"],
  37298. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  37299. referencedClasses: [],
  37300. messageSends: ["visitIRBlockSequence:"]
  37301. }),
  37302. $globals.IRBlockSequence);
  37303. $core.addClass('IRValue', $globals.IRInstruction, ['value'], 'Compiler-IR');
  37304. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  37305. $core.addMethod(
  37306. $core.method({
  37307. selector: "accept:",
  37308. protocol: 'visiting',
  37309. fn: function (aVisitor){
  37310. var self=this;
  37311. return $core.withContext(function($ctx1) {
  37312. return $recv(aVisitor)._visitIRValue_(self);
  37313. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRValue)});
  37314. },
  37315. args: ["aVisitor"],
  37316. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  37317. referencedClasses: [],
  37318. messageSends: ["visitIRValue:"]
  37319. }),
  37320. $globals.IRValue);
  37321. $core.addMethod(
  37322. $core.method({
  37323. selector: "needsBoxingAsReceiver",
  37324. protocol: 'testing',
  37325. fn: function (){
  37326. var self=this;
  37327. return false;
  37328. },
  37329. args: [],
  37330. source: "needsBoxingAsReceiver\x0a\x09^ false",
  37331. referencedClasses: [],
  37332. messageSends: []
  37333. }),
  37334. $globals.IRValue);
  37335. $core.addMethod(
  37336. $core.method({
  37337. selector: "value",
  37338. protocol: 'accessing',
  37339. fn: function (){
  37340. var self=this;
  37341. return self["@value"];
  37342. },
  37343. args: [],
  37344. source: "value\x0a\x09^ value",
  37345. referencedClasses: [],
  37346. messageSends: []
  37347. }),
  37348. $globals.IRValue);
  37349. $core.addMethod(
  37350. $core.method({
  37351. selector: "value:",
  37352. protocol: 'accessing',
  37353. fn: function (aString){
  37354. var self=this;
  37355. self["@value"]=aString;
  37356. return self;
  37357. },
  37358. args: ["aString"],
  37359. source: "value: aString\x0a\x09value := aString",
  37360. referencedClasses: [],
  37361. messageSends: []
  37362. }),
  37363. $globals.IRValue);
  37364. $core.addClass('IRVariable', $globals.IRInstruction, ['variable'], 'Compiler-IR');
  37365. $globals.IRVariable.comment="I am a variable instruction.";
  37366. $core.addMethod(
  37367. $core.method({
  37368. selector: "accept:",
  37369. protocol: 'visiting',
  37370. fn: function (aVisitor){
  37371. var self=this;
  37372. return $core.withContext(function($ctx1) {
  37373. return $recv(aVisitor)._visitIRVariable_(self);
  37374. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVariable)});
  37375. },
  37376. args: ["aVisitor"],
  37377. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  37378. referencedClasses: [],
  37379. messageSends: ["visitIRVariable:"]
  37380. }),
  37381. $globals.IRVariable);
  37382. $core.addMethod(
  37383. $core.method({
  37384. selector: "isVariable",
  37385. protocol: 'testing',
  37386. fn: function (){
  37387. var self=this;
  37388. return true;
  37389. },
  37390. args: [],
  37391. source: "isVariable\x0a\x09^ true",
  37392. referencedClasses: [],
  37393. messageSends: []
  37394. }),
  37395. $globals.IRVariable);
  37396. $core.addMethod(
  37397. $core.method({
  37398. selector: "needsBoxingAsReceiver",
  37399. protocol: 'testing',
  37400. fn: function (){
  37401. var self=this;
  37402. return $core.withContext(function($ctx1) {
  37403. return $recv($recv(self._variable())._isPseudoVar())._not();
  37404. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  37405. },
  37406. args: [],
  37407. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  37408. referencedClasses: [],
  37409. messageSends: ["not", "isPseudoVar", "variable"]
  37410. }),
  37411. $globals.IRVariable);
  37412. $core.addMethod(
  37413. $core.method({
  37414. selector: "variable",
  37415. protocol: 'accessing',
  37416. fn: function (){
  37417. var self=this;
  37418. return self["@variable"];
  37419. },
  37420. args: [],
  37421. source: "variable\x0a\x09^ variable",
  37422. referencedClasses: [],
  37423. messageSends: []
  37424. }),
  37425. $globals.IRVariable);
  37426. $core.addMethod(
  37427. $core.method({
  37428. selector: "variable:",
  37429. protocol: 'accessing',
  37430. fn: function (aScopeVariable){
  37431. var self=this;
  37432. self["@variable"]=aScopeVariable;
  37433. return self;
  37434. },
  37435. args: ["aScopeVariable"],
  37436. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  37437. referencedClasses: [],
  37438. messageSends: []
  37439. }),
  37440. $globals.IRVariable);
  37441. $core.addClass('IRVerbatim', $globals.IRInstruction, ['source'], 'Compiler-IR');
  37442. $core.addMethod(
  37443. $core.method({
  37444. selector: "accept:",
  37445. protocol: 'visiting',
  37446. fn: function (aVisitor){
  37447. var self=this;
  37448. return $core.withContext(function($ctx1) {
  37449. return $recv(aVisitor)._visitIRVerbatim_(self);
  37450. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  37451. },
  37452. args: ["aVisitor"],
  37453. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  37454. referencedClasses: [],
  37455. messageSends: ["visitIRVerbatim:"]
  37456. }),
  37457. $globals.IRVerbatim);
  37458. $core.addMethod(
  37459. $core.method({
  37460. selector: "source",
  37461. protocol: 'accessing',
  37462. fn: function (){
  37463. var self=this;
  37464. return self["@source"];
  37465. },
  37466. args: [],
  37467. source: "source\x0a\x09^ source",
  37468. referencedClasses: [],
  37469. messageSends: []
  37470. }),
  37471. $globals.IRVerbatim);
  37472. $core.addMethod(
  37473. $core.method({
  37474. selector: "source:",
  37475. protocol: 'accessing',
  37476. fn: function (aString){
  37477. var self=this;
  37478. self["@source"]=aString;
  37479. return self;
  37480. },
  37481. args: ["aString"],
  37482. source: "source: aString\x0a\x09source := aString",
  37483. referencedClasses: [],
  37484. messageSends: []
  37485. }),
  37486. $globals.IRVerbatim);
  37487. $core.addClass('IRVisitor', $globals.Object, [], 'Compiler-IR');
  37488. $core.addMethod(
  37489. $core.method({
  37490. selector: "visit:",
  37491. protocol: 'visiting',
  37492. fn: function (anIRInstruction){
  37493. var self=this;
  37494. return $core.withContext(function($ctx1) {
  37495. return $recv(anIRInstruction)._accept_(self);
  37496. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  37497. },
  37498. args: ["anIRInstruction"],
  37499. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  37500. referencedClasses: [],
  37501. messageSends: ["accept:"]
  37502. }),
  37503. $globals.IRVisitor);
  37504. $core.addMethod(
  37505. $core.method({
  37506. selector: "visitIRAssignment:",
  37507. protocol: 'visiting',
  37508. fn: function (anIRAssignment){
  37509. var self=this;
  37510. return $core.withContext(function($ctx1) {
  37511. return self._visitIRInstruction_(anIRAssignment);
  37512. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  37513. },
  37514. args: ["anIRAssignment"],
  37515. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  37516. referencedClasses: [],
  37517. messageSends: ["visitIRInstruction:"]
  37518. }),
  37519. $globals.IRVisitor);
  37520. $core.addMethod(
  37521. $core.method({
  37522. selector: "visitIRBlockReturn:",
  37523. protocol: 'visiting',
  37524. fn: function (anIRBlockReturn){
  37525. var self=this;
  37526. return $core.withContext(function($ctx1) {
  37527. return self._visitIRReturn_(anIRBlockReturn);
  37528. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  37529. },
  37530. args: ["anIRBlockReturn"],
  37531. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  37532. referencedClasses: [],
  37533. messageSends: ["visitIRReturn:"]
  37534. }),
  37535. $globals.IRVisitor);
  37536. $core.addMethod(
  37537. $core.method({
  37538. selector: "visitIRBlockSequence:",
  37539. protocol: 'visiting',
  37540. fn: function (anIRBlockSequence){
  37541. var self=this;
  37542. return $core.withContext(function($ctx1) {
  37543. return self._visitIRSequence_(anIRBlockSequence);
  37544. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  37545. },
  37546. args: ["anIRBlockSequence"],
  37547. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  37548. referencedClasses: [],
  37549. messageSends: ["visitIRSequence:"]
  37550. }),
  37551. $globals.IRVisitor);
  37552. $core.addMethod(
  37553. $core.method({
  37554. selector: "visitIRClosure:",
  37555. protocol: 'visiting',
  37556. fn: function (anIRClosure){
  37557. var self=this;
  37558. return $core.withContext(function($ctx1) {
  37559. return self._visitIRInstruction_(anIRClosure);
  37560. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  37561. },
  37562. args: ["anIRClosure"],
  37563. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  37564. referencedClasses: [],
  37565. messageSends: ["visitIRInstruction:"]
  37566. }),
  37567. $globals.IRVisitor);
  37568. $core.addMethod(
  37569. $core.method({
  37570. selector: "visitIRDynamicArray:",
  37571. protocol: 'visiting',
  37572. fn: function (anIRDynamicArray){
  37573. var self=this;
  37574. return $core.withContext(function($ctx1) {
  37575. return self._visitIRInstruction_(anIRDynamicArray);
  37576. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  37577. },
  37578. args: ["anIRDynamicArray"],
  37579. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  37580. referencedClasses: [],
  37581. messageSends: ["visitIRInstruction:"]
  37582. }),
  37583. $globals.IRVisitor);
  37584. $core.addMethod(
  37585. $core.method({
  37586. selector: "visitIRDynamicDictionary:",
  37587. protocol: 'visiting',
  37588. fn: function (anIRDynamicDictionary){
  37589. var self=this;
  37590. return $core.withContext(function($ctx1) {
  37591. return self._visitIRInstruction_(anIRDynamicDictionary);
  37592. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  37593. },
  37594. args: ["anIRDynamicDictionary"],
  37595. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  37596. referencedClasses: [],
  37597. messageSends: ["visitIRInstruction:"]
  37598. }),
  37599. $globals.IRVisitor);
  37600. $core.addMethod(
  37601. $core.method({
  37602. selector: "visitIRInlinedClosure:",
  37603. protocol: 'visiting',
  37604. fn: function (anIRInlinedClosure){
  37605. var self=this;
  37606. return $core.withContext(function($ctx1) {
  37607. return self._visitIRClosure_(anIRInlinedClosure);
  37608. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  37609. },
  37610. args: ["anIRInlinedClosure"],
  37611. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  37612. referencedClasses: [],
  37613. messageSends: ["visitIRClosure:"]
  37614. }),
  37615. $globals.IRVisitor);
  37616. $core.addMethod(
  37617. $core.method({
  37618. selector: "visitIRInlinedSequence:",
  37619. protocol: 'visiting',
  37620. fn: function (anIRInlinedSequence){
  37621. var self=this;
  37622. return $core.withContext(function($ctx1) {
  37623. return self._visitIRSequence_(anIRInlinedSequence);
  37624. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  37625. },
  37626. args: ["anIRInlinedSequence"],
  37627. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  37628. referencedClasses: [],
  37629. messageSends: ["visitIRSequence:"]
  37630. }),
  37631. $globals.IRVisitor);
  37632. $core.addMethod(
  37633. $core.method({
  37634. selector: "visitIRInstruction:",
  37635. protocol: 'visiting',
  37636. fn: function (anIRInstruction){
  37637. var self=this;
  37638. return $core.withContext(function($ctx1) {
  37639. $recv($recv(anIRInstruction)._instructions())._do_((function(each){
  37640. return $core.withContext(function($ctx2) {
  37641. return self._visit_(each);
  37642. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37643. }));
  37644. return anIRInstruction;
  37645. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  37646. },
  37647. args: ["anIRInstruction"],
  37648. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  37649. referencedClasses: [],
  37650. messageSends: ["do:", "instructions", "visit:"]
  37651. }),
  37652. $globals.IRVisitor);
  37653. $core.addMethod(
  37654. $core.method({
  37655. selector: "visitIRMethod:",
  37656. protocol: 'visiting',
  37657. fn: function (anIRMethod){
  37658. var self=this;
  37659. return $core.withContext(function($ctx1) {
  37660. return self._visitIRInstruction_(anIRMethod);
  37661. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  37662. },
  37663. args: ["anIRMethod"],
  37664. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  37665. referencedClasses: [],
  37666. messageSends: ["visitIRInstruction:"]
  37667. }),
  37668. $globals.IRVisitor);
  37669. $core.addMethod(
  37670. $core.method({
  37671. selector: "visitIRNonLocalReturn:",
  37672. protocol: 'visiting',
  37673. fn: function (anIRNonLocalReturn){
  37674. var self=this;
  37675. return $core.withContext(function($ctx1) {
  37676. return self._visitIRInstruction_(anIRNonLocalReturn);
  37677. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  37678. },
  37679. args: ["anIRNonLocalReturn"],
  37680. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  37681. referencedClasses: [],
  37682. messageSends: ["visitIRInstruction:"]
  37683. }),
  37684. $globals.IRVisitor);
  37685. $core.addMethod(
  37686. $core.method({
  37687. selector: "visitIRNonLocalReturnHandling:",
  37688. protocol: 'visiting',
  37689. fn: function (anIRNonLocalReturnHandling){
  37690. var self=this;
  37691. return $core.withContext(function($ctx1) {
  37692. return self._visitIRInstruction_(anIRNonLocalReturnHandling);
  37693. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  37694. },
  37695. args: ["anIRNonLocalReturnHandling"],
  37696. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  37697. referencedClasses: [],
  37698. messageSends: ["visitIRInstruction:"]
  37699. }),
  37700. $globals.IRVisitor);
  37701. $core.addMethod(
  37702. $core.method({
  37703. selector: "visitIRReturn:",
  37704. protocol: 'visiting',
  37705. fn: function (anIRReturn){
  37706. var self=this;
  37707. return $core.withContext(function($ctx1) {
  37708. return self._visitIRInstruction_(anIRReturn);
  37709. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  37710. },
  37711. args: ["anIRReturn"],
  37712. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  37713. referencedClasses: [],
  37714. messageSends: ["visitIRInstruction:"]
  37715. }),
  37716. $globals.IRVisitor);
  37717. $core.addMethod(
  37718. $core.method({
  37719. selector: "visitIRSend:",
  37720. protocol: 'visiting',
  37721. fn: function (anIRSend){
  37722. var self=this;
  37723. return $core.withContext(function($ctx1) {
  37724. return self._visitIRInstruction_(anIRSend);
  37725. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  37726. },
  37727. args: ["anIRSend"],
  37728. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  37729. referencedClasses: [],
  37730. messageSends: ["visitIRInstruction:"]
  37731. }),
  37732. $globals.IRVisitor);
  37733. $core.addMethod(
  37734. $core.method({
  37735. selector: "visitIRSequence:",
  37736. protocol: 'visiting',
  37737. fn: function (anIRSequence){
  37738. var self=this;
  37739. return $core.withContext(function($ctx1) {
  37740. return self._visitIRInstruction_(anIRSequence);
  37741. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  37742. },
  37743. args: ["anIRSequence"],
  37744. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  37745. referencedClasses: [],
  37746. messageSends: ["visitIRInstruction:"]
  37747. }),
  37748. $globals.IRVisitor);
  37749. $core.addMethod(
  37750. $core.method({
  37751. selector: "visitIRTempDeclaration:",
  37752. protocol: 'visiting',
  37753. fn: function (anIRTempDeclaration){
  37754. var self=this;
  37755. return $core.withContext(function($ctx1) {
  37756. return self._visitIRInstruction_(anIRTempDeclaration);
  37757. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  37758. },
  37759. args: ["anIRTempDeclaration"],
  37760. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  37761. referencedClasses: [],
  37762. messageSends: ["visitIRInstruction:"]
  37763. }),
  37764. $globals.IRVisitor);
  37765. $core.addMethod(
  37766. $core.method({
  37767. selector: "visitIRValue:",
  37768. protocol: 'visiting',
  37769. fn: function (anIRValue){
  37770. var self=this;
  37771. return $core.withContext(function($ctx1) {
  37772. return self._visitIRInstruction_(anIRValue);
  37773. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  37774. },
  37775. args: ["anIRValue"],
  37776. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  37777. referencedClasses: [],
  37778. messageSends: ["visitIRInstruction:"]
  37779. }),
  37780. $globals.IRVisitor);
  37781. $core.addMethod(
  37782. $core.method({
  37783. selector: "visitIRVariable:",
  37784. protocol: 'visiting',
  37785. fn: function (anIRVariable){
  37786. var self=this;
  37787. return $core.withContext(function($ctx1) {
  37788. return self._visitIRInstruction_(anIRVariable);
  37789. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  37790. },
  37791. args: ["anIRVariable"],
  37792. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  37793. referencedClasses: [],
  37794. messageSends: ["visitIRInstruction:"]
  37795. }),
  37796. $globals.IRVisitor);
  37797. $core.addMethod(
  37798. $core.method({
  37799. selector: "visitIRVerbatim:",
  37800. protocol: 'visiting',
  37801. fn: function (anIRVerbatim){
  37802. var self=this;
  37803. return $core.withContext(function($ctx1) {
  37804. return self._visitIRInstruction_(anIRVerbatim);
  37805. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  37806. },
  37807. args: ["anIRVerbatim"],
  37808. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  37809. referencedClasses: [],
  37810. messageSends: ["visitIRInstruction:"]
  37811. }),
  37812. $globals.IRVisitor);
  37813. $core.addClass('IRJSTranslator', $globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  37814. $core.addMethod(
  37815. $core.method({
  37816. selector: "contents",
  37817. protocol: 'accessing',
  37818. fn: function (){
  37819. var self=this;
  37820. return $core.withContext(function($ctx1) {
  37821. return $recv(self._stream())._contents();
  37822. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  37823. },
  37824. args: [],
  37825. source: "contents\x0a\x09^ self stream contents",
  37826. referencedClasses: [],
  37827. messageSends: ["contents", "stream"]
  37828. }),
  37829. $globals.IRJSTranslator);
  37830. $core.addMethod(
  37831. $core.method({
  37832. selector: "currentClass",
  37833. protocol: 'accessing',
  37834. fn: function (){
  37835. var self=this;
  37836. return self["@currentClass"];
  37837. },
  37838. args: [],
  37839. source: "currentClass\x0a\x09^ currentClass",
  37840. referencedClasses: [],
  37841. messageSends: []
  37842. }),
  37843. $globals.IRJSTranslator);
  37844. $core.addMethod(
  37845. $core.method({
  37846. selector: "currentClass:",
  37847. protocol: 'accessing',
  37848. fn: function (aClass){
  37849. var self=this;
  37850. self["@currentClass"]=aClass;
  37851. return self;
  37852. },
  37853. args: ["aClass"],
  37854. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  37855. referencedClasses: [],
  37856. messageSends: []
  37857. }),
  37858. $globals.IRJSTranslator);
  37859. $core.addMethod(
  37860. $core.method({
  37861. selector: "initialize",
  37862. protocol: 'initialization',
  37863. fn: function (){
  37864. var self=this;
  37865. return $core.withContext(function($ctx1) {
  37866. (
  37867. $ctx1.supercall = true,
  37868. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  37869. $ctx1.supercall = false;
  37870. self["@stream"]=$recv($globals.JSStream)._new();
  37871. return self;
  37872. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  37873. },
  37874. args: [],
  37875. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  37876. referencedClasses: ["JSStream"],
  37877. messageSends: ["initialize", "new"]
  37878. }),
  37879. $globals.IRJSTranslator);
  37880. $core.addMethod(
  37881. $core.method({
  37882. selector: "stream",
  37883. protocol: 'accessing',
  37884. fn: function (){
  37885. var self=this;
  37886. return self["@stream"];
  37887. },
  37888. args: [],
  37889. source: "stream\x0a\x09^ stream",
  37890. referencedClasses: [],
  37891. messageSends: []
  37892. }),
  37893. $globals.IRJSTranslator);
  37894. $core.addMethod(
  37895. $core.method({
  37896. selector: "stream:",
  37897. protocol: 'accessing',
  37898. fn: function (aStream){
  37899. var self=this;
  37900. self["@stream"]=aStream;
  37901. return self;
  37902. },
  37903. args: ["aStream"],
  37904. source: "stream: aStream\x0a\x09stream := aStream",
  37905. referencedClasses: [],
  37906. messageSends: []
  37907. }),
  37908. $globals.IRJSTranslator);
  37909. $core.addMethod(
  37910. $core.method({
  37911. selector: "visitIRAssignment:",
  37912. protocol: 'visiting',
  37913. fn: function (anIRAssignment){
  37914. var self=this;
  37915. return $core.withContext(function($ctx1) {
  37916. $recv(self._stream())._nextPutAssignLhs_rhs_((function(){
  37917. return $core.withContext(function($ctx2) {
  37918. return self._visit_($recv(anIRAssignment)._left());
  37919. $ctx2.sendIdx["visit:"]=1;
  37920. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37921. }),(function(){
  37922. return $core.withContext(function($ctx2) {
  37923. return self._visit_($recv(anIRAssignment)._right());
  37924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  37925. }));
  37926. return self;
  37927. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  37928. },
  37929. args: ["anIRAssignment"],
  37930. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  37931. referencedClasses: [],
  37932. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  37933. }),
  37934. $globals.IRJSTranslator);
  37935. $core.addMethod(
  37936. $core.method({
  37937. selector: "visitIRClosure:",
  37938. protocol: 'visiting',
  37939. fn: function (anIRClosure){
  37940. var self=this;
  37941. return $core.withContext(function($ctx1) {
  37942. var $1,$2;
  37943. $1=self._stream();
  37944. $ctx1.sendIdx["stream"]=1;
  37945. $recv($1)._nextPutClosureWith_arguments_((function(){
  37946. return $core.withContext(function($ctx2) {
  37947. $2=self._stream();
  37948. $ctx2.sendIdx["stream"]=2;
  37949. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  37950. return $core.withContext(function($ctx3) {
  37951. return $recv($recv(each)._name())._asVariableName();
  37952. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  37953. })));
  37954. return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  37955. return $core.withContext(function($ctx3) {
  37956. return (
  37957. $ctx3.supercall = true,
  37958. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure]));
  37959. $ctx3.supercall = false;
  37960. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  37961. }));
  37962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37963. }),$recv(anIRClosure)._arguments());
  37964. return self;
  37965. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  37966. },
  37967. args: ["anIRClosure"],
  37968. 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",
  37969. referencedClasses: [],
  37970. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  37971. }),
  37972. $globals.IRJSTranslator);
  37973. $core.addMethod(
  37974. $core.method({
  37975. selector: "visitIRDynamicArray:",
  37976. protocol: 'visiting',
  37977. fn: function (anIRDynamicArray){
  37978. var self=this;
  37979. return $core.withContext(function($ctx1) {
  37980. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._instructions(),"[","]");
  37981. return self;
  37982. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  37983. },
  37984. args: ["anIRDynamicArray"],
  37985. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray instructions\x0a\x09\x09enclosedBetween: '[' and: ']'",
  37986. referencedClasses: [],
  37987. messageSends: ["visitInstructionList:enclosedBetween:and:", "instructions"]
  37988. }),
  37989. $globals.IRJSTranslator);
  37990. $core.addMethod(
  37991. $core.method({
  37992. selector: "visitIRDynamicDictionary:",
  37993. protocol: 'visiting',
  37994. fn: function (anIRDynamicDictionary){
  37995. var self=this;
  37996. return $core.withContext(function($ctx1) {
  37997. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._instructions(),"$globals.HashedCollection._newFromPairs_([","])");
  37998. return self;
  37999. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  38000. },
  38001. args: ["anIRDynamicDictionary"],
  38002. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary instructions\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  38003. referencedClasses: [],
  38004. messageSends: ["visitInstructionList:enclosedBetween:and:", "instructions"]
  38005. }),
  38006. $globals.IRJSTranslator);
  38007. $core.addMethod(
  38008. $core.method({
  38009. selector: "visitIRMethod:",
  38010. protocol: 'visiting',
  38011. fn: function (anIRMethod){
  38012. var self=this;
  38013. return $core.withContext(function($ctx1) {
  38014. var $1,$2,$3,$4,$5,$6,$7;
  38015. $1=self._stream();
  38016. $ctx1.sendIdx["stream"]=1;
  38017. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  38018. return $core.withContext(function($ctx2) {
  38019. $2=self._stream();
  38020. $ctx2.sendIdx["stream"]=2;
  38021. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  38022. return $core.withContext(function($ctx3) {
  38023. $3=self._stream();
  38024. $ctx3.sendIdx["stream"]=3;
  38025. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  38026. return $core.withContext(function($ctx4) {
  38027. return $recv($recv(each)._name())._asVariableName();
  38028. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  38029. }));
  38030. $ctx3.sendIdx["collect:"]=1;
  38031. $recv($3)._nextPutVars_($4);
  38032. $ctx3.sendIdx["nextPutVars:"]=1;
  38033. $5=self._stream();
  38034. $ctx3.sendIdx["stream"]=4;
  38035. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  38036. return $core.withContext(function($ctx4) {
  38037. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  38038. return $core.withContext(function($ctx5) {
  38039. $6=self._stream();
  38040. $ctx5.sendIdx["stream"]=5;
  38041. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  38042. return $core.withContext(function($ctx6) {
  38043. return $recv($recv(each)._variable())._alias();
  38044. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  38045. })));
  38046. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  38047. }));
  38048. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  38049. if($core.assert($7)){
  38050. return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  38051. return $core.withContext(function($ctx5) {
  38052. return (
  38053. $ctx5.supercall = true,
  38054. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  38055. $ctx5.supercall = false;
  38056. $ctx5.sendIdx["visitIRMethod:"]=1;
  38057. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  38058. }));
  38059. } else {
  38060. return (
  38061. $ctx4.supercall = true,
  38062. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  38063. $ctx4.supercall = false;
  38064. };
  38065. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  38066. }));
  38067. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  38068. }),$recv(anIRMethod)._arguments());
  38069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38070. }));
  38071. return self;
  38072. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  38073. },
  38074. args: ["anIRMethod"],
  38075. 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 ]",
  38076. referencedClasses: [],
  38077. 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"]
  38078. }),
  38079. $globals.IRJSTranslator);
  38080. $core.addMethod(
  38081. $core.method({
  38082. selector: "visitIRNonLocalReturn:",
  38083. protocol: 'visiting',
  38084. fn: function (anIRNonLocalReturn){
  38085. var self=this;
  38086. return $core.withContext(function($ctx1) {
  38087. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  38088. return $core.withContext(function($ctx2) {
  38089. return (
  38090. $ctx2.supercall = true,
  38091. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  38092. $ctx2.supercall = false;
  38093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38094. }));
  38095. return self;
  38096. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  38097. },
  38098. args: ["anIRNonLocalReturn"],
  38099. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  38100. referencedClasses: [],
  38101. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  38102. }),
  38103. $globals.IRJSTranslator);
  38104. $core.addMethod(
  38105. $core.method({
  38106. selector: "visitIRReturn:",
  38107. protocol: 'visiting',
  38108. fn: function (anIRReturn){
  38109. var self=this;
  38110. return $core.withContext(function($ctx1) {
  38111. $recv(self._stream())._nextPutReturnWith_((function(){
  38112. return $core.withContext(function($ctx2) {
  38113. return (
  38114. $ctx2.supercall = true,
  38115. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  38116. $ctx2.supercall = false;
  38117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38118. }));
  38119. return self;
  38120. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  38121. },
  38122. args: ["anIRReturn"],
  38123. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  38124. referencedClasses: [],
  38125. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  38126. }),
  38127. $globals.IRJSTranslator);
  38128. $core.addMethod(
  38129. $core.method({
  38130. selector: "visitIRSend:",
  38131. protocol: 'visiting',
  38132. fn: function (anIRSend){
  38133. var self=this;
  38134. var sends,superclass;
  38135. return $core.withContext(function($ctx1) {
  38136. var $1,$2;
  38137. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  38138. $1=$recv(anIRSend)._isSuperSend();
  38139. if($core.assert($1)){
  38140. self._visitSuperSend_(anIRSend);
  38141. } else {
  38142. self._visitSend_(anIRSend);
  38143. };
  38144. $2=$recv($recv(sends).__gt((1)))._and_((function(){
  38145. return $core.withContext(function($ctx2) {
  38146. return $recv($recv(anIRSend)._index()).__lt(sends);
  38147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38148. }));
  38149. if($core.assert($2)){
  38150. $recv(self._stream())._nextPutSendIndexFor_(anIRSend);
  38151. };
  38152. return self;
  38153. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  38154. },
  38155. args: ["anIRSend"],
  38156. 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\x09(sends > 1 and: [ anIRSend index < sends ])\x0a\x09\x09ifTrue: [ self stream nextPutSendIndexFor: anIRSend ]",
  38157. referencedClasses: [],
  38158. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuperSend", "visitSuperSend:", "visitSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"]
  38159. }),
  38160. $globals.IRJSTranslator);
  38161. $core.addMethod(
  38162. $core.method({
  38163. selector: "visitIRSequence:",
  38164. protocol: 'visiting',
  38165. fn: function (anIRSequence){
  38166. var self=this;
  38167. return $core.withContext(function($ctx1) {
  38168. var $1;
  38169. $1=self._stream();
  38170. $ctx1.sendIdx["stream"]=1;
  38171. $recv($1)._nextPutSequenceWith_((function(){
  38172. return $core.withContext(function($ctx2) {
  38173. return $recv($recv(anIRSequence)._instructions())._do_((function(each){
  38174. return $core.withContext(function($ctx3) {
  38175. return $recv(self._stream())._nextPutStatementWith_(self._visit_(each));
  38176. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38177. }));
  38178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38179. }));
  38180. return self;
  38181. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  38182. },
  38183. args: ["anIRSequence"],
  38184. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  38185. referencedClasses: [],
  38186. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"]
  38187. }),
  38188. $globals.IRJSTranslator);
  38189. $core.addMethod(
  38190. $core.method({
  38191. selector: "visitIRTempDeclaration:",
  38192. protocol: 'visiting',
  38193. fn: function (anIRTempDeclaration){
  38194. var self=this;
  38195. return self;
  38196. },
  38197. args: ["anIRTempDeclaration"],
  38198. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  38199. referencedClasses: [],
  38200. messageSends: []
  38201. }),
  38202. $globals.IRJSTranslator);
  38203. $core.addMethod(
  38204. $core.method({
  38205. selector: "visitIRValue:",
  38206. protocol: 'visiting',
  38207. fn: function (anIRValue){
  38208. var self=this;
  38209. return $core.withContext(function($ctx1) {
  38210. $recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavascript());
  38211. return self;
  38212. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  38213. },
  38214. args: ["anIRValue"],
  38215. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  38216. referencedClasses: [],
  38217. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"]
  38218. }),
  38219. $globals.IRJSTranslator);
  38220. $core.addMethod(
  38221. $core.method({
  38222. selector: "visitIRVariable:",
  38223. protocol: 'visiting',
  38224. fn: function (anIRVariable){
  38225. var self=this;
  38226. return $core.withContext(function($ctx1) {
  38227. var $3,$2,$1,$4;
  38228. $3=$recv(anIRVariable)._variable();
  38229. $ctx1.sendIdx["variable"]=1;
  38230. $2=$recv($3)._name();
  38231. $1=$recv($2).__eq("thisContext");
  38232. if($core.assert($1)){
  38233. $4=self._stream();
  38234. $ctx1.sendIdx["stream"]=1;
  38235. $recv($4)._nextPutAll_("$core.getThisContext()");
  38236. $ctx1.sendIdx["nextPutAll:"]=1;
  38237. } else {
  38238. $recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  38239. };
  38240. return self;
  38241. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  38242. },
  38243. args: ["anIRVariable"],
  38244. 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 ]",
  38245. referencedClasses: [],
  38246. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  38247. }),
  38248. $globals.IRJSTranslator);
  38249. $core.addMethod(
  38250. $core.method({
  38251. selector: "visitIRVerbatim:",
  38252. protocol: 'visiting',
  38253. fn: function (anIRVerbatim){
  38254. var self=this;
  38255. return $core.withContext(function($ctx1) {
  38256. var $1;
  38257. $1=self._stream();
  38258. $ctx1.sendIdx["stream"]=1;
  38259. $recv($1)._nextPutStatementWith_((function(){
  38260. return $core.withContext(function($ctx2) {
  38261. return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  38262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38263. }));
  38264. return self;
  38265. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  38266. },
  38267. args: ["anIRVerbatim"],
  38268. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  38269. referencedClasses: [],
  38270. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  38271. }),
  38272. $globals.IRJSTranslator);
  38273. $core.addMethod(
  38274. $core.method({
  38275. selector: "visitInstructionList:enclosedBetween:and:",
  38276. protocol: 'visiting',
  38277. fn: function (anArray,aString,anotherString){
  38278. var self=this;
  38279. return $core.withContext(function($ctx1) {
  38280. var $1;
  38281. $1=self._stream();
  38282. $ctx1.sendIdx["stream"]=1;
  38283. $recv($1)._nextPutAll_(aString);
  38284. $ctx1.sendIdx["nextPutAll:"]=1;
  38285. $recv(anArray)._do_separatedBy_((function(each){
  38286. return $core.withContext(function($ctx2) {
  38287. return self._visit_(each);
  38288. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38289. }),(function(){
  38290. return $core.withContext(function($ctx2) {
  38291. return $recv(self._stream())._nextPutAll_(",");
  38292. $ctx2.sendIdx["nextPutAll:"]=2;
  38293. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38294. }));
  38295. $recv(self["@stream"])._nextPutAll_(anotherString);
  38296. return self;
  38297. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  38298. },
  38299. args: ["anArray", "aString", "anotherString"],
  38300. 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",
  38301. referencedClasses: [],
  38302. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  38303. }),
  38304. $globals.IRJSTranslator);
  38305. $core.addMethod(
  38306. $core.method({
  38307. selector: "visitReceiver:",
  38308. protocol: 'visiting',
  38309. fn: function (anIRInstruction){
  38310. var self=this;
  38311. return $core.withContext(function($ctx1) {
  38312. var $1,$2,$3;
  38313. $1=$recv(anIRInstruction)._needsBoxingAsReceiver();
  38314. if(!$core.assert($1)){
  38315. $2=self._visit_(anIRInstruction);
  38316. $ctx1.sendIdx["visit:"]=1;
  38317. return $2;
  38318. };
  38319. $3=self._stream();
  38320. $ctx1.sendIdx["stream"]=1;
  38321. $recv($3)._nextPutAll_("$recv(");
  38322. $ctx1.sendIdx["nextPutAll:"]=1;
  38323. self._visit_(anIRInstruction);
  38324. $recv(self._stream())._nextPutAll_(")");
  38325. return self;
  38326. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)});
  38327. },
  38328. args: ["anIRInstruction"],
  38329. 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: ')'",
  38330. referencedClasses: [],
  38331. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  38332. }),
  38333. $globals.IRJSTranslator);
  38334. $core.addMethod(
  38335. $core.method({
  38336. selector: "visitSend:",
  38337. protocol: 'visiting',
  38338. fn: function (anIRSend){
  38339. var self=this;
  38340. return $core.withContext(function($ctx1) {
  38341. self._visitReceiver_($recv(anIRSend)._receiver());
  38342. $recv(self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  38343. self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  38344. return self;
  38345. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  38346. },
  38347. args: ["anIRSend"],
  38348. 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: ')'",
  38349. referencedClasses: [],
  38350. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  38351. }),
  38352. $globals.IRJSTranslator);
  38353. $core.addMethod(
  38354. $core.method({
  38355. selector: "visitSuperSend:",
  38356. protocol: 'visiting',
  38357. fn: function (anIRSend){
  38358. var self=this;
  38359. return $core.withContext(function($ctx1) {
  38360. var $1,$4,$3,$2,$5,$6,$7,$8;
  38361. $1=self._stream();
  38362. $ctx1.sendIdx["stream"]=1;
  38363. $recv($1)._nextPutAll_("(");
  38364. $ctx1.sendIdx["nextPutAll:"]=1;
  38365. $recv($1)._lf();
  38366. $ctx1.sendIdx["lf"]=1;
  38367. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38368. $ctx1.sendIdx["nextPutAll:"]=2;
  38369. $recv($1)._lf();
  38370. $ctx1.sendIdx["lf"]=2;
  38371. $4=$recv(anIRSend)._scope();
  38372. $ctx1.sendIdx["scope"]=1;
  38373. $3=$recv($4)._alias();
  38374. $ctx1.sendIdx["alias"]=1;
  38375. $2=$recv($3).__comma(".supercall = true,");
  38376. $ctx1.sendIdx[","]=1;
  38377. $recv($1)._nextPutAll_($2);
  38378. $ctx1.sendIdx["nextPutAll:"]=3;
  38379. $recv($1)._lf();
  38380. $ctx1.sendIdx["lf"]=3;
  38381. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38382. $ctx1.sendIdx["nextPutAll:"]=4;
  38383. $recv($1)._lf();
  38384. $ctx1.sendIdx["lf"]=4;
  38385. $5="(".__comma($recv(self._currentClass())._asJavascript());
  38386. $ctx1.sendIdx[","]=2;
  38387. $recv($1)._nextPutAll_($5);
  38388. $ctx1.sendIdx["nextPutAll:"]=5;
  38389. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  38390. $ctx1.sendIdx["nextPutAll:"]=6;
  38391. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  38392. $ctx1.sendIdx[","]=3;
  38393. $recv($1)._nextPutAll_($6);
  38394. $ctx1.sendIdx["nextPutAll:"]=7;
  38395. $7=$recv($1)._nextPutAll_("$recv(self), ");
  38396. $ctx1.sendIdx["nextPutAll:"]=8;
  38397. self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  38398. $8=self._stream();
  38399. $recv($8)._nextPutAll_("));");
  38400. $ctx1.sendIdx["nextPutAll:"]=9;
  38401. $recv($8)._lf();
  38402. $ctx1.sendIdx["lf"]=5;
  38403. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38404. $ctx1.sendIdx["nextPutAll:"]=10;
  38405. $recv($8)._lf();
  38406. $ctx1.sendIdx["lf"]=6;
  38407. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  38408. $ctx1.sendIdx["nextPutAll:"]=11;
  38409. $recv($8)._lf();
  38410. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38411. return self;
  38412. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  38413. },
  38414. args: ["anIRSend"],
  38415. 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);'",
  38416. referencedClasses: [],
  38417. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  38418. }),
  38419. $globals.IRJSTranslator);
  38420. $core.addClass('JSStream', $globals.Object, ['stream'], 'Compiler-IR');
  38421. $core.addMethod(
  38422. $core.method({
  38423. selector: "contents",
  38424. protocol: 'accessing',
  38425. fn: function (){
  38426. var self=this;
  38427. return $core.withContext(function($ctx1) {
  38428. return $recv(self["@stream"])._contents();
  38429. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  38430. },
  38431. args: [],
  38432. source: "contents\x0a\x09^ stream contents",
  38433. referencedClasses: [],
  38434. messageSends: ["contents"]
  38435. }),
  38436. $globals.JSStream);
  38437. $core.addMethod(
  38438. $core.method({
  38439. selector: "initialize",
  38440. protocol: 'initialization',
  38441. fn: function (){
  38442. var self=this;
  38443. return $core.withContext(function($ctx1) {
  38444. (
  38445. $ctx1.supercall = true,
  38446. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  38447. $ctx1.supercall = false;
  38448. self["@stream"]=""._writeStream();
  38449. return self;
  38450. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  38451. },
  38452. args: [],
  38453. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  38454. referencedClasses: [],
  38455. messageSends: ["initialize", "writeStream"]
  38456. }),
  38457. $globals.JSStream);
  38458. $core.addMethod(
  38459. $core.method({
  38460. selector: "lf",
  38461. protocol: 'streaming',
  38462. fn: function (){
  38463. var self=this;
  38464. return $core.withContext(function($ctx1) {
  38465. $recv(self["@stream"])._lf();
  38466. return self;
  38467. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  38468. },
  38469. args: [],
  38470. source: "lf\x0a\x09stream lf",
  38471. referencedClasses: [],
  38472. messageSends: ["lf"]
  38473. }),
  38474. $globals.JSStream);
  38475. $core.addMethod(
  38476. $core.method({
  38477. selector: "nextPut:",
  38478. protocol: 'streaming',
  38479. fn: function (aString){
  38480. var self=this;
  38481. return $core.withContext(function($ctx1) {
  38482. $recv(self["@stream"])._nextPut_(aString);
  38483. return self;
  38484. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  38485. },
  38486. args: ["aString"],
  38487. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  38488. referencedClasses: [],
  38489. messageSends: ["nextPut:"]
  38490. }),
  38491. $globals.JSStream);
  38492. $core.addMethod(
  38493. $core.method({
  38494. selector: "nextPutAll:",
  38495. protocol: 'streaming',
  38496. fn: function (aString){
  38497. var self=this;
  38498. return $core.withContext(function($ctx1) {
  38499. $recv(self["@stream"])._nextPutAll_(aString);
  38500. return self;
  38501. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  38502. },
  38503. args: ["aString"],
  38504. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  38505. referencedClasses: [],
  38506. messageSends: ["nextPutAll:"]
  38507. }),
  38508. $globals.JSStream);
  38509. $core.addMethod(
  38510. $core.method({
  38511. selector: "nextPutAssignLhs:rhs:",
  38512. protocol: 'streaming',
  38513. fn: function (aBlock,anotherBlock){
  38514. var self=this;
  38515. return $core.withContext(function($ctx1) {
  38516. $recv(aBlock)._value();
  38517. $ctx1.sendIdx["value"]=1;
  38518. $recv(self["@stream"])._nextPutAll_("=");
  38519. $recv(anotherBlock)._value();
  38520. return self;
  38521. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  38522. },
  38523. args: ["aBlock", "anotherBlock"],
  38524. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  38525. referencedClasses: [],
  38526. messageSends: ["value", "nextPutAll:"]
  38527. }),
  38528. $globals.JSStream);
  38529. $core.addMethod(
  38530. $core.method({
  38531. selector: "nextPutBlockContextFor:during:",
  38532. protocol: 'streaming',
  38533. fn: function (anIRClosure,aBlock){
  38534. var self=this;
  38535. return $core.withContext(function($ctx1) {
  38536. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  38537. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  38538. if(!$core.assert($1)){
  38539. $2=$recv(aBlock)._value();
  38540. $ctx1.sendIdx["value"]=1;
  38541. return $2;
  38542. };
  38543. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38544. $ctx1.sendIdx["nextPutAll:"]=1;
  38545. self._lf();
  38546. $ctx1.sendIdx["lf"]=1;
  38547. $6=$recv(anIRClosure)._scope();
  38548. $ctx1.sendIdx["scope"]=1;
  38549. $5=$recv($6)._alias();
  38550. $ctx1.sendIdx["alias"]=1;
  38551. $4="return $core.withContext(function(".__comma($5);
  38552. $ctx1.sendIdx[","]=2;
  38553. $3=$recv($4).__comma(") {");
  38554. $ctx1.sendIdx[","]=1;
  38555. self._nextPutAll_($3);
  38556. $ctx1.sendIdx["nextPutAll:"]=2;
  38557. self._lf();
  38558. $ctx1.sendIdx["lf"]=2;
  38559. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38560. $ctx1.sendIdx["nextPutAll:"]=3;
  38561. $7=self._lf();
  38562. $ctx1.sendIdx["lf"]=3;
  38563. $recv(aBlock)._value();
  38564. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38565. $ctx1.sendIdx["nextPutAll:"]=4;
  38566. self._lf();
  38567. $ctx1.sendIdx["lf"]=4;
  38568. $11=$recv(anIRClosure)._scope();
  38569. $ctx1.sendIdx["scope"]=2;
  38570. $10=$recv($11)._alias();
  38571. $ctx1.sendIdx["alias"]=2;
  38572. $9="}, function(".__comma($10);
  38573. $ctx1.sendIdx[","]=4;
  38574. $8=$recv($9).__comma(") {");
  38575. $ctx1.sendIdx[","]=3;
  38576. self._nextPutAll_($8);
  38577. $ctx1.sendIdx["nextPutAll:"]=5;
  38578. $15=$recv(anIRClosure)._scope();
  38579. $ctx1.sendIdx["scope"]=3;
  38580. $14=$recv($15)._alias();
  38581. $ctx1.sendIdx["alias"]=3;
  38582. $13=$recv($14).__comma(".fillBlock({");
  38583. $ctx1.sendIdx[","]=5;
  38584. $12=self._nextPutAll_($13);
  38585. $ctx1.sendIdx["nextPutAll:"]=6;
  38586. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  38587. return $core.withContext(function($ctx2) {
  38588. $16=$recv(each)._asVariableName();
  38589. $ctx2.sendIdx["asVariableName"]=1;
  38590. self._nextPutAll_($16);
  38591. $ctx2.sendIdx["nextPutAll:"]=7;
  38592. self._nextPutAll_(":");
  38593. $ctx2.sendIdx["nextPutAll:"]=8;
  38594. $17=self._nextPutAll_($recv(each)._asVariableName());
  38595. $ctx2.sendIdx["nextPutAll:"]=9;
  38596. return $17;
  38597. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38598. }),(function(){
  38599. return $core.withContext(function($ctx2) {
  38600. return self._nextPutAll_(",");
  38601. $ctx2.sendIdx["nextPutAll:"]=10;
  38602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38603. }));
  38604. self._nextPutAll_("},");
  38605. $ctx1.sendIdx["nextPutAll:"]=11;
  38606. $23=$recv(anIRClosure)._scope();
  38607. $ctx1.sendIdx["scope"]=4;
  38608. $22=$recv($23)._outerScope();
  38609. $21=$recv($22)._alias();
  38610. $20=$recv($21).__comma(",");
  38611. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  38612. $ctx1.sendIdx[","]=7;
  38613. $18=$recv($19).__comma(")});");
  38614. $ctx1.sendIdx[","]=6;
  38615. self._nextPutAll_($18);
  38616. $ctx1.sendIdx["nextPutAll:"]=12;
  38617. self._lf();
  38618. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38619. return self;
  38620. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  38621. },
  38622. args: ["anIRClosure", "aBlock"],
  38623. 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);'",
  38624. referencedClasses: [],
  38625. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  38626. }),
  38627. $globals.JSStream);
  38628. $core.addMethod(
  38629. $core.method({
  38630. selector: "nextPutClosureWith:arguments:",
  38631. protocol: 'streaming',
  38632. fn: function (aBlock,anArray){
  38633. var self=this;
  38634. return $core.withContext(function($ctx1) {
  38635. var $1,$2,$3;
  38636. $recv(self["@stream"])._nextPutAll_("(function(");
  38637. $ctx1.sendIdx["nextPutAll:"]=1;
  38638. $recv(anArray)._do_separatedBy_((function(each){
  38639. return $core.withContext(function($ctx2) {
  38640. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  38641. $ctx2.sendIdx["nextPutAll:"]=2;
  38642. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38643. }),(function(){
  38644. return $core.withContext(function($ctx2) {
  38645. return $recv(self["@stream"])._nextPut_(",");
  38646. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38647. }));
  38648. $1=self["@stream"];
  38649. $recv($1)._nextPutAll_("){");
  38650. $ctx1.sendIdx["nextPutAll:"]=3;
  38651. $2=$recv($1)._lf();
  38652. $ctx1.sendIdx["lf"]=1;
  38653. $recv(aBlock)._value();
  38654. $3=self["@stream"];
  38655. $recv($3)._lf();
  38656. $recv($3)._nextPutAll_("})");
  38657. return self;
  38658. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  38659. },
  38660. args: ["aBlock", "anArray"],
  38661. 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: '})'",
  38662. referencedClasses: [],
  38663. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  38664. }),
  38665. $globals.JSStream);
  38666. $core.addMethod(
  38667. $core.method({
  38668. selector: "nextPutContextFor:during:",
  38669. protocol: 'streaming',
  38670. fn: function (aMethod,aBlock){
  38671. var self=this;
  38672. return $core.withContext(function($ctx1) {
  38673. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  38674. $1=$recv(aMethod)._requiresSmalltalkContext();
  38675. if(!$core.assert($1)){
  38676. $2=$recv(aBlock)._value();
  38677. $ctx1.sendIdx["value"]=1;
  38678. return $2;
  38679. };
  38680. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38681. $ctx1.sendIdx["nextPutAll:"]=1;
  38682. self._lf();
  38683. $ctx1.sendIdx["lf"]=1;
  38684. $6=$recv(aMethod)._scope();
  38685. $ctx1.sendIdx["scope"]=1;
  38686. $5=$recv($6)._alias();
  38687. $ctx1.sendIdx["alias"]=1;
  38688. $4="return $core.withContext(function(".__comma($5);
  38689. $ctx1.sendIdx[","]=2;
  38690. $3=$recv($4).__comma(") {");
  38691. $ctx1.sendIdx[","]=1;
  38692. self._nextPutAll_($3);
  38693. $ctx1.sendIdx["nextPutAll:"]=2;
  38694. self._lf();
  38695. $ctx1.sendIdx["lf"]=2;
  38696. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38697. $ctx1.sendIdx["nextPutAll:"]=3;
  38698. $7=self._lf();
  38699. $ctx1.sendIdx["lf"]=3;
  38700. $recv(aBlock)._value();
  38701. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38702. $ctx1.sendIdx["nextPutAll:"]=4;
  38703. self._lf();
  38704. $ctx1.sendIdx["lf"]=4;
  38705. $12=$recv(aMethod)._scope();
  38706. $ctx1.sendIdx["scope"]=2;
  38707. $11=$recv($12)._alias();
  38708. $ctx1.sendIdx["alias"]=2;
  38709. $10="}, function(".__comma($11);
  38710. $ctx1.sendIdx[","]=5;
  38711. $9=$recv($10).__comma(") {");
  38712. $ctx1.sendIdx[","]=4;
  38713. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  38714. $ctx1.sendIdx[","]=3;
  38715. self._nextPutAll_($8);
  38716. $ctx1.sendIdx["nextPutAll:"]=5;
  38717. $16=$recv($recv(aMethod)._selector())._asJavascript();
  38718. $ctx1.sendIdx["asJavascript"]=1;
  38719. $15=".fill(self,".__comma($16);
  38720. $14=$recv($15).__comma(",{");
  38721. $ctx1.sendIdx[","]=6;
  38722. $13=self._nextPutAll_($14);
  38723. $ctx1.sendIdx["nextPutAll:"]=6;
  38724. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  38725. return $core.withContext(function($ctx2) {
  38726. $17=$recv(each)._asVariableName();
  38727. $ctx2.sendIdx["asVariableName"]=1;
  38728. self._nextPutAll_($17);
  38729. $ctx2.sendIdx["nextPutAll:"]=7;
  38730. self._nextPutAll_(":");
  38731. $ctx2.sendIdx["nextPutAll:"]=8;
  38732. $18=self._nextPutAll_($recv(each)._asVariableName());
  38733. $ctx2.sendIdx["nextPutAll:"]=9;
  38734. return $18;
  38735. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38736. }),(function(){
  38737. return $core.withContext(function($ctx2) {
  38738. return self._nextPutAll_(",");
  38739. $ctx2.sendIdx["nextPutAll:"]=10;
  38740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38741. }));
  38742. self._nextPutAll_("},");
  38743. $ctx1.sendIdx["nextPutAll:"]=11;
  38744. self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavascript());
  38745. $ctx1.sendIdx["nextPutAll:"]=12;
  38746. self._nextPutAll_(")});");
  38747. $ctx1.sendIdx["nextPutAll:"]=13;
  38748. self._lf();
  38749. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38750. return self;
  38751. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  38752. },
  38753. args: ["aMethod", "aBlock"],
  38754. 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);'",
  38755. referencedClasses: [],
  38756. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  38757. }),
  38758. $globals.JSStream);
  38759. $core.addMethod(
  38760. $core.method({
  38761. selector: "nextPutFunctionWith:arguments:",
  38762. protocol: 'streaming',
  38763. fn: function (aBlock,anArray){
  38764. var self=this;
  38765. return $core.withContext(function($ctx1) {
  38766. var $1,$2,$3,$4,$5;
  38767. $recv(self["@stream"])._nextPutAll_("fn: function(");
  38768. $ctx1.sendIdx["nextPutAll:"]=1;
  38769. $recv(anArray)._do_separatedBy_((function(each){
  38770. return $core.withContext(function($ctx2) {
  38771. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  38772. $ctx2.sendIdx["nextPutAll:"]=2;
  38773. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38774. }),(function(){
  38775. return $core.withContext(function($ctx2) {
  38776. return $recv(self["@stream"])._nextPut_(",");
  38777. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38778. }));
  38779. $1=self["@stream"];
  38780. $recv($1)._nextPutAll_("){");
  38781. $ctx1.sendIdx["nextPutAll:"]=3;
  38782. $2=$recv($1)._lf();
  38783. $ctx1.sendIdx["lf"]=1;
  38784. $3=self["@stream"];
  38785. $recv($3)._nextPutAll_("var self=this;");
  38786. $ctx1.sendIdx["nextPutAll:"]=4;
  38787. $4=$recv($3)._lf();
  38788. $ctx1.sendIdx["lf"]=2;
  38789. $recv(aBlock)._value();
  38790. $5=self["@stream"];
  38791. $recv($5)._lf();
  38792. $recv($5)._nextPutAll_("}");
  38793. return self;
  38794. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  38795. },
  38796. args: ["aBlock", "anArray"],
  38797. 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: '}'",
  38798. referencedClasses: [],
  38799. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  38800. }),
  38801. $globals.JSStream);
  38802. $core.addMethod(
  38803. $core.method({
  38804. selector: "nextPutIf:then:",
  38805. protocol: 'streaming',
  38806. fn: function (aBlock,anotherBlock){
  38807. var self=this;
  38808. return $core.withContext(function($ctx1) {
  38809. var $1;
  38810. $recv(self["@stream"])._nextPutAll_("if(");
  38811. $ctx1.sendIdx["nextPutAll:"]=1;
  38812. $recv(aBlock)._value();
  38813. $ctx1.sendIdx["value"]=1;
  38814. $1=self["@stream"];
  38815. $recv($1)._nextPutAll_("){");
  38816. $ctx1.sendIdx["nextPutAll:"]=2;
  38817. $recv($1)._lf();
  38818. $recv(anotherBlock)._value();
  38819. $recv(self["@stream"])._nextPutAll_("}");
  38820. return self;
  38821. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  38822. },
  38823. args: ["aBlock", "anotherBlock"],
  38824. source: "nextPutIf: aBlock then: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  38825. referencedClasses: [],
  38826. messageSends: ["nextPutAll:", "value", "lf"]
  38827. }),
  38828. $globals.JSStream);
  38829. $core.addMethod(
  38830. $core.method({
  38831. selector: "nextPutIf:then:else:",
  38832. protocol: 'streaming',
  38833. fn: function (aBlock,ifBlock,elseBlock){
  38834. var self=this;
  38835. return $core.withContext(function($ctx1) {
  38836. var $1,$2,$3;
  38837. $recv(self["@stream"])._nextPutAll_("if(");
  38838. $ctx1.sendIdx["nextPutAll:"]=1;
  38839. $recv(aBlock)._value();
  38840. $ctx1.sendIdx["value"]=1;
  38841. $1=self["@stream"];
  38842. $recv($1)._nextPutAll_("){");
  38843. $ctx1.sendIdx["nextPutAll:"]=2;
  38844. $2=$recv($1)._lf();
  38845. $ctx1.sendIdx["lf"]=1;
  38846. $recv(ifBlock)._value();
  38847. $ctx1.sendIdx["value"]=2;
  38848. $3=self["@stream"];
  38849. $recv($3)._nextPutAll_("} else {");
  38850. $ctx1.sendIdx["nextPutAll:"]=3;
  38851. $recv($3)._lf();
  38852. $recv(elseBlock)._value();
  38853. $recv(self["@stream"])._nextPutAll_("}");
  38854. return self;
  38855. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  38856. },
  38857. args: ["aBlock", "ifBlock", "elseBlock"],
  38858. 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: '}'",
  38859. referencedClasses: [],
  38860. messageSends: ["nextPutAll:", "value", "lf"]
  38861. }),
  38862. $globals.JSStream);
  38863. $core.addMethod(
  38864. $core.method({
  38865. selector: "nextPutMethodDeclaration:with:",
  38866. protocol: 'streaming',
  38867. fn: function (aMethod,aBlock){
  38868. var self=this;
  38869. return $core.withContext(function($ctx1) {
  38870. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  38871. $1=self["@stream"];
  38872. $recv($1)._nextPutAll_("$core.method({");
  38873. $ctx1.sendIdx["nextPutAll:"]=1;
  38874. $recv($1)._lf();
  38875. $ctx1.sendIdx["lf"]=1;
  38876. $4=$recv($recv(aMethod)._selector())._asJavascript();
  38877. $ctx1.sendIdx["asJavascript"]=1;
  38878. $3="selector: ".__comma($4);
  38879. $ctx1.sendIdx[","]=2;
  38880. $2=$recv($3).__comma(",");
  38881. $ctx1.sendIdx[","]=1;
  38882. $recv($1)._nextPutAll_($2);
  38883. $ctx1.sendIdx["nextPutAll:"]=2;
  38884. $recv($1)._lf();
  38885. $ctx1.sendIdx["lf"]=2;
  38886. $7=$recv($recv(aMethod)._source())._asJavascript();
  38887. $ctx1.sendIdx["asJavascript"]=2;
  38888. $6="source: ".__comma($7);
  38889. $ctx1.sendIdx[","]=4;
  38890. $5=$recv($6).__comma(",");
  38891. $ctx1.sendIdx[","]=3;
  38892. $recv($1)._nextPutAll_($5);
  38893. $ctx1.sendIdx["nextPutAll:"]=3;
  38894. $8=$recv($1)._lf();
  38895. $ctx1.sendIdx["lf"]=3;
  38896. $recv(aBlock)._value();
  38897. $ctx1.sendIdx["value"]=1;
  38898. $9=self["@stream"];
  38899. $12=$recv($globals.String)._lf();
  38900. $ctx1.sendIdx["lf"]=4;
  38901. $11=",".__comma($12);
  38902. $ctx1.sendIdx[","]=6;
  38903. $10=$recv($11).__comma("messageSends: ");
  38904. $ctx1.sendIdx[","]=5;
  38905. $recv($9)._nextPutAll_($10);
  38906. $ctx1.sendIdx["nextPutAll:"]=4;
  38907. $15=$recv($recv(aMethod)._messageSends())._asArray();
  38908. $ctx1.sendIdx["asArray"]=1;
  38909. $14=$recv($15)._asJavascript();
  38910. $ctx1.sendIdx["asJavascript"]=3;
  38911. $13=$recv($14).__comma(",");
  38912. $ctx1.sendIdx[","]=7;
  38913. $recv($9)._nextPutAll_($13);
  38914. $ctx1.sendIdx["nextPutAll:"]=5;
  38915. $recv($9)._lf();
  38916. $ctx1.sendIdx["lf"]=5;
  38917. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  38918. return $core.withContext(function($ctx2) {
  38919. return $recv(each)._value();
  38920. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38921. })))._asArray())._asJavascript();
  38922. $ctx1.sendIdx["asJavascript"]=4;
  38923. $17="args: ".__comma($18);
  38924. $16=$recv($17).__comma(",");
  38925. $ctx1.sendIdx[","]=8;
  38926. $recv($9)._nextPutAll_($16);
  38927. $ctx1.sendIdx["nextPutAll:"]=6;
  38928. $recv($9)._lf();
  38929. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  38930. $ctx1.sendIdx["nextPutAll:"]=7;
  38931. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  38932. return $core.withContext(function($ctx2) {
  38933. return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavascript());
  38934. $ctx2.sendIdx["nextPutAll:"]=8;
  38935. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38936. }),(function(){
  38937. return $core.withContext(function($ctx2) {
  38938. return $recv(self["@stream"])._nextPutAll_(",");
  38939. $ctx2.sendIdx["nextPutAll:"]=9;
  38940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38941. }));
  38942. $20=self["@stream"];
  38943. $recv($20)._nextPutAll_("]");
  38944. $ctx1.sendIdx["nextPutAll:"]=10;
  38945. $recv($20)._nextPutAll_("})");
  38946. return self;
  38947. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  38948. },
  38949. args: ["aMethod", "aBlock"],
  38950. 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: '})'",
  38951. referencedClasses: ["String"],
  38952. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  38953. }),
  38954. $globals.JSStream);
  38955. $core.addMethod(
  38956. $core.method({
  38957. selector: "nextPutNonLocalReturnHandlingWith:",
  38958. protocol: 'streaming',
  38959. fn: function (aBlock){
  38960. var self=this;
  38961. return $core.withContext(function($ctx1) {
  38962. var $1,$2,$3;
  38963. $1=self["@stream"];
  38964. $recv($1)._nextPutAll_("var $early={};");
  38965. $ctx1.sendIdx["nextPutAll:"]=1;
  38966. $recv($1)._lf();
  38967. $ctx1.sendIdx["lf"]=1;
  38968. $recv($1)._nextPutAll_("try {");
  38969. $ctx1.sendIdx["nextPutAll:"]=2;
  38970. $2=$recv($1)._lf();
  38971. $ctx1.sendIdx["lf"]=2;
  38972. $recv(aBlock)._value();
  38973. $3=self["@stream"];
  38974. $recv($3)._nextPutAll_("}");
  38975. $ctx1.sendIdx["nextPutAll:"]=3;
  38976. $recv($3)._lf();
  38977. $ctx1.sendIdx["lf"]=3;
  38978. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  38979. $recv($3)._lf();
  38980. return self;
  38981. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  38982. },
  38983. args: ["aBlock"],
  38984. 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",
  38985. referencedClasses: [],
  38986. messageSends: ["nextPutAll:", "lf", "value"]
  38987. }),
  38988. $globals.JSStream);
  38989. $core.addMethod(
  38990. $core.method({
  38991. selector: "nextPutNonLocalReturnWith:",
  38992. protocol: 'streaming',
  38993. fn: function (aBlock){
  38994. var self=this;
  38995. return $core.withContext(function($ctx1) {
  38996. $recv(self["@stream"])._nextPutAll_("throw $early=[");
  38997. $ctx1.sendIdx["nextPutAll:"]=1;
  38998. $recv(aBlock)._value();
  38999. $recv(self["@stream"])._nextPutAll_("]");
  39000. return self;
  39001. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  39002. },
  39003. args: ["aBlock"],
  39004. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  39005. referencedClasses: [],
  39006. messageSends: ["nextPutAll:", "value"]
  39007. }),
  39008. $globals.JSStream);
  39009. $core.addMethod(
  39010. $core.method({
  39011. selector: "nextPutReturnWith:",
  39012. protocol: 'streaming',
  39013. fn: function (aBlock){
  39014. var self=this;
  39015. return $core.withContext(function($ctx1) {
  39016. $recv(self["@stream"])._nextPutAll_("return ");
  39017. $recv(aBlock)._value();
  39018. return self;
  39019. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  39020. },
  39021. args: ["aBlock"],
  39022. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  39023. referencedClasses: [],
  39024. messageSends: ["nextPutAll:", "value"]
  39025. }),
  39026. $globals.JSStream);
  39027. $core.addMethod(
  39028. $core.method({
  39029. selector: "nextPutSendIndexFor:",
  39030. protocol: 'streaming',
  39031. fn: function (anIRSend){
  39032. var self=this;
  39033. return $core.withContext(function($ctx1) {
  39034. self._nextPutAll_(";");
  39035. $ctx1.sendIdx["nextPutAll:"]=1;
  39036. self._lf();
  39037. $ctx1.sendIdx["lf"]=1;
  39038. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  39039. $ctx1.sendIdx["nextPutAll:"]=2;
  39040. self._lf();
  39041. $ctx1.sendIdx["lf"]=2;
  39042. self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  39043. $ctx1.sendIdx["nextPutAll:"]=3;
  39044. self._nextPutAll_(".sendIdx[");
  39045. $ctx1.sendIdx["nextPutAll:"]=4;
  39046. self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavascript());
  39047. $ctx1.sendIdx["nextPutAll:"]=5;
  39048. self._nextPutAll_("]=");
  39049. $ctx1.sendIdx["nextPutAll:"]=6;
  39050. self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  39051. $ctx1.sendIdx["nextPutAll:"]=7;
  39052. self._nextPutAll_(";");
  39053. $ctx1.sendIdx["nextPutAll:"]=8;
  39054. self._lf();
  39055. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  39056. return self;
  39057. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  39058. },
  39059. args: ["anIRSend"],
  39060. 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)'",
  39061. referencedClasses: [],
  39062. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"]
  39063. }),
  39064. $globals.JSStream);
  39065. $core.addMethod(
  39066. $core.method({
  39067. selector: "nextPutSequenceWith:",
  39068. protocol: 'streaming',
  39069. fn: function (aBlock){
  39070. var self=this;
  39071. return $core.withContext(function($ctx1) {
  39072. $recv(aBlock)._value();
  39073. return self;
  39074. }, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},$globals.JSStream)});
  39075. },
  39076. args: ["aBlock"],
  39077. source: "nextPutSequenceWith: aBlock\x0a\x09\x22stream\x0a\x09\x09nextPutAll: 'switch($core.thisContext.pc){'; lf.\x22\x0a\x09aBlock value.\x0a\x09\x22stream\x0a\x09\x09nextPutAll: '};'; lf\x22",
  39078. referencedClasses: [],
  39079. messageSends: ["value"]
  39080. }),
  39081. $globals.JSStream);
  39082. $core.addMethod(
  39083. $core.method({
  39084. selector: "nextPutStatementWith:",
  39085. protocol: 'streaming',
  39086. fn: function (aBlock){
  39087. var self=this;
  39088. return $core.withContext(function($ctx1) {
  39089. var $1;
  39090. $recv(aBlock)._value();
  39091. $1=self["@stream"];
  39092. $recv($1)._nextPutAll_(";");
  39093. $recv($1)._lf();
  39094. return self;
  39095. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  39096. },
  39097. args: ["aBlock"],
  39098. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  39099. referencedClasses: [],
  39100. messageSends: ["value", "nextPutAll:", "lf"]
  39101. }),
  39102. $globals.JSStream);
  39103. $core.addMethod(
  39104. $core.method({
  39105. selector: "nextPutVars:",
  39106. protocol: 'streaming',
  39107. fn: function (aCollection){
  39108. var self=this;
  39109. return $core.withContext(function($ctx1) {
  39110. var $1;
  39111. $recv(aCollection)._ifNotEmpty_((function(){
  39112. return $core.withContext(function($ctx2) {
  39113. $recv(self["@stream"])._nextPutAll_("var ");
  39114. $ctx2.sendIdx["nextPutAll:"]=1;
  39115. $recv(aCollection)._do_separatedBy_((function(each){
  39116. return $core.withContext(function($ctx3) {
  39117. return $recv(self["@stream"])._nextPutAll_(each);
  39118. $ctx3.sendIdx["nextPutAll:"]=2;
  39119. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39120. }),(function(){
  39121. return $core.withContext(function($ctx3) {
  39122. return $recv(self["@stream"])._nextPutAll_(",");
  39123. $ctx3.sendIdx["nextPutAll:"]=3;
  39124. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  39125. }));
  39126. $1=self["@stream"];
  39127. $recv($1)._nextPutAll_(";");
  39128. return $recv($1)._lf();
  39129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39130. }));
  39131. return self;
  39132. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  39133. },
  39134. args: ["aCollection"],
  39135. 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 ]",
  39136. referencedClasses: [],
  39137. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  39138. }),
  39139. $globals.JSStream);
  39140. $core.addMethod(
  39141. $core.method({
  39142. selector: "appendToInstruction:",
  39143. protocol: '*Compiler-IR',
  39144. fn: function (anIRInstruction){
  39145. var self=this;
  39146. return $core.withContext(function($ctx1) {
  39147. $recv(anIRInstruction)._appendBlock_(self);
  39148. return self;
  39149. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  39150. },
  39151. args: ["anIRInstruction"],
  39152. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  39153. referencedClasses: [],
  39154. messageSends: ["appendBlock:"]
  39155. }),
  39156. $globals.BlockClosure);
  39157. });
  39158. define('amber_core/Compiler-Inlining',["amber/boot", "amber_core/Compiler-Core", "amber_core/Compiler-IR", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects"], function($boot){"use strict";
  39159. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  39160. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  39161. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  39162. $core.addPackage('Compiler-Inlining');
  39163. $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  39164. $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  39165. $core.addClass('IRInlinedAssignment', $globals.IRAssignment, [], 'Compiler-Inlining');
  39166. $globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  39167. $core.addMethod(
  39168. $core.method({
  39169. selector: "accept:",
  39170. protocol: 'visiting',
  39171. fn: function (aVisitor){
  39172. var self=this;
  39173. return $core.withContext(function($ctx1) {
  39174. return $recv(aVisitor)._visitIRInlinedAssignment_(self);
  39175. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedAssignment)});
  39176. },
  39177. args: ["aVisitor"],
  39178. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  39179. referencedClasses: [],
  39180. messageSends: ["visitIRInlinedAssignment:"]
  39181. }),
  39182. $globals.IRInlinedAssignment);
  39183. $core.addMethod(
  39184. $core.method({
  39185. selector: "isInlined",
  39186. protocol: 'testing',
  39187. fn: function (){
  39188. var self=this;
  39189. return true;
  39190. },
  39191. args: [],
  39192. source: "isInlined\x0a\x09^ true",
  39193. referencedClasses: [],
  39194. messageSends: []
  39195. }),
  39196. $globals.IRInlinedAssignment);
  39197. $core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining');
  39198. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  39199. $core.addMethod(
  39200. $core.method({
  39201. selector: "accept:",
  39202. protocol: 'visiting',
  39203. fn: function (aVisitor){
  39204. var self=this;
  39205. return $core.withContext(function($ctx1) {
  39206. $recv(aVisitor)._visitIRInlinedClosure_(self);
  39207. return self;
  39208. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  39209. },
  39210. args: ["aVisitor"],
  39211. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  39212. referencedClasses: [],
  39213. messageSends: ["visitIRInlinedClosure:"]
  39214. }),
  39215. $globals.IRInlinedClosure);
  39216. $core.addMethod(
  39217. $core.method({
  39218. selector: "isInlined",
  39219. protocol: 'testing',
  39220. fn: function (){
  39221. var self=this;
  39222. return true;
  39223. },
  39224. args: [],
  39225. source: "isInlined\x0a\x09^ true",
  39226. referencedClasses: [],
  39227. messageSends: []
  39228. }),
  39229. $globals.IRInlinedClosure);
  39230. $core.addClass('IRInlinedReturn', $globals.IRReturn, [], 'Compiler-Inlining');
  39231. $globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  39232. $core.addMethod(
  39233. $core.method({
  39234. selector: "accept:",
  39235. protocol: 'visiting',
  39236. fn: function (aVisitor){
  39237. var self=this;
  39238. return $core.withContext(function($ctx1) {
  39239. return $recv(aVisitor)._visitIRInlinedReturn_(self);
  39240. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedReturn)});
  39241. },
  39242. args: ["aVisitor"],
  39243. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  39244. referencedClasses: [],
  39245. messageSends: ["visitIRInlinedReturn:"]
  39246. }),
  39247. $globals.IRInlinedReturn);
  39248. $core.addMethod(
  39249. $core.method({
  39250. selector: "isInlined",
  39251. protocol: 'testing',
  39252. fn: function (){
  39253. var self=this;
  39254. return true;
  39255. },
  39256. args: [],
  39257. source: "isInlined\x0a\x09^ true",
  39258. referencedClasses: [],
  39259. messageSends: []
  39260. }),
  39261. $globals.IRInlinedReturn);
  39262. $core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining');
  39263. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  39264. $core.addMethod(
  39265. $core.method({
  39266. selector: "accept:",
  39267. protocol: 'visiting',
  39268. fn: function (aVisitor){
  39269. var self=this;
  39270. return $core.withContext(function($ctx1) {
  39271. $recv(aVisitor)._visitInlinedSend_(self);
  39272. return self;
  39273. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  39274. },
  39275. args: ["aVisitor"],
  39276. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  39277. referencedClasses: [],
  39278. messageSends: ["visitInlinedSend:"]
  39279. }),
  39280. $globals.IRInlinedSend);
  39281. $core.addMethod(
  39282. $core.method({
  39283. selector: "internalVariables",
  39284. protocol: 'accessing',
  39285. fn: function (){
  39286. var self=this;
  39287. return [];
  39288. },
  39289. args: [],
  39290. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  39291. referencedClasses: [],
  39292. messageSends: []
  39293. }),
  39294. $globals.IRInlinedSend);
  39295. $core.addMethod(
  39296. $core.method({
  39297. selector: "isInlined",
  39298. protocol: 'testing',
  39299. fn: function (){
  39300. var self=this;
  39301. return true;
  39302. },
  39303. args: [],
  39304. source: "isInlined\x0a\x09^ true",
  39305. referencedClasses: [],
  39306. messageSends: []
  39307. }),
  39308. $globals.IRInlinedSend);
  39309. $core.addClass('IRInlinedIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39310. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  39311. $core.addMethod(
  39312. $core.method({
  39313. selector: "accept:",
  39314. protocol: 'visiting',
  39315. fn: function (aVisitor){
  39316. var self=this;
  39317. return $core.withContext(function($ctx1) {
  39318. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  39319. return self;
  39320. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  39321. },
  39322. args: ["aVisitor"],
  39323. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  39324. referencedClasses: [],
  39325. messageSends: ["visitIRInlinedIfFalse:"]
  39326. }),
  39327. $globals.IRInlinedIfFalse);
  39328. $core.addClass('IRInlinedIfNilIfNotNil', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39329. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  39330. $core.addMethod(
  39331. $core.method({
  39332. selector: "accept:",
  39333. protocol: 'visiting',
  39334. fn: function (aVisitor){
  39335. var self=this;
  39336. return $core.withContext(function($ctx1) {
  39337. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  39338. return self;
  39339. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  39340. },
  39341. args: ["aVisitor"],
  39342. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  39343. referencedClasses: [],
  39344. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  39345. }),
  39346. $globals.IRInlinedIfNilIfNotNil);
  39347. $core.addMethod(
  39348. $core.method({
  39349. selector: "internalVariables",
  39350. protocol: 'accessing',
  39351. fn: function (){
  39352. var self=this;
  39353. return $core.withContext(function($ctx1) {
  39354. return $recv($globals.Array)._with_(self._receiverInternalVariable());
  39355. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  39356. },
  39357. args: [],
  39358. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  39359. referencedClasses: ["Array"],
  39360. messageSends: ["with:", "receiverInternalVariable"]
  39361. }),
  39362. $globals.IRInlinedIfNilIfNotNil);
  39363. $core.addMethod(
  39364. $core.method({
  39365. selector: "receiverInternalVariable",
  39366. protocol: 'accessing',
  39367. fn: function (){
  39368. var self=this;
  39369. return $core.withContext(function($ctx1) {
  39370. var $1;
  39371. $1=$recv($globals.IRVariable)._new();
  39372. $ctx1.sendIdx["new"]=1;
  39373. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_(self._receiverInternalVariableName()));
  39374. return $recv($1)._yourself();
  39375. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  39376. },
  39377. args: [],
  39378. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  39379. referencedClasses: ["IRVariable", "AliasVar"],
  39380. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  39381. }),
  39382. $globals.IRInlinedIfNilIfNotNil);
  39383. $core.addMethod(
  39384. $core.method({
  39385. selector: "receiverInternalVariableName",
  39386. protocol: 'accessing',
  39387. fn: function (){
  39388. var self=this;
  39389. return "$receiver";
  39390. },
  39391. args: [],
  39392. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  39393. referencedClasses: [],
  39394. messageSends: []
  39395. }),
  39396. $globals.IRInlinedIfNilIfNotNil);
  39397. $core.addClass('IRInlinedIfTrue', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39398. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  39399. $core.addMethod(
  39400. $core.method({
  39401. selector: "accept:",
  39402. protocol: 'visiting',
  39403. fn: function (aVisitor){
  39404. var self=this;
  39405. return $core.withContext(function($ctx1) {
  39406. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  39407. return self;
  39408. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  39409. },
  39410. args: ["aVisitor"],
  39411. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  39412. referencedClasses: [],
  39413. messageSends: ["visitIRInlinedIfTrue:"]
  39414. }),
  39415. $globals.IRInlinedIfTrue);
  39416. $core.addClass('IRInlinedIfTrueIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39417. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  39418. $core.addMethod(
  39419. $core.method({
  39420. selector: "accept:",
  39421. protocol: 'visiting',
  39422. fn: function (aVisitor){
  39423. var self=this;
  39424. return $core.withContext(function($ctx1) {
  39425. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  39426. return self;
  39427. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  39428. },
  39429. args: ["aVisitor"],
  39430. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  39431. referencedClasses: [],
  39432. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  39433. }),
  39434. $globals.IRInlinedIfTrueIfFalse);
  39435. $core.addClass('IRInlinedSequence', $globals.IRBlockSequence, [], 'Compiler-Inlining');
  39436. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  39437. $core.addMethod(
  39438. $core.method({
  39439. selector: "accept:",
  39440. protocol: 'visiting',
  39441. fn: function (aVisitor){
  39442. var self=this;
  39443. return $core.withContext(function($ctx1) {
  39444. $recv(aVisitor)._visitIRInlinedSequence_(self);
  39445. return self;
  39446. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  39447. },
  39448. args: ["aVisitor"],
  39449. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  39450. referencedClasses: [],
  39451. messageSends: ["visitIRInlinedSequence:"]
  39452. }),
  39453. $globals.IRInlinedSequence);
  39454. $core.addMethod(
  39455. $core.method({
  39456. selector: "isInlined",
  39457. protocol: 'testing',
  39458. fn: function (){
  39459. var self=this;
  39460. return true;
  39461. },
  39462. args: [],
  39463. source: "isInlined\x0a\x09^ true",
  39464. referencedClasses: [],
  39465. messageSends: []
  39466. }),
  39467. $globals.IRInlinedSequence);
  39468. $core.addClass('IRInliner', $globals.IRVisitor, [], 'Compiler-Inlining');
  39469. $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`";
  39470. $core.addMethod(
  39471. $core.method({
  39472. selector: "assignmentInliner",
  39473. protocol: 'factory',
  39474. fn: function (){
  39475. var self=this;
  39476. return $core.withContext(function($ctx1) {
  39477. var $1;
  39478. $1=$recv($globals.IRAssignmentInliner)._new();
  39479. $recv($1)._translator_(self);
  39480. return $recv($1)._yourself();
  39481. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  39482. },
  39483. args: [],
  39484. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39485. referencedClasses: ["IRAssignmentInliner"],
  39486. messageSends: ["translator:", "new", "yourself"]
  39487. }),
  39488. $globals.IRInliner);
  39489. $core.addMethod(
  39490. $core.method({
  39491. selector: "returnInliner",
  39492. protocol: 'factory',
  39493. fn: function (){
  39494. var self=this;
  39495. return $core.withContext(function($ctx1) {
  39496. var $1;
  39497. $1=$recv($globals.IRReturnInliner)._new();
  39498. $recv($1)._translator_(self);
  39499. return $recv($1)._yourself();
  39500. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  39501. },
  39502. args: [],
  39503. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39504. referencedClasses: ["IRReturnInliner"],
  39505. messageSends: ["translator:", "new", "yourself"]
  39506. }),
  39507. $globals.IRInliner);
  39508. $core.addMethod(
  39509. $core.method({
  39510. selector: "sendInliner",
  39511. protocol: 'factory',
  39512. fn: function (){
  39513. var self=this;
  39514. return $core.withContext(function($ctx1) {
  39515. var $1;
  39516. $1=$recv($globals.IRSendInliner)._new();
  39517. $recv($1)._translator_(self);
  39518. return $recv($1)._yourself();
  39519. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  39520. },
  39521. args: [],
  39522. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39523. referencedClasses: ["IRSendInliner"],
  39524. messageSends: ["translator:", "new", "yourself"]
  39525. }),
  39526. $globals.IRInliner);
  39527. $core.addMethod(
  39528. $core.method({
  39529. selector: "shouldInlineAssignment:",
  39530. protocol: 'testing',
  39531. fn: function (anIRAssignment){
  39532. var self=this;
  39533. return $core.withContext(function($ctx1) {
  39534. var $3,$2,$1;
  39535. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  39536. return $core.withContext(function($ctx2) {
  39537. $3=$recv(anIRAssignment)._right();
  39538. $ctx2.sendIdx["right"]=1;
  39539. $2=$recv($3)._isSend();
  39540. return $recv($2)._and_((function(){
  39541. return $core.withContext(function($ctx3) {
  39542. return self._shouldInlineSend_($recv(anIRAssignment)._right());
  39543. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39544. }));
  39545. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39546. }));
  39547. $ctx1.sendIdx["and:"]=1;
  39548. return $1;
  39549. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  39550. },
  39551. args: ["anIRAssignment"],
  39552. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  39553. referencedClasses: [],
  39554. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  39555. }),
  39556. $globals.IRInliner);
  39557. $core.addMethod(
  39558. $core.method({
  39559. selector: "shouldInlineReturn:",
  39560. protocol: 'testing',
  39561. fn: function (anIRReturn){
  39562. var self=this;
  39563. return $core.withContext(function($ctx1) {
  39564. var $1;
  39565. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  39566. return $core.withContext(function($ctx2) {
  39567. return $recv($recv($recv($recv(anIRReturn)._instructions())._single())._isSend())._and_((function(){
  39568. return $core.withContext(function($ctx3) {
  39569. return self._shouldInlineSend_($recv(anIRReturn)._expression());
  39570. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39571. }));
  39572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39573. }));
  39574. $ctx1.sendIdx["and:"]=1;
  39575. return $1;
  39576. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  39577. },
  39578. args: ["anIRReturn"],
  39579. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions single isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  39580. referencedClasses: [],
  39581. messageSends: ["and:", "not", "isInlined", "isSend", "single", "instructions", "shouldInlineSend:", "expression"]
  39582. }),
  39583. $globals.IRInliner);
  39584. $core.addMethod(
  39585. $core.method({
  39586. selector: "shouldInlineSend:",
  39587. protocol: 'testing',
  39588. fn: function (anIRSend){
  39589. var self=this;
  39590. return $core.withContext(function($ctx1) {
  39591. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  39592. return $core.withContext(function($ctx2) {
  39593. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  39594. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39595. }));
  39596. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  39597. },
  39598. args: ["anIRSend"],
  39599. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  39600. referencedClasses: ["IRSendInliner"],
  39601. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  39602. }),
  39603. $globals.IRInliner);
  39604. $core.addMethod(
  39605. $core.method({
  39606. selector: "transformNonLocalReturn:",
  39607. protocol: 'visiting',
  39608. fn: function (anIRNonLocalReturn){
  39609. var self=this;
  39610. var localReturn;
  39611. return $core.withContext(function($ctx1) {
  39612. var $2,$1,$4,$3,$5,$6,$7;
  39613. $2=$recv(anIRNonLocalReturn)._scope();
  39614. $ctx1.sendIdx["scope"]=1;
  39615. $1=$recv($2)._canInlineNonLocalReturns();
  39616. if($core.assert($1)){
  39617. $4=$recv(anIRNonLocalReturn)._scope();
  39618. $ctx1.sendIdx["scope"]=2;
  39619. $3=$recv($4)._methodScope();
  39620. $5=$recv(anIRNonLocalReturn)._scope();
  39621. $ctx1.sendIdx["scope"]=3;
  39622. $recv($3)._removeNonLocalReturn_($5);
  39623. $6=$recv($globals.IRReturn)._new();
  39624. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  39625. localReturn=$recv($6)._yourself();
  39626. localReturn;
  39627. $recv($recv(anIRNonLocalReturn)._instructions())._do_((function(each){
  39628. return $core.withContext(function($ctx2) {
  39629. return $recv(localReturn)._add_(each);
  39630. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39631. }));
  39632. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  39633. return localReturn;
  39634. };
  39635. $7=(
  39636. $ctx1.supercall = true,
  39637. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  39638. $ctx1.supercall = false;
  39639. return $7;
  39640. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  39641. },
  39642. args: ["anIRNonLocalReturn"],
  39643. source: "transformNonLocalReturn: anIRNonLocalReturn\x0a\x09\x22Replace a non local return into a local return\x22\x0a\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 instructions do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ localReturn ].\x0a\x09^ super visitIRNonLocalReturn: anIRNonLocalReturn",
  39644. referencedClasses: ["IRReturn"],
  39645. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"]
  39646. }),
  39647. $globals.IRInliner);
  39648. $core.addMethod(
  39649. $core.method({
  39650. selector: "visitIRAssignment:",
  39651. protocol: 'visiting',
  39652. fn: function (anIRAssignment){
  39653. var self=this;
  39654. return $core.withContext(function($ctx1) {
  39655. var $1;
  39656. $1=self._shouldInlineAssignment_(anIRAssignment);
  39657. if($core.assert($1)){
  39658. return $recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  39659. } else {
  39660. return (
  39661. $ctx1.supercall = true,
  39662. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment]));
  39663. $ctx1.supercall = false;
  39664. };
  39665. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  39666. },
  39667. args: ["anIRAssignment"],
  39668. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  39669. referencedClasses: [],
  39670. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  39671. }),
  39672. $globals.IRInliner);
  39673. $core.addMethod(
  39674. $core.method({
  39675. selector: "visitIRNonLocalReturn:",
  39676. protocol: 'visiting',
  39677. fn: function (anIRNonLocalReturn){
  39678. var self=this;
  39679. return $core.withContext(function($ctx1) {
  39680. return self._transformNonLocalReturn_(anIRNonLocalReturn);
  39681. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRInliner)});
  39682. },
  39683. args: ["anIRNonLocalReturn"],
  39684. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  39685. referencedClasses: [],
  39686. messageSends: ["transformNonLocalReturn:"]
  39687. }),
  39688. $globals.IRInliner);
  39689. $core.addMethod(
  39690. $core.method({
  39691. selector: "visitIRReturn:",
  39692. protocol: 'visiting',
  39693. fn: function (anIRReturn){
  39694. var self=this;
  39695. return $core.withContext(function($ctx1) {
  39696. var $1;
  39697. $1=self._shouldInlineReturn_(anIRReturn);
  39698. if($core.assert($1)){
  39699. return $recv(self._returnInliner())._inlineReturn_(anIRReturn);
  39700. } else {
  39701. return (
  39702. $ctx1.supercall = true,
  39703. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  39704. $ctx1.supercall = false;
  39705. };
  39706. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  39707. },
  39708. args: ["anIRReturn"],
  39709. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  39710. referencedClasses: [],
  39711. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  39712. }),
  39713. $globals.IRInliner);
  39714. $core.addMethod(
  39715. $core.method({
  39716. selector: "visitIRSend:",
  39717. protocol: 'visiting',
  39718. fn: function (anIRSend){
  39719. var self=this;
  39720. return $core.withContext(function($ctx1) {
  39721. var $1;
  39722. $1=self._shouldInlineSend_(anIRSend);
  39723. if($core.assert($1)){
  39724. return $recv(self._sendInliner())._inlineSend_(anIRSend);
  39725. } else {
  39726. return (
  39727. $ctx1.supercall = true,
  39728. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($recv(self), [anIRSend]));
  39729. $ctx1.supercall = false;
  39730. };
  39731. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  39732. },
  39733. args: ["anIRSend"],
  39734. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  39735. referencedClasses: [],
  39736. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  39737. }),
  39738. $globals.IRInliner);
  39739. $core.addClass('IRInliningJSTranslator', $globals.IRJSTranslator, [], 'Compiler-Inlining');
  39740. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  39741. $core.addMethod(
  39742. $core.method({
  39743. selector: "visitIRInlinedAssignment:",
  39744. protocol: 'visiting',
  39745. fn: function (anIRInlinedAssignment){
  39746. var self=this;
  39747. return $core.withContext(function($ctx1) {
  39748. self._visit_($recv(anIRInlinedAssignment)._right());
  39749. return self;
  39750. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},$globals.IRInliningJSTranslator)});
  39751. },
  39752. args: ["anIRInlinedAssignment"],
  39753. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment right",
  39754. referencedClasses: [],
  39755. messageSends: ["visit:", "right"]
  39756. }),
  39757. $globals.IRInliningJSTranslator);
  39758. $core.addMethod(
  39759. $core.method({
  39760. selector: "visitIRInlinedClosure:",
  39761. protocol: 'visiting',
  39762. fn: function (anIRInlinedClosure){
  39763. var self=this;
  39764. return $core.withContext(function($ctx1) {
  39765. $recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  39766. return $core.withContext(function($ctx2) {
  39767. return $recv($recv(each)._name())._asVariableName();
  39768. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39769. })));
  39770. $recv($recv(anIRInlinedClosure)._instructions())._do_((function(each){
  39771. return $core.withContext(function($ctx2) {
  39772. return self._visit_(each);
  39773. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39774. }));
  39775. return self;
  39776. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  39777. },
  39778. args: ["anIRInlinedClosure"],
  39779. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09anIRInlinedClosure instructions do: [ :each |\x0a\x09\x09self visit: each ]",
  39780. referencedClasses: [],
  39781. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"]
  39782. }),
  39783. $globals.IRInliningJSTranslator);
  39784. $core.addMethod(
  39785. $core.method({
  39786. selector: "visitIRInlinedIfFalse:",
  39787. protocol: 'visiting',
  39788. fn: function (anIRInlinedIfFalse){
  39789. var self=this;
  39790. return $core.withContext(function($ctx1) {
  39791. var $1,$2,$4,$3;
  39792. $1=self._stream();
  39793. $ctx1.sendIdx["stream"]=1;
  39794. $recv($1)._nextPutIf_then_((function(){
  39795. return $core.withContext(function($ctx2) {
  39796. $2=self._stream();
  39797. $ctx2.sendIdx["stream"]=2;
  39798. $recv($2)._nextPutAll_("!$core.assert(");
  39799. $ctx2.sendIdx["nextPutAll:"]=1;
  39800. $4=$recv(anIRInlinedIfFalse)._instructions();
  39801. $ctx2.sendIdx["instructions"]=1;
  39802. $3=$recv($4)._first();
  39803. self._visit_($3);
  39804. $ctx2.sendIdx["visit:"]=1;
  39805. return $recv(self._stream())._nextPutAll_(")");
  39806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39807. }),(function(){
  39808. return $core.withContext(function($ctx2) {
  39809. return self._visit_($recv($recv(anIRInlinedIfFalse)._instructions())._last());
  39810. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39811. }));
  39812. return self;
  39813. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  39814. },
  39815. args: ["anIRInlinedIfFalse"],
  39816. source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '!$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfFalse instructions last ]",
  39817. referencedClasses: [],
  39818. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  39819. }),
  39820. $globals.IRInliningJSTranslator);
  39821. $core.addMethod(
  39822. $core.method({
  39823. selector: "visitIRInlinedIfNilIfNotNil:",
  39824. protocol: 'visiting',
  39825. fn: function (anIRInlinedIfNilIfNotNil){
  39826. var self=this;
  39827. return $core.withContext(function($ctx1) {
  39828. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  39829. $1=self._stream();
  39830. $ctx1.sendIdx["stream"]=1;
  39831. $recv($1)._nextPutIf_then_else_((function(){
  39832. var recvVarName;
  39833. return $core.withContext(function($ctx2) {
  39834. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  39835. recvVarName;
  39836. $2=self._stream();
  39837. $ctx2.sendIdx["stream"]=2;
  39838. $4="(".__comma(recvVarName);
  39839. $ctx2.sendIdx[","]=2;
  39840. $3=$recv($4).__comma(" = ");
  39841. $ctx2.sendIdx[","]=1;
  39842. $recv($2)._nextPutAll_($3);
  39843. $ctx2.sendIdx["nextPutAll:"]=1;
  39844. $6=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  39845. $ctx2.sendIdx["instructions"]=1;
  39846. $5=$recv($6)._first();
  39847. self._visit_($5);
  39848. $ctx2.sendIdx["visit:"]=1;
  39849. $7=self._stream();
  39850. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".isNil");
  39851. $ctx2.sendIdx[","]=3;
  39852. return $recv($7)._nextPutAll_($8);
  39853. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  39854. }),(function(){
  39855. return $core.withContext(function($ctx2) {
  39856. $10=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  39857. $ctx2.sendIdx["instructions"]=2;
  39858. $9=$recv($10)._second();
  39859. return self._visit_($9);
  39860. $ctx2.sendIdx["visit:"]=2;
  39861. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39862. }),(function(){
  39863. return $core.withContext(function($ctx2) {
  39864. return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._instructions())._third());
  39865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39866. }));
  39867. return self;
  39868. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  39869. },
  39870. args: ["anIRInlinedIfNilIfNotNil"],
  39871. 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 instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == null || ', recvVarName, '.isNil' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
  39872. referencedClasses: [],
  39873. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "instructions", "second", "third"]
  39874. }),
  39875. $globals.IRInliningJSTranslator);
  39876. $core.addMethod(
  39877. $core.method({
  39878. selector: "visitIRInlinedIfTrue:",
  39879. protocol: 'visiting',
  39880. fn: function (anIRInlinedIfTrue){
  39881. var self=this;
  39882. return $core.withContext(function($ctx1) {
  39883. var $1,$2,$4,$3;
  39884. $1=self._stream();
  39885. $ctx1.sendIdx["stream"]=1;
  39886. $recv($1)._nextPutIf_then_((function(){
  39887. return $core.withContext(function($ctx2) {
  39888. $2=self._stream();
  39889. $ctx2.sendIdx["stream"]=2;
  39890. $recv($2)._nextPutAll_("$core.assert(");
  39891. $ctx2.sendIdx["nextPutAll:"]=1;
  39892. $4=$recv(anIRInlinedIfTrue)._instructions();
  39893. $ctx2.sendIdx["instructions"]=1;
  39894. $3=$recv($4)._first();
  39895. self._visit_($3);
  39896. $ctx2.sendIdx["visit:"]=1;
  39897. return $recv(self._stream())._nextPutAll_(")");
  39898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39899. }),(function(){
  39900. return $core.withContext(function($ctx2) {
  39901. return self._visit_($recv($recv(anIRInlinedIfTrue)._instructions())._last());
  39902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39903. }));
  39904. return self;
  39905. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  39906. },
  39907. args: ["anIRInlinedIfTrue"],
  39908. source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrue instructions last ]",
  39909. referencedClasses: [],
  39910. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  39911. }),
  39912. $globals.IRInliningJSTranslator);
  39913. $core.addMethod(
  39914. $core.method({
  39915. selector: "visitIRInlinedIfTrueIfFalse:",
  39916. protocol: 'visiting',
  39917. fn: function (anIRInlinedIfTrueIfFalse){
  39918. var self=this;
  39919. return $core.withContext(function($ctx1) {
  39920. var $1,$2,$4,$3,$6,$5;
  39921. $1=self._stream();
  39922. $ctx1.sendIdx["stream"]=1;
  39923. $recv($1)._nextPutIf_then_else_((function(){
  39924. return $core.withContext(function($ctx2) {
  39925. $2=self._stream();
  39926. $ctx2.sendIdx["stream"]=2;
  39927. $recv($2)._nextPutAll_("$core.assert(");
  39928. $ctx2.sendIdx["nextPutAll:"]=1;
  39929. $4=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  39930. $ctx2.sendIdx["instructions"]=1;
  39931. $3=$recv($4)._first();
  39932. self._visit_($3);
  39933. $ctx2.sendIdx["visit:"]=1;
  39934. return $recv(self._stream())._nextPutAll_(")");
  39935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39936. }),(function(){
  39937. return $core.withContext(function($ctx2) {
  39938. $6=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  39939. $ctx2.sendIdx["instructions"]=2;
  39940. $5=$recv($6)._second();
  39941. return self._visit_($5);
  39942. $ctx2.sendIdx["visit:"]=2;
  39943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39944. }),(function(){
  39945. return $core.withContext(function($ctx2) {
  39946. return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._instructions())._third());
  39947. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39948. }));
  39949. return self;
  39950. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  39951. },
  39952. args: ["anIRInlinedIfTrueIfFalse"],
  39953. source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfTrueIfFalse instructions third ]",
  39954. referencedClasses: [],
  39955. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"]
  39956. }),
  39957. $globals.IRInliningJSTranslator);
  39958. $core.addMethod(
  39959. $core.method({
  39960. selector: "visitIRInlinedNonLocalReturn:",
  39961. protocol: 'visiting',
  39962. fn: function (anIRInlinedReturn){
  39963. var self=this;
  39964. return $core.withContext(function($ctx1) {
  39965. var $1;
  39966. $1=self._stream();
  39967. $ctx1.sendIdx["stream"]=1;
  39968. $recv($1)._nextPutStatementWith_((function(){
  39969. return $core.withContext(function($ctx2) {
  39970. return self._visit_($recv(anIRInlinedReturn)._expression());
  39971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39972. }));
  39973. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  39974. }));
  39975. return self;
  39976. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  39977. },
  39978. args: ["anIRInlinedReturn"],
  39979. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn expression ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  39980. referencedClasses: [],
  39981. messageSends: ["nextPutStatementWith:", "stream", "visit:", "expression", "nextPutNonLocalReturnWith:"]
  39982. }),
  39983. $globals.IRInliningJSTranslator);
  39984. $core.addMethod(
  39985. $core.method({
  39986. selector: "visitIRInlinedReturn:",
  39987. protocol: 'visiting',
  39988. fn: function (anIRInlinedReturn){
  39989. var self=this;
  39990. return $core.withContext(function($ctx1) {
  39991. self._visit_($recv(anIRInlinedReturn)._expression());
  39992. return self;
  39993. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  39994. },
  39995. args: ["anIRInlinedReturn"],
  39996. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn expression",
  39997. referencedClasses: [],
  39998. messageSends: ["visit:", "expression"]
  39999. }),
  40000. $globals.IRInliningJSTranslator);
  40001. $core.addMethod(
  40002. $core.method({
  40003. selector: "visitIRInlinedSequence:",
  40004. protocol: 'visiting',
  40005. fn: function (anIRInlinedSequence){
  40006. var self=this;
  40007. return $core.withContext(function($ctx1) {
  40008. $recv($recv(anIRInlinedSequence)._instructions())._do_((function(each){
  40009. return $core.withContext(function($ctx2) {
  40010. return $recv(self._stream())._nextPutStatementWith_((function(){
  40011. return $core.withContext(function($ctx3) {
  40012. return self._visit_(each);
  40013. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40014. }));
  40015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40016. }));
  40017. return self;
  40018. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRInliningJSTranslator)});
  40019. },
  40020. args: ["anIRInlinedSequence"],
  40021. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  40022. referencedClasses: [],
  40023. messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"]
  40024. }),
  40025. $globals.IRInliningJSTranslator);
  40026. $core.addClass('IRSendInliner', $globals.Object, ['send', 'translator'], 'Compiler-Inlining');
  40027. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  40028. $core.addMethod(
  40029. $core.method({
  40030. selector: "ifFalse:",
  40031. protocol: 'inlining',
  40032. fn: function (anIRInstruction){
  40033. var self=this;
  40034. return $core.withContext(function($ctx1) {
  40035. return self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  40036. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40037. },
  40038. args: ["anIRInstruction"],
  40039. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  40040. referencedClasses: ["IRInlinedIfFalse"],
  40041. messageSends: ["inlinedSend:withBlock:", "new"]
  40042. }),
  40043. $globals.IRSendInliner);
  40044. $core.addMethod(
  40045. $core.method({
  40046. selector: "ifFalse:ifTrue:",
  40047. protocol: 'inlining',
  40048. fn: function (anIRInstruction,anotherIRInstruction){
  40049. var self=this;
  40050. return $core.withContext(function($ctx1) {
  40051. return self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  40052. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40053. },
  40054. args: ["anIRInstruction", "anotherIRInstruction"],
  40055. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  40056. referencedClasses: [],
  40057. messageSends: ["perform:withArguments:"]
  40058. }),
  40059. $globals.IRSendInliner);
  40060. $core.addMethod(
  40061. $core.method({
  40062. selector: "ifNil:",
  40063. protocol: 'inlining',
  40064. fn: function (anIRInstruction){
  40065. var self=this;
  40066. return $core.withContext(function($ctx1) {
  40067. var $1,$3,$5,$6,$4,$2;
  40068. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  40069. $ctx1.sendIdx["new"]=1;
  40070. $3=$recv($globals.IRClosure)._new();
  40071. $ctx1.sendIdx["new"]=2;
  40072. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  40073. $5=$recv($globals.IRBlockSequence)._new();
  40074. $recv($5)._add_($recv(self._send())._receiver());
  40075. $6=$recv($5)._yourself();
  40076. $ctx1.sendIdx["yourself"]=1;
  40077. $4=$6;
  40078. $recv($3)._add_($4);
  40079. $ctx1.sendIdx["add:"]=1;
  40080. $2=$recv($3)._yourself();
  40081. return self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  40082. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40083. },
  40084. args: ["anIRInstruction"],
  40085. 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)",
  40086. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  40087. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  40088. }),
  40089. $globals.IRSendInliner);
  40090. $core.addMethod(
  40091. $core.method({
  40092. selector: "ifNil:ifNotNil:",
  40093. protocol: 'inlining',
  40094. fn: function (anIRInstruction,anotherIRInstruction){
  40095. var self=this;
  40096. return $core.withContext(function($ctx1) {
  40097. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  40098. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40099. },
  40100. args: ["anIRInstruction", "anotherIRInstruction"],
  40101. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  40102. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  40103. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40104. }),
  40105. $globals.IRSendInliner);
  40106. $core.addMethod(
  40107. $core.method({
  40108. selector: "ifNotNil:",
  40109. protocol: 'inlining',
  40110. fn: function (anIRInstruction){
  40111. var self=this;
  40112. return $core.withContext(function($ctx1) {
  40113. var $1,$3,$5,$6,$4,$2;
  40114. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  40115. $ctx1.sendIdx["new"]=1;
  40116. $3=$recv($globals.IRClosure)._new();
  40117. $ctx1.sendIdx["new"]=2;
  40118. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  40119. $5=$recv($globals.IRBlockSequence)._new();
  40120. $recv($5)._add_($recv(self._send())._receiver());
  40121. $6=$recv($5)._yourself();
  40122. $ctx1.sendIdx["yourself"]=1;
  40123. $4=$6;
  40124. $recv($3)._add_($4);
  40125. $ctx1.sendIdx["add:"]=1;
  40126. $2=$recv($3)._yourself();
  40127. return self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  40128. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40129. },
  40130. args: ["anIRInstruction"],
  40131. 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",
  40132. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  40133. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  40134. }),
  40135. $globals.IRSendInliner);
  40136. $core.addMethod(
  40137. $core.method({
  40138. selector: "ifNotNil:ifNil:",
  40139. protocol: 'inlining',
  40140. fn: function (anIRInstruction,anotherIRInstruction){
  40141. var self=this;
  40142. return $core.withContext(function($ctx1) {
  40143. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  40144. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40145. },
  40146. args: ["anIRInstruction", "anotherIRInstruction"],
  40147. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  40148. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  40149. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40150. }),
  40151. $globals.IRSendInliner);
  40152. $core.addMethod(
  40153. $core.method({
  40154. selector: "ifTrue:",
  40155. protocol: 'inlining',
  40156. fn: function (anIRInstruction){
  40157. var self=this;
  40158. return $core.withContext(function($ctx1) {
  40159. return self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  40160. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40161. },
  40162. args: ["anIRInstruction"],
  40163. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  40164. referencedClasses: ["IRInlinedIfTrue"],
  40165. messageSends: ["inlinedSend:withBlock:", "new"]
  40166. }),
  40167. $globals.IRSendInliner);
  40168. $core.addMethod(
  40169. $core.method({
  40170. selector: "ifTrue:ifFalse:",
  40171. protocol: 'inlining',
  40172. fn: function (anIRInstruction,anotherIRInstruction){
  40173. var self=this;
  40174. return $core.withContext(function($ctx1) {
  40175. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  40176. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40177. },
  40178. args: ["anIRInstruction", "anotherIRInstruction"],
  40179. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  40180. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  40181. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40182. }),
  40183. $globals.IRSendInliner);
  40184. $core.addMethod(
  40185. $core.method({
  40186. selector: "inlineClosure:",
  40187. protocol: 'inlining',
  40188. fn: function (anIRClosure){
  40189. var self=this;
  40190. var inlinedClosure,sequence,statements;
  40191. return $core.withContext(function($ctx1) {
  40192. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8,$23,$22,$24,$21,$25,$27,$26;
  40193. inlinedClosure=self._inlinedClosure();
  40194. $1=inlinedClosure;
  40195. $2=$recv(anIRClosure)._scope();
  40196. $ctx1.sendIdx["scope"]=1;
  40197. $recv($1)._scope_($2);
  40198. $ctx1.sendIdx["scope:"]=1;
  40199. $recv($1)._parent_($recv(anIRClosure)._parent());
  40200. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  40201. return $core.withContext(function($ctx2) {
  40202. return $recv(inlinedClosure)._add_(each);
  40203. $ctx2.sendIdx["add:"]=1;
  40204. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40205. }));
  40206. $ctx1.sendIdx["do:"]=1;
  40207. sequence=self._inlinedSequence();
  40208. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  40209. return $core.withContext(function($ctx2) {
  40210. $3=inlinedClosure;
  40211. $5=$recv($globals.IRTempDeclaration)._new();
  40212. $ctx2.sendIdx["new"]=1;
  40213. $recv($5)._name_(each);
  40214. $ctx2.sendIdx["name:"]=1;
  40215. $6=$recv($5)._yourself();
  40216. $ctx2.sendIdx["yourself"]=1;
  40217. $4=$6;
  40218. $recv($3)._add_($4);
  40219. $ctx2.sendIdx["add:"]=2;
  40220. $7=sequence;
  40221. $9=$recv($globals.IRAssignment)._new();
  40222. $ctx2.sendIdx["new"]=2;
  40223. $11=$recv($globals.IRVariable)._new();
  40224. $ctx2.sendIdx["new"]=3;
  40225. $13=$recv($globals.AliasVar)._new();
  40226. $ctx2.sendIdx["new"]=4;
  40227. $14=$recv(inlinedClosure)._scope();
  40228. $ctx2.sendIdx["scope"]=2;
  40229. $recv($13)._scope_($14);
  40230. $ctx2.sendIdx["scope:"]=2;
  40231. $recv($13)._name_(each);
  40232. $ctx2.sendIdx["name:"]=2;
  40233. $15=$recv($13)._yourself();
  40234. $ctx2.sendIdx["yourself"]=2;
  40235. $12=$15;
  40236. $10=$recv($11)._variable_($12);
  40237. $ctx2.sendIdx["variable:"]=1;
  40238. $recv($9)._add_($10);
  40239. $ctx2.sendIdx["add:"]=4;
  40240. $17=$recv($globals.IRVariable)._new();
  40241. $ctx2.sendIdx["new"]=5;
  40242. $19=$recv($globals.AliasVar)._new();
  40243. $recv($19)._scope_($recv(inlinedClosure)._scope());
  40244. $recv($19)._name_("$receiver");
  40245. $20=$recv($19)._yourself();
  40246. $ctx2.sendIdx["yourself"]=3;
  40247. $18=$20;
  40248. $16=$recv($17)._variable_($18);
  40249. $recv($9)._add_($16);
  40250. $ctx2.sendIdx["add:"]=5;
  40251. $8=$recv($9)._yourself();
  40252. return $recv($7)._add_($8);
  40253. $ctx2.sendIdx["add:"]=3;
  40254. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40255. }));
  40256. $ctx1.sendIdx["do:"]=2;
  40257. $recv(inlinedClosure)._add_(sequence);
  40258. $ctx1.sendIdx["add:"]=6;
  40259. statements=$recv($recv(anIRClosure)._sequence())._instructions();
  40260. $recv(statements)._ifNotEmpty_((function(){
  40261. return $core.withContext(function($ctx2) {
  40262. $recv($recv(statements)._allButLast())._do_((function(each){
  40263. return $core.withContext(function($ctx3) {
  40264. return $recv(sequence)._add_(each);
  40265. $ctx3.sendIdx["add:"]=7;
  40266. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  40267. }));
  40268. $23=$recv(statements)._last();
  40269. $ctx2.sendIdx["last"]=1;
  40270. $22=$recv($23)._isReturn();
  40271. $21=$recv($22)._and_((function(){
  40272. return $core.withContext(function($ctx3) {
  40273. $24=$recv(statements)._last();
  40274. $ctx3.sendIdx["last"]=2;
  40275. return $recv($24)._isBlockReturn();
  40276. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  40277. }));
  40278. if($core.assert($21)){
  40279. $25=sequence;
  40280. $27=$recv(statements)._last();
  40281. $ctx2.sendIdx["last"]=3;
  40282. $26=$recv($27)._expression();
  40283. return $recv($25)._add_($26);
  40284. $ctx2.sendIdx["add:"]=8;
  40285. } else {
  40286. return $recv(sequence)._add_($recv(statements)._last());
  40287. };
  40288. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40289. }));
  40290. return inlinedClosure;
  40291. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  40292. },
  40293. args: ["anIRClosure"],
  40294. 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 instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures don't have implicit local returns\x22\x0a\x09\x09(statements last isReturn and: [ statements last isBlockReturn ])\x0a\x09\x09\x09ifTrue: [ sequence add: statements last expression ]\x0a\x09\x09\x09ifFalse: [ sequence add: statements last ] ].\x0a\x0a\x09^ inlinedClosure",
  40295. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  40296. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "instructions", "sequence", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "and:", "isReturn", "last", "isBlockReturn", "expression"]
  40297. }),
  40298. $globals.IRSendInliner);
  40299. $core.addMethod(
  40300. $core.method({
  40301. selector: "inlineSend:",
  40302. protocol: 'inlining',
  40303. fn: function (anIRSend){
  40304. var self=this;
  40305. return $core.withContext(function($ctx1) {
  40306. var $2,$1;
  40307. self._send_(anIRSend);
  40308. $2=self._send();
  40309. $ctx1.sendIdx["send"]=1;
  40310. $1=$recv($2)._selector();
  40311. return self._perform_withArguments_($1,$recv(self._send())._arguments());
  40312. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  40313. },
  40314. args: ["anIRSend"],
  40315. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  40316. referencedClasses: [],
  40317. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  40318. }),
  40319. $globals.IRSendInliner);
  40320. $core.addMethod(
  40321. $core.method({
  40322. selector: "inlinedClosure",
  40323. protocol: 'factory',
  40324. fn: function (){
  40325. var self=this;
  40326. return $core.withContext(function($ctx1) {
  40327. return $recv($globals.IRInlinedClosure)._new();
  40328. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  40329. },
  40330. args: [],
  40331. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  40332. referencedClasses: ["IRInlinedClosure"],
  40333. messageSends: ["new"]
  40334. }),
  40335. $globals.IRSendInliner);
  40336. $core.addMethod(
  40337. $core.method({
  40338. selector: "inlinedSend:withBlock:",
  40339. protocol: 'inlining',
  40340. fn: function (inlinedSend,anIRInstruction){
  40341. var self=this;
  40342. var inlinedClosure;
  40343. return $core.withContext(function($ctx1) {
  40344. var $1,$2,$4,$3,$5;
  40345. $1=$recv(anIRInstruction)._isClosure();
  40346. if(!$core.assert($1)){
  40347. self._inliningError_("Message argument should be a block");
  40348. $ctx1.sendIdx["inliningError:"]=1;
  40349. };
  40350. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  40351. if(!$core.assert($2)){
  40352. self._inliningError_("Inlined block should have zero argument");
  40353. };
  40354. inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  40355. $4=self._send();
  40356. $ctx1.sendIdx["send"]=1;
  40357. $3=$recv($4)._receiver();
  40358. $recv(inlinedSend)._add_($3);
  40359. $ctx1.sendIdx["add:"]=1;
  40360. $recv(inlinedSend)._add_(inlinedClosure);
  40361. $recv(self._send())._replaceWith_(inlinedSend);
  40362. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  40363. $ctx1.sendIdx["internalVariables"]=1;
  40364. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  40365. return inlinedSend;
  40366. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  40367. },
  40368. args: ["inlinedSend", "anIRInstruction"],
  40369. 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",
  40370. referencedClasses: [],
  40371. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  40372. }),
  40373. $globals.IRSendInliner);
  40374. $core.addMethod(
  40375. $core.method({
  40376. selector: "inlinedSend:withBlock:withBlock:",
  40377. protocol: 'inlining',
  40378. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  40379. var self=this;
  40380. var inlinedClosure1,inlinedClosure2;
  40381. return $core.withContext(function($ctx1) {
  40382. var $1,$2,$3,$4,$6,$5,$7;
  40383. $1=$recv(anIRInstruction)._isClosure();
  40384. $ctx1.sendIdx["isClosure"]=1;
  40385. if(!$core.assert($1)){
  40386. self._inliningError_("Message argument should be a block");
  40387. $ctx1.sendIdx["inliningError:"]=1;
  40388. };
  40389. $2=$recv(anotherIRInstruction)._isClosure();
  40390. if(!$core.assert($2)){
  40391. self._inliningError_("Message argument should be a block");
  40392. };
  40393. $3=self._translator();
  40394. $ctx1.sendIdx["translator"]=1;
  40395. $4=self._inlineClosure_(anIRInstruction);
  40396. $ctx1.sendIdx["inlineClosure:"]=1;
  40397. inlinedClosure1=$recv($3)._visit_($4);
  40398. $ctx1.sendIdx["visit:"]=1;
  40399. inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  40400. $6=self._send();
  40401. $ctx1.sendIdx["send"]=1;
  40402. $5=$recv($6)._receiver();
  40403. $recv(inlinedSend)._add_($5);
  40404. $ctx1.sendIdx["add:"]=1;
  40405. $recv(inlinedSend)._add_(inlinedClosure1);
  40406. $ctx1.sendIdx["add:"]=2;
  40407. $recv(inlinedSend)._add_(inlinedClosure2);
  40408. $recv(self._send())._replaceWith_(inlinedSend);
  40409. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  40410. $ctx1.sendIdx["internalVariables"]=1;
  40411. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  40412. return inlinedSend;
  40413. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  40414. },
  40415. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  40416. 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",
  40417. referencedClasses: [],
  40418. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  40419. }),
  40420. $globals.IRSendInliner);
  40421. $core.addMethod(
  40422. $core.method({
  40423. selector: "inlinedSequence",
  40424. protocol: 'factory',
  40425. fn: function (){
  40426. var self=this;
  40427. return $core.withContext(function($ctx1) {
  40428. return $recv($globals.IRInlinedSequence)._new();
  40429. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  40430. },
  40431. args: [],
  40432. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  40433. referencedClasses: ["IRInlinedSequence"],
  40434. messageSends: ["new"]
  40435. }),
  40436. $globals.IRSendInliner);
  40437. $core.addMethod(
  40438. $core.method({
  40439. selector: "inliningError:",
  40440. protocol: 'error handling',
  40441. fn: function (aString){
  40442. var self=this;
  40443. return $core.withContext(function($ctx1) {
  40444. $recv($globals.InliningError)._signal_(aString);
  40445. return self;
  40446. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  40447. },
  40448. args: ["aString"],
  40449. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  40450. referencedClasses: ["InliningError"],
  40451. messageSends: ["signal:"]
  40452. }),
  40453. $globals.IRSendInliner);
  40454. $core.addMethod(
  40455. $core.method({
  40456. selector: "send",
  40457. protocol: 'accessing',
  40458. fn: function (){
  40459. var self=this;
  40460. return self["@send"];
  40461. },
  40462. args: [],
  40463. source: "send\x0a\x09^ send",
  40464. referencedClasses: [],
  40465. messageSends: []
  40466. }),
  40467. $globals.IRSendInliner);
  40468. $core.addMethod(
  40469. $core.method({
  40470. selector: "send:",
  40471. protocol: 'accessing',
  40472. fn: function (anIRSend){
  40473. var self=this;
  40474. self["@send"]=anIRSend;
  40475. return self;
  40476. },
  40477. args: ["anIRSend"],
  40478. source: "send: anIRSend\x0a\x09send := anIRSend",
  40479. referencedClasses: [],
  40480. messageSends: []
  40481. }),
  40482. $globals.IRSendInliner);
  40483. $core.addMethod(
  40484. $core.method({
  40485. selector: "translator",
  40486. protocol: 'accessing',
  40487. fn: function (){
  40488. var self=this;
  40489. return self["@translator"];
  40490. },
  40491. args: [],
  40492. source: "translator\x0a\x09^ translator",
  40493. referencedClasses: [],
  40494. messageSends: []
  40495. }),
  40496. $globals.IRSendInliner);
  40497. $core.addMethod(
  40498. $core.method({
  40499. selector: "translator:",
  40500. protocol: 'accessing',
  40501. fn: function (anASTTranslator){
  40502. var self=this;
  40503. self["@translator"]=anASTTranslator;
  40504. return self;
  40505. },
  40506. args: ["anASTTranslator"],
  40507. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  40508. referencedClasses: [],
  40509. messageSends: []
  40510. }),
  40511. $globals.IRSendInliner);
  40512. $core.addMethod(
  40513. $core.method({
  40514. selector: "inlinedSelectors",
  40515. protocol: 'accessing',
  40516. fn: function (){
  40517. var self=this;
  40518. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  40519. },
  40520. args: [],
  40521. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  40522. referencedClasses: [],
  40523. messageSends: []
  40524. }),
  40525. $globals.IRSendInliner.klass);
  40526. $core.addMethod(
  40527. $core.method({
  40528. selector: "shouldInline:",
  40529. protocol: 'accessing',
  40530. fn: function (anIRSend){
  40531. var self=this;
  40532. return $core.withContext(function($ctx1) {
  40533. var $1;
  40534. $1=$recv(self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  40535. if(!$core.assert($1)){
  40536. return false;
  40537. };
  40538. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  40539. return $core.withContext(function($ctx2) {
  40540. return $recv(each)._isClosure();
  40541. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40542. }));
  40543. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.klass)});
  40544. },
  40545. args: ["anIRSend"],
  40546. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  40547. referencedClasses: [],
  40548. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  40549. }),
  40550. $globals.IRSendInliner.klass);
  40551. $core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  40552. $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};";
  40553. $core.addMethod(
  40554. $core.method({
  40555. selector: "assignment",
  40556. protocol: 'accessing',
  40557. fn: function (){
  40558. var self=this;
  40559. return self["@assignment"];
  40560. },
  40561. args: [],
  40562. source: "assignment\x0a\x09^ assignment",
  40563. referencedClasses: [],
  40564. messageSends: []
  40565. }),
  40566. $globals.IRAssignmentInliner);
  40567. $core.addMethod(
  40568. $core.method({
  40569. selector: "assignment:",
  40570. protocol: 'accessing',
  40571. fn: function (aNode){
  40572. var self=this;
  40573. self["@assignment"]=aNode;
  40574. return self;
  40575. },
  40576. args: ["aNode"],
  40577. source: "assignment: aNode\x0a\x09assignment := aNode",
  40578. referencedClasses: [],
  40579. messageSends: []
  40580. }),
  40581. $globals.IRAssignmentInliner);
  40582. $core.addMethod(
  40583. $core.method({
  40584. selector: "inlineAssignment:",
  40585. protocol: 'inlining',
  40586. fn: function (anIRAssignment){
  40587. var self=this;
  40588. var inlinedAssignment;
  40589. return $core.withContext(function($ctx1) {
  40590. self._assignment_(anIRAssignment);
  40591. inlinedAssignment=$recv($globals.IRInlinedAssignment)._new();
  40592. $recv($recv(anIRAssignment)._instructions())._do_((function(each){
  40593. return $core.withContext(function($ctx2) {
  40594. return $recv(inlinedAssignment)._add_(each);
  40595. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40596. }));
  40597. $recv(anIRAssignment)._replaceWith_(inlinedAssignment);
  40598. self._inlineSend_($recv(inlinedAssignment)._right());
  40599. return inlinedAssignment;
  40600. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},$globals.IRAssignmentInliner)});
  40601. },
  40602. args: ["anIRAssignment"],
  40603. source: "inlineAssignment: anIRAssignment\x0a\x09| inlinedAssignment |\x0a\x09self assignment: anIRAssignment.\x0a\x09inlinedAssignment := IRInlinedAssignment new.\x0a\x09anIRAssignment instructions do: [ :each |\x0a\x09\x09inlinedAssignment add: each ].\x0a\x09anIRAssignment replaceWith: inlinedAssignment.\x0a\x09self inlineSend: inlinedAssignment right.\x0a\x09^ inlinedAssignment",
  40604. referencedClasses: ["IRInlinedAssignment"],
  40605. messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "right"]
  40606. }),
  40607. $globals.IRAssignmentInliner);
  40608. $core.addMethod(
  40609. $core.method({
  40610. selector: "inlineClosure:",
  40611. protocol: 'inlining',
  40612. fn: function (anIRClosure){
  40613. var self=this;
  40614. var inlinedClosure,statements;
  40615. return $core.withContext(function($ctx1) {
  40616. var $2,$1,$3,$5,$4;
  40617. inlinedClosure=(
  40618. $ctx1.supercall = true,
  40619. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  40620. $ctx1.supercall = false;
  40621. statements=$recv($recv(inlinedClosure)._sequence())._instructions();
  40622. $recv(statements)._ifNotEmpty_((function(){
  40623. return $core.withContext(function($ctx2) {
  40624. $2=$recv(statements)._last();
  40625. $ctx2.sendIdx["last"]=1;
  40626. $1=$recv($2)._canBeAssigned();
  40627. if($core.assert($1)){
  40628. $3=$recv(statements)._last();
  40629. $ctx2.sendIdx["last"]=2;
  40630. $5=$recv($globals.IRAssignment)._new();
  40631. $recv($5)._add_($recv(self._assignment())._left());
  40632. $ctx2.sendIdx["add:"]=1;
  40633. $recv($5)._add_($recv($recv(statements)._last())._copy());
  40634. $4=$recv($5)._yourself();
  40635. return $recv($3)._replaceWith_($4);
  40636. };
  40637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40638. }));
  40639. return inlinedClosure;
  40640. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},$globals.IRAssignmentInliner)});
  40641. },
  40642. args: ["anIRClosure"],
  40643. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure statements |\x0a\x0a\x09inlinedClosure := super inlineClosure: anIRClosure.\x0a\x09statements := inlinedClosure sequence instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last canBeAssigned ifTrue: [\x0a\x09\x09\x09statements last replaceWith: (IRAssignment new\x0a\x09\x09\x09\x09add: self assignment left;\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ inlinedClosure",
  40644. referencedClasses: ["IRAssignment"],
  40645. messageSends: ["inlineClosure:", "instructions", "sequence", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "last", "replaceWith:", "add:", "new", "left", "assignment", "copy", "yourself"]
  40646. }),
  40647. $globals.IRAssignmentInliner);
  40648. $core.addClass('IRReturnInliner', $globals.IRSendInliner, [], 'Compiler-Inlining');
  40649. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  40650. $core.addMethod(
  40651. $core.method({
  40652. selector: "inlineClosure:",
  40653. protocol: 'inlining',
  40654. fn: function (anIRClosure){
  40655. var self=this;
  40656. var closure,statements;
  40657. return $core.withContext(function($ctx1) {
  40658. var $2,$1,$3,$5,$4;
  40659. closure=(
  40660. $ctx1.supercall = true,
  40661. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  40662. $ctx1.supercall = false;
  40663. statements=$recv($recv(closure)._sequence())._instructions();
  40664. $recv(statements)._ifNotEmpty_((function(){
  40665. return $core.withContext(function($ctx2) {
  40666. $2=$recv(statements)._last();
  40667. $ctx2.sendIdx["last"]=1;
  40668. $1=$recv($2)._isReturn();
  40669. if(!$core.assert($1)){
  40670. $3=$recv(statements)._last();
  40671. $ctx2.sendIdx["last"]=2;
  40672. $5=$recv($globals.IRReturn)._new();
  40673. $recv($5)._add_($recv($recv(statements)._last())._copy());
  40674. $4=$recv($5)._yourself();
  40675. return $recv($3)._replaceWith_($4);
  40676. };
  40677. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40678. }));
  40679. return closure;
  40680. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},$globals.IRReturnInliner)});
  40681. },
  40682. args: ["anIRClosure"],
  40683. source: "inlineClosure: anIRClosure\x0a\x09| closure statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09statements := closure sequence instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last isReturn\x0a\x09\x09\x09ifFalse: [ statements last replaceWith: (IRReturn new\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself)] ].\x0a\x0a\x09^ closure",
  40684. referencedClasses: ["IRReturn"],
  40685. messageSends: ["inlineClosure:", "instructions", "sequence", "ifNotEmpty:", "ifFalse:", "isReturn", "last", "replaceWith:", "add:", "new", "copy", "yourself"]
  40686. }),
  40687. $globals.IRReturnInliner);
  40688. $core.addMethod(
  40689. $core.method({
  40690. selector: "inlineReturn:",
  40691. protocol: 'inlining',
  40692. fn: function (anIRReturn){
  40693. var self=this;
  40694. var return_;
  40695. return $core.withContext(function($ctx1) {
  40696. return_=self._inlinedReturn();
  40697. $recv($recv(anIRReturn)._instructions())._do_((function(each){
  40698. return $core.withContext(function($ctx2) {
  40699. return $recv(return_)._add_(each);
  40700. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40701. }));
  40702. $recv(anIRReturn)._replaceWith_(return_);
  40703. self._inlineSend_($recv(return_)._expression());
  40704. return return_;
  40705. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},$globals.IRReturnInliner)});
  40706. },
  40707. args: ["anIRReturn"],
  40708. source: "inlineReturn: anIRReturn\x0a\x09| return |\x0a\x09return := self inlinedReturn.\x0a\x09anIRReturn instructions do: [ :each |\x0a\x09\x09return add: each ].\x0a\x09anIRReturn replaceWith: return.\x0a\x09self inlineSend: return expression.\x0a\x09^ return",
  40709. referencedClasses: [],
  40710. messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "expression"]
  40711. }),
  40712. $globals.IRReturnInliner);
  40713. $core.addMethod(
  40714. $core.method({
  40715. selector: "inlinedReturn",
  40716. protocol: 'factory',
  40717. fn: function (){
  40718. var self=this;
  40719. return $core.withContext(function($ctx1) {
  40720. return $recv($globals.IRInlinedReturn)._new();
  40721. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},$globals.IRReturnInliner)});
  40722. },
  40723. args: [],
  40724. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  40725. referencedClasses: ["IRInlinedReturn"],
  40726. messageSends: ["new"]
  40727. }),
  40728. $globals.IRReturnInliner);
  40729. $core.addClass('InliningCodeGenerator', $globals.CodeGenerator, [], 'Compiler-Inlining');
  40730. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  40731. $core.addMethod(
  40732. $core.method({
  40733. selector: "compileNode:",
  40734. protocol: 'compiling',
  40735. fn: function (aNode){
  40736. var self=this;
  40737. var ir,stream;
  40738. return $core.withContext(function($ctx1) {
  40739. var $1;
  40740. $recv(self._semanticAnalyzer())._visit_(aNode);
  40741. $ctx1.sendIdx["visit:"]=1;
  40742. ir=$recv(self._translator())._visit_(aNode);
  40743. $ctx1.sendIdx["visit:"]=2;
  40744. $recv(self._inliner())._visit_(ir);
  40745. $ctx1.sendIdx["visit:"]=3;
  40746. $1=self._irTranslator();
  40747. $recv($1)._currentClass_(self._currentClass());
  40748. $recv($1)._visit_(ir);
  40749. return $recv($1)._contents();
  40750. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.InliningCodeGenerator)});
  40751. },
  40752. args: ["aNode"],
  40753. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09self inliner visit: ir.\x0a\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  40754. referencedClasses: [],
  40755. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"]
  40756. }),
  40757. $globals.InliningCodeGenerator);
  40758. $core.addMethod(
  40759. $core.method({
  40760. selector: "inliner",
  40761. protocol: 'compiling',
  40762. fn: function (){
  40763. var self=this;
  40764. return $core.withContext(function($ctx1) {
  40765. return $recv($globals.IRInliner)._new();
  40766. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  40767. },
  40768. args: [],
  40769. source: "inliner\x0a\x09^ IRInliner new",
  40770. referencedClasses: ["IRInliner"],
  40771. messageSends: ["new"]
  40772. }),
  40773. $globals.InliningCodeGenerator);
  40774. $core.addMethod(
  40775. $core.method({
  40776. selector: "irTranslator",
  40777. protocol: 'compiling',
  40778. fn: function (){
  40779. var self=this;
  40780. return $core.withContext(function($ctx1) {
  40781. return $recv($globals.IRInliningJSTranslator)._new();
  40782. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.InliningCodeGenerator)});
  40783. },
  40784. args: [],
  40785. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  40786. referencedClasses: ["IRInliningJSTranslator"],
  40787. messageSends: ["new"]
  40788. }),
  40789. $globals.InliningCodeGenerator);
  40790. $core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Inlining');
  40791. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  40792. });
  40793. 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";
  40794. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  40795. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  40796. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  40797. $core.addPackage('Compiler-Interpreter');
  40798. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  40799. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  40800. $core.addClass('AIBlockClosure', $globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  40801. $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`).";
  40802. $core.addMethod(
  40803. $core.method({
  40804. selector: "applyTo:arguments:",
  40805. protocol: 'evaluating',
  40806. fn: function (anObject,aCollection){
  40807. var self=this;
  40808. return $core.withContext(function($ctx1) {
  40809. self._interpreterError();
  40810. return self;
  40811. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  40812. },
  40813. args: ["anObject", "aCollection"],
  40814. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  40815. referencedClasses: [],
  40816. messageSends: ["interpreterError"]
  40817. }),
  40818. $globals.AIBlockClosure);
  40819. $core.addMethod(
  40820. $core.method({
  40821. selector: "compiledSource",
  40822. protocol: 'accessing',
  40823. fn: function (){
  40824. var self=this;
  40825. return "[ AST Block closure ]";
  40826. },
  40827. args: [],
  40828. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  40829. referencedClasses: [],
  40830. messageSends: []
  40831. }),
  40832. $globals.AIBlockClosure);
  40833. $core.addMethod(
  40834. $core.method({
  40835. selector: "currySelf",
  40836. protocol: 'converting',
  40837. fn: function (){
  40838. var self=this;
  40839. return $core.withContext(function($ctx1) {
  40840. self._interpreterError();
  40841. return self;
  40842. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  40843. },
  40844. args: [],
  40845. source: "currySelf\x0a\x09self interpreterError",
  40846. referencedClasses: [],
  40847. messageSends: ["interpreterError"]
  40848. }),
  40849. $globals.AIBlockClosure);
  40850. $core.addMethod(
  40851. $core.method({
  40852. selector: "initializeWithContext:node:",
  40853. protocol: 'initialization',
  40854. fn: function (aContext,aNode){
  40855. var self=this;
  40856. self["@node"]=aNode;
  40857. self["@outerContext"]=aContext;
  40858. return self;
  40859. },
  40860. args: ["aContext", "aNode"],
  40861. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  40862. referencedClasses: [],
  40863. messageSends: []
  40864. }),
  40865. $globals.AIBlockClosure);
  40866. $core.addMethod(
  40867. $core.method({
  40868. selector: "interpreterError",
  40869. protocol: 'error handling',
  40870. fn: function (){
  40871. var self=this;
  40872. return $core.withContext(function($ctx1) {
  40873. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  40874. return self;
  40875. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  40876. },
  40877. args: [],
  40878. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  40879. referencedClasses: ["ASTInterpreterError"],
  40880. messageSends: ["signal:"]
  40881. }),
  40882. $globals.AIBlockClosure);
  40883. $core.addMethod(
  40884. $core.method({
  40885. selector: "numArgs",
  40886. protocol: 'accessing',
  40887. fn: function (){
  40888. var self=this;
  40889. return $core.withContext(function($ctx1) {
  40890. return $recv($recv(self["@node"])._temps())._size();
  40891. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  40892. },
  40893. args: [],
  40894. source: "numArgs\x0a\x09^ node temps size",
  40895. referencedClasses: [],
  40896. messageSends: ["size", "temps"]
  40897. }),
  40898. $globals.AIBlockClosure);
  40899. $core.addMethod(
  40900. $core.method({
  40901. selector: "value",
  40902. protocol: 'evaluating',
  40903. fn: function (){
  40904. var self=this;
  40905. return $core.withContext(function($ctx1) {
  40906. return self._valueWithPossibleArguments_([]);
  40907. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  40908. },
  40909. args: [],
  40910. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  40911. referencedClasses: [],
  40912. messageSends: ["valueWithPossibleArguments:"]
  40913. }),
  40914. $globals.AIBlockClosure);
  40915. $core.addMethod(
  40916. $core.method({
  40917. selector: "value:",
  40918. protocol: 'evaluating',
  40919. fn: function (anArgument){
  40920. var self=this;
  40921. return $core.withContext(function($ctx1) {
  40922. return self._valueWithPossibleArguments_([anArgument]);
  40923. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  40924. },
  40925. args: ["anArgument"],
  40926. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  40927. referencedClasses: [],
  40928. messageSends: ["valueWithPossibleArguments:"]
  40929. }),
  40930. $globals.AIBlockClosure);
  40931. $core.addMethod(
  40932. $core.method({
  40933. selector: "value:value:",
  40934. protocol: 'evaluating',
  40935. fn: function (firstArgument,secondArgument){
  40936. var self=this;
  40937. return $core.withContext(function($ctx1) {
  40938. return self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  40939. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  40940. },
  40941. args: ["firstArgument", "secondArgument"],
  40942. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  40943. referencedClasses: [],
  40944. messageSends: ["valueWithPossibleArguments:"]
  40945. }),
  40946. $globals.AIBlockClosure);
  40947. $core.addMethod(
  40948. $core.method({
  40949. selector: "value:value:value:",
  40950. protocol: 'evaluating',
  40951. fn: function (firstArgument,secondArgument,thirdArgument){
  40952. var self=this;
  40953. return $core.withContext(function($ctx1) {
  40954. return self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  40955. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  40956. },
  40957. args: ["firstArgument", "secondArgument", "thirdArgument"],
  40958. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  40959. referencedClasses: [],
  40960. messageSends: ["valueWithPossibleArguments:"]
  40961. }),
  40962. $globals.AIBlockClosure);
  40963. $core.addMethod(
  40964. $core.method({
  40965. selector: "valueWithPossibleArguments:",
  40966. protocol: 'evaluating',
  40967. fn: function (aCollection){
  40968. var self=this;
  40969. var context,sequenceNode;
  40970. return $core.withContext(function($ctx1) {
  40971. var $1,$2,$3;
  40972. context=$recv(self["@outerContext"])._newInnerContext();
  40973. $1=$recv($recv($recv(self["@node"])._nodes())._first())._copy();
  40974. $recv($1)._parent_(nil);
  40975. sequenceNode=$recv($1)._yourself();
  40976. $recv($recv(sequenceNode)._temps())._do_((function(each){
  40977. return $core.withContext(function($ctx2) {
  40978. return $recv(context)._defineLocal_(each);
  40979. $ctx2.sendIdx["defineLocal:"]=1;
  40980. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40981. }));
  40982. $recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){
  40983. return $core.withContext(function($ctx2) {
  40984. $recv(context)._defineLocal_(each);
  40985. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  40986. return nil;
  40987. })));
  40988. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  40989. }));
  40990. $2=$recv(context)._interpreter();
  40991. $ctx1.sendIdx["interpreter"]=1;
  40992. $recv($2)._node_(sequenceNode);
  40993. $recv($2)._enterNode();
  40994. $recv($2)._proceed();
  40995. $3=$recv(self["@outerContext"])._interpreter();
  40996. $ctx1.sendIdx["interpreter"]=2;
  40997. $recv($3)._setNonLocalReturnFromContext_(context);
  40998. return $recv($recv(context)._interpreter())._pop();
  40999. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  41000. },
  41001. args: ["aCollection"],
  41002. 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 nodes 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",
  41003. referencedClasses: [],
  41004. messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  41005. }),
  41006. $globals.AIBlockClosure);
  41007. $core.addMethod(
  41008. $core.method({
  41009. selector: "forContext:node:",
  41010. protocol: 'instance creation',
  41011. fn: function (aContext,aNode){
  41012. var self=this;
  41013. return $core.withContext(function($ctx1) {
  41014. var $1;
  41015. $1=self._new();
  41016. $recv($1)._initializeWithContext_node_(aContext,aNode);
  41017. return $recv($1)._yourself();
  41018. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)});
  41019. },
  41020. args: ["aContext", "aNode"],
  41021. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  41022. referencedClasses: [],
  41023. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  41024. }),
  41025. $globals.AIBlockClosure.klass);
  41026. $core.addClass('AIContext', $globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
  41027. $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)";
  41028. $core.addMethod(
  41029. $core.method({
  41030. selector: "arguments",
  41031. protocol: 'interpreting',
  41032. fn: function (){
  41033. var self=this;
  41034. return $core.withContext(function($ctx1) {
  41035. return $recv($recv(self._ast())._arguments())._collect_((function(each){
  41036. return $core.withContext(function($ctx2) {
  41037. return self._localAt_ifAbsent_(each,(function(){
  41038. return $core.withContext(function($ctx3) {
  41039. return self._error_("Argument not in context");
  41040. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41041. }));
  41042. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41043. }));
  41044. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  41045. },
  41046. args: [],
  41047. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  41048. referencedClasses: [],
  41049. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  41050. }),
  41051. $globals.AIContext);
  41052. $core.addMethod(
  41053. $core.method({
  41054. selector: "ast",
  41055. protocol: 'interpreting',
  41056. fn: function (){
  41057. var self=this;
  41058. return $core.withContext(function($ctx1) {
  41059. var $1,$2,$3,$receiver;
  41060. $1=self._isBlockContext();
  41061. if($core.assert($1)){
  41062. $2=self._outerContext();
  41063. return $recv($2)._ifNotNil_((function(context){
  41064. return $core.withContext(function($ctx2) {
  41065. return $recv(context)._ast();
  41066. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,2)});
  41067. }));
  41068. };
  41069. $3=self["@ast"];
  41070. if(($receiver = $3) == null || $receiver.isNil){
  41071. self._initializeAST();
  41072. } else {
  41073. $3;
  41074. };
  41075. return self["@ast"];
  41076. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  41077. },
  41078. args: [],
  41079. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  41080. referencedClasses: [],
  41081. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  41082. }),
  41083. $globals.AIContext);
  41084. $core.addMethod(
  41085. $core.method({
  41086. selector: "basicLocalAt:",
  41087. protocol: 'private',
  41088. fn: function (aString){
  41089. var self=this;
  41090. return $core.withContext(function($ctx1) {
  41091. return $recv(self._locals())._at_(aString);
  41092. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  41093. },
  41094. args: ["aString"],
  41095. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  41096. referencedClasses: [],
  41097. messageSends: ["at:", "locals"]
  41098. }),
  41099. $globals.AIContext);
  41100. $core.addMethod(
  41101. $core.method({
  41102. selector: "basicLocalAt:put:",
  41103. protocol: 'private',
  41104. fn: function (aString,anObject){
  41105. var self=this;
  41106. return $core.withContext(function($ctx1) {
  41107. $recv(self._locals())._at_put_(aString,anObject);
  41108. return self;
  41109. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  41110. },
  41111. args: ["aString", "anObject"],
  41112. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  41113. referencedClasses: [],
  41114. messageSends: ["at:put:", "locals"]
  41115. }),
  41116. $globals.AIContext);
  41117. $core.addMethod(
  41118. $core.method({
  41119. selector: "basicReceiver",
  41120. protocol: 'interpreting',
  41121. fn: function (){
  41122. var self=this;
  41123. return $core.withContext(function($ctx1) {
  41124. return self._localAt_("self");
  41125. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  41126. },
  41127. args: [],
  41128. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  41129. referencedClasses: [],
  41130. messageSends: ["localAt:"]
  41131. }),
  41132. $globals.AIContext);
  41133. $core.addMethod(
  41134. $core.method({
  41135. selector: "defineLocal:",
  41136. protocol: 'accessing',
  41137. fn: function (aString){
  41138. var self=this;
  41139. return $core.withContext(function($ctx1) {
  41140. $recv(self._locals())._at_put_(aString,nil);
  41141. return self;
  41142. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  41143. },
  41144. args: ["aString"],
  41145. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  41146. referencedClasses: [],
  41147. messageSends: ["at:put:", "locals"]
  41148. }),
  41149. $globals.AIContext);
  41150. $core.addMethod(
  41151. $core.method({
  41152. selector: "evaluate:on:",
  41153. protocol: 'evaluating',
  41154. fn: function (aString,anEvaluator){
  41155. var self=this;
  41156. return $core.withContext(function($ctx1) {
  41157. return $recv(anEvaluator)._evaluate_context_(aString,self);
  41158. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  41159. },
  41160. args: ["aString", "anEvaluator"],
  41161. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  41162. referencedClasses: [],
  41163. messageSends: ["evaluate:context:"]
  41164. }),
  41165. $globals.AIContext);
  41166. $core.addMethod(
  41167. $core.method({
  41168. selector: "evaluateNode:",
  41169. protocol: 'evaluating',
  41170. fn: function (aNode){
  41171. var self=this;
  41172. return $core.withContext(function($ctx1) {
  41173. var $1;
  41174. $1=$recv($globals.ASTInterpreter)._new();
  41175. $recv($1)._context_(self);
  41176. $recv($1)._node_(aNode);
  41177. $recv($1)._enterNode();
  41178. $recv($1)._proceed();
  41179. return $recv($1)._result();
  41180. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  41181. },
  41182. args: ["aNode"],
  41183. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  41184. referencedClasses: ["ASTInterpreter"],
  41185. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  41186. }),
  41187. $globals.AIContext);
  41188. $core.addMethod(
  41189. $core.method({
  41190. selector: "evaluatedSelector",
  41191. protocol: 'accessing',
  41192. fn: function (){
  41193. var self=this;
  41194. return self["@evaluatedSelector"];
  41195. },
  41196. args: [],
  41197. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  41198. referencedClasses: [],
  41199. messageSends: []
  41200. }),
  41201. $globals.AIContext);
  41202. $core.addMethod(
  41203. $core.method({
  41204. selector: "evaluatedSelector:",
  41205. protocol: 'accessing',
  41206. fn: function (aString){
  41207. var self=this;
  41208. self["@evaluatedSelector"]=aString;
  41209. return self;
  41210. },
  41211. args: ["aString"],
  41212. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  41213. referencedClasses: [],
  41214. messageSends: []
  41215. }),
  41216. $globals.AIContext);
  41217. $core.addMethod(
  41218. $core.method({
  41219. selector: "index",
  41220. protocol: 'accessing',
  41221. fn: function (){
  41222. var self=this;
  41223. return $core.withContext(function($ctx1) {
  41224. var $1,$receiver;
  41225. $1=self["@index"];
  41226. if(($receiver = $1) == null || $receiver.isNil){
  41227. return (0);
  41228. } else {
  41229. return $1;
  41230. };
  41231. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  41232. },
  41233. args: [],
  41234. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  41235. referencedClasses: [],
  41236. messageSends: ["ifNil:"]
  41237. }),
  41238. $globals.AIContext);
  41239. $core.addMethod(
  41240. $core.method({
  41241. selector: "index:",
  41242. protocol: 'accessing',
  41243. fn: function (anInteger){
  41244. var self=this;
  41245. self["@index"]=anInteger;
  41246. return self;
  41247. },
  41248. args: ["anInteger"],
  41249. source: "index: anInteger\x0a\x09index := anInteger",
  41250. referencedClasses: [],
  41251. messageSends: []
  41252. }),
  41253. $globals.AIContext);
  41254. $core.addMethod(
  41255. $core.method({
  41256. selector: "initializeAST",
  41257. protocol: 'initialization',
  41258. fn: function (){
  41259. var self=this;
  41260. return $core.withContext(function($ctx1) {
  41261. var $1;
  41262. $1=self._method();
  41263. $ctx1.sendIdx["method"]=1;
  41264. self["@ast"]=$recv($1)._ast();
  41265. $recv($recv($globals.SemanticAnalyzer)._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]);
  41266. return self;
  41267. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  41268. },
  41269. args: [],
  41270. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  41271. referencedClasses: ["SemanticAnalyzer"],
  41272. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  41273. }),
  41274. $globals.AIContext);
  41275. $core.addMethod(
  41276. $core.method({
  41277. selector: "initializeFromMethodContext:",
  41278. protocol: 'initialization',
  41279. fn: function (aMethodContext){
  41280. var self=this;
  41281. return $core.withContext(function($ctx1) {
  41282. var $1,$2,$3,$receiver;
  41283. self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  41284. self._index_($recv(aMethodContext)._index());
  41285. self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  41286. self._receiver_($recv(aMethodContext)._receiver());
  41287. self._supercall_($recv(aMethodContext)._supercall());
  41288. self._selector_($recv(aMethodContext)._selector());
  41289. $1=$recv(aMethodContext)._outerContext();
  41290. $ctx1.sendIdx["outerContext"]=1;
  41291. if(($receiver = $1) == null || $receiver.isNil){
  41292. $1;
  41293. } else {
  41294. var outer;
  41295. outer=$receiver;
  41296. $2=$recv(outer)._methodContext();
  41297. if(($receiver = $2) == null || $receiver.isNil){
  41298. $2;
  41299. } else {
  41300. self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  41301. };
  41302. $3=$recv(aMethodContext)._locals();
  41303. $ctx1.sendIdx["locals"]=1;
  41304. $recv($3)._keysAndValuesDo_((function(key,value){
  41305. return $core.withContext(function($ctx2) {
  41306. return $recv(self._locals())._at_put_(key,value);
  41307. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  41308. }));
  41309. };
  41310. return self;
  41311. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  41312. },
  41313. args: ["aMethodContext"],
  41314. 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 ] ]",
  41315. referencedClasses: [],
  41316. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  41317. }),
  41318. $globals.AIContext);
  41319. $core.addMethod(
  41320. $core.method({
  41321. selector: "initializeInterpreter",
  41322. protocol: 'initialization',
  41323. fn: function (){
  41324. var self=this;
  41325. return $core.withContext(function($ctx1) {
  41326. var $1,$2,$receiver;
  41327. $1=$recv($globals.ASTInterpreter)._new();
  41328. $recv($1)._context_(self);
  41329. self["@interpreter"]=$recv($1)._yourself();
  41330. $2=self._innerContext();
  41331. if(($receiver = $2) == null || $receiver.isNil){
  41332. $2;
  41333. } else {
  41334. self._setupInterpreter_(self["@interpreter"]);
  41335. };
  41336. return self;
  41337. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  41338. },
  41339. args: [],
  41340. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  41341. referencedClasses: ["ASTInterpreter"],
  41342. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  41343. }),
  41344. $globals.AIContext);
  41345. $core.addMethod(
  41346. $core.method({
  41347. selector: "initializeLocals",
  41348. protocol: 'initialization',
  41349. fn: function (){
  41350. var self=this;
  41351. return $core.withContext(function($ctx1) {
  41352. self["@locals"]=$recv($globals.Dictionary)._new();
  41353. $recv(self["@locals"])._at_put_("thisContext",self);
  41354. return self;
  41355. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  41356. },
  41357. args: [],
  41358. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  41359. referencedClasses: ["Dictionary"],
  41360. messageSends: ["new", "at:put:"]
  41361. }),
  41362. $globals.AIContext);
  41363. $core.addMethod(
  41364. $core.method({
  41365. selector: "innerContext",
  41366. protocol: 'accessing',
  41367. fn: function (){
  41368. var self=this;
  41369. return self["@innerContext"];
  41370. },
  41371. args: [],
  41372. source: "innerContext\x0a\x09^ innerContext",
  41373. referencedClasses: [],
  41374. messageSends: []
  41375. }),
  41376. $globals.AIContext);
  41377. $core.addMethod(
  41378. $core.method({
  41379. selector: "innerContext:",
  41380. protocol: 'accessing',
  41381. fn: function (anAIContext){
  41382. var self=this;
  41383. self["@innerContext"]=anAIContext;
  41384. return self;
  41385. },
  41386. args: ["anAIContext"],
  41387. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  41388. referencedClasses: [],
  41389. messageSends: []
  41390. }),
  41391. $globals.AIContext);
  41392. $core.addMethod(
  41393. $core.method({
  41394. selector: "interpreter",
  41395. protocol: 'interpreting',
  41396. fn: function (){
  41397. var self=this;
  41398. return $core.withContext(function($ctx1) {
  41399. var $1,$receiver;
  41400. $1=self["@interpreter"];
  41401. if(($receiver = $1) == null || $receiver.isNil){
  41402. self._initializeInterpreter();
  41403. } else {
  41404. $1;
  41405. };
  41406. return self["@interpreter"];
  41407. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  41408. },
  41409. args: [],
  41410. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  41411. referencedClasses: [],
  41412. messageSends: ["ifNil:", "initializeInterpreter"]
  41413. }),
  41414. $globals.AIContext);
  41415. $core.addMethod(
  41416. $core.method({
  41417. selector: "interpreter:",
  41418. protocol: 'interpreting',
  41419. fn: function (anInterpreter){
  41420. var self=this;
  41421. self["@interpreter"]=anInterpreter;
  41422. return self;
  41423. },
  41424. args: ["anInterpreter"],
  41425. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  41426. referencedClasses: [],
  41427. messageSends: []
  41428. }),
  41429. $globals.AIContext);
  41430. $core.addMethod(
  41431. $core.method({
  41432. selector: "isTopContext",
  41433. protocol: 'testing',
  41434. fn: function (){
  41435. var self=this;
  41436. return $core.withContext(function($ctx1) {
  41437. return $recv(self._innerContext())._isNil();
  41438. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  41439. },
  41440. args: [],
  41441. source: "isTopContext\x0a\x09^ self innerContext isNil",
  41442. referencedClasses: [],
  41443. messageSends: ["isNil", "innerContext"]
  41444. }),
  41445. $globals.AIContext);
  41446. $core.addMethod(
  41447. $core.method({
  41448. selector: "localAt:",
  41449. protocol: 'accessing',
  41450. fn: function (aString){
  41451. var self=this;
  41452. var context;
  41453. return $core.withContext(function($ctx1) {
  41454. context=self._lookupContextForLocal_(aString);
  41455. return $recv(context)._basicLocalAt_(aString);
  41456. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  41457. },
  41458. args: ["aString"],
  41459. 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",
  41460. referencedClasses: [],
  41461. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  41462. }),
  41463. $globals.AIContext);
  41464. $core.addMethod(
  41465. $core.method({
  41466. selector: "localAt:ifAbsent:",
  41467. protocol: 'accessing',
  41468. fn: function (aString,aBlock){
  41469. var self=this;
  41470. var context;
  41471. return $core.withContext(function($ctx1) {
  41472. var $early={};
  41473. try {
  41474. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  41475. return $core.withContext(function($ctx2) {
  41476. throw $early=[$recv(aBlock)._value()];
  41477. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41478. }));
  41479. return $recv(context)._basicLocalAt_(aString);
  41480. }
  41481. catch(e) {if(e===$early)return e[0]; throw e}
  41482. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  41483. },
  41484. args: ["aString", "aBlock"],
  41485. 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",
  41486. referencedClasses: [],
  41487. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  41488. }),
  41489. $globals.AIContext);
  41490. $core.addMethod(
  41491. $core.method({
  41492. selector: "localAt:put:",
  41493. protocol: 'accessing',
  41494. fn: function (aString,anObject){
  41495. var self=this;
  41496. var context;
  41497. return $core.withContext(function($ctx1) {
  41498. context=self._lookupContextForLocal_(aString);
  41499. $recv(context)._basicLocalAt_put_(aString,anObject);
  41500. return self;
  41501. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  41502. },
  41503. args: ["aString", "anObject"],
  41504. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  41505. referencedClasses: [],
  41506. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  41507. }),
  41508. $globals.AIContext);
  41509. $core.addMethod(
  41510. $core.method({
  41511. selector: "locals",
  41512. protocol: 'accessing',
  41513. fn: function (){
  41514. var self=this;
  41515. return $core.withContext(function($ctx1) {
  41516. var $1,$receiver;
  41517. $1=self["@locals"];
  41518. if(($receiver = $1) == null || $receiver.isNil){
  41519. self._initializeLocals();
  41520. } else {
  41521. $1;
  41522. };
  41523. return self["@locals"];
  41524. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  41525. },
  41526. args: [],
  41527. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  41528. referencedClasses: [],
  41529. messageSends: ["ifNil:", "initializeLocals"]
  41530. }),
  41531. $globals.AIContext);
  41532. $core.addMethod(
  41533. $core.method({
  41534. selector: "lookupContextForLocal:",
  41535. protocol: 'private',
  41536. fn: function (aString){
  41537. var self=this;
  41538. return $core.withContext(function($ctx1) {
  41539. return self._lookupContextForLocal_ifNone_(aString,(function(){
  41540. return $core.withContext(function($ctx2) {
  41541. return self._variableNotFound();
  41542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41543. }));
  41544. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  41545. },
  41546. args: ["aString"],
  41547. 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 ]",
  41548. referencedClasses: [],
  41549. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  41550. }),
  41551. $globals.AIContext);
  41552. $core.addMethod(
  41553. $core.method({
  41554. selector: "lookupContextForLocal:ifNone:",
  41555. protocol: 'private',
  41556. fn: function (aString,aBlock){
  41557. var self=this;
  41558. return $core.withContext(function($ctx1) {
  41559. var $1;
  41560. return $recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  41561. return self;
  41562. }),(function(){
  41563. return $core.withContext(function($ctx2) {
  41564. $1=self._outerContext();
  41565. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  41566. return $core.withContext(function($ctx3) {
  41567. return $recv(context)._lookupContextForLocal_(aString);
  41568. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  41569. }));
  41570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41571. }));
  41572. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  41573. },
  41574. args: ["aString", "aBlock"],
  41575. 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 ] ]",
  41576. referencedClasses: [],
  41577. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  41578. }),
  41579. $globals.AIContext);
  41580. $core.addMethod(
  41581. $core.method({
  41582. selector: "newInnerContext",
  41583. protocol: 'factory',
  41584. fn: function (){
  41585. var self=this;
  41586. return $core.withContext(function($ctx1) {
  41587. var $1;
  41588. $1=$recv(self._class())._new();
  41589. $recv($1)._outerContext_(self);
  41590. return $recv($1)._yourself();
  41591. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  41592. },
  41593. args: [],
  41594. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  41595. referencedClasses: [],
  41596. messageSends: ["outerContext:", "new", "class", "yourself"]
  41597. }),
  41598. $globals.AIContext);
  41599. $core.addMethod(
  41600. $core.method({
  41601. selector: "outerContext",
  41602. protocol: 'accessing',
  41603. fn: function (){
  41604. var self=this;
  41605. return self["@outerContext"];
  41606. },
  41607. args: [],
  41608. source: "outerContext\x0a\x09^ outerContext",
  41609. referencedClasses: [],
  41610. messageSends: []
  41611. }),
  41612. $globals.AIContext);
  41613. $core.addMethod(
  41614. $core.method({
  41615. selector: "outerContext:",
  41616. protocol: 'accessing',
  41617. fn: function (anAIContext){
  41618. var self=this;
  41619. return $core.withContext(function($ctx1) {
  41620. var $1,$receiver;
  41621. self["@outerContext"]=anAIContext;
  41622. $1=self["@outerContext"];
  41623. if(($receiver = $1) == null || $receiver.isNil){
  41624. $1;
  41625. } else {
  41626. var context;
  41627. context=$receiver;
  41628. $recv(context)._innerContext_(self);
  41629. };
  41630. return self;
  41631. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  41632. },
  41633. args: ["anAIContext"],
  41634. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  41635. referencedClasses: [],
  41636. messageSends: ["ifNotNil:", "innerContext:"]
  41637. }),
  41638. $globals.AIContext);
  41639. $core.addMethod(
  41640. $core.method({
  41641. selector: "receiver:",
  41642. protocol: 'interpreting',
  41643. fn: function (anObject){
  41644. var self=this;
  41645. return $core.withContext(function($ctx1) {
  41646. $recv(self._locals())._at_put_("self",anObject);
  41647. return self;
  41648. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  41649. },
  41650. args: ["anObject"],
  41651. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  41652. referencedClasses: [],
  41653. messageSends: ["at:put:", "locals"]
  41654. }),
  41655. $globals.AIContext);
  41656. $core.addMethod(
  41657. $core.method({
  41658. selector: "selector",
  41659. protocol: 'accessing',
  41660. fn: function (){
  41661. var self=this;
  41662. return self["@selector"];
  41663. },
  41664. args: [],
  41665. source: "selector\x0a\x09^ selector",
  41666. referencedClasses: [],
  41667. messageSends: []
  41668. }),
  41669. $globals.AIContext);
  41670. $core.addMethod(
  41671. $core.method({
  41672. selector: "selector:",
  41673. protocol: 'accessing',
  41674. fn: function (aString){
  41675. var self=this;
  41676. self["@selector"]=aString;
  41677. return self;
  41678. },
  41679. args: ["aString"],
  41680. source: "selector: aString\x0a\x09selector := aString",
  41681. referencedClasses: [],
  41682. messageSends: []
  41683. }),
  41684. $globals.AIContext);
  41685. $core.addMethod(
  41686. $core.method({
  41687. selector: "sendIndexAt:",
  41688. protocol: 'accessing',
  41689. fn: function (aString){
  41690. var self=this;
  41691. return $core.withContext(function($ctx1) {
  41692. return $recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  41693. return (0);
  41694. }));
  41695. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  41696. },
  41697. args: ["aString"],
  41698. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  41699. referencedClasses: [],
  41700. messageSends: ["at:ifAbsent:", "sendIndexes"]
  41701. }),
  41702. $globals.AIContext);
  41703. $core.addMethod(
  41704. $core.method({
  41705. selector: "sendIndexes",
  41706. protocol: 'accessing',
  41707. fn: function (){
  41708. var self=this;
  41709. return $core.withContext(function($ctx1) {
  41710. var $1,$receiver;
  41711. $1=self["@sendIndexes"];
  41712. if(($receiver = $1) == null || $receiver.isNil){
  41713. return $recv($globals.Dictionary)._new();
  41714. } else {
  41715. return $1;
  41716. };
  41717. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  41718. },
  41719. args: [],
  41720. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  41721. referencedClasses: ["Dictionary"],
  41722. messageSends: ["ifNil:", "new"]
  41723. }),
  41724. $globals.AIContext);
  41725. $core.addMethod(
  41726. $core.method({
  41727. selector: "sendIndexes:",
  41728. protocol: 'accessing',
  41729. fn: function (aDictionary){
  41730. var self=this;
  41731. self["@sendIndexes"]=aDictionary;
  41732. return self;
  41733. },
  41734. args: ["aDictionary"],
  41735. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  41736. referencedClasses: [],
  41737. messageSends: []
  41738. }),
  41739. $globals.AIContext);
  41740. $core.addMethod(
  41741. $core.method({
  41742. selector: "setupInterpreter:",
  41743. protocol: 'interpreting',
  41744. fn: function (anInterpreter){
  41745. var self=this;
  41746. var currentNode;
  41747. return $core.withContext(function($ctx1) {
  41748. var $1,$2,$3,$6,$5,$4,$receiver;
  41749. $1=$recv($globals.ASTPCNodeVisitor)._new();
  41750. $recv($1)._selector_(self._evaluatedSelector());
  41751. $recv($1)._context_(self);
  41752. $2=self._ast();
  41753. $ctx1.sendIdx["ast"]=1;
  41754. $recv($1)._visit_($2);
  41755. currentNode=$recv($1)._currentNode();
  41756. $3=$recv(self._ast())._sequenceNode();
  41757. if(($receiver = $3) == null || $receiver.isNil){
  41758. $3;
  41759. } else {
  41760. var sequence;
  41761. sequence=$receiver;
  41762. $recv($recv(sequence)._temps())._do_((function(each){
  41763. return $core.withContext(function($ctx2) {
  41764. return self._defineLocal_(each);
  41765. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41766. }));
  41767. $ctx1.sendIdx["do:"]=1;
  41768. };
  41769. $recv(anInterpreter)._node_(currentNode);
  41770. $6=self._innerContext();
  41771. $ctx1.sendIdx["innerContext"]=1;
  41772. $5=$recv($6)._arguments();
  41773. $4=$recv($5)._reversed();
  41774. $recv($4)._do_((function(each){
  41775. return $core.withContext(function($ctx2) {
  41776. return $recv(anInterpreter)._push_(each);
  41777. $ctx2.sendIdx["push:"]=1;
  41778. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  41779. }));
  41780. $recv(anInterpreter)._push_($recv(self._innerContext())._receiver());
  41781. return self;
  41782. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  41783. },
  41784. args: ["anInterpreter"],
  41785. 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\x09context: self;\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)",
  41786. referencedClasses: ["ASTPCNodeVisitor"],
  41787. messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  41788. }),
  41789. $globals.AIContext);
  41790. $core.addMethod(
  41791. $core.method({
  41792. selector: "supercall",
  41793. protocol: 'interpreting',
  41794. fn: function (){
  41795. var self=this;
  41796. return $core.withContext(function($ctx1) {
  41797. var $1,$receiver;
  41798. $1=self["@supercall"];
  41799. if(($receiver = $1) == null || $receiver.isNil){
  41800. return false;
  41801. } else {
  41802. return $1;
  41803. };
  41804. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  41805. },
  41806. args: [],
  41807. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  41808. referencedClasses: [],
  41809. messageSends: ["ifNil:"]
  41810. }),
  41811. $globals.AIContext);
  41812. $core.addMethod(
  41813. $core.method({
  41814. selector: "supercall:",
  41815. protocol: 'interpreting',
  41816. fn: function (aBoolean){
  41817. var self=this;
  41818. self["@supercall"]=aBoolean;
  41819. return self;
  41820. },
  41821. args: ["aBoolean"],
  41822. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  41823. referencedClasses: [],
  41824. messageSends: []
  41825. }),
  41826. $globals.AIContext);
  41827. $core.addMethod(
  41828. $core.method({
  41829. selector: "variableNotFound",
  41830. protocol: 'error handling',
  41831. fn: function (){
  41832. var self=this;
  41833. return $core.withContext(function($ctx1) {
  41834. self._error_("Variable missing");
  41835. return self;
  41836. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  41837. },
  41838. args: [],
  41839. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  41840. referencedClasses: [],
  41841. messageSends: ["error:"]
  41842. }),
  41843. $globals.AIContext);
  41844. $core.addMethod(
  41845. $core.method({
  41846. selector: "fromMethodContext:",
  41847. protocol: 'instance creation',
  41848. fn: function (aMethodContext){
  41849. var self=this;
  41850. return $core.withContext(function($ctx1) {
  41851. var $1;
  41852. $1=self._new();
  41853. $recv($1)._initializeFromMethodContext_(aMethodContext);
  41854. return $recv($1)._yourself();
  41855. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)});
  41856. },
  41857. args: ["aMethodContext"],
  41858. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  41859. referencedClasses: [],
  41860. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  41861. }),
  41862. $globals.AIContext.klass);
  41863. $core.addClass('AISemanticAnalyzer', $globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
  41864. $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.";
  41865. $core.addMethod(
  41866. $core.method({
  41867. selector: "context",
  41868. protocol: 'accessing',
  41869. fn: function (){
  41870. var self=this;
  41871. return self["@context"];
  41872. },
  41873. args: [],
  41874. source: "context\x0a\x09^ context",
  41875. referencedClasses: [],
  41876. messageSends: []
  41877. }),
  41878. $globals.AISemanticAnalyzer);
  41879. $core.addMethod(
  41880. $core.method({
  41881. selector: "context:",
  41882. protocol: 'accessing',
  41883. fn: function (anAIContext){
  41884. var self=this;
  41885. self["@context"]=anAIContext;
  41886. return self;
  41887. },
  41888. args: ["anAIContext"],
  41889. source: "context: anAIContext\x0a\x09context := anAIContext",
  41890. referencedClasses: [],
  41891. messageSends: []
  41892. }),
  41893. $globals.AISemanticAnalyzer);
  41894. $core.addMethod(
  41895. $core.method({
  41896. selector: "visitVariableNode:",
  41897. protocol: 'visiting',
  41898. fn: function (aNode){
  41899. var self=this;
  41900. return $core.withContext(function($ctx1) {
  41901. var $1;
  41902. var $early={};
  41903. try {
  41904. $recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  41905. return $core.withContext(function($ctx2) {
  41906. $1=(
  41907. $ctx2.supercall = true,
  41908. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($recv(self), [aNode]));
  41909. $ctx2.supercall = false;
  41910. throw $early=[$1];
  41911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41912. }));
  41913. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  41914. return self;
  41915. }
  41916. catch(e) {if(e===$early)return e[0]; throw e}
  41917. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  41918. },
  41919. args: ["aNode"],
  41920. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  41921. referencedClasses: ["ASTContextVar"],
  41922. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  41923. }),
  41924. $globals.AISemanticAnalyzer);
  41925. $core.addClass('ASTContextVar', $globals.ScopeVar, ['context'], 'Compiler-Interpreter');
  41926. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  41927. $core.addMethod(
  41928. $core.method({
  41929. selector: "context",
  41930. protocol: 'accessing',
  41931. fn: function (){
  41932. var self=this;
  41933. return self["@context"];
  41934. },
  41935. args: [],
  41936. source: "context\x0a\x09^ context",
  41937. referencedClasses: [],
  41938. messageSends: []
  41939. }),
  41940. $globals.ASTContextVar);
  41941. $core.addMethod(
  41942. $core.method({
  41943. selector: "context:",
  41944. protocol: 'accessing',
  41945. fn: function (anObject){
  41946. var self=this;
  41947. self["@context"]=anObject;
  41948. return self;
  41949. },
  41950. args: ["anObject"],
  41951. source: "context: anObject\x0a\x09context := anObject",
  41952. referencedClasses: [],
  41953. messageSends: []
  41954. }),
  41955. $globals.ASTContextVar);
  41956. $core.addClass('ASTDebugger', $globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
  41957. $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.";
  41958. $core.addMethod(
  41959. $core.method({
  41960. selector: "atEnd",
  41961. protocol: 'testing',
  41962. fn: function (){
  41963. var self=this;
  41964. return $core.withContext(function($ctx1) {
  41965. var $1,$receiver;
  41966. $1=self._context();
  41967. $ctx1.sendIdx["context"]=1;
  41968. if(($receiver = $1) == null || $receiver.isNil){
  41969. return true;
  41970. } else {
  41971. $1;
  41972. };
  41973. return $recv($recv(self._interpreter())._atEnd())._and_((function(){
  41974. return $core.withContext(function($ctx2) {
  41975. return $recv(self._context())._isTopContext();
  41976. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41977. }));
  41978. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  41979. },
  41980. args: [],
  41981. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  41982. referencedClasses: [],
  41983. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  41984. }),
  41985. $globals.ASTDebugger);
  41986. $core.addMethod(
  41987. $core.method({
  41988. selector: "context",
  41989. protocol: 'accessing',
  41990. fn: function (){
  41991. var self=this;
  41992. return self["@context"];
  41993. },
  41994. args: [],
  41995. source: "context\x0a\x09^ context",
  41996. referencedClasses: [],
  41997. messageSends: []
  41998. }),
  41999. $globals.ASTDebugger);
  42000. $core.addMethod(
  42001. $core.method({
  42002. selector: "context:",
  42003. protocol: 'accessing',
  42004. fn: function (aContext){
  42005. var self=this;
  42006. self["@context"]=aContext;
  42007. return self;
  42008. },
  42009. args: ["aContext"],
  42010. source: "context: aContext\x0a\x09context := aContext",
  42011. referencedClasses: [],
  42012. messageSends: []
  42013. }),
  42014. $globals.ASTDebugger);
  42015. $core.addMethod(
  42016. $core.method({
  42017. selector: "flushInnerContexts",
  42018. protocol: 'actions',
  42019. fn: function (){
  42020. var self=this;
  42021. return $core.withContext(function($ctx1) {
  42022. var $1,$receiver;
  42023. $1=self._context();
  42024. if(($receiver = $1) == null || $receiver.isNil){
  42025. $1;
  42026. } else {
  42027. var cxt;
  42028. cxt=$receiver;
  42029. $recv(cxt)._innerContext_(nil);
  42030. };
  42031. return self;
  42032. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  42033. },
  42034. args: [],
  42035. 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 ]",
  42036. referencedClasses: [],
  42037. messageSends: ["ifNotNil:", "context", "innerContext:"]
  42038. }),
  42039. $globals.ASTDebugger);
  42040. $core.addMethod(
  42041. $core.method({
  42042. selector: "interpreter",
  42043. protocol: 'accessing',
  42044. fn: function (){
  42045. var self=this;
  42046. return $core.withContext(function($ctx1) {
  42047. var $1,$receiver;
  42048. $1=self._context();
  42049. if(($receiver = $1) == null || $receiver.isNil){
  42050. return $1;
  42051. } else {
  42052. var ctx;
  42053. ctx=$receiver;
  42054. return $recv(ctx)._interpreter();
  42055. };
  42056. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  42057. },
  42058. args: [],
  42059. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  42060. referencedClasses: [],
  42061. messageSends: ["ifNotNil:", "context", "interpreter"]
  42062. }),
  42063. $globals.ASTDebugger);
  42064. $core.addMethod(
  42065. $core.method({
  42066. selector: "method",
  42067. protocol: 'accessing',
  42068. fn: function (){
  42069. var self=this;
  42070. return $core.withContext(function($ctx1) {
  42071. return $recv(self._context())._method();
  42072. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  42073. },
  42074. args: [],
  42075. source: "method\x0a\x09^ self context method",
  42076. referencedClasses: [],
  42077. messageSends: ["method", "context"]
  42078. }),
  42079. $globals.ASTDebugger);
  42080. $core.addMethod(
  42081. $core.method({
  42082. selector: "node",
  42083. protocol: 'accessing',
  42084. fn: function (){
  42085. var self=this;
  42086. return $core.withContext(function($ctx1) {
  42087. var $1,$receiver;
  42088. $1=self._interpreter();
  42089. $ctx1.sendIdx["interpreter"]=1;
  42090. if(($receiver = $1) == null || $receiver.isNil){
  42091. return $1;
  42092. } else {
  42093. return $recv(self._interpreter())._node();
  42094. };
  42095. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  42096. },
  42097. args: [],
  42098. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  42099. referencedClasses: [],
  42100. messageSends: ["ifNotNil:", "interpreter", "node"]
  42101. }),
  42102. $globals.ASTDebugger);
  42103. $core.addMethod(
  42104. $core.method({
  42105. selector: "onStep",
  42106. protocol: 'private',
  42107. fn: function (){
  42108. var self=this;
  42109. return $core.withContext(function($ctx1) {
  42110. var $1,$3,$2,$4,$6,$5,$receiver;
  42111. $1=self._interpreter();
  42112. $ctx1.sendIdx["interpreter"]=1;
  42113. self["@result"]=$recv($1)._result();
  42114. $3=self._interpreter();
  42115. $ctx1.sendIdx["interpreter"]=2;
  42116. $2=$recv($3)._atEnd();
  42117. $ctx1.sendIdx["atEnd"]=1;
  42118. if($core.assert($2)){
  42119. $4=$recv(self._context())._outerContext();
  42120. if(($receiver = $4) == null || $receiver.isNil){
  42121. $4;
  42122. } else {
  42123. var outerContext;
  42124. outerContext=$receiver;
  42125. self._context_(outerContext);
  42126. };
  42127. $6=self._interpreter();
  42128. $ctx1.sendIdx["interpreter"]=3;
  42129. $5=$recv($6)._atEnd();
  42130. if(!$core.assert($5)){
  42131. $recv(self._interpreter())._skip();
  42132. };
  42133. };
  42134. self._flushInnerContexts();
  42135. return self;
  42136. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  42137. },
  42138. args: [],
  42139. 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",
  42140. referencedClasses: [],
  42141. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  42142. }),
  42143. $globals.ASTDebugger);
  42144. $core.addMethod(
  42145. $core.method({
  42146. selector: "proceed",
  42147. protocol: 'stepping',
  42148. fn: function (){
  42149. var self=this;
  42150. return $core.withContext(function($ctx1) {
  42151. $recv((function(){
  42152. return $core.withContext(function($ctx2) {
  42153. return self._atEnd();
  42154. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42155. }))._whileFalse_((function(){
  42156. return $core.withContext(function($ctx2) {
  42157. return self._stepOver();
  42158. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42159. }));
  42160. return self;
  42161. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  42162. },
  42163. args: [],
  42164. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  42165. referencedClasses: [],
  42166. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  42167. }),
  42168. $globals.ASTDebugger);
  42169. $core.addMethod(
  42170. $core.method({
  42171. selector: "restart",
  42172. protocol: 'stepping',
  42173. fn: function (){
  42174. var self=this;
  42175. return $core.withContext(function($ctx1) {
  42176. $recv(self._interpreter())._restart();
  42177. self._flushInnerContexts();
  42178. return self;
  42179. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  42180. },
  42181. args: [],
  42182. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  42183. referencedClasses: [],
  42184. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  42185. }),
  42186. $globals.ASTDebugger);
  42187. $core.addMethod(
  42188. $core.method({
  42189. selector: "result",
  42190. protocol: 'accessing',
  42191. fn: function (){
  42192. var self=this;
  42193. return self["@result"];
  42194. },
  42195. args: [],
  42196. source: "result\x0a\x09^ result",
  42197. referencedClasses: [],
  42198. messageSends: []
  42199. }),
  42200. $globals.ASTDebugger);
  42201. $core.addMethod(
  42202. $core.method({
  42203. selector: "stepInto",
  42204. protocol: 'stepping',
  42205. fn: function (){
  42206. var self=this;
  42207. return $core.withContext(function($ctx1) {
  42208. self._shouldBeImplemented();
  42209. return self;
  42210. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  42211. },
  42212. args: [],
  42213. source: "stepInto\x0a\x09self shouldBeImplemented",
  42214. referencedClasses: [],
  42215. messageSends: ["shouldBeImplemented"]
  42216. }),
  42217. $globals.ASTDebugger);
  42218. $core.addMethod(
  42219. $core.method({
  42220. selector: "stepOver",
  42221. protocol: 'stepping',
  42222. fn: function (){
  42223. var self=this;
  42224. return $core.withContext(function($ctx1) {
  42225. var $1,$2;
  42226. $1=$recv(self._context())._isTopContext();
  42227. if($core.assert($1)){
  42228. $recv(self._interpreter())._stepOver();
  42229. } else {
  42230. $2=self._interpreter();
  42231. $ctx1.sendIdx["interpreter"]=1;
  42232. $recv($2)._skip();
  42233. };
  42234. self._onStep();
  42235. return self;
  42236. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  42237. },
  42238. args: [],
  42239. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  42240. referencedClasses: [],
  42241. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  42242. }),
  42243. $globals.ASTDebugger);
  42244. $core.addMethod(
  42245. $core.method({
  42246. selector: "context:",
  42247. protocol: 'instance creation',
  42248. fn: function (aContext){
  42249. var self=this;
  42250. return $core.withContext(function($ctx1) {
  42251. var $1;
  42252. $1=self._new();
  42253. $recv($1)._context_(aContext);
  42254. return $recv($1)._yourself();
  42255. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)});
  42256. },
  42257. args: ["aContext"],
  42258. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  42259. referencedClasses: [],
  42260. messageSends: ["context:", "new", "yourself"]
  42261. }),
  42262. $globals.ASTDebugger.klass);
  42263. $core.addClass('ASTEnterNode', $globals.NodeVisitor, ['interpreter'], 'Compiler-Interpreter');
  42264. $core.addMethod(
  42265. $core.method({
  42266. selector: "interpreter",
  42267. protocol: 'accessing',
  42268. fn: function (){
  42269. var self=this;
  42270. return self["@interpreter"];
  42271. },
  42272. args: [],
  42273. source: "interpreter\x0a\x09^ interpreter",
  42274. referencedClasses: [],
  42275. messageSends: []
  42276. }),
  42277. $globals.ASTEnterNode);
  42278. $core.addMethod(
  42279. $core.method({
  42280. selector: "interpreter:",
  42281. protocol: 'accessing',
  42282. fn: function (anObject){
  42283. var self=this;
  42284. self["@interpreter"]=anObject;
  42285. return self;
  42286. },
  42287. args: ["anObject"],
  42288. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  42289. referencedClasses: [],
  42290. messageSends: []
  42291. }),
  42292. $globals.ASTEnterNode);
  42293. $core.addMethod(
  42294. $core.method({
  42295. selector: "visitBlockNode:",
  42296. protocol: 'visiting',
  42297. fn: function (aNode){
  42298. var self=this;
  42299. return aNode;
  42300. },
  42301. args: ["aNode"],
  42302. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  42303. referencedClasses: [],
  42304. messageSends: []
  42305. }),
  42306. $globals.ASTEnterNode);
  42307. $core.addMethod(
  42308. $core.method({
  42309. selector: "visitNode:",
  42310. protocol: 'visiting',
  42311. fn: function (aNode){
  42312. var self=this;
  42313. return $core.withContext(function($ctx1) {
  42314. var $early={};
  42315. try {
  42316. $recv($recv(aNode)._nodes())._ifEmpty_ifNotEmpty_((function(){
  42317. throw $early=[aNode];
  42318. }),(function(nodes){
  42319. return $core.withContext(function($ctx2) {
  42320. throw $early=[self._visit_($recv(nodes)._first())];
  42321. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  42322. }));
  42323. return self;
  42324. }
  42325. catch(e) {if(e===$early)return e[0]; throw e}
  42326. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.ASTEnterNode)});
  42327. },
  42328. args: ["aNode"],
  42329. source: "visitNode: aNode\x0a\x09aNode nodes\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  42330. referencedClasses: [],
  42331. messageSends: ["ifEmpty:ifNotEmpty:", "nodes", "visit:", "first"]
  42332. }),
  42333. $globals.ASTEnterNode);
  42334. $core.addMethod(
  42335. $core.method({
  42336. selector: "visitSequenceNode:",
  42337. protocol: 'visiting',
  42338. fn: function (aNode){
  42339. var self=this;
  42340. return $core.withContext(function($ctx1) {
  42341. var $1;
  42342. $recv($recv(aNode)._temps())._do_((function(each){
  42343. return $core.withContext(function($ctx2) {
  42344. return $recv($recv(self._interpreter())._context())._defineLocal_(each);
  42345. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42346. }));
  42347. $1=(
  42348. $ctx1.supercall = true,
  42349. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  42350. $ctx1.supercall = false;
  42351. return $1;
  42352. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  42353. },
  42354. args: ["aNode"],
  42355. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  42356. referencedClasses: [],
  42357. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  42358. }),
  42359. $globals.ASTEnterNode);
  42360. $core.addMethod(
  42361. $core.method({
  42362. selector: "on:",
  42363. protocol: 'instance creation',
  42364. fn: function (anInterpreter){
  42365. var self=this;
  42366. return $core.withContext(function($ctx1) {
  42367. var $1;
  42368. $1=self._new();
  42369. $recv($1)._interpreter_(anInterpreter);
  42370. return $recv($1)._yourself();
  42371. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.klass)});
  42372. },
  42373. args: ["anInterpreter"],
  42374. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  42375. referencedClasses: [],
  42376. messageSends: ["interpreter:", "new", "yourself"]
  42377. }),
  42378. $globals.ASTEnterNode.klass);
  42379. $core.addClass('ASTInterpreter', $globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
  42380. $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";
  42381. $core.addMethod(
  42382. $core.method({
  42383. selector: "assign:to:",
  42384. protocol: 'private',
  42385. fn: function (aNode,anObject){
  42386. var self=this;
  42387. return $core.withContext(function($ctx1) {
  42388. var $1,$3,$2,$4;
  42389. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  42390. if($core.assert($1)){
  42391. $3=self._context();
  42392. $ctx1.sendIdx["context"]=1;
  42393. $2=$recv($3)._receiver();
  42394. $4=$recv(aNode)._value();
  42395. $ctx1.sendIdx["value"]=1;
  42396. $recv($2)._instVarAt_put_($4,anObject);
  42397. } else {
  42398. $recv(self._context())._localAt_put_($recv(aNode)._value(),anObject);
  42399. };
  42400. return self;
  42401. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  42402. },
  42403. args: ["aNode", "anObject"],
  42404. 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 ]",
  42405. referencedClasses: [],
  42406. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  42407. }),
  42408. $globals.ASTInterpreter);
  42409. $core.addMethod(
  42410. $core.method({
  42411. selector: "atEnd",
  42412. protocol: 'testing',
  42413. fn: function (){
  42414. var self=this;
  42415. return $core.withContext(function($ctx1) {
  42416. var $1;
  42417. $1=self["@forceAtEnd"];
  42418. if($core.assert($1)){
  42419. return true;
  42420. };
  42421. return $recv(self._hasReturned())._or_((function(){
  42422. return $core.withContext(function($ctx2) {
  42423. return $recv(self._node())._isNil();
  42424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42425. }));
  42426. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  42427. },
  42428. args: [],
  42429. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  42430. referencedClasses: [],
  42431. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  42432. }),
  42433. $globals.ASTInterpreter);
  42434. $core.addMethod(
  42435. $core.method({
  42436. selector: "context",
  42437. protocol: 'accessing',
  42438. fn: function (){
  42439. var self=this;
  42440. return self["@context"];
  42441. },
  42442. args: [],
  42443. source: "context\x0a\x09^ context",
  42444. referencedClasses: [],
  42445. messageSends: []
  42446. }),
  42447. $globals.ASTInterpreter);
  42448. $core.addMethod(
  42449. $core.method({
  42450. selector: "context:",
  42451. protocol: 'accessing',
  42452. fn: function (aContext){
  42453. var self=this;
  42454. self["@context"]=aContext;
  42455. return self;
  42456. },
  42457. args: ["aContext"],
  42458. source: "context: aContext\x0a\x09context := aContext",
  42459. referencedClasses: [],
  42460. messageSends: []
  42461. }),
  42462. $globals.ASTInterpreter);
  42463. $core.addMethod(
  42464. $core.method({
  42465. selector: "enterNode",
  42466. protocol: 'interpreting',
  42467. fn: function (){
  42468. var self=this;
  42469. return $core.withContext(function($ctx1) {
  42470. self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_(self._node()));
  42471. return self;
  42472. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  42473. },
  42474. args: [],
  42475. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  42476. referencedClasses: ["ASTEnterNode"],
  42477. messageSends: ["node:", "visit:", "on:", "node"]
  42478. }),
  42479. $globals.ASTInterpreter);
  42480. $core.addMethod(
  42481. $core.method({
  42482. selector: "eval:",
  42483. protocol: 'private',
  42484. fn: function (aString){
  42485. var self=this;
  42486. var source,function_;
  42487. return $core.withContext(function($ctx1) {
  42488. var $3,$2,$1;
  42489. source=$recv($globals.String)._streamContents_((function(str){
  42490. return $core.withContext(function($ctx2) {
  42491. $recv(str)._nextPutAll_("0,(function(");
  42492. $ctx2.sendIdx["nextPutAll:"]=1;
  42493. $3=self._context();
  42494. $ctx2.sendIdx["context"]=1;
  42495. $2=$recv($3)._locals();
  42496. $ctx2.sendIdx["locals"]=1;
  42497. $1=$recv($2)._keys();
  42498. $recv($1)._do_separatedBy_((function(each){
  42499. return $core.withContext(function($ctx3) {
  42500. return $recv(str)._nextPutAll_(each);
  42501. $ctx3.sendIdx["nextPutAll:"]=2;
  42502. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42503. }),(function(){
  42504. return $core.withContext(function($ctx3) {
  42505. return $recv(str)._nextPutAll_(",");
  42506. $ctx3.sendIdx["nextPutAll:"]=3;
  42507. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42508. }));
  42509. $recv(str)._nextPutAll_("){ return (function() {");
  42510. $ctx2.sendIdx["nextPutAll:"]=4;
  42511. $recv(str)._nextPutAll_(aString);
  42512. $ctx2.sendIdx["nextPutAll:"]=5;
  42513. return $recv(str)._nextPutAll_("})()})");
  42514. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  42515. }));
  42516. function_=$recv($recv($globals.Compiler)._new())._eval_(source);
  42517. return $recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values());
  42518. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  42519. },
  42520. args: ["aString"],
  42521. 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",
  42522. referencedClasses: ["String", "Compiler"],
  42523. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  42524. }),
  42525. $globals.ASTInterpreter);
  42526. $core.addMethod(
  42527. $core.method({
  42528. selector: "hasReturned",
  42529. protocol: 'testing',
  42530. fn: function (){
  42531. var self=this;
  42532. return $core.withContext(function($ctx1) {
  42533. var $1,$receiver;
  42534. $1=self["@returned"];
  42535. if(($receiver = $1) == null || $receiver.isNil){
  42536. return false;
  42537. } else {
  42538. return $1;
  42539. };
  42540. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  42541. },
  42542. args: [],
  42543. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  42544. referencedClasses: [],
  42545. messageSends: ["ifNil:"]
  42546. }),
  42547. $globals.ASTInterpreter);
  42548. $core.addMethod(
  42549. $core.method({
  42550. selector: "initialize",
  42551. protocol: 'initialization',
  42552. fn: function (){
  42553. var self=this;
  42554. return $core.withContext(function($ctx1) {
  42555. (
  42556. $ctx1.supercall = true,
  42557. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  42558. $ctx1.supercall = false;
  42559. self["@forceAtEnd"]=false;
  42560. return self;
  42561. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  42562. },
  42563. args: [],
  42564. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  42565. referencedClasses: [],
  42566. messageSends: ["initialize"]
  42567. }),
  42568. $globals.ASTInterpreter);
  42569. $core.addMethod(
  42570. $core.method({
  42571. selector: "interpret",
  42572. protocol: 'interpreting',
  42573. fn: function (){
  42574. var self=this;
  42575. return $core.withContext(function($ctx1) {
  42576. self._visit_(self._node());
  42577. return self;
  42578. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  42579. },
  42580. args: [],
  42581. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  42582. referencedClasses: [],
  42583. messageSends: ["visit:", "node"]
  42584. }),
  42585. $globals.ASTInterpreter);
  42586. $core.addMethod(
  42587. $core.method({
  42588. selector: "messageFromSendNode:arguments:",
  42589. protocol: 'private',
  42590. fn: function (aSendNode,aCollection){
  42591. var self=this;
  42592. return $core.withContext(function($ctx1) {
  42593. var $1;
  42594. $1=$recv($globals.Message)._new();
  42595. $recv($1)._selector_($recv(aSendNode)._selector());
  42596. $recv($1)._arguments_(aCollection);
  42597. return $recv($1)._yourself();
  42598. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  42599. },
  42600. args: ["aSendNode", "aCollection"],
  42601. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  42602. referencedClasses: ["Message"],
  42603. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  42604. }),
  42605. $globals.ASTInterpreter);
  42606. $core.addMethod(
  42607. $core.method({
  42608. selector: "messageNotUnderstood:receiver:",
  42609. protocol: 'private',
  42610. fn: function (aMessage,anObject){
  42611. var self=this;
  42612. return $core.withContext(function($ctx1) {
  42613. var $1;
  42614. $1=$recv($globals.MessageNotUnderstood)._new();
  42615. $recv($1)._message_(aMessage);
  42616. $recv($1)._receiver_(anObject);
  42617. $recv($1)._signal();
  42618. return self;
  42619. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  42620. },
  42621. args: ["aMessage", "anObject"],
  42622. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  42623. referencedClasses: ["MessageNotUnderstood"],
  42624. messageSends: ["message:", "new", "receiver:", "signal"]
  42625. }),
  42626. $globals.ASTInterpreter);
  42627. $core.addMethod(
  42628. $core.method({
  42629. selector: "next",
  42630. protocol: 'interpreting',
  42631. fn: function (){
  42632. var self=this;
  42633. var nd,nextNode;
  42634. return $core.withContext(function($ctx1) {
  42635. var $1,$2,$receiver;
  42636. nd=self._node();
  42637. $1=$recv(nd)._parent();
  42638. if(($receiver = $1) == null || $receiver.isNil){
  42639. nextNode=$1;
  42640. } else {
  42641. var parent;
  42642. parent=$receiver;
  42643. $2=$recv(parent)._nextSiblingNode_(nd);
  42644. if(($receiver = $2) == null || $receiver.isNil){
  42645. nextNode=parent;
  42646. } else {
  42647. var sibling;
  42648. sibling=$receiver;
  42649. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  42650. };
  42651. };
  42652. self._node_(nextNode);
  42653. return self;
  42654. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  42655. },
  42656. args: [],
  42657. 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",
  42658. referencedClasses: ["ASTEnterNode"],
  42659. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  42660. }),
  42661. $globals.ASTInterpreter);
  42662. $core.addMethod(
  42663. $core.method({
  42664. selector: "node",
  42665. protocol: 'accessing',
  42666. fn: function (){
  42667. var self=this;
  42668. return self["@node"];
  42669. },
  42670. args: [],
  42671. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  42672. referencedClasses: [],
  42673. messageSends: []
  42674. }),
  42675. $globals.ASTInterpreter);
  42676. $core.addMethod(
  42677. $core.method({
  42678. selector: "node:",
  42679. protocol: 'accessing',
  42680. fn: function (aNode){
  42681. var self=this;
  42682. self["@node"]=aNode;
  42683. return self;
  42684. },
  42685. args: ["aNode"],
  42686. source: "node: aNode\x0a\x09node := aNode",
  42687. referencedClasses: [],
  42688. messageSends: []
  42689. }),
  42690. $globals.ASTInterpreter);
  42691. $core.addMethod(
  42692. $core.method({
  42693. selector: "peek",
  42694. protocol: 'stack',
  42695. fn: function (){
  42696. var self=this;
  42697. return $core.withContext(function($ctx1) {
  42698. var $1;
  42699. var $early={};
  42700. try {
  42701. $1=self._stack();
  42702. $ctx1.sendIdx["stack"]=1;
  42703. $recv($1)._ifEmpty_((function(){
  42704. throw $early=[nil];
  42705. }));
  42706. return $recv(self._stack())._last();
  42707. }
  42708. catch(e) {if(e===$early)return e[0]; throw e}
  42709. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  42710. },
  42711. args: [],
  42712. 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",
  42713. referencedClasses: [],
  42714. messageSends: ["ifEmpty:", "stack", "last"]
  42715. }),
  42716. $globals.ASTInterpreter);
  42717. $core.addMethod(
  42718. $core.method({
  42719. selector: "pop",
  42720. protocol: 'stack',
  42721. fn: function (){
  42722. var self=this;
  42723. var peekedValue;
  42724. return $core.withContext(function($ctx1) {
  42725. peekedValue=self._peek();
  42726. $recv(self._stack())._removeLast();
  42727. return peekedValue;
  42728. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  42729. },
  42730. args: [],
  42731. 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",
  42732. referencedClasses: [],
  42733. messageSends: ["peek", "removeLast", "stack"]
  42734. }),
  42735. $globals.ASTInterpreter);
  42736. $core.addMethod(
  42737. $core.method({
  42738. selector: "proceed",
  42739. protocol: 'interpreting',
  42740. fn: function (){
  42741. var self=this;
  42742. return $core.withContext(function($ctx1) {
  42743. $recv((function(){
  42744. return $core.withContext(function($ctx2) {
  42745. return self._atEnd();
  42746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42747. }))._whileFalse_((function(){
  42748. return $core.withContext(function($ctx2) {
  42749. return self._step();
  42750. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42751. }));
  42752. return self;
  42753. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  42754. },
  42755. args: [],
  42756. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  42757. referencedClasses: [],
  42758. messageSends: ["whileFalse:", "atEnd", "step"]
  42759. }),
  42760. $globals.ASTInterpreter);
  42761. $core.addMethod(
  42762. $core.method({
  42763. selector: "push:",
  42764. protocol: 'stack',
  42765. fn: function (anObject){
  42766. var self=this;
  42767. return $core.withContext(function($ctx1) {
  42768. return $recv(self._stack())._add_(anObject);
  42769. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  42770. },
  42771. args: ["anObject"],
  42772. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  42773. referencedClasses: [],
  42774. messageSends: ["add:", "stack"]
  42775. }),
  42776. $globals.ASTInterpreter);
  42777. $core.addMethod(
  42778. $core.method({
  42779. selector: "restart",
  42780. protocol: 'interpreting',
  42781. fn: function (){
  42782. var self=this;
  42783. return $core.withContext(function($ctx1) {
  42784. self._node_($recv(self._context())._ast());
  42785. self._enterNode();
  42786. return self;
  42787. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  42788. },
  42789. args: [],
  42790. source: "restart\x0a\x09self node: self context ast; enterNode",
  42791. referencedClasses: [],
  42792. messageSends: ["node:", "ast", "context", "enterNode"]
  42793. }),
  42794. $globals.ASTInterpreter);
  42795. $core.addMethod(
  42796. $core.method({
  42797. selector: "result",
  42798. protocol: 'accessing',
  42799. fn: function (){
  42800. var self=this;
  42801. return $core.withContext(function($ctx1) {
  42802. var $1;
  42803. $1=self._hasReturned();
  42804. if($core.assert($1)){
  42805. return self._returnValue();
  42806. } else {
  42807. return $recv(self._context())._receiver();
  42808. };
  42809. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  42810. },
  42811. args: [],
  42812. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  42813. referencedClasses: [],
  42814. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  42815. }),
  42816. $globals.ASTInterpreter);
  42817. $core.addMethod(
  42818. $core.method({
  42819. selector: "returnValue",
  42820. protocol: 'accessing',
  42821. fn: function (){
  42822. var self=this;
  42823. return self["@returnValue"];
  42824. },
  42825. args: [],
  42826. source: "returnValue\x0a\x09^ returnValue",
  42827. referencedClasses: [],
  42828. messageSends: []
  42829. }),
  42830. $globals.ASTInterpreter);
  42831. $core.addMethod(
  42832. $core.method({
  42833. selector: "returnValue:",
  42834. protocol: 'accessing',
  42835. fn: function (anObject){
  42836. var self=this;
  42837. self["@returnValue"]=anObject;
  42838. return self;
  42839. },
  42840. args: ["anObject"],
  42841. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  42842. referencedClasses: [],
  42843. messageSends: []
  42844. }),
  42845. $globals.ASTInterpreter);
  42846. $core.addMethod(
  42847. $core.method({
  42848. selector: "sendMessage:to:superSend:",
  42849. protocol: 'private',
  42850. fn: function (aMessage,anObject,aBoolean){
  42851. var self=this;
  42852. var method;
  42853. return $core.withContext(function($ctx1) {
  42854. var $2,$1,$3,$receiver;
  42855. var $early={};
  42856. try {
  42857. if(!$core.assert(aBoolean)){
  42858. return $recv(aMessage)._sendTo_(anObject);
  42859. };
  42860. $2=$recv(anObject)._class();
  42861. $ctx1.sendIdx["class"]=1;
  42862. $1=$recv($2)._superclass();
  42863. $ctx1.sendIdx["superclass"]=1;
  42864. if(($receiver = $1) == null || $receiver.isNil){
  42865. $3=self._messageNotUnderstood_receiver_(aMessage,anObject);
  42866. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  42867. return $3;
  42868. } else {
  42869. $1;
  42870. };
  42871. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  42872. return $core.withContext(function($ctx2) {
  42873. throw $early=[self._messageNotUnderstood_receiver_(aMessage,anObject)];
  42874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42875. }));
  42876. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  42877. }
  42878. catch(e) {if(e===$early)return e[0]; throw e}
  42879. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  42880. },
  42881. args: ["aMessage", "anObject", "aBoolean"],
  42882. 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",
  42883. referencedClasses: [],
  42884. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  42885. }),
  42886. $globals.ASTInterpreter);
  42887. $core.addMethod(
  42888. $core.method({
  42889. selector: "setNonLocalReturnFromContext:",
  42890. protocol: 'interpreting',
  42891. fn: function (aContext){
  42892. var self=this;
  42893. return $core.withContext(function($ctx1) {
  42894. var $2,$1;
  42895. $2=$recv(aContext)._interpreter();
  42896. $ctx1.sendIdx["interpreter"]=1;
  42897. $1=$recv($2)._hasReturned();
  42898. if($core.assert($1)){
  42899. self["@returned"]=true;
  42900. self["@returned"];
  42901. self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  42902. };
  42903. return self;
  42904. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  42905. },
  42906. args: ["aContext"],
  42907. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  42908. referencedClasses: [],
  42909. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  42910. }),
  42911. $globals.ASTInterpreter);
  42912. $core.addMethod(
  42913. $core.method({
  42914. selector: "skip",
  42915. protocol: 'interpreting',
  42916. fn: function (){
  42917. var self=this;
  42918. return $core.withContext(function($ctx1) {
  42919. self._next();
  42920. return self;
  42921. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  42922. },
  42923. args: [],
  42924. source: "skip\x0a\x09self next",
  42925. referencedClasses: [],
  42926. messageSends: ["next"]
  42927. }),
  42928. $globals.ASTInterpreter);
  42929. $core.addMethod(
  42930. $core.method({
  42931. selector: "stack",
  42932. protocol: 'accessing',
  42933. fn: function (){
  42934. var self=this;
  42935. return $core.withContext(function($ctx1) {
  42936. var $1,$receiver;
  42937. $1=self["@stack"];
  42938. if(($receiver = $1) == null || $receiver.isNil){
  42939. self["@stack"]=$recv($globals.OrderedCollection)._new();
  42940. return self["@stack"];
  42941. } else {
  42942. return $1;
  42943. };
  42944. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  42945. },
  42946. args: [],
  42947. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  42948. referencedClasses: ["OrderedCollection"],
  42949. messageSends: ["ifNil:", "new"]
  42950. }),
  42951. $globals.ASTInterpreter);
  42952. $core.addMethod(
  42953. $core.method({
  42954. selector: "step",
  42955. protocol: 'interpreting',
  42956. fn: function (){
  42957. var self=this;
  42958. return $core.withContext(function($ctx1) {
  42959. self._interpret();
  42960. self._next();
  42961. return self;
  42962. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  42963. },
  42964. args: [],
  42965. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  42966. referencedClasses: [],
  42967. messageSends: ["interpret", "next"]
  42968. }),
  42969. $globals.ASTInterpreter);
  42970. $core.addMethod(
  42971. $core.method({
  42972. selector: "stepOver",
  42973. protocol: 'interpreting',
  42974. fn: function (){
  42975. var self=this;
  42976. return $core.withContext(function($ctx1) {
  42977. var $2,$1;
  42978. self._step();
  42979. $ctx1.sendIdx["step"]=1;
  42980. $recv((function(){
  42981. return $core.withContext(function($ctx2) {
  42982. $2=self._node();
  42983. $ctx2.sendIdx["node"]=1;
  42984. $1=$recv($2)._isNil();
  42985. return $recv($1)._or_((function(){
  42986. return $core.withContext(function($ctx3) {
  42987. return $recv(self._node())._isSteppingNode();
  42988. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42989. }));
  42990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42991. }))._whileFalse_((function(){
  42992. return $core.withContext(function($ctx2) {
  42993. return self._step();
  42994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42995. }));
  42996. return self;
  42997. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  42998. },
  42999. args: [],
  43000. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  43001. referencedClasses: [],
  43002. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  43003. }),
  43004. $globals.ASTInterpreter);
  43005. $core.addMethod(
  43006. $core.method({
  43007. selector: "visit:",
  43008. protocol: 'visiting',
  43009. fn: function (aNode){
  43010. var self=this;
  43011. return $core.withContext(function($ctx1) {
  43012. var $1;
  43013. $1=self._hasReturned();
  43014. if(!$core.assert($1)){
  43015. (
  43016. $ctx1.supercall = true,
  43017. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($recv(self), [aNode]));
  43018. $ctx1.supercall = false;
  43019. };
  43020. return self;
  43021. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  43022. },
  43023. args: ["aNode"],
  43024. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  43025. referencedClasses: [],
  43026. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  43027. }),
  43028. $globals.ASTInterpreter);
  43029. $core.addMethod(
  43030. $core.method({
  43031. selector: "visitAssignmentNode:",
  43032. protocol: 'visiting',
  43033. fn: function (aNode){
  43034. var self=this;
  43035. var poppedValue;
  43036. return $core.withContext(function($ctx1) {
  43037. poppedValue=self._pop();
  43038. $ctx1.sendIdx["pop"]=1;
  43039. self._pop();
  43040. self._push_(poppedValue);
  43041. self._assign_to_($recv(aNode)._left(),poppedValue);
  43042. return self;
  43043. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  43044. },
  43045. args: ["aNode"],
  43046. 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",
  43047. referencedClasses: [],
  43048. messageSends: ["pop", "push:", "assign:to:", "left"]
  43049. }),
  43050. $globals.ASTInterpreter);
  43051. $core.addMethod(
  43052. $core.method({
  43053. selector: "visitBlockNode:",
  43054. protocol: 'visiting',
  43055. fn: function (aNode){
  43056. var self=this;
  43057. var block;
  43058. return $core.withContext(function($ctx1) {
  43059. block=$recv($globals.AIBlockClosure)._forContext_node_(self._context(),aNode);
  43060. self._push_(block);
  43061. return self;
  43062. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  43063. },
  43064. args: ["aNode"],
  43065. 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",
  43066. referencedClasses: ["AIBlockClosure"],
  43067. messageSends: ["forContext:node:", "context", "push:"]
  43068. }),
  43069. $globals.ASTInterpreter);
  43070. $core.addMethod(
  43071. $core.method({
  43072. selector: "visitBlockSequenceNode:",
  43073. protocol: 'visiting',
  43074. fn: function (aNode){
  43075. var self=this;
  43076. return $core.withContext(function($ctx1) {
  43077. (
  43078. $ctx1.supercall = true,
  43079. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode]));
  43080. $ctx1.supercall = false;
  43081. self["@forceAtEnd"]=true;
  43082. return self;
  43083. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43084. },
  43085. args: ["aNode"],
  43086. 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",
  43087. referencedClasses: [],
  43088. messageSends: ["visitBlockSequenceNode:"]
  43089. }),
  43090. $globals.ASTInterpreter);
  43091. $core.addMethod(
  43092. $core.method({
  43093. selector: "visitDynamicArrayNode:",
  43094. protocol: 'visiting',
  43095. fn: function (aNode){
  43096. var self=this;
  43097. var array;
  43098. return $core.withContext(function($ctx1) {
  43099. array=[];
  43100. $recv($recv(aNode)._nodes())._do_((function(each){
  43101. return $core.withContext(function($ctx2) {
  43102. return $recv(array)._addFirst_(self._pop());
  43103. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43104. }));
  43105. self._push_(array);
  43106. return self;
  43107. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  43108. },
  43109. args: ["aNode"],
  43110. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09\x0a\x09array := #().\x0a\x09aNode nodes do: [ :each |\x0a\x09\x09array addFirst: self pop ].\x0a\x09\x0a\x09self push: array",
  43111. referencedClasses: [],
  43112. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"]
  43113. }),
  43114. $globals.ASTInterpreter);
  43115. $core.addMethod(
  43116. $core.method({
  43117. selector: "visitDynamicDictionaryNode:",
  43118. protocol: 'visiting',
  43119. fn: function (aNode){
  43120. var self=this;
  43121. var keyValueList;
  43122. return $core.withContext(function($ctx1) {
  43123. keyValueList=$recv($globals.OrderedCollection)._new();
  43124. $recv($recv(aNode)._nodes())._do_((function(each){
  43125. return $core.withContext(function($ctx2) {
  43126. return $recv(keyValueList)._add_(self._pop());
  43127. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43128. }));
  43129. self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  43130. return self;
  43131. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  43132. },
  43133. args: ["aNode"],
  43134. source: "visitDynamicDictionaryNode: aNode\x0a\x09| keyValueList |\x0a\x09\x0a\x09keyValueList := OrderedCollection new.\x0a\x09\x0a\x09aNode nodes do: [ :each | \x0a\x09\x09keyValueList add: self pop ].\x0a\x09\x0a\x09self push: (HashedCollection newFromPairs: keyValueList reversed)",
  43135. referencedClasses: ["OrderedCollection", "HashedCollection"],
  43136. messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  43137. }),
  43138. $globals.ASTInterpreter);
  43139. $core.addMethod(
  43140. $core.method({
  43141. selector: "visitJSStatementNode:",
  43142. protocol: 'visiting',
  43143. fn: function (aNode){
  43144. var self=this;
  43145. return $core.withContext(function($ctx1) {
  43146. self["@returned"]=true;
  43147. self._returnValue_(self._eval_($recv(aNode)._source()));
  43148. return self;
  43149. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43150. },
  43151. args: ["aNode"],
  43152. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  43153. referencedClasses: [],
  43154. messageSends: ["returnValue:", "eval:", "source"]
  43155. }),
  43156. $globals.ASTInterpreter);
  43157. $core.addMethod(
  43158. $core.method({
  43159. selector: "visitNode:",
  43160. protocol: 'visiting',
  43161. fn: function (aNode){
  43162. var self=this;
  43163. return self;
  43164. },
  43165. args: ["aNode"],
  43166. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  43167. referencedClasses: [],
  43168. messageSends: []
  43169. }),
  43170. $globals.ASTInterpreter);
  43171. $core.addMethod(
  43172. $core.method({
  43173. selector: "visitReturnNode:",
  43174. protocol: 'visiting',
  43175. fn: function (aNode){
  43176. var self=this;
  43177. return $core.withContext(function($ctx1) {
  43178. self["@returned"]=true;
  43179. self._returnValue_(self._pop());
  43180. return self;
  43181. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43182. },
  43183. args: ["aNode"],
  43184. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  43185. referencedClasses: [],
  43186. messageSends: ["returnValue:", "pop"]
  43187. }),
  43188. $globals.ASTInterpreter);
  43189. $core.addMethod(
  43190. $core.method({
  43191. selector: "visitSendNode:",
  43192. protocol: 'visiting',
  43193. fn: function (aNode){
  43194. var self=this;
  43195. var receiver,args,message,result;
  43196. return $core.withContext(function($ctx1) {
  43197. var $1;
  43198. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  43199. return $core.withContext(function($ctx2) {
  43200. return self._pop();
  43201. $ctx2.sendIdx["pop"]=1;
  43202. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43203. }));
  43204. receiver=self._peek();
  43205. message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  43206. result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  43207. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  43208. return $core.withContext(function($ctx2) {
  43209. return $recv($recv(aNode)._isLastChild())._not();
  43210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43211. }));
  43212. if(!$core.assert($1)){
  43213. self._pop();
  43214. self._push_(result);
  43215. };
  43216. return self;
  43217. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  43218. },
  43219. args: ["aNode"],
  43220. 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 ]",
  43221. referencedClasses: [],
  43222. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  43223. }),
  43224. $globals.ASTInterpreter);
  43225. $core.addMethod(
  43226. $core.method({
  43227. selector: "visitValueNode:",
  43228. protocol: 'visiting',
  43229. fn: function (aNode){
  43230. var self=this;
  43231. return $core.withContext(function($ctx1) {
  43232. self._push_($recv(aNode)._value());
  43233. return self;
  43234. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43235. },
  43236. args: ["aNode"],
  43237. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  43238. referencedClasses: [],
  43239. messageSends: ["push:", "value"]
  43240. }),
  43241. $globals.ASTInterpreter);
  43242. $core.addMethod(
  43243. $core.method({
  43244. selector: "visitVariableNode:",
  43245. protocol: 'visiting',
  43246. fn: function (aNode){
  43247. var self=this;
  43248. return $core.withContext(function($ctx1) {
  43249. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  43250. $2=$recv(aNode)._binding();
  43251. $ctx1.sendIdx["binding"]=1;
  43252. $1=$recv($2)._isUnknownVar();
  43253. if($core.assert($1)){
  43254. $5=$recv($globals.Platform)._globals();
  43255. $ctx1.sendIdx["globals"]=1;
  43256. $6=$recv(aNode)._value();
  43257. $ctx1.sendIdx["value"]=1;
  43258. $4=$recv($5)._at_ifAbsent_($6,(function(){
  43259. return $core.withContext(function($ctx2) {
  43260. return self._error_("Unknown variable");
  43261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43262. }));
  43263. $ctx1.sendIdx["at:ifAbsent:"]=1;
  43264. $3=self._push_($4);
  43265. $ctx1.sendIdx["push:"]=1;
  43266. return $3;
  43267. };
  43268. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  43269. if($core.assert($8)){
  43270. $10=self._context();
  43271. $ctx1.sendIdx["context"]=1;
  43272. $9=$recv($10)._receiver();
  43273. $11=$recv(aNode)._value();
  43274. $ctx1.sendIdx["value"]=2;
  43275. $7=$recv($9)._instVarAt_($11);
  43276. } else {
  43277. $12=self._context();
  43278. $13=$recv(aNode)._value();
  43279. $ctx1.sendIdx["value"]=3;
  43280. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  43281. return $core.withContext(function($ctx2) {
  43282. $15=$recv(aNode)._value();
  43283. $ctx2.sendIdx["value"]=4;
  43284. $14=$recv($15)._isCapitalized();
  43285. if($core.assert($14)){
  43286. $16=$recv($globals.Smalltalk)._globals();
  43287. $ctx2.sendIdx["globals"]=2;
  43288. $17=$recv(aNode)._value();
  43289. $ctx2.sendIdx["value"]=5;
  43290. return $recv($16)._at_ifAbsent_($17,(function(){
  43291. return $core.withContext(function($ctx3) {
  43292. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  43293. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  43294. }));
  43295. };
  43296. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  43297. }));
  43298. };
  43299. self._push_($7);
  43300. return self;
  43301. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43302. },
  43303. args: ["aNode"],
  43304. 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 ] ] ] ])",
  43305. referencedClasses: ["Platform", "Smalltalk"],
  43306. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  43307. }),
  43308. $globals.ASTInterpreter);
  43309. $core.addClass('ASTInterpreterError', $globals.Error, [], 'Compiler-Interpreter');
  43310. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  43311. $core.addClass('ASTPCNodeVisitor', $globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
  43312. $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`";
  43313. $core.addMethod(
  43314. $core.method({
  43315. selector: "context",
  43316. protocol: 'accessing',
  43317. fn: function (){
  43318. var self=this;
  43319. return self["@context"];
  43320. },
  43321. args: [],
  43322. source: "context\x0a\x09^ context",
  43323. referencedClasses: [],
  43324. messageSends: []
  43325. }),
  43326. $globals.ASTPCNodeVisitor);
  43327. $core.addMethod(
  43328. $core.method({
  43329. selector: "context:",
  43330. protocol: 'accessing',
  43331. fn: function (aContext){
  43332. var self=this;
  43333. self["@context"]=aContext;
  43334. return self;
  43335. },
  43336. args: ["aContext"],
  43337. source: "context: aContext\x0a\x09context := aContext",
  43338. referencedClasses: [],
  43339. messageSends: []
  43340. }),
  43341. $globals.ASTPCNodeVisitor);
  43342. $core.addMethod(
  43343. $core.method({
  43344. selector: "currentNode",
  43345. protocol: 'accessing',
  43346. fn: function (){
  43347. var self=this;
  43348. return self["@currentNode"];
  43349. },
  43350. args: [],
  43351. source: "currentNode\x0a\x09^ currentNode",
  43352. referencedClasses: [],
  43353. messageSends: []
  43354. }),
  43355. $globals.ASTPCNodeVisitor);
  43356. $core.addMethod(
  43357. $core.method({
  43358. selector: "increaseIndex",
  43359. protocol: 'accessing',
  43360. fn: function (){
  43361. var self=this;
  43362. return $core.withContext(function($ctx1) {
  43363. self["@index"]=$recv(self._index()).__plus((1));
  43364. return self;
  43365. }, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},$globals.ASTPCNodeVisitor)});
  43366. },
  43367. args: [],
  43368. source: "increaseIndex\x0a\x09index := self index + 1",
  43369. referencedClasses: [],
  43370. messageSends: ["+", "index"]
  43371. }),
  43372. $globals.ASTPCNodeVisitor);
  43373. $core.addMethod(
  43374. $core.method({
  43375. selector: "index",
  43376. protocol: 'accessing',
  43377. fn: function (){
  43378. var self=this;
  43379. return $core.withContext(function($ctx1) {
  43380. var $1,$receiver;
  43381. $1=self["@index"];
  43382. if(($receiver = $1) == null || $receiver.isNil){
  43383. self["@index"]=(0);
  43384. return self["@index"];
  43385. } else {
  43386. return $1;
  43387. };
  43388. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.ASTPCNodeVisitor)});
  43389. },
  43390. args: [],
  43391. source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
  43392. referencedClasses: [],
  43393. messageSends: ["ifNil:"]
  43394. }),
  43395. $globals.ASTPCNodeVisitor);
  43396. $core.addMethod(
  43397. $core.method({
  43398. selector: "selector",
  43399. protocol: 'accessing',
  43400. fn: function (){
  43401. var self=this;
  43402. return self["@selector"];
  43403. },
  43404. args: [],
  43405. source: "selector\x0a\x09^ selector",
  43406. referencedClasses: [],
  43407. messageSends: []
  43408. }),
  43409. $globals.ASTPCNodeVisitor);
  43410. $core.addMethod(
  43411. $core.method({
  43412. selector: "selector:",
  43413. protocol: 'accessing',
  43414. fn: function (aString){
  43415. var self=this;
  43416. self["@selector"]=aString;
  43417. return self;
  43418. },
  43419. args: ["aString"],
  43420. source: "selector: aString\x0a\x09selector := aString",
  43421. referencedClasses: [],
  43422. messageSends: []
  43423. }),
  43424. $globals.ASTPCNodeVisitor);
  43425. $core.addMethod(
  43426. $core.method({
  43427. selector: "visitJSStatementNode:",
  43428. protocol: 'visiting',
  43429. fn: function (aNode){
  43430. var self=this;
  43431. self["@currentNode"]=aNode;
  43432. return self;
  43433. },
  43434. args: ["aNode"],
  43435. 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",
  43436. referencedClasses: [],
  43437. messageSends: []
  43438. }),
  43439. $globals.ASTPCNodeVisitor);
  43440. $core.addMethod(
  43441. $core.method({
  43442. selector: "visitSendNode:",
  43443. protocol: 'visiting',
  43444. fn: function (aNode){
  43445. var self=this;
  43446. var sendIndex;
  43447. return $core.withContext(function($ctx1) {
  43448. var $1,$2,$4,$3,$5;
  43449. $1=self._context();
  43450. $2=self._selector();
  43451. $ctx1.sendIdx["selector"]=1;
  43452. sendIndex=$recv($1)._sendIndexAt_($2);
  43453. (
  43454. $ctx1.supercall = true,
  43455. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  43456. $ctx1.supercall = false;
  43457. $4=self._selector();
  43458. $ctx1.sendIdx["selector"]=2;
  43459. $3=$recv($4).__eq($recv(aNode)._selector());
  43460. $ctx1.sendIdx["="]=1;
  43461. if($core.assert($3)){
  43462. $5=$recv(self._index()).__eq(sendIndex);
  43463. if($core.assert($5)){
  43464. self["@currentNode"]=aNode;
  43465. self["@currentNode"];
  43466. };
  43467. self._increaseIndex();
  43468. };
  43469. return self;
  43470. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},$globals.ASTPCNodeVisitor)});
  43471. },
  43472. args: ["aNode"],
  43473. source: "visitSendNode: aNode\x0a\x09| sendIndex |\x0a\x09sendIndex := self context sendIndexAt: self selector.\x0a\x09\x0a\x09super visitSendNode: aNode.\x0a\x09\x0a\x09self selector = aNode selector ifTrue: [\x0a\x09\x09self index = sendIndex ifTrue: [ currentNode := aNode ].\x0a\x09\x09self increaseIndex ]",
  43474. referencedClasses: [],
  43475. messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"]
  43476. }),
  43477. $globals.ASTPCNodeVisitor);
  43478. $core.addMethod(
  43479. $core.method({
  43480. selector: "isSteppingNode",
  43481. protocol: '*Compiler-Interpreter',
  43482. fn: function (){
  43483. var self=this;
  43484. return true;
  43485. },
  43486. args: [],
  43487. source: "isSteppingNode\x0a\x09^ true",
  43488. referencedClasses: [],
  43489. messageSends: []
  43490. }),
  43491. $globals.AssignmentNode);
  43492. $core.addMethod(
  43493. $core.method({
  43494. selector: "isSteppingNode",
  43495. protocol: '*Compiler-Interpreter',
  43496. fn: function (){
  43497. var self=this;
  43498. return true;
  43499. },
  43500. args: [],
  43501. source: "isSteppingNode\x0a\x09^ true",
  43502. referencedClasses: [],
  43503. messageSends: []
  43504. }),
  43505. $globals.BlockNode);
  43506. $core.addMethod(
  43507. $core.method({
  43508. selector: "nextSiblingNode:",
  43509. protocol: '*Compiler-Interpreter',
  43510. fn: function (aNode){
  43511. var self=this;
  43512. return nil;
  43513. },
  43514. args: ["aNode"],
  43515. 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",
  43516. referencedClasses: [],
  43517. messageSends: []
  43518. }),
  43519. $globals.BlockNode);
  43520. $core.addMethod(
  43521. $core.method({
  43522. selector: "isSteppingNode",
  43523. protocol: '*Compiler-Interpreter',
  43524. fn: function (){
  43525. var self=this;
  43526. return true;
  43527. },
  43528. args: [],
  43529. source: "isSteppingNode\x0a\x09^ true",
  43530. referencedClasses: [],
  43531. messageSends: []
  43532. }),
  43533. $globals.DynamicArrayNode);
  43534. $core.addMethod(
  43535. $core.method({
  43536. selector: "isSteppingNode",
  43537. protocol: '*Compiler-Interpreter',
  43538. fn: function (){
  43539. var self=this;
  43540. return true;
  43541. },
  43542. args: [],
  43543. source: "isSteppingNode\x0a\x09^ true",
  43544. referencedClasses: [],
  43545. messageSends: []
  43546. }),
  43547. $globals.DynamicDictionaryNode);
  43548. $core.addMethod(
  43549. $core.method({
  43550. selector: "isSteppingNode",
  43551. protocol: '*Compiler-Interpreter',
  43552. fn: function (){
  43553. var self=this;
  43554. return true;
  43555. },
  43556. args: [],
  43557. source: "isSteppingNode\x0a\x09^ true",
  43558. referencedClasses: [],
  43559. messageSends: []
  43560. }),
  43561. $globals.JSStatementNode);
  43562. $core.addMethod(
  43563. $core.method({
  43564. selector: "isSteppingNode",
  43565. protocol: '*Compiler-Interpreter',
  43566. fn: function (){
  43567. var self=this;
  43568. return false;
  43569. },
  43570. args: [],
  43571. source: "isSteppingNode\x0a\x09^ false",
  43572. referencedClasses: [],
  43573. messageSends: []
  43574. }),
  43575. $globals.Node);
  43576. $core.addMethod(
  43577. $core.method({
  43578. selector: "nextSiblingNode:",
  43579. protocol: '*Compiler-Interpreter',
  43580. fn: function (aNode){
  43581. var self=this;
  43582. return $core.withContext(function($ctx1) {
  43583. var $1;
  43584. var $early={};
  43585. try {
  43586. $1=self._nodes();
  43587. $ctx1.sendIdx["nodes"]=1;
  43588. return $recv($1)._at_ifAbsent_($recv($recv(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  43589. throw $early=[nil];
  43590. }));
  43591. }
  43592. catch(e) {if(e===$early)return e[0]; throw e}
  43593. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.Node)});
  43594. },
  43595. args: ["aNode"],
  43596. source: "nextSiblingNode: aNode\x0a\x09\x22Answer the next node after aNode or nil\x22\x0a\x09\x0a\x09^ self nodes \x0a\x09\x09at: (self nodes indexOf: aNode) + 1\x0a\x09\x09ifAbsent: [ ^ nil ]",
  43597. referencedClasses: [],
  43598. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:"]
  43599. }),
  43600. $globals.Node);
  43601. $core.addMethod(
  43602. $core.method({
  43603. selector: "isSteppingNode",
  43604. protocol: '*Compiler-Interpreter',
  43605. fn: function (){
  43606. var self=this;
  43607. return true;
  43608. },
  43609. args: [],
  43610. source: "isSteppingNode\x0a\x09^ true",
  43611. referencedClasses: [],
  43612. messageSends: []
  43613. }),
  43614. $globals.SendNode);
  43615. });
  43616. define('amber/lang',[
  43617. './deploy',
  43618. './compatibility', // pre-fetch, dep of ./boot
  43619. './boot', // pre-fetch, dep of ./helpers
  43620. './helpers', // pre-fetch, dep of ./deploy
  43621. './parser',
  43622. // --- packages for the Amber reflection begin here ---
  43623. 'amber_core/Platform-ImportExport',
  43624. 'amber_core/Compiler-Core',
  43625. 'amber_core/Compiler-AST',
  43626. 'amber_core/Compiler-Semantic',
  43627. 'amber_core/Compiler-IR',
  43628. 'amber_core/Compiler-Inlining',
  43629. 'amber_core/Compiler-Interpreter'
  43630. // --- packages for the Amber reflection end here ---
  43631. ], function (amber) { return amber; });
  43632. 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";
  43633. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  43634. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  43635. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  43636. $core.addPackage('SUnit');
  43637. $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
  43638. $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  43639. $core.addClass('ResultAnnouncement', $globals.Object, ['result'], 'SUnit');
  43640. $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.";
  43641. $core.addMethod(
  43642. $core.method({
  43643. selector: "result",
  43644. protocol: 'accessing',
  43645. fn: function (){
  43646. var self=this;
  43647. return self["@result"];
  43648. },
  43649. args: [],
  43650. source: "result\x0a\x09^ result",
  43651. referencedClasses: [],
  43652. messageSends: []
  43653. }),
  43654. $globals.ResultAnnouncement);
  43655. $core.addMethod(
  43656. $core.method({
  43657. selector: "result:",
  43658. protocol: 'accessing',
  43659. fn: function (aTestResult){
  43660. var self=this;
  43661. self["@result"]=aTestResult;
  43662. return self;
  43663. },
  43664. args: ["aTestResult"],
  43665. source: "result: aTestResult\x0a\x09result := aTestResult",
  43666. referencedClasses: [],
  43667. messageSends: []
  43668. }),
  43669. $globals.ResultAnnouncement);
  43670. $core.addClass('TestCase', $globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
  43671. $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.";
  43672. $core.addMethod(
  43673. $core.method({
  43674. selector: "assert:",
  43675. protocol: 'testing',
  43676. fn: function (aBoolean){
  43677. var self=this;
  43678. return $core.withContext(function($ctx1) {
  43679. self._assert_description_(aBoolean,"Assertion failed");
  43680. return self;
  43681. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  43682. },
  43683. args: ["aBoolean"],
  43684. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  43685. referencedClasses: [],
  43686. messageSends: ["assert:description:"]
  43687. }),
  43688. $globals.TestCase);
  43689. $core.addMethod(
  43690. $core.method({
  43691. selector: "assert:description:",
  43692. protocol: 'testing',
  43693. fn: function (aBoolean,aString){
  43694. var self=this;
  43695. return $core.withContext(function($ctx1) {
  43696. if(!$core.assert(aBoolean)){
  43697. self._signalFailure_(aString);
  43698. };
  43699. return self;
  43700. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  43701. },
  43702. args: ["aBoolean", "aString"],
  43703. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  43704. referencedClasses: [],
  43705. messageSends: ["ifFalse:", "signalFailure:"]
  43706. }),
  43707. $globals.TestCase);
  43708. $core.addMethod(
  43709. $core.method({
  43710. selector: "assert:equals:",
  43711. protocol: 'testing',
  43712. fn: function (actual,expected){
  43713. var self=this;
  43714. return $core.withContext(function($ctx1) {
  43715. var $1,$5,$4,$3,$2;
  43716. $1=$recv(actual).__eq(expected);
  43717. $5=$recv(expected)._printString();
  43718. $ctx1.sendIdx["printString"]=1;
  43719. $4="Expected: ".__comma($5);
  43720. $3=$recv($4).__comma(" but was: ");
  43721. $ctx1.sendIdx[","]=2;
  43722. $2=$recv($3).__comma($recv(actual)._printString());
  43723. $ctx1.sendIdx[","]=1;
  43724. return self._assert_description_($1,$2);
  43725. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  43726. },
  43727. args: ["actual", "expected"],
  43728. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  43729. referencedClasses: [],
  43730. messageSends: ["assert:description:", "=", ",", "printString"]
  43731. }),
  43732. $globals.TestCase);
  43733. $core.addMethod(
  43734. $core.method({
  43735. selector: "async:",
  43736. protocol: 'async',
  43737. fn: function (aBlock){
  43738. var self=this;
  43739. var c;
  43740. return $core.withContext(function($ctx1) {
  43741. var $1;
  43742. self._errorIfNotAsync_("#async");
  43743. c=self["@context"];
  43744. return (function(){
  43745. return $core.withContext(function($ctx2) {
  43746. $1=self._isAsync();
  43747. if($core.assert($1)){
  43748. return $recv(c)._execute_(aBlock);
  43749. };
  43750. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43751. });
  43752. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  43753. },
  43754. args: ["aBlock"],
  43755. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  43756. referencedClasses: [],
  43757. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  43758. }),
  43759. $globals.TestCase);
  43760. $core.addMethod(
  43761. $core.method({
  43762. selector: "context:",
  43763. protocol: 'accessing',
  43764. fn: function (aRunningTestContext){
  43765. var self=this;
  43766. self["@context"]=aRunningTestContext;
  43767. return self;
  43768. },
  43769. args: ["aRunningTestContext"],
  43770. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  43771. referencedClasses: [],
  43772. messageSends: []
  43773. }),
  43774. $globals.TestCase);
  43775. $core.addMethod(
  43776. $core.method({
  43777. selector: "deny:",
  43778. protocol: 'testing',
  43779. fn: function (aBoolean){
  43780. var self=this;
  43781. return $core.withContext(function($ctx1) {
  43782. self._assert_($recv(aBoolean)._not());
  43783. return self;
  43784. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  43785. },
  43786. args: ["aBoolean"],
  43787. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  43788. referencedClasses: [],
  43789. messageSends: ["assert:", "not"]
  43790. }),
  43791. $globals.TestCase);
  43792. $core.addMethod(
  43793. $core.method({
  43794. selector: "errorIfNotAsync:",
  43795. protocol: 'error handling',
  43796. fn: function (aString){
  43797. var self=this;
  43798. return $core.withContext(function($ctx1) {
  43799. var $1;
  43800. $1=self._isAsync();
  43801. if(!$core.assert($1)){
  43802. self._error_($recv(aString).__comma(" used without prior #timeout:"));
  43803. };
  43804. return self;
  43805. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  43806. },
  43807. args: ["aString"],
  43808. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  43809. referencedClasses: [],
  43810. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  43811. }),
  43812. $globals.TestCase);
  43813. $core.addMethod(
  43814. $core.method({
  43815. selector: "finished",
  43816. protocol: 'async',
  43817. fn: function (){
  43818. var self=this;
  43819. return $core.withContext(function($ctx1) {
  43820. self._errorIfNotAsync_("#finished");
  43821. self["@asyncTimeout"]=nil;
  43822. return self;
  43823. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  43824. },
  43825. args: [],
  43826. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  43827. referencedClasses: [],
  43828. messageSends: ["errorIfNotAsync:"]
  43829. }),
  43830. $globals.TestCase);
  43831. $core.addMethod(
  43832. $core.method({
  43833. selector: "isAsync",
  43834. protocol: 'testing',
  43835. fn: function (){
  43836. var self=this;
  43837. return $core.withContext(function($ctx1) {
  43838. return $recv(self["@asyncTimeout"])._notNil();
  43839. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  43840. },
  43841. args: [],
  43842. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  43843. referencedClasses: [],
  43844. messageSends: ["notNil"]
  43845. }),
  43846. $globals.TestCase);
  43847. $core.addMethod(
  43848. $core.method({
  43849. selector: "performTest",
  43850. protocol: 'running',
  43851. fn: function (){
  43852. var self=this;
  43853. return $core.withContext(function($ctx1) {
  43854. self["@asyncTimeout"]=nil;
  43855. self._perform_(self._selector());
  43856. return self;
  43857. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  43858. },
  43859. args: [],
  43860. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  43861. referencedClasses: [],
  43862. messageSends: ["perform:", "selector"]
  43863. }),
  43864. $globals.TestCase);
  43865. $core.addMethod(
  43866. $core.method({
  43867. selector: "runCase",
  43868. protocol: 'running',
  43869. fn: function (){
  43870. var self=this;
  43871. return $core.withContext(function($ctx1) {
  43872. $recv($recv($globals.TestContext)._testCase_(self))._start();
  43873. return self;
  43874. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  43875. },
  43876. args: [],
  43877. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  43878. referencedClasses: ["TestContext"],
  43879. messageSends: ["start", "testCase:"]
  43880. }),
  43881. $globals.TestCase);
  43882. $core.addMethod(
  43883. $core.method({
  43884. selector: "selector",
  43885. protocol: 'accessing',
  43886. fn: function (){
  43887. var self=this;
  43888. return self["@testSelector"];
  43889. },
  43890. args: [],
  43891. source: "selector\x0a\x09^ testSelector",
  43892. referencedClasses: [],
  43893. messageSends: []
  43894. }),
  43895. $globals.TestCase);
  43896. $core.addMethod(
  43897. $core.method({
  43898. selector: "setTestSelector:",
  43899. protocol: 'accessing',
  43900. fn: function (aSelector){
  43901. var self=this;
  43902. self["@testSelector"]=aSelector;
  43903. return self;
  43904. },
  43905. args: ["aSelector"],
  43906. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  43907. referencedClasses: [],
  43908. messageSends: []
  43909. }),
  43910. $globals.TestCase);
  43911. $core.addMethod(
  43912. $core.method({
  43913. selector: "setUp",
  43914. protocol: 'running',
  43915. fn: function (){
  43916. var self=this;
  43917. return self;
  43918. },
  43919. args: [],
  43920. source: "setUp",
  43921. referencedClasses: [],
  43922. messageSends: []
  43923. }),
  43924. $globals.TestCase);
  43925. $core.addMethod(
  43926. $core.method({
  43927. selector: "should:",
  43928. protocol: 'testing',
  43929. fn: function (aBlock){
  43930. var self=this;
  43931. return $core.withContext(function($ctx1) {
  43932. self._assert_($recv(aBlock)._value());
  43933. return self;
  43934. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  43935. },
  43936. args: ["aBlock"],
  43937. source: "should: aBlock\x0a\x09self assert: aBlock value",
  43938. referencedClasses: [],
  43939. messageSends: ["assert:", "value"]
  43940. }),
  43941. $globals.TestCase);
  43942. $core.addMethod(
  43943. $core.method({
  43944. selector: "should:raise:",
  43945. protocol: 'testing',
  43946. fn: function (aBlock,anExceptionClass){
  43947. var self=this;
  43948. return $core.withContext(function($ctx1) {
  43949. self._assert_($recv((function(){
  43950. return $core.withContext(function($ctx2) {
  43951. $recv(aBlock)._value();
  43952. return false;
  43953. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43954. }))._on_do_(anExceptionClass,(function(ex){
  43955. return true;
  43956. })));
  43957. return self;
  43958. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  43959. },
  43960. args: ["aBlock", "anExceptionClass"],
  43961. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  43962. referencedClasses: [],
  43963. messageSends: ["assert:", "on:do:", "value"]
  43964. }),
  43965. $globals.TestCase);
  43966. $core.addMethod(
  43967. $core.method({
  43968. selector: "shouldnt:raise:",
  43969. protocol: 'testing',
  43970. fn: function (aBlock,anExceptionClass){
  43971. var self=this;
  43972. return $core.withContext(function($ctx1) {
  43973. self._assert_($recv((function(){
  43974. return $core.withContext(function($ctx2) {
  43975. $recv(aBlock)._value();
  43976. return true;
  43977. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43978. }))._on_do_(anExceptionClass,(function(ex){
  43979. return false;
  43980. })));
  43981. return self;
  43982. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  43983. },
  43984. args: ["aBlock", "anExceptionClass"],
  43985. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  43986. referencedClasses: [],
  43987. messageSends: ["assert:", "on:do:", "value"]
  43988. }),
  43989. $globals.TestCase);
  43990. $core.addMethod(
  43991. $core.method({
  43992. selector: "signalFailure:",
  43993. protocol: 'private',
  43994. fn: function (aString){
  43995. var self=this;
  43996. return $core.withContext(function($ctx1) {
  43997. var $1;
  43998. $1=$recv($globals.TestFailure)._new();
  43999. $recv($1)._messageText_(aString);
  44000. $recv($1)._signal();
  44001. return self;
  44002. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  44003. },
  44004. args: ["aString"],
  44005. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  44006. referencedClasses: ["TestFailure"],
  44007. messageSends: ["messageText:", "new", "signal"]
  44008. }),
  44009. $globals.TestCase);
  44010. $core.addMethod(
  44011. $core.method({
  44012. selector: "tearDown",
  44013. protocol: 'running',
  44014. fn: function (){
  44015. var self=this;
  44016. return self;
  44017. },
  44018. args: [],
  44019. source: "tearDown",
  44020. referencedClasses: [],
  44021. messageSends: []
  44022. }),
  44023. $globals.TestCase);
  44024. $core.addMethod(
  44025. $core.method({
  44026. selector: "timeout:",
  44027. protocol: 'async',
  44028. fn: function (aNumber){
  44029. var self=this;
  44030. return $core.withContext(function($ctx1) {
  44031. var $1,$receiver;
  44032. $1=self["@asyncTimeout"];
  44033. if(($receiver = $1) == null || $receiver.isNil){
  44034. $1;
  44035. } else {
  44036. $recv(self["@asyncTimeout"])._clearTimeout();
  44037. };
  44038. self["@asyncTimeout"]=(0);
  44039. self["@asyncTimeout"]=$recv(self._async_((function(){
  44040. return $core.withContext(function($ctx2) {
  44041. return self._assert_description_(false,"SUnit grace time exhausted");
  44042. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44043. })))._valueWithTimeout_(aNumber);
  44044. return self;
  44045. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  44046. },
  44047. args: ["aNumber"],
  44048. 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",
  44049. referencedClasses: [],
  44050. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  44051. }),
  44052. $globals.TestCase);
  44053. $core.addMethod(
  44054. $core.method({
  44055. selector: "allTestSelectors",
  44056. protocol: 'accessing',
  44057. fn: function (){
  44058. var self=this;
  44059. var selectors;
  44060. return $core.withContext(function($ctx1) {
  44061. var $1;
  44062. selectors=self._testSelectors();
  44063. $1=self._shouldInheritSelectors();
  44064. if($core.assert($1)){
  44065. $recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors());
  44066. };
  44067. return selectors;
  44068. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)});
  44069. },
  44070. args: [],
  44071. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  44072. referencedClasses: [],
  44073. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  44074. }),
  44075. $globals.TestCase.klass);
  44076. $core.addMethod(
  44077. $core.method({
  44078. selector: "buildSuite",
  44079. protocol: 'accessing',
  44080. fn: function (){
  44081. var self=this;
  44082. return $core.withContext(function($ctx1) {
  44083. return $recv(self._allTestSelectors())._collect_((function(each){
  44084. return $core.withContext(function($ctx2) {
  44085. return self._selector_(each);
  44086. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44087. }));
  44088. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)});
  44089. },
  44090. args: [],
  44091. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  44092. referencedClasses: [],
  44093. messageSends: ["collect:", "allTestSelectors", "selector:"]
  44094. }),
  44095. $globals.TestCase.klass);
  44096. $core.addMethod(
  44097. $core.method({
  44098. selector: "classTag",
  44099. protocol: 'accessing',
  44100. fn: function (){
  44101. var self=this;
  44102. return "test";
  44103. },
  44104. args: [],
  44105. 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'",
  44106. referencedClasses: [],
  44107. messageSends: []
  44108. }),
  44109. $globals.TestCase.klass);
  44110. $core.addMethod(
  44111. $core.method({
  44112. selector: "isAbstract",
  44113. protocol: 'testing',
  44114. fn: function (){
  44115. var self=this;
  44116. return $core.withContext(function($ctx1) {
  44117. return $recv(self._name()).__eq("TestCase");
  44118. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)});
  44119. },
  44120. args: [],
  44121. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  44122. referencedClasses: [],
  44123. messageSends: ["=", "name"]
  44124. }),
  44125. $globals.TestCase.klass);
  44126. $core.addMethod(
  44127. $core.method({
  44128. selector: "lookupHierarchyRoot",
  44129. protocol: 'accessing',
  44130. fn: function (){
  44131. var self=this;
  44132. return $globals.TestCase;
  44133. },
  44134. args: [],
  44135. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  44136. referencedClasses: ["TestCase"],
  44137. messageSends: []
  44138. }),
  44139. $globals.TestCase.klass);
  44140. $core.addMethod(
  44141. $core.method({
  44142. selector: "selector:",
  44143. protocol: 'accessing',
  44144. fn: function (aSelector){
  44145. var self=this;
  44146. return $core.withContext(function($ctx1) {
  44147. var $1;
  44148. $1=self._new();
  44149. $recv($1)._setTestSelector_(aSelector);
  44150. return $recv($1)._yourself();
  44151. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)});
  44152. },
  44153. args: ["aSelector"],
  44154. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  44155. referencedClasses: [],
  44156. messageSends: ["setTestSelector:", "new", "yourself"]
  44157. }),
  44158. $globals.TestCase.klass);
  44159. $core.addMethod(
  44160. $core.method({
  44161. selector: "shouldInheritSelectors",
  44162. protocol: 'testing',
  44163. fn: function (){
  44164. var self=this;
  44165. return $core.withContext(function($ctx1) {
  44166. return self.__tild_eq(self._lookupHierarchyRoot());
  44167. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)});
  44168. },
  44169. args: [],
  44170. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  44171. referencedClasses: [],
  44172. messageSends: ["~=", "lookupHierarchyRoot"]
  44173. }),
  44174. $globals.TestCase.klass);
  44175. $core.addMethod(
  44176. $core.method({
  44177. selector: "testSelectors",
  44178. protocol: 'accessing',
  44179. fn: function (){
  44180. var self=this;
  44181. return $core.withContext(function($ctx1) {
  44182. return $recv($recv(self._methodDictionary())._keys())._select_((function(each){
  44183. return $core.withContext(function($ctx2) {
  44184. return $recv(each)._match_("^test");
  44185. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44186. }));
  44187. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)});
  44188. },
  44189. args: [],
  44190. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  44191. referencedClasses: [],
  44192. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  44193. }),
  44194. $globals.TestCase.klass);
  44195. $core.addClass('TestContext', $globals.Object, ['testCase'], 'SUnit');
  44196. $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).";
  44197. $core.addMethod(
  44198. $core.method({
  44199. selector: "execute:",
  44200. protocol: 'running',
  44201. fn: function (aBlock){
  44202. var self=this;
  44203. var failed;
  44204. return $core.withContext(function($ctx1) {
  44205. var $1,$2;
  44206. $recv(self["@testCase"])._context_(self);
  44207. $ctx1.sendIdx["context:"]=1;
  44208. $recv((function(){
  44209. return $core.withContext(function($ctx2) {
  44210. failed=true;
  44211. failed;
  44212. $recv(aBlock)._value();
  44213. failed=false;
  44214. return failed;
  44215. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44216. }))._ensure_((function(){
  44217. return $core.withContext(function($ctx2) {
  44218. $recv(self["@testCase"])._context_(nil);
  44219. $1=$recv(failed)._and_((function(){
  44220. return $core.withContext(function($ctx3) {
  44221. return $recv(self["@testCase"])._isAsync();
  44222. $ctx3.sendIdx["isAsync"]=1;
  44223. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  44224. }));
  44225. if($core.assert($1)){
  44226. $recv(self["@testCase"])._finished();
  44227. };
  44228. $2=$recv(self["@testCase"])._isAsync();
  44229. if(!$core.assert($2)){
  44230. return $recv(self["@testCase"])._tearDown();
  44231. };
  44232. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44233. }));
  44234. return self;
  44235. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  44236. },
  44237. args: ["aBlock"],
  44238. 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 ] ]",
  44239. referencedClasses: [],
  44240. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  44241. }),
  44242. $globals.TestContext);
  44243. $core.addMethod(
  44244. $core.method({
  44245. selector: "start",
  44246. protocol: 'running',
  44247. fn: function (){
  44248. var self=this;
  44249. return $core.withContext(function($ctx1) {
  44250. self._execute_((function(){
  44251. return $core.withContext(function($ctx2) {
  44252. $recv(self["@testCase"])._setUp();
  44253. return $recv(self["@testCase"])._performTest();
  44254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44255. }));
  44256. return self;
  44257. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  44258. },
  44259. args: [],
  44260. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  44261. referencedClasses: [],
  44262. messageSends: ["execute:", "setUp", "performTest"]
  44263. }),
  44264. $globals.TestContext);
  44265. $core.addMethod(
  44266. $core.method({
  44267. selector: "testCase:",
  44268. protocol: 'accessing',
  44269. fn: function (aTestCase){
  44270. var self=this;
  44271. self["@testCase"]=aTestCase;
  44272. return self;
  44273. },
  44274. args: ["aTestCase"],
  44275. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  44276. referencedClasses: [],
  44277. messageSends: []
  44278. }),
  44279. $globals.TestContext);
  44280. $core.addMethod(
  44281. $core.method({
  44282. selector: "testCase:",
  44283. protocol: 'instance creation',
  44284. fn: function (aTestCase){
  44285. var self=this;
  44286. return $core.withContext(function($ctx1) {
  44287. var $1;
  44288. $1=self._new();
  44289. $recv($1)._testCase_(aTestCase);
  44290. return $recv($1)._yourself();
  44291. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)});
  44292. },
  44293. args: ["aTestCase"],
  44294. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  44295. referencedClasses: [],
  44296. messageSends: ["testCase:", "new", "yourself"]
  44297. }),
  44298. $globals.TestContext.klass);
  44299. $core.addClass('ReportingTestContext', $globals.TestContext, ['finished', 'result'], 'SUnit');
  44300. $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`.";
  44301. $core.addMethod(
  44302. $core.method({
  44303. selector: "execute:",
  44304. protocol: 'running',
  44305. fn: function (aBlock){
  44306. var self=this;
  44307. return $core.withContext(function($ctx1) {
  44308. var $1;
  44309. $recv((function(){
  44310. return $core.withContext(function($ctx2) {
  44311. return self._withErrorReporting_((function(){
  44312. return $core.withContext(function($ctx3) {
  44313. return (
  44314. $ctx3.supercall = true,
  44315. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($recv(self), [aBlock]));
  44316. $ctx3.supercall = false;
  44317. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44318. }));
  44319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44320. }))._ensure_((function(){
  44321. return $core.withContext(function($ctx2) {
  44322. $1=$recv(self["@testCase"])._isAsync();
  44323. if(!$core.assert($1)){
  44324. $recv(self["@result"])._increaseRuns();
  44325. return $recv(self["@finished"])._value();
  44326. };
  44327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44328. }));
  44329. return self;
  44330. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  44331. },
  44332. args: ["aBlock"],
  44333. 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 ] ]",
  44334. referencedClasses: [],
  44335. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  44336. }),
  44337. $globals.ReportingTestContext);
  44338. $core.addMethod(
  44339. $core.method({
  44340. selector: "finished:",
  44341. protocol: 'accessing',
  44342. fn: function (aBlock){
  44343. var self=this;
  44344. self["@finished"]=aBlock;
  44345. return self;
  44346. },
  44347. args: ["aBlock"],
  44348. source: "finished: aBlock\x0a\x09finished := aBlock",
  44349. referencedClasses: [],
  44350. messageSends: []
  44351. }),
  44352. $globals.ReportingTestContext);
  44353. $core.addMethod(
  44354. $core.method({
  44355. selector: "result:",
  44356. protocol: 'accessing',
  44357. fn: function (aTestResult){
  44358. var self=this;
  44359. self["@result"]=aTestResult;
  44360. return self;
  44361. },
  44362. args: ["aTestResult"],
  44363. source: "result: aTestResult\x0a\x09result := aTestResult",
  44364. referencedClasses: [],
  44365. messageSends: []
  44366. }),
  44367. $globals.ReportingTestContext);
  44368. $core.addMethod(
  44369. $core.method({
  44370. selector: "withErrorReporting:",
  44371. protocol: 'private',
  44372. fn: function (aBlock){
  44373. var self=this;
  44374. return $core.withContext(function($ctx1) {
  44375. $recv((function(){
  44376. return $core.withContext(function($ctx2) {
  44377. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  44378. return $core.withContext(function($ctx3) {
  44379. return $recv(self["@result"])._addFailure_(self["@testCase"]);
  44380. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  44381. }));
  44382. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44383. }))._on_do_($globals.Error,(function(ex){
  44384. return $core.withContext(function($ctx2) {
  44385. return $recv(self["@result"])._addError_(self["@testCase"]);
  44386. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  44387. }));
  44388. $ctx1.sendIdx["on:do:"]=1;
  44389. return self;
  44390. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  44391. },
  44392. args: ["aBlock"],
  44393. 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 ]",
  44394. referencedClasses: ["TestFailure", "Error"],
  44395. messageSends: ["on:do:", "addFailure:", "addError:"]
  44396. }),
  44397. $globals.ReportingTestContext);
  44398. $core.addMethod(
  44399. $core.method({
  44400. selector: "testCase:result:finished:",
  44401. protocol: 'instance creation',
  44402. fn: function (aTestCase,aTestResult,aBlock){
  44403. var self=this;
  44404. return $core.withContext(function($ctx1) {
  44405. var $1;
  44406. $1=(
  44407. $ctx1.supercall = true,
  44408. ($globals.ReportingTestContext.klass.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($recv(self), [aTestCase]));
  44409. $ctx1.supercall = false;
  44410. $recv($1)._result_(aTestResult);
  44411. $recv($1)._finished_(aBlock);
  44412. return $recv($1)._yourself();
  44413. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)});
  44414. },
  44415. args: ["aTestCase", "aTestResult", "aBlock"],
  44416. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  44417. referencedClasses: [],
  44418. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  44419. }),
  44420. $globals.ReportingTestContext.klass);
  44421. $core.addClass('TestFailure', $globals.Error, [], 'SUnit');
  44422. $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.";
  44423. $core.addClass('TestResult', $globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  44424. $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";
  44425. $core.addMethod(
  44426. $core.method({
  44427. selector: "addError:",
  44428. protocol: 'accessing',
  44429. fn: function (anError){
  44430. var self=this;
  44431. return $core.withContext(function($ctx1) {
  44432. $recv(self._errors())._add_(anError);
  44433. return self;
  44434. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  44435. },
  44436. args: ["anError"],
  44437. source: "addError: anError\x0a\x09self errors add: anError",
  44438. referencedClasses: [],
  44439. messageSends: ["add:", "errors"]
  44440. }),
  44441. $globals.TestResult);
  44442. $core.addMethod(
  44443. $core.method({
  44444. selector: "addFailure:",
  44445. protocol: 'accessing',
  44446. fn: function (aFailure){
  44447. var self=this;
  44448. return $core.withContext(function($ctx1) {
  44449. $recv(self._failures())._add_(aFailure);
  44450. return self;
  44451. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  44452. },
  44453. args: ["aFailure"],
  44454. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  44455. referencedClasses: [],
  44456. messageSends: ["add:", "failures"]
  44457. }),
  44458. $globals.TestResult);
  44459. $core.addMethod(
  44460. $core.method({
  44461. selector: "errors",
  44462. protocol: 'accessing',
  44463. fn: function (){
  44464. var self=this;
  44465. return self["@errors"];
  44466. },
  44467. args: [],
  44468. source: "errors\x0a\x09^ errors",
  44469. referencedClasses: [],
  44470. messageSends: []
  44471. }),
  44472. $globals.TestResult);
  44473. $core.addMethod(
  44474. $core.method({
  44475. selector: "failures",
  44476. protocol: 'accessing',
  44477. fn: function (){
  44478. var self=this;
  44479. return self["@failures"];
  44480. },
  44481. args: [],
  44482. source: "failures\x0a\x09^ failures",
  44483. referencedClasses: [],
  44484. messageSends: []
  44485. }),
  44486. $globals.TestResult);
  44487. $core.addMethod(
  44488. $core.method({
  44489. selector: "increaseRuns",
  44490. protocol: 'accessing',
  44491. fn: function (){
  44492. var self=this;
  44493. return $core.withContext(function($ctx1) {
  44494. self["@runs"]=$recv(self["@runs"]).__plus((1));
  44495. return self;
  44496. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  44497. },
  44498. args: [],
  44499. source: "increaseRuns\x0a\x09runs := runs + 1",
  44500. referencedClasses: [],
  44501. messageSends: ["+"]
  44502. }),
  44503. $globals.TestResult);
  44504. $core.addMethod(
  44505. $core.method({
  44506. selector: "initialize",
  44507. protocol: 'initialization',
  44508. fn: function (){
  44509. var self=this;
  44510. return $core.withContext(function($ctx1) {
  44511. (
  44512. $ctx1.supercall = true,
  44513. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  44514. $ctx1.supercall = false;
  44515. self["@timestamp"]=$recv($globals.Date)._now();
  44516. self["@runs"]=(0);
  44517. self["@errors"]=$recv($globals.Array)._new();
  44518. $ctx1.sendIdx["new"]=1;
  44519. self["@failures"]=$recv($globals.Array)._new();
  44520. self["@total"]=(0);
  44521. return self;
  44522. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  44523. },
  44524. args: [],
  44525. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  44526. referencedClasses: ["Date", "Array"],
  44527. messageSends: ["initialize", "now", "new"]
  44528. }),
  44529. $globals.TestResult);
  44530. $core.addMethod(
  44531. $core.method({
  44532. selector: "nextRunDo:",
  44533. protocol: 'running',
  44534. fn: function (aBlock){
  44535. var self=this;
  44536. return $core.withContext(function($ctx1) {
  44537. var $2,$1;
  44538. $2=self._runs();
  44539. $ctx1.sendIdx["runs"]=1;
  44540. $1=$recv($2).__eq_eq(self._total());
  44541. if(!$core.assert($1)){
  44542. return $recv(aBlock)._value_($recv(self._runs()).__plus((1)));
  44543. };
  44544. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  44545. },
  44546. args: ["aBlock"],
  44547. 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 ]",
  44548. referencedClasses: [],
  44549. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  44550. }),
  44551. $globals.TestResult);
  44552. $core.addMethod(
  44553. $core.method({
  44554. selector: "runCase:",
  44555. protocol: 'running',
  44556. fn: function (aTestCase){
  44557. var self=this;
  44558. return $core.withContext(function($ctx1) {
  44559. $recv((function(){
  44560. return $core.withContext(function($ctx2) {
  44561. return $recv((function(){
  44562. return $core.withContext(function($ctx3) {
  44563. self._increaseRuns();
  44564. return $recv(aTestCase)._runCase();
  44565. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44566. }))._on_do_($globals.TestFailure,(function(ex){
  44567. return $core.withContext(function($ctx3) {
  44568. return self._addFailure_(aTestCase);
  44569. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  44570. }));
  44571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44572. }))._on_do_($globals.Error,(function(ex){
  44573. return $core.withContext(function($ctx2) {
  44574. return self._addError_(aTestCase);
  44575. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  44576. }));
  44577. $ctx1.sendIdx["on:do:"]=1;
  44578. return self;
  44579. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  44580. },
  44581. args: ["aTestCase"],
  44582. 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 ]",
  44583. referencedClasses: ["TestFailure", "Error"],
  44584. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  44585. }),
  44586. $globals.TestResult);
  44587. $core.addMethod(
  44588. $core.method({
  44589. selector: "runs",
  44590. protocol: 'accessing',
  44591. fn: function (){
  44592. var self=this;
  44593. return self["@runs"];
  44594. },
  44595. args: [],
  44596. source: "runs\x0a\x09^ runs",
  44597. referencedClasses: [],
  44598. messageSends: []
  44599. }),
  44600. $globals.TestResult);
  44601. $core.addMethod(
  44602. $core.method({
  44603. selector: "status",
  44604. protocol: 'accessing',
  44605. fn: function (){
  44606. var self=this;
  44607. return $core.withContext(function($ctx1) {
  44608. var $1;
  44609. $1=$recv(self._errors())._ifNotEmpty_ifEmpty_((function(){
  44610. return "error";
  44611. }),(function(){
  44612. return $core.withContext(function($ctx2) {
  44613. return $recv(self._failures())._ifNotEmpty_ifEmpty_((function(){
  44614. return "failure";
  44615. }),(function(){
  44616. return "success";
  44617. }));
  44618. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44619. }));
  44620. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  44621. return $1;
  44622. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  44623. },
  44624. args: [],
  44625. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  44626. referencedClasses: [],
  44627. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  44628. }),
  44629. $globals.TestResult);
  44630. $core.addMethod(
  44631. $core.method({
  44632. selector: "timestamp",
  44633. protocol: 'accessing',
  44634. fn: function (){
  44635. var self=this;
  44636. return self["@timestamp"];
  44637. },
  44638. args: [],
  44639. source: "timestamp\x0a\x09^ timestamp",
  44640. referencedClasses: [],
  44641. messageSends: []
  44642. }),
  44643. $globals.TestResult);
  44644. $core.addMethod(
  44645. $core.method({
  44646. selector: "total",
  44647. protocol: 'accessing',
  44648. fn: function (){
  44649. var self=this;
  44650. return self["@total"];
  44651. },
  44652. args: [],
  44653. source: "total\x0a\x09^ total",
  44654. referencedClasses: [],
  44655. messageSends: []
  44656. }),
  44657. $globals.TestResult);
  44658. $core.addMethod(
  44659. $core.method({
  44660. selector: "total:",
  44661. protocol: 'accessing',
  44662. fn: function (aNumber){
  44663. var self=this;
  44664. self["@total"]=aNumber;
  44665. return self;
  44666. },
  44667. args: ["aNumber"],
  44668. source: "total: aNumber\x0a\x09total := aNumber",
  44669. referencedClasses: [],
  44670. messageSends: []
  44671. }),
  44672. $globals.TestResult);
  44673. $core.addClass('TestSuiteRunner', $globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  44674. $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`.";
  44675. $core.addMethod(
  44676. $core.method({
  44677. selector: "announcer",
  44678. protocol: 'accessing',
  44679. fn: function (){
  44680. var self=this;
  44681. return self["@announcer"];
  44682. },
  44683. args: [],
  44684. source: "announcer\x0a\x09^ announcer",
  44685. referencedClasses: [],
  44686. messageSends: []
  44687. }),
  44688. $globals.TestSuiteRunner);
  44689. $core.addMethod(
  44690. $core.method({
  44691. selector: "contextOf:",
  44692. protocol: 'private',
  44693. fn: function (anInteger){
  44694. var self=this;
  44695. return $core.withContext(function($ctx1) {
  44696. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){
  44697. return $core.withContext(function($ctx2) {
  44698. return self._resume();
  44699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44700. }));
  44701. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  44702. },
  44703. args: ["anInteger"],
  44704. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  44705. referencedClasses: ["ReportingTestContext"],
  44706. messageSends: ["testCase:result:finished:", "at:", "resume"]
  44707. }),
  44708. $globals.TestSuiteRunner);
  44709. $core.addMethod(
  44710. $core.method({
  44711. selector: "initialize",
  44712. protocol: 'initialization',
  44713. fn: function (){
  44714. var self=this;
  44715. return $core.withContext(function($ctx1) {
  44716. var $1;
  44717. (
  44718. $ctx1.supercall = true,
  44719. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  44720. $ctx1.supercall = false;
  44721. self["@announcer"]=$recv($globals.Announcer)._new();
  44722. $ctx1.sendIdx["new"]=1;
  44723. self["@result"]=$recv($globals.TestResult)._new();
  44724. self["@runNextTest"]=(function(){
  44725. var runs;
  44726. return $core.withContext(function($ctx2) {
  44727. runs=$recv(self["@result"])._runs();
  44728. runs;
  44729. $1=$recv(runs).__lt($recv(self["@result"])._total());
  44730. if($core.assert($1)){
  44731. return $recv(self._contextOf_($recv(runs).__plus((1))))._start();
  44732. };
  44733. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  44734. });
  44735. return self;
  44736. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  44737. },
  44738. args: [],
  44739. 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 ] ].",
  44740. referencedClasses: ["Announcer", "TestResult"],
  44741. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  44742. }),
  44743. $globals.TestSuiteRunner);
  44744. $core.addMethod(
  44745. $core.method({
  44746. selector: "result",
  44747. protocol: 'accessing',
  44748. fn: function (){
  44749. var self=this;
  44750. return self["@result"];
  44751. },
  44752. args: [],
  44753. source: "result\x0a\x09^ result",
  44754. referencedClasses: [],
  44755. messageSends: []
  44756. }),
  44757. $globals.TestSuiteRunner);
  44758. $core.addMethod(
  44759. $core.method({
  44760. selector: "resume",
  44761. protocol: 'actions',
  44762. fn: function (){
  44763. var self=this;
  44764. return $core.withContext(function($ctx1) {
  44765. $recv(self["@runNextTest"])._fork();
  44766. $recv(self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_(self["@result"]));
  44767. return self;
  44768. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  44769. },
  44770. args: [],
  44771. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  44772. referencedClasses: ["ResultAnnouncement"],
  44773. messageSends: ["fork", "announce:", "result:", "new"]
  44774. }),
  44775. $globals.TestSuiteRunner);
  44776. $core.addMethod(
  44777. $core.method({
  44778. selector: "run",
  44779. protocol: 'actions',
  44780. fn: function (){
  44781. var self=this;
  44782. return $core.withContext(function($ctx1) {
  44783. $recv(self["@result"])._total_($recv(self["@suite"])._size());
  44784. self._resume();
  44785. return self;
  44786. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  44787. },
  44788. args: [],
  44789. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  44790. referencedClasses: [],
  44791. messageSends: ["total:", "size", "resume"]
  44792. }),
  44793. $globals.TestSuiteRunner);
  44794. $core.addMethod(
  44795. $core.method({
  44796. selector: "suite:",
  44797. protocol: 'accessing',
  44798. fn: function (aCollection){
  44799. var self=this;
  44800. self["@suite"]=aCollection;
  44801. return self;
  44802. },
  44803. args: ["aCollection"],
  44804. source: "suite: aCollection\x0a\x09suite := aCollection",
  44805. referencedClasses: [],
  44806. messageSends: []
  44807. }),
  44808. $globals.TestSuiteRunner);
  44809. $core.addMethod(
  44810. $core.method({
  44811. selector: "new",
  44812. protocol: 'instance creation',
  44813. fn: function (){
  44814. var self=this;
  44815. return $core.withContext(function($ctx1) {
  44816. self._shouldNotImplement();
  44817. return self;
  44818. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)});
  44819. },
  44820. args: [],
  44821. source: "new\x0a\x09self shouldNotImplement",
  44822. referencedClasses: [],
  44823. messageSends: ["shouldNotImplement"]
  44824. }),
  44825. $globals.TestSuiteRunner.klass);
  44826. $core.addMethod(
  44827. $core.method({
  44828. selector: "on:",
  44829. protocol: 'instance creation',
  44830. fn: function (aCollection){
  44831. var self=this;
  44832. return $core.withContext(function($ctx1) {
  44833. var $1;
  44834. $1=(
  44835. $ctx1.supercall = true,
  44836. ($globals.TestSuiteRunner.klass.superclass||$boot.nilAsClass).fn.prototype._new.apply($recv(self), []));
  44837. $ctx1.supercall = false;
  44838. return $recv($1)._suite_(aCollection);
  44839. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)});
  44840. },
  44841. args: ["aCollection"],
  44842. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  44843. referencedClasses: [],
  44844. messageSends: ["suite:", "new"]
  44845. }),
  44846. $globals.TestSuiteRunner.klass);
  44847. $core.addMethod(
  44848. $core.method({
  44849. selector: "isTestClass",
  44850. protocol: '*SUnit',
  44851. fn: function (){
  44852. var self=this;
  44853. return $core.withContext(function($ctx1) {
  44854. return $recv(self._includesBehavior_($globals.TestCase))._and_((function(){
  44855. return $core.withContext(function($ctx2) {
  44856. return $recv(self._isAbstract())._not();
  44857. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44858. }));
  44859. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.Behavior)});
  44860. },
  44861. args: [],
  44862. source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
  44863. referencedClasses: ["TestCase"],
  44864. messageSends: ["and:", "includesBehavior:", "not", "isAbstract"]
  44865. }),
  44866. $globals.Behavior);
  44867. $core.addMethod(
  44868. $core.method({
  44869. selector: "isTestPackage",
  44870. protocol: '*SUnit',
  44871. fn: function (){
  44872. var self=this;
  44873. return $core.withContext(function($ctx1) {
  44874. return $recv(self._classes())._anySatisfy_((function(each){
  44875. return $core.withContext(function($ctx2) {
  44876. return $recv(each)._isTestClass();
  44877. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44878. }));
  44879. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  44880. },
  44881. args: [],
  44882. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  44883. referencedClasses: [],
  44884. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  44885. }),
  44886. $globals.Package);
  44887. });
  44888. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  44889. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  44890. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  44891. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  44892. $core.addPackage('Compiler-Tests');
  44893. $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  44894. $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  44895. $core.addClass('ASTParsingTest', $globals.TestCase, [], 'Compiler-Tests');
  44896. $core.addMethod(
  44897. $core.method({
  44898. selector: "analyze:forClass:",
  44899. protocol: 'convenience',
  44900. fn: function (aNode,aClass){
  44901. var self=this;
  44902. return $core.withContext(function($ctx1) {
  44903. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  44904. return aNode;
  44905. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  44906. },
  44907. args: ["aNode", "aClass"],
  44908. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  44909. referencedClasses: ["SemanticAnalyzer"],
  44910. messageSends: ["visit:", "on:"]
  44911. }),
  44912. $globals.ASTParsingTest);
  44913. $core.addMethod(
  44914. $core.method({
  44915. selector: "parse:",
  44916. protocol: 'parsing',
  44917. fn: function (aString){
  44918. var self=this;
  44919. return $core.withContext(function($ctx1) {
  44920. return $recv($globals.Smalltalk)._parse_(aString);
  44921. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  44922. },
  44923. args: ["aString"],
  44924. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  44925. referencedClasses: ["Smalltalk"],
  44926. messageSends: ["parse:"]
  44927. }),
  44928. $globals.ASTParsingTest);
  44929. $core.addMethod(
  44930. $core.method({
  44931. selector: "parse:forClass:",
  44932. protocol: 'parsing',
  44933. fn: function (aString,aClass){
  44934. var self=this;
  44935. return $core.withContext(function($ctx1) {
  44936. return self._analyze_forClass_(self._parse_(aString),aClass);
  44937. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  44938. },
  44939. args: ["aString", "aClass"],
  44940. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  44941. referencedClasses: [],
  44942. messageSends: ["analyze:forClass:", "parse:"]
  44943. }),
  44944. $globals.ASTParsingTest);
  44945. $core.addClass('ASTPCNodeVisitorTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  44946. $core.addMethod(
  44947. $core.method({
  44948. selector: "astPCNodeVisitor",
  44949. protocol: 'factory',
  44950. fn: function (){
  44951. var self=this;
  44952. return $core.withContext(function($ctx1) {
  44953. var $1,$2;
  44954. $1=$recv($globals.ASTPCNodeVisitor)._new();
  44955. $ctx1.sendIdx["new"]=1;
  44956. $2=$recv($recv($globals.AIContext)._new())._yourself();
  44957. $ctx1.sendIdx["yourself"]=1;
  44958. $recv($1)._context_($2);
  44959. return $recv($1)._yourself();
  44960. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  44961. },
  44962. args: [],
  44963. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  44964. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  44965. messageSends: ["context:", "new", "yourself"]
  44966. }),
  44967. $globals.ASTPCNodeVisitorTest);
  44968. $core.addMethod(
  44969. $core.method({
  44970. selector: "astPCNodeVisitorForSelector:",
  44971. protocol: 'factory',
  44972. fn: function (aString){
  44973. var self=this;
  44974. return $core.withContext(function($ctx1) {
  44975. var $1,$2;
  44976. $1=$recv($globals.ASTPCNodeVisitor)._new();
  44977. $ctx1.sendIdx["new"]=1;
  44978. $recv($1)._selector_(aString);
  44979. $2=$recv($recv($globals.AIContext)._new())._yourself();
  44980. $ctx1.sendIdx["yourself"]=1;
  44981. $recv($1)._context_($2);
  44982. return $recv($1)._yourself();
  44983. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  44984. },
  44985. args: ["aString"],
  44986. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  44987. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  44988. messageSends: ["selector:", "new", "context:", "yourself"]
  44989. }),
  44990. $globals.ASTPCNodeVisitorTest);
  44991. $core.addMethod(
  44992. $core.method({
  44993. selector: "testJSStatementNode",
  44994. protocol: 'tests',
  44995. fn: function (){
  44996. var self=this;
  44997. var ast,visitor;
  44998. return $core.withContext(function($ctx1) {
  44999. var $3,$2,$1;
  45000. ast=self._parse_forClass_("foo <consolee.log(1)>",$globals.Object);
  45001. $3=self._astPCNodeVisitor();
  45002. $recv($3)._visit_(ast);
  45003. $2=$recv($3)._currentNode();
  45004. $1=$recv($2)._isJSStatementNode();
  45005. self._assert_($1);
  45006. return self;
  45007. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  45008. },
  45009. args: [],
  45010. source: "testJSStatementNode\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",
  45011. referencedClasses: ["Object"],
  45012. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  45013. }),
  45014. $globals.ASTPCNodeVisitorTest);
  45015. $core.addMethod(
  45016. $core.method({
  45017. selector: "testMessageSend",
  45018. protocol: 'tests',
  45019. fn: function (){
  45020. var self=this;
  45021. var ast;
  45022. return $core.withContext(function($ctx1) {
  45023. var $3,$2,$1;
  45024. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  45025. $3=self._astPCNodeVisitorForSelector_("yourself");
  45026. $recv($3)._visit_(ast);
  45027. $2=$recv($3)._currentNode();
  45028. $1=$recv($2)._selector();
  45029. self._assert_equals_($1,"yourself");
  45030. return self;
  45031. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45032. },
  45033. args: [],
  45034. 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'",
  45035. referencedClasses: ["Object"],
  45036. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  45037. }),
  45038. $globals.ASTPCNodeVisitorTest);
  45039. $core.addMethod(
  45040. $core.method({
  45041. selector: "testMessageSendWithBlocks",
  45042. protocol: 'tests',
  45043. fn: function (){
  45044. var self=this;
  45045. var ast;
  45046. return $core.withContext(function($ctx1) {
  45047. var $3,$2,$1;
  45048. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  45049. $3=self._astPCNodeVisitorForSelector_("yourself");
  45050. $recv($3)._visit_(ast);
  45051. $2=$recv($3)._currentNode();
  45052. $1=$recv($2)._selector();
  45053. self._assert_equals_($1,"yourself");
  45054. return self;
  45055. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45056. },
  45057. args: [],
  45058. 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'",
  45059. referencedClasses: ["Object"],
  45060. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  45061. }),
  45062. $globals.ASTPCNodeVisitorTest);
  45063. $core.addMethod(
  45064. $core.method({
  45065. selector: "testMessageSendWithInlining",
  45066. protocol: 'tests',
  45067. fn: function (){
  45068. var self=this;
  45069. var ast;
  45070. return $core.withContext(function($ctx1) {
  45071. var $3,$4,$2,$1,$7,$6,$5;
  45072. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  45073. $ctx1.sendIdx["parse:forClass:"]=1;
  45074. $3=self._astPCNodeVisitorForSelector_("yourself");
  45075. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  45076. $recv($3)._visit_(ast);
  45077. $ctx1.sendIdx["visit:"]=1;
  45078. $4=$recv($3)._currentNode();
  45079. $ctx1.sendIdx["currentNode"]=1;
  45080. $2=$4;
  45081. $1=$recv($2)._selector();
  45082. $ctx1.sendIdx["selector"]=1;
  45083. self._assert_equals_($1,"yourself");
  45084. $ctx1.sendIdx["assert:equals:"]=1;
  45085. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  45086. $7=self._astPCNodeVisitorForSelector_("asBoolean");
  45087. $recv($7)._visit_(ast);
  45088. $6=$recv($7)._currentNode();
  45089. $5=$recv($6)._selector();
  45090. self._assert_equals_($5,"asBoolean");
  45091. return self;
  45092. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45093. },
  45094. args: [],
  45095. 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'",
  45096. referencedClasses: ["Object"],
  45097. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  45098. }),
  45099. $globals.ASTPCNodeVisitorTest);
  45100. $core.addMethod(
  45101. $core.method({
  45102. selector: "testNoMessageSend",
  45103. protocol: 'tests',
  45104. fn: function (){
  45105. var self=this;
  45106. var ast;
  45107. return $core.withContext(function($ctx1) {
  45108. var $3,$2,$1;
  45109. ast=self._parse_forClass_("foo ^ self",$globals.Object);
  45110. $3=self._astPCNodeVisitor();
  45111. $recv($3)._visit_(ast);
  45112. $2=$recv($3)._currentNode();
  45113. $1=$recv($2)._isNil();
  45114. self._assert_($1);
  45115. return self;
  45116. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45117. },
  45118. args: [],
  45119. 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",
  45120. referencedClasses: ["Object"],
  45121. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  45122. }),
  45123. $globals.ASTPCNodeVisitorTest);
  45124. $core.addMethod(
  45125. $core.method({
  45126. selector: "testPC",
  45127. protocol: 'tests',
  45128. fn: function (){
  45129. var self=this;
  45130. var ast,visitor;
  45131. return $core.withContext(function($ctx1) {
  45132. var $3,$2,$1;
  45133. ast=self._parse_forClass_("foo <console.log(1)>",$globals.Object);
  45134. $3=self._astPCNodeVisitor();
  45135. $recv($3)._visit_(ast);
  45136. $2=$recv($3)._currentNode();
  45137. $1=$recv($2)._isJSStatementNode();
  45138. self._assert_($1);
  45139. return self;
  45140. }, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  45141. },
  45142. args: [],
  45143. source: "testPC\x0a\x09| ast visitor |\x0a\x09\x0a\x09ast := self parse: 'foo <console.log(1)>' forClass: Object.\x0a\x09self assert: (self astPCNodeVisitor\x0a\x09\x09visit: ast;\x0a\x09\x09currentNode) isJSStatementNode",
  45144. referencedClasses: ["Object"],
  45145. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  45146. }),
  45147. $globals.ASTPCNodeVisitorTest);
  45148. $core.addClass('ASTPositionTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  45149. $core.addMethod(
  45150. $core.method({
  45151. selector: "testNodeAtPosition",
  45152. protocol: 'tests',
  45153. fn: function (){
  45154. var self=this;
  45155. var node;
  45156. return $core.withContext(function($ctx1) {
  45157. var $3,$4,$2,$1,$7,$8,$6,$5;
  45158. node=self._parse_("yourself\x0a\x09^ self");
  45159. $ctx1.sendIdx["parse:"]=1;
  45160. $3=node;
  45161. $4=(2).__at((4));
  45162. $ctx1.sendIdx["@"]=1;
  45163. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  45164. return nil;
  45165. }));
  45166. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  45167. $1=$recv($2)._source();
  45168. self._assert_equals_($1,"self");
  45169. $ctx1.sendIdx["assert:equals:"]=1;
  45170. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  45171. $ctx1.sendIdx["parse:"]=2;
  45172. $7=node;
  45173. $8=(2).__at((7));
  45174. $ctx1.sendIdx["@"]=2;
  45175. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  45176. return nil;
  45177. }));
  45178. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  45179. $5=$recv($6)._selector();
  45180. $ctx1.sendIdx["selector"]=1;
  45181. self._assert_equals_($5,"ifTrue:");
  45182. $ctx1.sendIdx["assert:equals:"]=2;
  45183. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  45184. self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  45185. return nil;
  45186. })))._selector(),"foo");
  45187. return self;
  45188. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  45189. },
  45190. args: [],
  45191. 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'",
  45192. referencedClasses: [],
  45193. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  45194. }),
  45195. $globals.ASTPositionTest);
  45196. $core.addClass('CodeGeneratorTest', $globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
  45197. $core.addMethod(
  45198. $core.method({
  45199. selector: "codeGeneratorClass",
  45200. protocol: 'accessing',
  45201. fn: function (){
  45202. var self=this;
  45203. return $globals.CodeGenerator;
  45204. },
  45205. args: [],
  45206. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  45207. referencedClasses: ["CodeGenerator"],
  45208. messageSends: []
  45209. }),
  45210. $globals.CodeGeneratorTest);
  45211. $core.addMethod(
  45212. $core.method({
  45213. selector: "compiler",
  45214. protocol: 'factory',
  45215. fn: function (){
  45216. var self=this;
  45217. return $core.withContext(function($ctx1) {
  45218. var $1;
  45219. $1=$recv($globals.Compiler)._new();
  45220. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  45221. return $recv($1)._yourself();
  45222. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  45223. },
  45224. args: [],
  45225. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  45226. referencedClasses: ["Compiler"],
  45227. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  45228. }),
  45229. $globals.CodeGeneratorTest);
  45230. $core.addMethod(
  45231. $core.method({
  45232. selector: "setUp",
  45233. protocol: 'initialization',
  45234. fn: function (){
  45235. var self=this;
  45236. return $core.withContext(function($ctx1) {
  45237. self["@receiver"]=$recv($globals.DoIt)._new();
  45238. return self;
  45239. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  45240. },
  45241. args: [],
  45242. source: "setUp\x0a\x09receiver := DoIt new",
  45243. referencedClasses: ["DoIt"],
  45244. messageSends: ["new"]
  45245. }),
  45246. $globals.CodeGeneratorTest);
  45247. $core.addMethod(
  45248. $core.method({
  45249. selector: "should:receiver:raise:",
  45250. protocol: 'testing',
  45251. fn: function (aString,anObject,anErrorClass){
  45252. var self=this;
  45253. var method,result;
  45254. return $core.withContext(function($ctx1) {
  45255. var $1,$2,$3,$receiver;
  45256. self["@receiver"]=anObject;
  45257. $recv((function(){
  45258. return $core.withContext(function($ctx2) {
  45259. return self._should_raise_((function(){
  45260. return $core.withContext(function($ctx3) {
  45261. $1=self._compiler();
  45262. $2=$recv(anObject)._class();
  45263. $ctx3.sendIdx["class"]=1;
  45264. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  45265. method;
  45266. return $recv(self["@receiver"])._perform_($recv(method)._selector());
  45267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45268. }),anErrorClass);
  45269. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45270. }))._ensure_((function(){
  45271. return $core.withContext(function($ctx2) {
  45272. $3=method;
  45273. if(($receiver = $3) == null || $receiver.isNil){
  45274. return $3;
  45275. } else {
  45276. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  45277. };
  45278. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45279. }));
  45280. return self;
  45281. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  45282. },
  45283. args: ["aString", "anObject", "anErrorClass"],
  45284. 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 ] ]",
  45285. referencedClasses: [],
  45286. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  45287. }),
  45288. $globals.CodeGeneratorTest);
  45289. $core.addMethod(
  45290. $core.method({
  45291. selector: "should:receiver:return:",
  45292. protocol: 'testing',
  45293. fn: function (aString,anObject,aResult){
  45294. var self=this;
  45295. var method,result;
  45296. return $core.withContext(function($ctx1) {
  45297. var $1,$2;
  45298. self["@receiver"]=anObject;
  45299. $1=self._compiler();
  45300. $2=$recv(anObject)._class();
  45301. $ctx1.sendIdx["class"]=1;
  45302. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  45303. result=$recv(self["@receiver"])._perform_($recv(method)._selector());
  45304. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  45305. self._assert_equals_(aResult,result);
  45306. return self;
  45307. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  45308. },
  45309. args: ["aString", "anObject", "aResult"],
  45310. 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",
  45311. referencedClasses: [],
  45312. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  45313. }),
  45314. $globals.CodeGeneratorTest);
  45315. $core.addMethod(
  45316. $core.method({
  45317. selector: "should:return:",
  45318. protocol: 'testing',
  45319. fn: function (aString,anObject){
  45320. var self=this;
  45321. return $core.withContext(function($ctx1) {
  45322. return self._should_receiver_return_(aString,self["@receiver"],anObject);
  45323. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  45324. },
  45325. args: ["aString", "anObject"],
  45326. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  45327. referencedClasses: [],
  45328. messageSends: ["should:receiver:return:"]
  45329. }),
  45330. $globals.CodeGeneratorTest);
  45331. $core.addMethod(
  45332. $core.method({
  45333. selector: "tearDown",
  45334. protocol: 'initialization',
  45335. fn: function (){
  45336. var self=this;
  45337. return self;
  45338. },
  45339. args: [],
  45340. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  45341. referencedClasses: [],
  45342. messageSends: []
  45343. }),
  45344. $globals.CodeGeneratorTest);
  45345. $core.addMethod(
  45346. $core.method({
  45347. selector: "testAssignment",
  45348. protocol: 'tests',
  45349. fn: function (){
  45350. var self=this;
  45351. return $core.withContext(function($ctx1) {
  45352. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  45353. $ctx1.sendIdx["should:return:"]=1;
  45354. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  45355. $ctx1.sendIdx["should:return:"]=2;
  45356. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  45357. return self;
  45358. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  45359. },
  45360. args: [],
  45361. 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",
  45362. referencedClasses: [],
  45363. messageSends: ["should:return:"]
  45364. }),
  45365. $globals.CodeGeneratorTest);
  45366. $core.addMethod(
  45367. $core.method({
  45368. selector: "testBackslashSelectors",
  45369. protocol: 'tests',
  45370. fn: function (){
  45371. var self=this;
  45372. return $core.withContext(function($ctx1) {
  45373. self._should_return_("\x5c arg ^ 4",(4));
  45374. $ctx1.sendIdx["should:return:"]=1;
  45375. self._should_return_("\x5c\x5c arg ^ 42",(42));
  45376. return self;
  45377. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  45378. },
  45379. args: [],
  45380. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  45381. referencedClasses: [],
  45382. messageSends: ["should:return:"]
  45383. }),
  45384. $globals.CodeGeneratorTest);
  45385. $core.addMethod(
  45386. $core.method({
  45387. selector: "testBlockReturn",
  45388. protocol: 'tests',
  45389. fn: function (){
  45390. var self=this;
  45391. return $core.withContext(function($ctx1) {
  45392. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  45393. $ctx1.sendIdx["should:return:"]=1;
  45394. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  45395. $ctx1.sendIdx["should:return:"]=2;
  45396. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  45397. return self;
  45398. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  45399. },
  45400. args: [],
  45401. 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).",
  45402. referencedClasses: [],
  45403. messageSends: ["should:return:"]
  45404. }),
  45405. $globals.CodeGeneratorTest);
  45406. $core.addMethod(
  45407. $core.method({
  45408. selector: "testCascades",
  45409. protocol: 'tests',
  45410. fn: function (){
  45411. var self=this;
  45412. return $core.withContext(function($ctx1) {
  45413. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  45414. return self;
  45415. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  45416. },
  45417. args: [],
  45418. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  45419. referencedClasses: [],
  45420. messageSends: ["should:return:"]
  45421. }),
  45422. $globals.CodeGeneratorTest);
  45423. $core.addMethod(
  45424. $core.method({
  45425. selector: "testCascadesInDynamicArray",
  45426. protocol: 'tests',
  45427. fn: function (){
  45428. var self=this;
  45429. return $core.withContext(function($ctx1) {
  45430. self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  45431. return self;
  45432. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  45433. },
  45434. args: [],
  45435. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  45436. referencedClasses: [],
  45437. messageSends: ["should:return:"]
  45438. }),
  45439. $globals.CodeGeneratorTest);
  45440. $core.addMethod(
  45441. $core.method({
  45442. selector: "testCascadesInDynamicDictioary",
  45443. protocol: 'tests',
  45444. fn: function (){
  45445. var self=this;
  45446. return $core.withContext(function($ctx1) {
  45447. self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  45448. return self;
  45449. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  45450. },
  45451. args: [],
  45452. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  45453. referencedClasses: [],
  45454. messageSends: ["should:return:"]
  45455. }),
  45456. $globals.CodeGeneratorTest);
  45457. $core.addMethod(
  45458. $core.method({
  45459. selector: "testCascadesInSend",
  45460. protocol: 'tests',
  45461. fn: function (){
  45462. var self=this;
  45463. return $core.withContext(function($ctx1) {
  45464. self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  45465. return self;
  45466. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  45467. },
  45468. args: [],
  45469. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  45470. referencedClasses: [],
  45471. messageSends: ["should:return:"]
  45472. }),
  45473. $globals.CodeGeneratorTest);
  45474. $core.addMethod(
  45475. $core.method({
  45476. selector: "testCascadesWithInlining",
  45477. protocol: 'tests',
  45478. fn: function (){
  45479. var self=this;
  45480. return $core.withContext(function($ctx1) {
  45481. self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  45482. $ctx1.sendIdx["should:return:"]=1;
  45483. self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  45484. return self;
  45485. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  45486. },
  45487. args: [],
  45488. 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",
  45489. referencedClasses: [],
  45490. messageSends: ["should:return:"]
  45491. }),
  45492. $globals.CodeGeneratorTest);
  45493. $core.addMethod(
  45494. $core.method({
  45495. selector: "testDynamicArrayElementsOrdered",
  45496. protocol: 'tests',
  45497. fn: function (){
  45498. var self=this;
  45499. return $core.withContext(function($ctx1) {
  45500. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  45501. $ctx1.sendIdx["should:return:"]=1;
  45502. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  45503. return self;
  45504. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  45505. },
  45506. args: [],
  45507. 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).",
  45508. referencedClasses: [],
  45509. messageSends: ["should:return:"]
  45510. }),
  45511. $globals.CodeGeneratorTest);
  45512. $core.addMethod(
  45513. $core.method({
  45514. selector: "testDynamicDictionaryElementsOrdered",
  45515. protocol: 'tests',
  45516. fn: function (){
  45517. var self=this;
  45518. return $core.withContext(function($ctx1) {
  45519. 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)]));
  45520. return self;
  45521. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  45522. },
  45523. args: [],
  45524. 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}.",
  45525. referencedClasses: [],
  45526. messageSends: ["should:return:"]
  45527. }),
  45528. $globals.CodeGeneratorTest);
  45529. $core.addMethod(
  45530. $core.method({
  45531. selector: "testDynamicDictionaryWithMoreArrows",
  45532. protocol: 'tests',
  45533. fn: function (){
  45534. var self=this;
  45535. return $core.withContext(function($ctx1) {
  45536. var $2,$1;
  45537. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  45538. $ctx1.sendIdx["->"]=1;
  45539. $1=$recv($globals.HashedCollection)._with_($2);
  45540. self._should_return_("foo ^ #{1->2->3}",$1);
  45541. return self;
  45542. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  45543. },
  45544. args: [],
  45545. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  45546. referencedClasses: ["HashedCollection"],
  45547. messageSends: ["should:return:", "with:", "->"]
  45548. }),
  45549. $globals.CodeGeneratorTest);
  45550. $core.addMethod(
  45551. $core.method({
  45552. selector: "testGlobalVar",
  45553. protocol: 'tests',
  45554. fn: function (){
  45555. var self=this;
  45556. return $core.withContext(function($ctx1) {
  45557. self._should_return_("foo ^ eval class",$globals.BlockClosure);
  45558. $ctx1.sendIdx["should:return:"]=1;
  45559. self._should_return_("foo ^ Math cos: 0",(1));
  45560. $ctx1.sendIdx["should:return:"]=2;
  45561. self._should_return_("foo ^ NonExistingVar",nil);
  45562. return self;
  45563. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  45564. },
  45565. args: [],
  45566. 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",
  45567. referencedClasses: ["BlockClosure"],
  45568. messageSends: ["should:return:"]
  45569. }),
  45570. $globals.CodeGeneratorTest);
  45571. $core.addMethod(
  45572. $core.method({
  45573. selector: "testInnerTemporalDependentElementsOrdered",
  45574. protocol: 'tests',
  45575. fn: function (){
  45576. var self=this;
  45577. return $core.withContext(function($ctx1) {
  45578. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  45579. $2="foo".__minus_gt($globals.Array);
  45580. $ctx1.sendIdx["->"]=1;
  45581. $3="bar".__minus_gt((2));
  45582. $ctx1.sendIdx["->"]=2;
  45583. $1=[$2,$3];
  45584. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  45585. $ctx1.sendIdx["should:return:"]=1;
  45586. $5="foo".__minus_gt($globals.Array);
  45587. $ctx1.sendIdx["->"]=3;
  45588. $6="bar".__minus_gt((2));
  45589. $ctx1.sendIdx["->"]=4;
  45590. $4=[$5,$6];
  45591. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  45592. $ctx1.sendIdx["should:return:"]=2;
  45593. $8="foo".__minus_gt((1));
  45594. $ctx1.sendIdx["->"]=5;
  45595. $9="bar".__minus_gt((2));
  45596. $ctx1.sendIdx["->"]=6;
  45597. $7=[$8,$9];
  45598. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  45599. $ctx1.sendIdx["should:return:"]=3;
  45600. $11="foo".__minus_gt((1));
  45601. $ctx1.sendIdx["->"]=7;
  45602. $10=[$11,"bar".__minus_gt((2))];
  45603. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  45604. $ctx1.sendIdx["should:return:"]=4;
  45605. 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)]));
  45606. return self;
  45607. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  45608. },
  45609. args: [],
  45610. 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}.",
  45611. referencedClasses: ["Array"],
  45612. messageSends: ["should:return:", "->"]
  45613. }),
  45614. $globals.CodeGeneratorTest);
  45615. $core.addMethod(
  45616. $core.method({
  45617. selector: "testJSStatement",
  45618. protocol: 'tests',
  45619. fn: function (){
  45620. var self=this;
  45621. return $core.withContext(function($ctx1) {
  45622. self._should_return_("foo <return 2+3>",(5));
  45623. return self;
  45624. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  45625. },
  45626. args: [],
  45627. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  45628. referencedClasses: [],
  45629. messageSends: ["should:return:"]
  45630. }),
  45631. $globals.CodeGeneratorTest);
  45632. $core.addMethod(
  45633. $core.method({
  45634. selector: "testLexicalScope",
  45635. protocol: 'tests',
  45636. fn: function (){
  45637. var self=this;
  45638. return $core.withContext(function($ctx1) {
  45639. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  45640. return self;
  45641. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  45642. },
  45643. args: [],
  45644. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  45645. referencedClasses: [],
  45646. messageSends: ["should:return:"]
  45647. }),
  45648. $globals.CodeGeneratorTest);
  45649. $core.addMethod(
  45650. $core.method({
  45651. selector: "testLiterals",
  45652. protocol: 'tests',
  45653. fn: function (){
  45654. var self=this;
  45655. return $core.withContext(function($ctx1) {
  45656. self._should_return_("foo ^ 1",(1));
  45657. $ctx1.sendIdx["should:return:"]=1;
  45658. self._should_return_("foo ^ 'hello'","hello");
  45659. $ctx1.sendIdx["should:return:"]=2;
  45660. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  45661. $ctx1.sendIdx["should:return:"]=3;
  45662. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  45663. $ctx1.sendIdx["should:return:"]=4;
  45664. self._should_return_("foo ^ true",true);
  45665. $ctx1.sendIdx["should:return:"]=5;
  45666. self._should_return_("foo ^ false",false);
  45667. $ctx1.sendIdx["should:return:"]=6;
  45668. self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  45669. $ctx1.sendIdx["should:return:"]=7;
  45670. self._should_return_("foo ^ #hello","hello");
  45671. $ctx1.sendIdx["should:return:"]=8;
  45672. self._should_return_("foo ^ $h","h");
  45673. $ctx1.sendIdx["should:return:"]=9;
  45674. self._should_return_("foo ^ -123.456",(-123.456));
  45675. $ctx1.sendIdx["should:return:"]=10;
  45676. self._should_return_("foo ^ -2.5e4",(-25000));
  45677. return self;
  45678. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  45679. },
  45680. args: [],
  45681. 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.",
  45682. referencedClasses: [],
  45683. messageSends: ["should:return:"]
  45684. }),
  45685. $globals.CodeGeneratorTest);
  45686. $core.addMethod(
  45687. $core.method({
  45688. selector: "testLocalReturn",
  45689. protocol: 'tests',
  45690. fn: function (){
  45691. var self=this;
  45692. return $core.withContext(function($ctx1) {
  45693. self._should_return_("foo ^ 1",(1));
  45694. $ctx1.sendIdx["should:return:"]=1;
  45695. self._should_return_("foo ^ 1 + 1",(2));
  45696. $ctx1.sendIdx["should:return:"]=2;
  45697. self._should_return_("foo ",self["@receiver"]);
  45698. $ctx1.sendIdx["should:return:"]=3;
  45699. self._should_return_("foo self asString",self["@receiver"]);
  45700. $ctx1.sendIdx["should:return:"]=4;
  45701. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  45702. return self;
  45703. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  45704. },
  45705. args: [],
  45706. 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",
  45707. referencedClasses: [],
  45708. messageSends: ["should:return:"]
  45709. }),
  45710. $globals.CodeGeneratorTest);
  45711. $core.addMethod(
  45712. $core.method({
  45713. selector: "testMessageSends",
  45714. protocol: 'tests',
  45715. fn: function (){
  45716. var self=this;
  45717. return $core.withContext(function($ctx1) {
  45718. self._should_return_("foo ^ 1 asString","1");
  45719. $ctx1.sendIdx["should:return:"]=1;
  45720. self._should_return_("foo ^ 1 + 1",(2));
  45721. $ctx1.sendIdx["should:return:"]=2;
  45722. self._should_return_("foo ^ 1 + 2 * 3",(9));
  45723. $ctx1.sendIdx["should:return:"]=3;
  45724. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  45725. $ctx1.sendIdx["should:return:"]=4;
  45726. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  45727. return self;
  45728. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  45729. },
  45730. args: [],
  45731. 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)",
  45732. referencedClasses: [],
  45733. messageSends: ["should:return:"]
  45734. }),
  45735. $globals.CodeGeneratorTest);
  45736. $core.addMethod(
  45737. $core.method({
  45738. selector: "testMultipleSequences",
  45739. protocol: 'tests',
  45740. fn: function (){
  45741. var self=this;
  45742. return $core.withContext(function($ctx1) {
  45743. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  45744. return self;
  45745. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  45746. },
  45747. args: [],
  45748. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  45749. referencedClasses: [],
  45750. messageSends: ["should:return:"]
  45751. }),
  45752. $globals.CodeGeneratorTest);
  45753. $core.addMethod(
  45754. $core.method({
  45755. selector: "testMutableLiterals",
  45756. protocol: 'tests',
  45757. fn: function (){
  45758. var self=this;
  45759. return $core.withContext(function($ctx1) {
  45760. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  45761. return self;
  45762. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  45763. },
  45764. args: [],
  45765. 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)",
  45766. referencedClasses: [],
  45767. messageSends: ["should:return:"]
  45768. }),
  45769. $globals.CodeGeneratorTest);
  45770. $core.addMethod(
  45771. $core.method({
  45772. selector: "testNestedIfTrue",
  45773. protocol: 'tests',
  45774. fn: function (){
  45775. var self=this;
  45776. return $core.withContext(function($ctx1) {
  45777. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  45778. $ctx1.sendIdx["should:return:"]=1;
  45779. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  45780. $ctx1.sendIdx["should:return:"]=2;
  45781. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  45782. $ctx1.sendIdx["should:return:"]=3;
  45783. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  45784. return self;
  45785. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  45786. },
  45787. args: [],
  45788. 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.",
  45789. referencedClasses: [],
  45790. messageSends: ["should:return:"]
  45791. }),
  45792. $globals.CodeGeneratorTest);
  45793. $core.addMethod(
  45794. $core.method({
  45795. selector: "testNestedSends",
  45796. protocol: 'tests',
  45797. fn: function (){
  45798. var self=this;
  45799. return $core.withContext(function($ctx1) {
  45800. 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());
  45801. return self;
  45802. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  45803. },
  45804. args: [],
  45805. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  45806. referencedClasses: ["Point"],
  45807. messageSends: ["should:return:", "asString", "x:y:", "@"]
  45808. }),
  45809. $globals.CodeGeneratorTest);
  45810. $core.addMethod(
  45811. $core.method({
  45812. selector: "testNonLocalReturn",
  45813. protocol: 'tests',
  45814. fn: function (){
  45815. var self=this;
  45816. return $core.withContext(function($ctx1) {
  45817. self._should_return_("foo [ ^ 1 ] value",(1));
  45818. $ctx1.sendIdx["should:return:"]=1;
  45819. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  45820. $ctx1.sendIdx["should:return:"]=2;
  45821. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  45822. $ctx1.sendIdx["should:return:"]=3;
  45823. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  45824. return self;
  45825. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  45826. },
  45827. args: [],
  45828. 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",
  45829. referencedClasses: [],
  45830. messageSends: ["should:return:"]
  45831. }),
  45832. $globals.CodeGeneratorTest);
  45833. $core.addMethod(
  45834. $core.method({
  45835. selector: "testPascalCaseGlobal",
  45836. protocol: 'tests',
  45837. fn: function (){
  45838. var self=this;
  45839. return $core.withContext(function($ctx1) {
  45840. self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  45841. $ctx1.sendIdx["should:return:"]=1;
  45842. self._should_return_("foo ^NonExistent",nil);
  45843. return self;
  45844. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  45845. },
  45846. args: [],
  45847. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  45848. referencedClasses: ["Smalltalk"],
  45849. messageSends: ["should:return:", "at:", "globals"]
  45850. }),
  45851. $globals.CodeGeneratorTest);
  45852. $core.addMethod(
  45853. $core.method({
  45854. selector: "testRootSuperSend",
  45855. protocol: 'tests',
  45856. fn: function (){
  45857. var self=this;
  45858. return $core.withContext(function($ctx1) {
  45859. self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  45860. return self;
  45861. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  45862. },
  45863. args: [],
  45864. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  45865. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  45866. messageSends: ["should:receiver:raise:", "new"]
  45867. }),
  45868. $globals.CodeGeneratorTest);
  45869. $core.addMethod(
  45870. $core.method({
  45871. selector: "testSendReceiverAndArgumentsOrdered",
  45872. protocol: 'tests',
  45873. fn: function (){
  45874. var self=this;
  45875. return $core.withContext(function($ctx1) {
  45876. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  45877. $ctx1.sendIdx["should:return:"]=1;
  45878. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  45879. return self;
  45880. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  45881. },
  45882. args: [],
  45883. 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}.",
  45884. referencedClasses: ["Array"],
  45885. messageSends: ["should:return:"]
  45886. }),
  45887. $globals.CodeGeneratorTest);
  45888. $core.addMethod(
  45889. $core.method({
  45890. selector: "testSuperSend",
  45891. protocol: 'tests',
  45892. fn: function (){
  45893. var self=this;
  45894. return $core.withContext(function($ctx1) {
  45895. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  45896. return self;
  45897. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  45898. },
  45899. args: [],
  45900. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  45901. referencedClasses: [],
  45902. messageSends: ["should:receiver:return:"]
  45903. }),
  45904. $globals.CodeGeneratorTest);
  45905. $core.addMethod(
  45906. $core.method({
  45907. selector: "testTempVariables",
  45908. protocol: 'tests',
  45909. fn: function (){
  45910. var self=this;
  45911. return $core.withContext(function($ctx1) {
  45912. self._should_return_("foo | a | ^ a",nil);
  45913. $ctx1.sendIdx["should:return:"]=1;
  45914. self._should_return_("foo | AVariable | ^ AVariable",nil);
  45915. $ctx1.sendIdx["should:return:"]=2;
  45916. self._should_return_("foo | a b c | ^ c",nil);
  45917. $ctx1.sendIdx["should:return:"]=3;
  45918. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  45919. $ctx1.sendIdx["should:return:"]=4;
  45920. self._should_return_("foo | a | a:= 1. ^ a",(1));
  45921. $ctx1.sendIdx["should:return:"]=5;
  45922. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  45923. return self;
  45924. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  45925. },
  45926. args: [],
  45927. 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.",
  45928. referencedClasses: [],
  45929. messageSends: ["should:return:"]
  45930. }),
  45931. $globals.CodeGeneratorTest);
  45932. $core.addMethod(
  45933. $core.method({
  45934. selector: "testThisContext",
  45935. protocol: 'tests',
  45936. fn: function (){
  45937. var self=this;
  45938. return $core.withContext(function($ctx1) {
  45939. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  45940. return self;
  45941. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  45942. },
  45943. args: [],
  45944. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  45945. referencedClasses: [],
  45946. messageSends: ["should:return:"]
  45947. }),
  45948. $globals.CodeGeneratorTest);
  45949. $core.addMethod(
  45950. $core.method({
  45951. selector: "testifFalse",
  45952. protocol: 'tests',
  45953. fn: function (){
  45954. var self=this;
  45955. return $core.withContext(function($ctx1) {
  45956. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  45957. $ctx1.sendIdx["should:return:"]=1;
  45958. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  45959. $ctx1.sendIdx["should:return:"]=2;
  45960. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  45961. $ctx1.sendIdx["should:return:"]=3;
  45962. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  45963. return self;
  45964. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  45965. },
  45966. args: [],
  45967. 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.",
  45968. referencedClasses: [],
  45969. messageSends: ["should:return:"]
  45970. }),
  45971. $globals.CodeGeneratorTest);
  45972. $core.addMethod(
  45973. $core.method({
  45974. selector: "testifFalseIfTrue",
  45975. protocol: 'tests',
  45976. fn: function (){
  45977. var self=this;
  45978. return $core.withContext(function($ctx1) {
  45979. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  45980. $ctx1.sendIdx["should:return:"]=1;
  45981. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  45982. $ctx1.sendIdx["should:return:"]=2;
  45983. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  45984. $ctx1.sendIdx["should:return:"]=3;
  45985. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  45986. return self;
  45987. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  45988. },
  45989. args: [],
  45990. 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.",
  45991. referencedClasses: [],
  45992. messageSends: ["should:return:"]
  45993. }),
  45994. $globals.CodeGeneratorTest);
  45995. $core.addMethod(
  45996. $core.method({
  45997. selector: "testifNil",
  45998. protocol: 'tests',
  45999. fn: function (){
  46000. var self=this;
  46001. return $core.withContext(function($ctx1) {
  46002. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  46003. $ctx1.sendIdx["should:return:"]=1;
  46004. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  46005. $ctx1.sendIdx["should:return:"]=2;
  46006. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  46007. $ctx1.sendIdx["should:return:"]=3;
  46008. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  46009. return self;
  46010. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  46011. },
  46012. args: [],
  46013. 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.",
  46014. referencedClasses: [],
  46015. messageSends: ["should:return:"]
  46016. }),
  46017. $globals.CodeGeneratorTest);
  46018. $core.addMethod(
  46019. $core.method({
  46020. selector: "testifNilIfNotNil",
  46021. protocol: 'tests',
  46022. fn: function (){
  46023. var self=this;
  46024. return $core.withContext(function($ctx1) {
  46025. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  46026. $ctx1.sendIdx["should:return:"]=1;
  46027. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  46028. $ctx1.sendIdx["should:return:"]=2;
  46029. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  46030. $ctx1.sendIdx["should:return:"]=3;
  46031. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  46032. return self;
  46033. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  46034. },
  46035. args: [],
  46036. 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.",
  46037. referencedClasses: [],
  46038. messageSends: ["should:return:"]
  46039. }),
  46040. $globals.CodeGeneratorTest);
  46041. $core.addMethod(
  46042. $core.method({
  46043. selector: "testifNotNil",
  46044. protocol: 'tests',
  46045. fn: function (){
  46046. var self=this;
  46047. return $core.withContext(function($ctx1) {
  46048. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  46049. $ctx1.sendIdx["should:return:"]=1;
  46050. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  46051. $ctx1.sendIdx["should:return:"]=2;
  46052. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  46053. $ctx1.sendIdx["should:return:"]=3;
  46054. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  46055. return self;
  46056. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  46057. },
  46058. args: [],
  46059. 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.",
  46060. referencedClasses: [],
  46061. messageSends: ["should:return:"]
  46062. }),
  46063. $globals.CodeGeneratorTest);
  46064. $core.addMethod(
  46065. $core.method({
  46066. selector: "testifNotNilWithArgument",
  46067. protocol: 'tests',
  46068. fn: function (){
  46069. var self=this;
  46070. return $core.withContext(function($ctx1) {
  46071. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  46072. $ctx1.sendIdx["should:return:"]=1;
  46073. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  46074. $ctx1.sendIdx["should:return:"]=2;
  46075. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  46076. $ctx1.sendIdx["should:return:"]=3;
  46077. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  46078. $ctx1.sendIdx["should:return:"]=4;
  46079. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  46080. $ctx1.sendIdx["should:return:"]=5;
  46081. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  46082. return self;
  46083. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  46084. },
  46085. args: [],
  46086. 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",
  46087. referencedClasses: [],
  46088. messageSends: ["should:return:"]
  46089. }),
  46090. $globals.CodeGeneratorTest);
  46091. $core.addMethod(
  46092. $core.method({
  46093. selector: "testifTrue",
  46094. protocol: 'tests',
  46095. fn: function (){
  46096. var self=this;
  46097. return $core.withContext(function($ctx1) {
  46098. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  46099. $ctx1.sendIdx["should:return:"]=1;
  46100. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  46101. $ctx1.sendIdx["should:return:"]=2;
  46102. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  46103. $ctx1.sendIdx["should:return:"]=3;
  46104. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  46105. return self;
  46106. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  46107. },
  46108. args: [],
  46109. 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.",
  46110. referencedClasses: [],
  46111. messageSends: ["should:return:"]
  46112. }),
  46113. $globals.CodeGeneratorTest);
  46114. $core.addMethod(
  46115. $core.method({
  46116. selector: "testifTrueIfFalse",
  46117. protocol: 'tests',
  46118. fn: function (){
  46119. var self=this;
  46120. return $core.withContext(function($ctx1) {
  46121. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  46122. $ctx1.sendIdx["should:return:"]=1;
  46123. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  46124. $ctx1.sendIdx["should:return:"]=2;
  46125. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  46126. $ctx1.sendIdx["should:return:"]=3;
  46127. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  46128. return self;
  46129. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  46130. },
  46131. args: [],
  46132. 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.",
  46133. referencedClasses: [],
  46134. messageSends: ["should:return:"]
  46135. }),
  46136. $globals.CodeGeneratorTest);
  46137. $core.addClass('ASTInterpreterTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  46138. $core.addMethod(
  46139. $core.method({
  46140. selector: "analyze:forClass:",
  46141. protocol: 'parsing',
  46142. fn: function (aNode,aClass){
  46143. var self=this;
  46144. return $core.withContext(function($ctx1) {
  46145. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  46146. return aNode;
  46147. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  46148. },
  46149. args: ["aNode", "aClass"],
  46150. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  46151. referencedClasses: ["SemanticAnalyzer"],
  46152. messageSends: ["visit:", "on:"]
  46153. }),
  46154. $globals.ASTInterpreterTest);
  46155. $core.addMethod(
  46156. $core.method({
  46157. selector: "interpret:receiver:withArguments:",
  46158. protocol: 'private',
  46159. fn: function (aString,anObject,aDictionary){
  46160. var self=this;
  46161. var ctx,ast,interpreter;
  46162. return $core.withContext(function($ctx1) {
  46163. var $1,$2,$3,$receiver;
  46164. interpreter=$recv($globals.ASTInterpreter)._new();
  46165. $ctx1.sendIdx["new"]=1;
  46166. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  46167. $1=$recv($globals.AIContext)._new();
  46168. $recv($1)._receiver_(anObject);
  46169. $recv($1)._interpreter_(interpreter);
  46170. ctx=$recv($1)._yourself();
  46171. $2=$recv(ast)._sequenceNode();
  46172. if(($receiver = $2) == null || $receiver.isNil){
  46173. $2;
  46174. } else {
  46175. var sequence;
  46176. sequence=$receiver;
  46177. $recv($recv(sequence)._temps())._do_((function(each){
  46178. return $core.withContext(function($ctx2) {
  46179. return $recv(ctx)._defineLocal_(each);
  46180. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  46181. }));
  46182. };
  46183. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  46184. return $core.withContext(function($ctx2) {
  46185. return $recv(ctx)._localAt_put_(key,value);
  46186. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  46187. }));
  46188. $3=interpreter;
  46189. $recv($3)._context_(ctx);
  46190. $recv($3)._node_(ast);
  46191. $recv($3)._enterNode();
  46192. $recv($3)._proceed();
  46193. return $recv($3)._result();
  46194. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  46195. },
  46196. args: ["aString", "anObject", "aDictionary"],
  46197. 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",
  46198. referencedClasses: ["ASTInterpreter", "AIContext"],
  46199. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  46200. }),
  46201. $globals.ASTInterpreterTest);
  46202. $core.addMethod(
  46203. $core.method({
  46204. selector: "parse:",
  46205. protocol: 'parsing',
  46206. fn: function (aString){
  46207. var self=this;
  46208. return $core.withContext(function($ctx1) {
  46209. return $recv($globals.Smalltalk)._parse_(aString);
  46210. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  46211. },
  46212. args: ["aString"],
  46213. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  46214. referencedClasses: ["Smalltalk"],
  46215. messageSends: ["parse:"]
  46216. }),
  46217. $globals.ASTInterpreterTest);
  46218. $core.addMethod(
  46219. $core.method({
  46220. selector: "parse:forClass:",
  46221. protocol: 'parsing',
  46222. fn: function (aString,aClass){
  46223. var self=this;
  46224. return $core.withContext(function($ctx1) {
  46225. return self._analyze_forClass_(self._parse_(aString),aClass);
  46226. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  46227. },
  46228. args: ["aString", "aClass"],
  46229. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  46230. referencedClasses: [],
  46231. messageSends: ["analyze:forClass:", "parse:"]
  46232. }),
  46233. $globals.ASTInterpreterTest);
  46234. $core.addMethod(
  46235. $core.method({
  46236. selector: "should:receiver:return:",
  46237. protocol: 'testing',
  46238. fn: function (aString,anObject,aResult){
  46239. var self=this;
  46240. return $core.withContext(function($ctx1) {
  46241. self["@receiver"]=anObject;
  46242. return self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  46243. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  46244. },
  46245. args: ["aString", "anObject", "aResult"],
  46246. 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",
  46247. referencedClasses: [],
  46248. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  46249. }),
  46250. $globals.ASTInterpreterTest);
  46251. $core.addClass('ASTDebuggerTest', $globals.ASTInterpreterTest, [], 'Compiler-Tests');
  46252. $core.addMethod(
  46253. $core.method({
  46254. selector: "interpret:receiver:withArguments:",
  46255. protocol: 'private',
  46256. fn: function (aString,anObject,aDictionary){
  46257. var self=this;
  46258. var ctx,ast,debugger_;
  46259. return $core.withContext(function($ctx1) {
  46260. var $1,$2,$3,$4,$5,$receiver;
  46261. $1=$recv($globals.AIContext)._new();
  46262. $ctx1.sendIdx["new"]=1;
  46263. $recv($1)._receiver_(anObject);
  46264. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  46265. ctx=$recv($1)._yourself();
  46266. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  46267. $2=$recv(ast)._sequenceNode();
  46268. if(($receiver = $2) == null || $receiver.isNil){
  46269. $2;
  46270. } else {
  46271. var sequence;
  46272. sequence=$receiver;
  46273. $recv($recv(sequence)._temps())._do_((function(each){
  46274. return $core.withContext(function($ctx2) {
  46275. return $recv(ctx)._defineLocal_(each);
  46276. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  46277. }));
  46278. };
  46279. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  46280. return $core.withContext(function($ctx2) {
  46281. return $recv(ctx)._localAt_put_(key,value);
  46282. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  46283. }));
  46284. $3=$recv(ctx)._interpreter();
  46285. $ctx1.sendIdx["interpreter"]=1;
  46286. $recv($3)._context_(ctx);
  46287. $ctx1.sendIdx["context:"]=1;
  46288. $4=$recv(ctx)._interpreter();
  46289. $recv($4)._node_(ast);
  46290. $recv($4)._enterNode();
  46291. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  46292. $5=debugger_;
  46293. $recv($5)._proceed();
  46294. return $recv($5)._result();
  46295. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  46296. },
  46297. args: ["aString", "anObject", "aDictionary"],
  46298. 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",
  46299. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  46300. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  46301. }),
  46302. $globals.ASTDebuggerTest);
  46303. $core.addClass('InliningCodeGeneratorTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  46304. $core.addMethod(
  46305. $core.method({
  46306. selector: "codeGeneratorClass",
  46307. protocol: 'accessing',
  46308. fn: function (){
  46309. var self=this;
  46310. return $globals.InliningCodeGenerator;
  46311. },
  46312. args: [],
  46313. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  46314. referencedClasses: ["InliningCodeGenerator"],
  46315. messageSends: []
  46316. }),
  46317. $globals.InliningCodeGeneratorTest);
  46318. $core.addClass('ScopeVarTest', $globals.TestCase, [], 'Compiler-Tests');
  46319. $core.addMethod(
  46320. $core.method({
  46321. selector: "testClassRefVar",
  46322. protocol: 'tests',
  46323. fn: function (){
  46324. var self=this;
  46325. var node;
  46326. return $core.withContext(function($ctx1) {
  46327. var $1,$2;
  46328. $1=$recv($globals.VariableNode)._new();
  46329. $ctx1.sendIdx["new"]=1;
  46330. $recv($1)._value_("Object");
  46331. node=$recv($1)._yourself();
  46332. $2=$recv($globals.SemanticAnalyzer)._new();
  46333. $ctx1.sendIdx["new"]=2;
  46334. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  46335. $recv($2)._visit_(node);
  46336. self._assert_($recv($recv(node)._binding())._isClassRefVar());
  46337. return self;
  46338. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  46339. },
  46340. args: [],
  46341. 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",
  46342. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  46343. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  46344. }),
  46345. $globals.ScopeVarTest);
  46346. $core.addMethod(
  46347. $core.method({
  46348. selector: "testInstanceVar",
  46349. protocol: 'tests',
  46350. fn: function (){
  46351. var self=this;
  46352. var node,scope;
  46353. return $core.withContext(function($ctx1) {
  46354. var $1;
  46355. $1=$recv($globals.VariableNode)._new();
  46356. $ctx1.sendIdx["new"]=1;
  46357. $recv($1)._value_("bzzz");
  46358. node=$recv($1)._yourself();
  46359. scope=$recv($globals.MethodLexicalScope)._new();
  46360. $recv(scope)._addIVar_("bzzz");
  46361. self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  46362. return self;
  46363. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  46364. },
  46365. args: [],
  46366. 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",
  46367. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46368. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  46369. }),
  46370. $globals.ScopeVarTest);
  46371. $core.addMethod(
  46372. $core.method({
  46373. selector: "testPseudoVar",
  46374. protocol: 'tests',
  46375. fn: function (){
  46376. var self=this;
  46377. var node,pseudoVars;
  46378. return $core.withContext(function($ctx1) {
  46379. var $1;
  46380. pseudoVars=["self", "super", "true", "false", "nil"];
  46381. $recv(pseudoVars)._do_((function(each){
  46382. return $core.withContext(function($ctx2) {
  46383. $1=$recv($globals.VariableNode)._new();
  46384. $ctx2.sendIdx["new"]=1;
  46385. $recv($1)._value_(each);
  46386. node=$recv($1)._yourself();
  46387. node;
  46388. return self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  46389. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46390. }));
  46391. return self;
  46392. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  46393. },
  46394. args: [],
  46395. 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]",
  46396. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46397. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  46398. }),
  46399. $globals.ScopeVarTest);
  46400. $core.addMethod(
  46401. $core.method({
  46402. selector: "testTempVar",
  46403. protocol: 'tests',
  46404. fn: function (){
  46405. var self=this;
  46406. var node,scope;
  46407. return $core.withContext(function($ctx1) {
  46408. var $1;
  46409. $1=$recv($globals.VariableNode)._new();
  46410. $ctx1.sendIdx["new"]=1;
  46411. $recv($1)._value_("bzzz");
  46412. node=$recv($1)._yourself();
  46413. scope=$recv($globals.MethodLexicalScope)._new();
  46414. $recv(scope)._addTemp_("bzzz");
  46415. self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  46416. return self;
  46417. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  46418. },
  46419. args: [],
  46420. 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",
  46421. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46422. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  46423. }),
  46424. $globals.ScopeVarTest);
  46425. $core.addMethod(
  46426. $core.method({
  46427. selector: "testUnknownVar",
  46428. protocol: 'tests',
  46429. fn: function (){
  46430. var self=this;
  46431. var node;
  46432. return $core.withContext(function($ctx1) {
  46433. var $1;
  46434. $1=$recv($globals.VariableNode)._new();
  46435. $ctx1.sendIdx["new"]=1;
  46436. $recv($1)._value_("bzzz");
  46437. node=$recv($1)._yourself();
  46438. self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  46439. return self;
  46440. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  46441. },
  46442. args: [],
  46443. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  46444. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46445. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  46446. }),
  46447. $globals.ScopeVarTest);
  46448. $core.addClass('SemanticAnalyzerTest', $globals.TestCase, ['analyzer'], 'Compiler-Tests');
  46449. $core.addMethod(
  46450. $core.method({
  46451. selector: "setUp",
  46452. protocol: 'running',
  46453. fn: function (){
  46454. var self=this;
  46455. return $core.withContext(function($ctx1) {
  46456. self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  46457. return self;
  46458. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  46459. },
  46460. args: [],
  46461. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  46462. referencedClasses: ["SemanticAnalyzer", "Object"],
  46463. messageSends: ["on:"]
  46464. }),
  46465. $globals.SemanticAnalyzerTest);
  46466. $core.addMethod(
  46467. $core.method({
  46468. selector: "testAssignment",
  46469. protocol: 'tests',
  46470. fn: function (){
  46471. var self=this;
  46472. var src,ast;
  46473. return $core.withContext(function($ctx1) {
  46474. src="foo self := 1";
  46475. ast=$recv($globals.Smalltalk)._parse_(src);
  46476. self._should_raise_((function(){
  46477. return $core.withContext(function($ctx2) {
  46478. return $recv(self["@analyzer"])._visit_(ast);
  46479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46480. }),$globals.InvalidAssignmentError);
  46481. return self;
  46482. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46483. },
  46484. args: [],
  46485. 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",
  46486. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  46487. messageSends: ["parse:", "should:raise:", "visit:"]
  46488. }),
  46489. $globals.SemanticAnalyzerTest);
  46490. $core.addMethod(
  46491. $core.method({
  46492. selector: "testNonLocalReturn",
  46493. protocol: 'tests',
  46494. fn: function (){
  46495. var self=this;
  46496. var src,ast;
  46497. return $core.withContext(function($ctx1) {
  46498. src="foo | a | a + 1. ^ a";
  46499. ast=$recv($globals.Smalltalk)._parse_(src);
  46500. $recv(self["@analyzer"])._visit_(ast);
  46501. self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  46502. return self;
  46503. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46504. },
  46505. args: [],
  46506. 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",
  46507. referencedClasses: ["Smalltalk"],
  46508. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  46509. }),
  46510. $globals.SemanticAnalyzerTest);
  46511. $core.addMethod(
  46512. $core.method({
  46513. selector: "testNonLocalReturn2",
  46514. protocol: 'tests',
  46515. fn: function (){
  46516. var self=this;
  46517. var src,ast;
  46518. return $core.withContext(function($ctx1) {
  46519. src="foo | a | a + 1. [ [ ^ a] ]";
  46520. ast=$recv($globals.Smalltalk)._parse_(src);
  46521. $recv(self["@analyzer"])._visit_(ast);
  46522. self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  46523. return self;
  46524. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46525. },
  46526. args: [],
  46527. 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",
  46528. referencedClasses: ["Smalltalk"],
  46529. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  46530. }),
  46531. $globals.SemanticAnalyzerTest);
  46532. $core.addMethod(
  46533. $core.method({
  46534. selector: "testScope",
  46535. protocol: 'tests',
  46536. fn: function (){
  46537. var self=this;
  46538. var src,ast;
  46539. return $core.withContext(function($ctx1) {
  46540. var $4,$3,$2,$1;
  46541. src="foo | a | a + 1. [ | b | b := a ]";
  46542. ast=$recv($globals.Smalltalk)._parse_(src);
  46543. $recv(self["@analyzer"])._visit_(ast);
  46544. $4=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46545. $ctx1.sendIdx["nodes"]=1;
  46546. $3=$recv($4)._last();
  46547. $2=$recv($3)._scope();
  46548. $ctx1.sendIdx["scope"]=1;
  46549. $1=$recv($2).__eq_eq($recv(ast)._scope());
  46550. self._deny_($1);
  46551. return self;
  46552. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46553. },
  46554. args: [],
  46555. 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 nodes first nodes last scope == ast scope.",
  46556. referencedClasses: ["Smalltalk"],
  46557. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"]
  46558. }),
  46559. $globals.SemanticAnalyzerTest);
  46560. $core.addMethod(
  46561. $core.method({
  46562. selector: "testScope2",
  46563. protocol: 'tests',
  46564. fn: function (){
  46565. var self=this;
  46566. var src,ast;
  46567. return $core.withContext(function($ctx1) {
  46568. var $8,$7,$6,$5,$4,$3,$2,$1;
  46569. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  46570. ast=$recv($globals.Smalltalk)._parse_(src);
  46571. $recv(self["@analyzer"])._visit_(ast);
  46572. $8=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46573. $ctx1.sendIdx["nodes"]=3;
  46574. $7=$recv($8)._last();
  46575. $6=$recv($7)._nodes();
  46576. $ctx1.sendIdx["nodes"]=2;
  46577. $5=$recv($6)._first();
  46578. $ctx1.sendIdx["first"]=2;
  46579. $4=$recv($5)._nodes();
  46580. $ctx1.sendIdx["nodes"]=1;
  46581. $3=$recv($4)._first();
  46582. $ctx1.sendIdx["first"]=1;
  46583. $2=$recv($3)._scope();
  46584. $ctx1.sendIdx["scope"]=1;
  46585. $1=$recv($2).__eq_eq($recv(ast)._scope());
  46586. self._deny_($1);
  46587. return self;
  46588. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46589. },
  46590. args: [],
  46591. 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 nodes first nodes last nodes first nodes first scope == ast scope.",
  46592. referencedClasses: ["Smalltalk"],
  46593. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"]
  46594. }),
  46595. $globals.SemanticAnalyzerTest);
  46596. $core.addMethod(
  46597. $core.method({
  46598. selector: "testScopeLevel",
  46599. protocol: 'tests',
  46600. fn: function (){
  46601. var self=this;
  46602. var src,ast;
  46603. return $core.withContext(function($ctx1) {
  46604. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  46605. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  46606. ast=$recv($globals.Smalltalk)._parse_(src);
  46607. $recv(self["@analyzer"])._visit_(ast);
  46608. $2=$recv(ast)._scope();
  46609. $ctx1.sendIdx["scope"]=1;
  46610. $1=$recv($2)._scopeLevel();
  46611. $ctx1.sendIdx["scopeLevel"]=1;
  46612. self._assert_equals_($1,(1));
  46613. $ctx1.sendIdx["assert:equals:"]=1;
  46614. $10=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46615. $ctx1.sendIdx["nodes"]=3;
  46616. $9=$recv($10)._last();
  46617. $8=$recv($9)._nodes();
  46618. $ctx1.sendIdx["nodes"]=2;
  46619. $7=$recv($8)._first();
  46620. $ctx1.sendIdx["first"]=2;
  46621. $6=$recv($7)._nodes();
  46622. $ctx1.sendIdx["nodes"]=1;
  46623. $5=$recv($6)._first();
  46624. $ctx1.sendIdx["first"]=1;
  46625. $4=$recv($5)._scope();
  46626. $3=$recv($4)._scopeLevel();
  46627. self._assert_equals_($3,(3));
  46628. return self;
  46629. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46630. },
  46631. args: [],
  46632. 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 nodes first nodes last nodes first nodes first scope scopeLevel equals: 3",
  46633. referencedClasses: ["Smalltalk"],
  46634. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"]
  46635. }),
  46636. $globals.SemanticAnalyzerTest);
  46637. $core.addMethod(
  46638. $core.method({
  46639. selector: "testUnknownVariables",
  46640. protocol: 'tests',
  46641. fn: function (){
  46642. var self=this;
  46643. var src,ast;
  46644. return $core.withContext(function($ctx1) {
  46645. src="foo | a | b + a";
  46646. ast=$recv($globals.Smalltalk)._parse_(src);
  46647. self._should_raise_((function(){
  46648. return $core.withContext(function($ctx2) {
  46649. return $recv(self["@analyzer"])._visit_(ast);
  46650. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46651. }),$globals.UnknownVariableError);
  46652. return self;
  46653. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46654. },
  46655. args: [],
  46656. 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",
  46657. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46658. messageSends: ["parse:", "should:raise:", "visit:"]
  46659. }),
  46660. $globals.SemanticAnalyzerTest);
  46661. $core.addMethod(
  46662. $core.method({
  46663. selector: "testUnknownVariablesWithScope",
  46664. protocol: 'tests',
  46665. fn: function (){
  46666. var self=this;
  46667. var src,ast;
  46668. return $core.withContext(function($ctx1) {
  46669. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  46670. ast=$recv($globals.Smalltalk)._parse_(src);
  46671. self._should_raise_((function(){
  46672. return $core.withContext(function($ctx2) {
  46673. return $recv(self["@analyzer"])._visit_(ast);
  46674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46675. }),$globals.UnknownVariableError);
  46676. return self;
  46677. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46678. },
  46679. args: [],
  46680. 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",
  46681. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46682. messageSends: ["parse:", "should:raise:", "visit:"]
  46683. }),
  46684. $globals.SemanticAnalyzerTest);
  46685. $core.addMethod(
  46686. $core.method({
  46687. selector: "testVariableShadowing",
  46688. protocol: 'tests',
  46689. fn: function (){
  46690. var self=this;
  46691. var src,ast;
  46692. return $core.withContext(function($ctx1) {
  46693. src="foo | a | a + 1";
  46694. ast=$recv($globals.Smalltalk)._parse_(src);
  46695. $recv(self["@analyzer"])._visit_(ast);
  46696. return self;
  46697. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46698. },
  46699. args: [],
  46700. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46701. referencedClasses: ["Smalltalk"],
  46702. messageSends: ["parse:", "visit:"]
  46703. }),
  46704. $globals.SemanticAnalyzerTest);
  46705. $core.addMethod(
  46706. $core.method({
  46707. selector: "testVariableShadowing2",
  46708. protocol: 'tests',
  46709. fn: function (){
  46710. var self=this;
  46711. var src,ast;
  46712. return $core.withContext(function($ctx1) {
  46713. src="foo | a | a + 1. [ | a | a := 2 ]";
  46714. ast=$recv($globals.Smalltalk)._parse_(src);
  46715. self._should_raise_((function(){
  46716. return $core.withContext(function($ctx2) {
  46717. return $recv(self["@analyzer"])._visit_(ast);
  46718. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46719. }),$globals.ShadowingVariableError);
  46720. return self;
  46721. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46722. },
  46723. args: [],
  46724. 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",
  46725. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  46726. messageSends: ["parse:", "should:raise:", "visit:"]
  46727. }),
  46728. $globals.SemanticAnalyzerTest);
  46729. $core.addMethod(
  46730. $core.method({
  46731. selector: "testVariableShadowing3",
  46732. protocol: 'tests',
  46733. fn: function (){
  46734. var self=this;
  46735. var src,ast;
  46736. return $core.withContext(function($ctx1) {
  46737. src="foo | a | a + 1. [ | b | b := 2 ]";
  46738. ast=$recv($globals.Smalltalk)._parse_(src);
  46739. $recv(self["@analyzer"])._visit_(ast);
  46740. return self;
  46741. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46742. },
  46743. args: [],
  46744. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46745. referencedClasses: ["Smalltalk"],
  46746. messageSends: ["parse:", "visit:"]
  46747. }),
  46748. $globals.SemanticAnalyzerTest);
  46749. $core.addMethod(
  46750. $core.method({
  46751. selector: "testVariableShadowing4",
  46752. protocol: 'tests',
  46753. fn: function (){
  46754. var self=this;
  46755. var src,ast;
  46756. return $core.withContext(function($ctx1) {
  46757. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  46758. ast=$recv($globals.Smalltalk)._parse_(src);
  46759. $recv(self["@analyzer"])._visit_(ast);
  46760. return self;
  46761. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46762. },
  46763. args: [],
  46764. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46765. referencedClasses: ["Smalltalk"],
  46766. messageSends: ["parse:", "visit:"]
  46767. }),
  46768. $globals.SemanticAnalyzerTest);
  46769. $core.addMethod(
  46770. $core.method({
  46771. selector: "testVariableShadowing5",
  46772. protocol: 'tests',
  46773. fn: function (){
  46774. var self=this;
  46775. var src,ast;
  46776. return $core.withContext(function($ctx1) {
  46777. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  46778. ast=$recv($globals.Smalltalk)._parse_(src);
  46779. self._should_raise_((function(){
  46780. return $core.withContext(function($ctx2) {
  46781. return $recv(self["@analyzer"])._visit_(ast);
  46782. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46783. }),$globals.ShadowingVariableError);
  46784. return self;
  46785. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46786. },
  46787. args: [],
  46788. 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",
  46789. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  46790. messageSends: ["parse:", "should:raise:", "visit:"]
  46791. }),
  46792. $globals.SemanticAnalyzerTest);
  46793. $core.addMethod(
  46794. $core.method({
  46795. selector: "testVariablesLookup",
  46796. protocol: 'tests',
  46797. fn: function (){
  46798. var self=this;
  46799. var src,ast;
  46800. return $core.withContext(function($ctx1) {
  46801. 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;
  46802. src="foo | a | a + 1. [ | b | b := a ]";
  46803. ast=$recv($globals.Smalltalk)._parse_(src);
  46804. $recv(self["@analyzer"])._visit_(ast);
  46805. $7=$recv(ast)._nodes();
  46806. $ctx1.sendIdx["nodes"]=2;
  46807. $6=$recv($7)._first();
  46808. $ctx1.sendIdx["first"]=2;
  46809. $5=$recv($6)._nodes();
  46810. $ctx1.sendIdx["nodes"]=1;
  46811. $4=$recv($5)._first();
  46812. $ctx1.sendIdx["first"]=1;
  46813. $3=$recv($4)._receiver();
  46814. $ctx1.sendIdx["receiver"]=1;
  46815. $2=$recv($3)._binding();
  46816. $ctx1.sendIdx["binding"]=1;
  46817. $1=$recv($2)._isTempVar();
  46818. $ctx1.sendIdx["isTempVar"]=1;
  46819. self._assert_($1);
  46820. $ctx1.sendIdx["assert:"]=1;
  46821. $15=$recv(ast)._nodes();
  46822. $ctx1.sendIdx["nodes"]=4;
  46823. $14=$recv($15)._first();
  46824. $ctx1.sendIdx["first"]=4;
  46825. $13=$recv($14)._nodes();
  46826. $ctx1.sendIdx["nodes"]=3;
  46827. $12=$recv($13)._first();
  46828. $ctx1.sendIdx["first"]=3;
  46829. $11=$recv($12)._receiver();
  46830. $10=$recv($11)._binding();
  46831. $ctx1.sendIdx["binding"]=2;
  46832. $9=$recv($10)._scope();
  46833. $ctx1.sendIdx["scope"]=1;
  46834. $16=$recv(ast)._scope();
  46835. $ctx1.sendIdx["scope"]=2;
  46836. $8=$recv($9).__eq_eq($16);
  46837. $ctx1.sendIdx["=="]=1;
  46838. self._assert_($8);
  46839. $ctx1.sendIdx["assert:"]=2;
  46840. $27=$recv(ast)._nodes();
  46841. $ctx1.sendIdx["nodes"]=8;
  46842. $26=$recv($27)._first();
  46843. $ctx1.sendIdx["first"]=7;
  46844. $25=$recv($26)._nodes();
  46845. $ctx1.sendIdx["nodes"]=7;
  46846. $24=$recv($25)._last();
  46847. $ctx1.sendIdx["last"]=1;
  46848. $23=$recv($24)._nodes();
  46849. $ctx1.sendIdx["nodes"]=6;
  46850. $22=$recv($23)._first();
  46851. $ctx1.sendIdx["first"]=6;
  46852. $21=$recv($22)._nodes();
  46853. $ctx1.sendIdx["nodes"]=5;
  46854. $20=$recv($21)._first();
  46855. $ctx1.sendIdx["first"]=5;
  46856. $19=$recv($20)._left();
  46857. $ctx1.sendIdx["left"]=1;
  46858. $18=$recv($19)._binding();
  46859. $ctx1.sendIdx["binding"]=3;
  46860. $17=$recv($18)._isTempVar();
  46861. self._assert_($17);
  46862. $ctx1.sendIdx["assert:"]=3;
  46863. $39=$recv(ast)._nodes();
  46864. $ctx1.sendIdx["nodes"]=12;
  46865. $38=$recv($39)._first();
  46866. $ctx1.sendIdx["first"]=10;
  46867. $37=$recv($38)._nodes();
  46868. $ctx1.sendIdx["nodes"]=11;
  46869. $36=$recv($37)._last();
  46870. $ctx1.sendIdx["last"]=2;
  46871. $35=$recv($36)._nodes();
  46872. $ctx1.sendIdx["nodes"]=10;
  46873. $34=$recv($35)._first();
  46874. $ctx1.sendIdx["first"]=9;
  46875. $33=$recv($34)._nodes();
  46876. $ctx1.sendIdx["nodes"]=9;
  46877. $32=$recv($33)._first();
  46878. $ctx1.sendIdx["first"]=8;
  46879. $31=$recv($32)._left();
  46880. $30=$recv($31)._binding();
  46881. $29=$recv($30)._scope();
  46882. $ctx1.sendIdx["scope"]=3;
  46883. $42=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46884. $ctx1.sendIdx["nodes"]=13;
  46885. $41=$recv($42)._last();
  46886. $40=$recv($41)._scope();
  46887. $28=$recv($29).__eq_eq($40);
  46888. self._assert_($28);
  46889. return self;
  46890. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46891. },
  46892. args: [],
  46893. 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 nodes first nodes first receiver binding isTempVar.\x0a\x09self assert: ast nodes first nodes first receiver binding scope == ast scope.\x0a\x0a\x09\x22Binding for `b`\x22\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding isTempVar.\x0a\x09self assert: ast nodes first nodes last nodes first nodes first left binding scope == ast nodes first nodes last scope.",
  46894. referencedClasses: ["Smalltalk"],
  46895. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"]
  46896. }),
  46897. $globals.SemanticAnalyzerTest);
  46898. $core.addClass('AISemanticAnalyzerTest', $globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
  46899. $core.addMethod(
  46900. $core.method({
  46901. selector: "setUp",
  46902. protocol: 'running',
  46903. fn: function (){
  46904. var self=this;
  46905. return $core.withContext(function($ctx1) {
  46906. var $1,$3,$4,$2;
  46907. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  46908. $3=$recv($globals.AIContext)._new();
  46909. $recv($3)._defineLocal_("local");
  46910. $recv($3)._localAt_put_("local",(3));
  46911. $4=$recv($3)._yourself();
  46912. $ctx1.sendIdx["yourself"]=1;
  46913. $2=$4;
  46914. $recv($1)._context_($2);
  46915. self["@analyzer"]=$recv($1)._yourself();
  46916. return self;
  46917. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  46918. },
  46919. args: [],
  46920. 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",
  46921. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  46922. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  46923. }),
  46924. $globals.AISemanticAnalyzerTest);
  46925. $core.addMethod(
  46926. $core.method({
  46927. selector: "testContextVariables",
  46928. protocol: 'tests',
  46929. fn: function (){
  46930. var self=this;
  46931. var src,ast;
  46932. return $core.withContext(function($ctx1) {
  46933. src="foo | a | local + a";
  46934. ast=$recv($globals.Smalltalk)._parse_(src);
  46935. self._shouldnt_raise_((function(){
  46936. return $core.withContext(function($ctx2) {
  46937. return $recv(self["@analyzer"])._visit_(ast);
  46938. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46939. }),$globals.UnknownVariableError);
  46940. return self;
  46941. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  46942. },
  46943. args: [],
  46944. 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",
  46945. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46946. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  46947. }),
  46948. $globals.AISemanticAnalyzerTest);
  46949. });
  46950. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  46951. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  46952. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  46953. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  46954. $core.addPackage('Kernel-Tests');
  46955. $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  46956. $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46957. $core.addClass('AnnouncementSubscriptionTest', $globals.TestCase, [], 'Kernel-Tests');
  46958. $core.addMethod(
  46959. $core.method({
  46960. selector: "testAddExtensionMethod",
  46961. protocol: 'tests',
  46962. fn: function (){
  46963. var self=this;
  46964. var method,dirty;
  46965. return $core.withContext(function($ctx1) {
  46966. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  46967. $2=self._class();
  46968. $ctx1.sendIdx["class"]=1;
  46969. $1=$recv($2)._package();
  46970. $ctx1.sendIdx["package"]=1;
  46971. dirty=$recv($1)._isDirty();
  46972. $ctx1.sendIdx["isDirty"]=1;
  46973. $4=self._class();
  46974. $ctx1.sendIdx["class"]=2;
  46975. $3=$recv($4)._package();
  46976. $ctx1.sendIdx["package"]=2;
  46977. $recv($3)._beClean();
  46978. $5=self._class();
  46979. $ctx1.sendIdx["class"]=3;
  46980. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  46981. $8=self._class();
  46982. $ctx1.sendIdx["class"]=4;
  46983. $7=$recv($8)._package();
  46984. $ctx1.sendIdx["package"]=3;
  46985. $6=$recv($7)._isDirty();
  46986. self._deny_($6);
  46987. $9=self._class();
  46988. $ctx1.sendIdx["class"]=5;
  46989. $recv($9)._removeCompiledMethod_(method);
  46990. $10=dirty;
  46991. if($core.assert($10)){
  46992. $recv($recv(self._class())._package())._beDirty();
  46993. };
  46994. return self;
  46995. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  46996. },
  46997. args: [],
  46998. 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 ]",
  46999. referencedClasses: [],
  47000. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  47001. }),
  47002. $globals.AnnouncementSubscriptionTest);
  47003. $core.addMethod(
  47004. $core.method({
  47005. selector: "testHandlesAnnouncement",
  47006. protocol: 'tests',
  47007. fn: function (){
  47008. var self=this;
  47009. var subscription,announcementClass1,announcementClass2,classBuilder;
  47010. return $core.withContext(function($ctx1) {
  47011. var $1,$2;
  47012. classBuilder=$recv($globals.ClassBuilder)._new();
  47013. $ctx1.sendIdx["new"]=1;
  47014. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  47015. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  47016. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  47017. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  47018. self._assert_equals_($1,true);
  47019. $ctx1.sendIdx["assert:equals:"]=1;
  47020. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  47021. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  47022. self._assert_equals_($2,true);
  47023. $ctx1.sendIdx["assert:equals:"]=2;
  47024. self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  47025. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  47026. return self;
  47027. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  47028. },
  47029. args: [],
  47030. 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.",
  47031. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  47032. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  47033. }),
  47034. $globals.AnnouncementSubscriptionTest);
  47035. $core.addClass('AnnouncerTest', $globals.TestCase, [], 'Kernel-Tests');
  47036. $core.addMethod(
  47037. $core.method({
  47038. selector: "testOnDo",
  47039. protocol: 'tests',
  47040. fn: function (){
  47041. var self=this;
  47042. var counter,announcer;
  47043. return $core.withContext(function($ctx1) {
  47044. var $1,$2;
  47045. counter=(0);
  47046. announcer=$recv($globals.Announcer)._new();
  47047. $ctx1.sendIdx["new"]=1;
  47048. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  47049. return $core.withContext(function($ctx2) {
  47050. counter=$recv(counter).__plus((1));
  47051. return counter;
  47052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47053. }));
  47054. $1=announcer;
  47055. $2=$recv($globals.SystemAnnouncement)._new();
  47056. $ctx1.sendIdx["new"]=2;
  47057. $recv($1)._announce_($2);
  47058. $ctx1.sendIdx["announce:"]=1;
  47059. self._assert_equals_(counter,(1));
  47060. $ctx1.sendIdx["assert:equals:"]=1;
  47061. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47062. self._assert_equals_(counter,(2));
  47063. return self;
  47064. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47065. },
  47066. args: [],
  47067. 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.",
  47068. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47069. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  47070. }),
  47071. $globals.AnnouncerTest);
  47072. $core.addMethod(
  47073. $core.method({
  47074. selector: "testOnDoFor",
  47075. protocol: 'tests',
  47076. fn: function (){
  47077. var self=this;
  47078. var counter,announcer;
  47079. return $core.withContext(function($ctx1) {
  47080. var $1,$2,$3,$4;
  47081. counter=(0);
  47082. announcer=$recv($globals.Announcer)._new();
  47083. $ctx1.sendIdx["new"]=1;
  47084. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  47085. return $core.withContext(function($ctx2) {
  47086. counter=$recv(counter).__plus((1));
  47087. return counter;
  47088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47089. }),self);
  47090. $1=announcer;
  47091. $2=$recv($globals.SystemAnnouncement)._new();
  47092. $ctx1.sendIdx["new"]=2;
  47093. $recv($1)._announce_($2);
  47094. $ctx1.sendIdx["announce:"]=1;
  47095. self._assert_equals_(counter,(1));
  47096. $ctx1.sendIdx["assert:equals:"]=1;
  47097. $3=announcer;
  47098. $4=$recv($globals.SystemAnnouncement)._new();
  47099. $ctx1.sendIdx["new"]=3;
  47100. $recv($3)._announce_($4);
  47101. $ctx1.sendIdx["announce:"]=2;
  47102. self._assert_equals_(counter,(2));
  47103. $ctx1.sendIdx["assert:equals:"]=2;
  47104. $recv(announcer)._unsubscribe_(self);
  47105. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47106. self._assert_equals_(counter,(2));
  47107. return self;
  47108. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47109. },
  47110. args: [],
  47111. 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.",
  47112. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47113. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  47114. }),
  47115. $globals.AnnouncerTest);
  47116. $core.addMethod(
  47117. $core.method({
  47118. selector: "testOnDoOnce",
  47119. protocol: 'tests',
  47120. fn: function (){
  47121. var self=this;
  47122. var counter,announcer;
  47123. return $core.withContext(function($ctx1) {
  47124. var $1,$2;
  47125. counter=(0);
  47126. announcer=$recv($globals.Announcer)._new();
  47127. $ctx1.sendIdx["new"]=1;
  47128. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  47129. return $core.withContext(function($ctx2) {
  47130. counter=$recv(counter).__plus((1));
  47131. return counter;
  47132. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47133. }));
  47134. $1=announcer;
  47135. $2=$recv($globals.SystemAnnouncement)._new();
  47136. $ctx1.sendIdx["new"]=2;
  47137. $recv($1)._announce_($2);
  47138. $ctx1.sendIdx["announce:"]=1;
  47139. self._assert_equals_(counter,(1));
  47140. $ctx1.sendIdx["assert:equals:"]=1;
  47141. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47142. self._assert_equals_(counter,(1));
  47143. return self;
  47144. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47145. },
  47146. args: [],
  47147. 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.",
  47148. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47149. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  47150. }),
  47151. $globals.AnnouncerTest);
  47152. $core.addClass('BlockClosureTest', $globals.TestCase, [], 'Kernel-Tests');
  47153. $core.addMethod(
  47154. $core.method({
  47155. selector: "localReturnOnDoCatch",
  47156. protocol: 'fixture',
  47157. fn: function (){
  47158. var self=this;
  47159. return $core.withContext(function($ctx1) {
  47160. var $early={};
  47161. try {
  47162. $recv((function(){
  47163. throw $early=[(2)];
  47164. }))._on_do_($globals.Error,(function(){
  47165. }));
  47166. return (3);
  47167. }
  47168. catch(e) {if(e===$early)return e[0]; throw e}
  47169. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  47170. },
  47171. args: [],
  47172. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  47173. referencedClasses: ["Error"],
  47174. messageSends: ["on:do:"]
  47175. }),
  47176. $globals.BlockClosureTest);
  47177. $core.addMethod(
  47178. $core.method({
  47179. selector: "localReturnOnDoMiss",
  47180. protocol: 'fixture',
  47181. fn: function (){
  47182. var self=this;
  47183. return $core.withContext(function($ctx1) {
  47184. var $early={};
  47185. try {
  47186. $recv((function(){
  47187. throw $early=[(2)];
  47188. }))._on_do_($globals.Class,(function(){
  47189. }));
  47190. return (3);
  47191. }
  47192. catch(e) {if(e===$early)return e[0]; throw e}
  47193. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  47194. },
  47195. args: [],
  47196. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  47197. referencedClasses: ["Class"],
  47198. messageSends: ["on:do:"]
  47199. }),
  47200. $globals.BlockClosureTest);
  47201. $core.addMethod(
  47202. $core.method({
  47203. selector: "testCanClearInterval",
  47204. protocol: 'tests',
  47205. fn: function (){
  47206. var self=this;
  47207. return $core.withContext(function($ctx1) {
  47208. self._shouldnt_raise_((function(){
  47209. return $core.withContext(function($ctx2) {
  47210. return $recv($recv((function(){
  47211. return $core.withContext(function($ctx3) {
  47212. return $recv($recv($globals.Error)._new())._signal();
  47213. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47214. }))._valueWithInterval_((0)))._clearInterval();
  47215. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47216. }),$globals.Error);
  47217. return self;
  47218. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  47219. },
  47220. args: [],
  47221. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  47222. referencedClasses: ["Error"],
  47223. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  47224. }),
  47225. $globals.BlockClosureTest);
  47226. $core.addMethod(
  47227. $core.method({
  47228. selector: "testCanClearTimeout",
  47229. protocol: 'tests',
  47230. fn: function (){
  47231. var self=this;
  47232. return $core.withContext(function($ctx1) {
  47233. self._shouldnt_raise_((function(){
  47234. return $core.withContext(function($ctx2) {
  47235. return $recv($recv((function(){
  47236. return $core.withContext(function($ctx3) {
  47237. return $recv($recv($globals.Error)._new())._signal();
  47238. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47239. }))._valueWithTimeout_((0)))._clearTimeout();
  47240. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47241. }),$globals.Error);
  47242. return self;
  47243. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  47244. },
  47245. args: [],
  47246. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  47247. referencedClasses: ["Error"],
  47248. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  47249. }),
  47250. $globals.BlockClosureTest);
  47251. $core.addMethod(
  47252. $core.method({
  47253. selector: "testCompiledSource",
  47254. protocol: 'tests',
  47255. fn: function (){
  47256. var self=this;
  47257. return $core.withContext(function($ctx1) {
  47258. self._assert_($recv($recv((function(){
  47259. return $core.withContext(function($ctx2) {
  47260. return (1).__plus((1));
  47261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47262. }))._compiledSource())._includesSubString_("function"));
  47263. return self;
  47264. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  47265. },
  47266. args: [],
  47267. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  47268. referencedClasses: [],
  47269. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  47270. }),
  47271. $globals.BlockClosureTest);
  47272. $core.addMethod(
  47273. $core.method({
  47274. selector: "testCurrySelf",
  47275. protocol: 'tests',
  47276. fn: function (){
  47277. var self=this;
  47278. var curriedMethod,array;
  47279. return $core.withContext(function($ctx1) {
  47280. curriedMethod=$recv($recv((function(selfarg,x){
  47281. return $core.withContext(function($ctx2) {
  47282. return $recv(selfarg)._at_(x);
  47283. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  47284. }))._currySelf())._asCompiledMethod_("foo:");
  47285. array=[(3), (1), (4)];
  47286. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  47287. $recv((function(){
  47288. return $core.withContext(function($ctx2) {
  47289. return self._assert_equals_($recv(array)._foo_((2)),(1));
  47290. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47291. }))._ensure_((function(){
  47292. return $core.withContext(function($ctx2) {
  47293. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  47294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47295. }));
  47296. return self;
  47297. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  47298. },
  47299. args: [],
  47300. 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 ]",
  47301. referencedClasses: ["ClassBuilder", "Array"],
  47302. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  47303. }),
  47304. $globals.BlockClosureTest);
  47305. $core.addMethod(
  47306. $core.method({
  47307. selector: "testEnsure",
  47308. protocol: 'tests',
  47309. fn: function (){
  47310. var self=this;
  47311. return $core.withContext(function($ctx1) {
  47312. self._assert_equals_($recv((function(){
  47313. return (3);
  47314. }))._ensure_((function(){
  47315. return (4);
  47316. })),(3));
  47317. return self;
  47318. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  47319. },
  47320. args: [],
  47321. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  47322. referencedClasses: [],
  47323. messageSends: ["assert:equals:", "ensure:"]
  47324. }),
  47325. $globals.BlockClosureTest);
  47326. $core.addMethod(
  47327. $core.method({
  47328. selector: "testEnsureRaises",
  47329. protocol: 'tests',
  47330. fn: function (){
  47331. var self=this;
  47332. return $core.withContext(function($ctx1) {
  47333. self._should_raise_((function(){
  47334. return $core.withContext(function($ctx2) {
  47335. return $recv((function(){
  47336. return $core.withContext(function($ctx3) {
  47337. return $recv($recv($globals.Error)._new())._signal();
  47338. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47339. }))._ensure_((function(){
  47340. return true;
  47341. }));
  47342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47343. }),$globals.Error);
  47344. return self;
  47345. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  47346. },
  47347. args: [],
  47348. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  47349. referencedClasses: ["Error"],
  47350. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  47351. }),
  47352. $globals.BlockClosureTest);
  47353. $core.addMethod(
  47354. $core.method({
  47355. selector: "testExceptionSemantics",
  47356. protocol: 'tests',
  47357. fn: function (){
  47358. var self=this;
  47359. return $core.withContext(function($ctx1) {
  47360. self._timeout_((100));
  47361. $recv(self._async_((function(){
  47362. return $core.withContext(function($ctx2) {
  47363. return $recv((function(){
  47364. return $core.withContext(function($ctx3) {
  47365. self._assert_(true);
  47366. $recv($globals.Error)._signal();
  47367. self._deny_(true);
  47368. return self._finished();
  47369. $ctx3.sendIdx["finished"]=1;
  47370. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47371. }))._on_do_($globals.Error,(function(ex){
  47372. return $core.withContext(function($ctx3) {
  47373. return self._finished();
  47374. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  47375. }));
  47376. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47377. })))._valueWithTimeout_((0));
  47378. return self;
  47379. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  47380. },
  47381. args: [],
  47382. 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",
  47383. referencedClasses: ["Error"],
  47384. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  47385. }),
  47386. $globals.BlockClosureTest);
  47387. $core.addMethod(
  47388. $core.method({
  47389. selector: "testLocalReturnOnDoCatch",
  47390. protocol: 'tests',
  47391. fn: function (){
  47392. var self=this;
  47393. return $core.withContext(function($ctx1) {
  47394. self._assert_equals_(self._localReturnOnDoCatch(),(2));
  47395. return self;
  47396. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  47397. },
  47398. args: [],
  47399. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  47400. referencedClasses: [],
  47401. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  47402. }),
  47403. $globals.BlockClosureTest);
  47404. $core.addMethod(
  47405. $core.method({
  47406. selector: "testLocalReturnOnDoMiss",
  47407. protocol: 'tests',
  47408. fn: function (){
  47409. var self=this;
  47410. return $core.withContext(function($ctx1) {
  47411. self._assert_equals_(self._localReturnOnDoMiss(),(2));
  47412. return self;
  47413. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  47414. },
  47415. args: [],
  47416. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  47417. referencedClasses: [],
  47418. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  47419. }),
  47420. $globals.BlockClosureTest);
  47421. $core.addMethod(
  47422. $core.method({
  47423. selector: "testNewWithValues",
  47424. protocol: 'tests',
  47425. fn: function (){
  47426. var self=this;
  47427. return $core.withContext(function($ctx1) {
  47428. function TestConstructor(arg1, arg2, arg3) {}
  47429. TestConstructor.prototype.name = 'theTestPrototype';
  47430. var wrappedConstructor = $recv(TestConstructor);
  47431. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  47432. self._assert_(result instanceof TestConstructor);
  47433. self._assert_equals_(result.name, 'theTestPrototype');
  47434. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  47435. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);;
  47436. return self;
  47437. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  47438. },
  47439. args: [],
  47440. source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\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, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);\x0a>",
  47441. referencedClasses: [],
  47442. messageSends: []
  47443. }),
  47444. $globals.BlockClosureTest);
  47445. $core.addMethod(
  47446. $core.method({
  47447. selector: "testNumArgs",
  47448. protocol: 'tests',
  47449. fn: function (){
  47450. var self=this;
  47451. return $core.withContext(function($ctx1) {
  47452. var $1;
  47453. $1=$recv((function(){
  47454. }))._numArgs();
  47455. $ctx1.sendIdx["numArgs"]=1;
  47456. self._assert_equals_($1,(0));
  47457. $ctx1.sendIdx["assert:equals:"]=1;
  47458. self._assert_equals_($recv((function(a,b){
  47459. }))._numArgs(),(2));
  47460. return self;
  47461. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  47462. },
  47463. args: [],
  47464. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  47465. referencedClasses: [],
  47466. messageSends: ["assert:equals:", "numArgs"]
  47467. }),
  47468. $globals.BlockClosureTest);
  47469. $core.addMethod(
  47470. $core.method({
  47471. selector: "testOnDo",
  47472. protocol: 'tests',
  47473. fn: function (){
  47474. var self=this;
  47475. return $core.withContext(function($ctx1) {
  47476. self._assert_($recv((function(){
  47477. return $core.withContext(function($ctx2) {
  47478. return $recv($recv($globals.Error)._new())._signal();
  47479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47480. }))._on_do_($globals.Error,(function(ex){
  47481. return true;
  47482. })));
  47483. return self;
  47484. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  47485. },
  47486. args: [],
  47487. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  47488. referencedClasses: ["Error"],
  47489. messageSends: ["assert:", "on:do:", "signal", "new"]
  47490. }),
  47491. $globals.BlockClosureTest);
  47492. $core.addMethod(
  47493. $core.method({
  47494. selector: "testValue",
  47495. protocol: 'tests',
  47496. fn: function (){
  47497. var self=this;
  47498. return $core.withContext(function($ctx1) {
  47499. var $1;
  47500. $1=$recv((function(){
  47501. return $core.withContext(function($ctx2) {
  47502. return (1).__plus((1));
  47503. $ctx2.sendIdx["+"]=1;
  47504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47505. }))._value();
  47506. $ctx1.sendIdx["value"]=1;
  47507. self._assert_equals_($1,(2));
  47508. $ctx1.sendIdx["assert:equals:"]=1;
  47509. self._assert_equals_($recv((function(x){
  47510. return $core.withContext(function($ctx2) {
  47511. return $recv(x).__plus((1));
  47512. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  47513. }))._value_((2)),(3));
  47514. $ctx1.sendIdx["assert:equals:"]=2;
  47515. self._assert_equals_($recv((function(x,y){
  47516. return $core.withContext(function($ctx2) {
  47517. return $recv(x).__star(y);
  47518. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  47519. }))._value_value_((2),(4)),(8));
  47520. $ctx1.sendIdx["assert:equals:"]=3;
  47521. self._assert_equals_($recv((function(a,b,c){
  47522. return (1);
  47523. }))._value(),(1));
  47524. return self;
  47525. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  47526. },
  47527. args: [],
  47528. 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",
  47529. referencedClasses: [],
  47530. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  47531. }),
  47532. $globals.BlockClosureTest);
  47533. $core.addMethod(
  47534. $core.method({
  47535. selector: "testValueWithPossibleArguments",
  47536. protocol: 'tests',
  47537. fn: function (){
  47538. var self=this;
  47539. return $core.withContext(function($ctx1) {
  47540. var $1,$2;
  47541. $1=$recv((function(){
  47542. return (1);
  47543. }))._valueWithPossibleArguments_([(3), (4)]);
  47544. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  47545. self._assert_equals_($1,(1));
  47546. $ctx1.sendIdx["assert:equals:"]=1;
  47547. $2=$recv((function(a){
  47548. return $core.withContext(function($ctx2) {
  47549. return $recv(a).__plus((4));
  47550. $ctx2.sendIdx["+"]=1;
  47551. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  47552. }))._valueWithPossibleArguments_([(3), (4)]);
  47553. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  47554. self._assert_equals_($2,(7));
  47555. $ctx1.sendIdx["assert:equals:"]=2;
  47556. self._assert_equals_($recv((function(a,b){
  47557. return $core.withContext(function($ctx2) {
  47558. return $recv(a).__plus(b);
  47559. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  47560. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  47561. return self;
  47562. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  47563. },
  47564. args: [],
  47565. 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.",
  47566. referencedClasses: [],
  47567. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  47568. }),
  47569. $globals.BlockClosureTest);
  47570. $core.addMethod(
  47571. $core.method({
  47572. selector: "testWhileFalse",
  47573. protocol: 'tests',
  47574. fn: function (){
  47575. var self=this;
  47576. var i;
  47577. return $core.withContext(function($ctx1) {
  47578. i=(0);
  47579. $recv((function(){
  47580. return $core.withContext(function($ctx2) {
  47581. return $recv(i).__gt((5));
  47582. $ctx2.sendIdx[">"]=1;
  47583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47584. }))._whileFalse_((function(){
  47585. return $core.withContext(function($ctx2) {
  47586. i=$recv(i).__plus((1));
  47587. $ctx2.sendIdx["+"]=1;
  47588. return i;
  47589. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47590. }));
  47591. self._assert_equals_(i,(6));
  47592. $ctx1.sendIdx["assert:equals:"]=1;
  47593. i=(0);
  47594. $recv((function(){
  47595. return $core.withContext(function($ctx2) {
  47596. i=$recv(i).__plus((1));
  47597. i;
  47598. return $recv(i).__gt((5));
  47599. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47600. }))._whileFalse();
  47601. self._assert_equals_(i,(6));
  47602. return self;
  47603. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  47604. },
  47605. args: [],
  47606. 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",
  47607. referencedClasses: [],
  47608. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  47609. }),
  47610. $globals.BlockClosureTest);
  47611. $core.addMethod(
  47612. $core.method({
  47613. selector: "testWhileTrue",
  47614. protocol: 'tests',
  47615. fn: function (){
  47616. var self=this;
  47617. var i;
  47618. return $core.withContext(function($ctx1) {
  47619. i=(0);
  47620. $recv((function(){
  47621. return $core.withContext(function($ctx2) {
  47622. return $recv(i).__lt((5));
  47623. $ctx2.sendIdx["<"]=1;
  47624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47625. }))._whileTrue_((function(){
  47626. return $core.withContext(function($ctx2) {
  47627. i=$recv(i).__plus((1));
  47628. $ctx2.sendIdx["+"]=1;
  47629. return i;
  47630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47631. }));
  47632. self._assert_equals_(i,(5));
  47633. $ctx1.sendIdx["assert:equals:"]=1;
  47634. i=(0);
  47635. $recv((function(){
  47636. return $core.withContext(function($ctx2) {
  47637. i=$recv(i).__plus((1));
  47638. i;
  47639. return $recv(i).__lt((5));
  47640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47641. }))._whileTrue();
  47642. self._assert_equals_(i,(5));
  47643. return self;
  47644. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  47645. },
  47646. args: [],
  47647. 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",
  47648. referencedClasses: [],
  47649. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  47650. }),
  47651. $globals.BlockClosureTest);
  47652. $core.addClass('BooleanTest', $globals.TestCase, [], 'Kernel-Tests');
  47653. $core.addMethod(
  47654. $core.method({
  47655. selector: "testEquality",
  47656. protocol: 'tests',
  47657. fn: function (){
  47658. var self=this;
  47659. return $core.withContext(function($ctx1) {
  47660. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  47661. $1=(0).__eq(false);
  47662. $ctx1.sendIdx["="]=1;
  47663. self._deny_($1);
  47664. $ctx1.sendIdx["deny:"]=1;
  47665. $2=false.__eq((0));
  47666. $ctx1.sendIdx["="]=2;
  47667. self._deny_($2);
  47668. $ctx1.sendIdx["deny:"]=2;
  47669. $3="".__eq(false);
  47670. $ctx1.sendIdx["="]=3;
  47671. self._deny_($3);
  47672. $ctx1.sendIdx["deny:"]=3;
  47673. $4=false.__eq("");
  47674. $ctx1.sendIdx["="]=4;
  47675. self._deny_($4);
  47676. $ctx1.sendIdx["deny:"]=4;
  47677. $5=true.__eq(true);
  47678. $ctx1.sendIdx["="]=5;
  47679. self._assert_($5);
  47680. $ctx1.sendIdx["assert:"]=1;
  47681. $6=false.__eq(true);
  47682. $ctx1.sendIdx["="]=6;
  47683. self._deny_($6);
  47684. $ctx1.sendIdx["deny:"]=5;
  47685. $7=true.__eq(false);
  47686. $ctx1.sendIdx["="]=7;
  47687. self._deny_($7);
  47688. $8=false.__eq(false);
  47689. $ctx1.sendIdx["="]=8;
  47690. self._assert_($8);
  47691. $ctx1.sendIdx["assert:"]=2;
  47692. $10=true._yourself();
  47693. $ctx1.sendIdx["yourself"]=1;
  47694. $9=$recv($10).__eq(true);
  47695. $ctx1.sendIdx["="]=9;
  47696. self._assert_($9);
  47697. $ctx1.sendIdx["assert:"]=3;
  47698. $12=true._yourself();
  47699. $ctx1.sendIdx["yourself"]=2;
  47700. $11=$recv($12).__eq(true._yourself());
  47701. self._assert_($11);
  47702. return self;
  47703. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  47704. },
  47705. args: [],
  47706. 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)",
  47707. referencedClasses: [],
  47708. messageSends: ["deny:", "=", "assert:", "yourself"]
  47709. }),
  47710. $globals.BooleanTest);
  47711. $core.addMethod(
  47712. $core.method({
  47713. selector: "testIdentity",
  47714. protocol: 'tests',
  47715. fn: function (){
  47716. var self=this;
  47717. return $core.withContext(function($ctx1) {
  47718. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  47719. $1=(0).__eq_eq(false);
  47720. $ctx1.sendIdx["=="]=1;
  47721. self._deny_($1);
  47722. $ctx1.sendIdx["deny:"]=1;
  47723. $2=false.__eq_eq((0));
  47724. $ctx1.sendIdx["=="]=2;
  47725. self._deny_($2);
  47726. $ctx1.sendIdx["deny:"]=2;
  47727. $3="".__eq_eq(false);
  47728. $ctx1.sendIdx["=="]=3;
  47729. self._deny_($3);
  47730. $ctx1.sendIdx["deny:"]=3;
  47731. $4=false.__eq_eq("");
  47732. $ctx1.sendIdx["=="]=4;
  47733. self._deny_($4);
  47734. $ctx1.sendIdx["deny:"]=4;
  47735. $5=true.__eq_eq(true);
  47736. $ctx1.sendIdx["=="]=5;
  47737. self._assert_($5);
  47738. $ctx1.sendIdx["assert:"]=1;
  47739. $6=false.__eq_eq(true);
  47740. $ctx1.sendIdx["=="]=6;
  47741. self._deny_($6);
  47742. $ctx1.sendIdx["deny:"]=5;
  47743. $7=true.__eq_eq(false);
  47744. $ctx1.sendIdx["=="]=7;
  47745. self._deny_($7);
  47746. $8=false.__eq_eq(false);
  47747. $ctx1.sendIdx["=="]=8;
  47748. self._assert_($8);
  47749. $ctx1.sendIdx["assert:"]=2;
  47750. $10=true._yourself();
  47751. $ctx1.sendIdx["yourself"]=1;
  47752. $9=$recv($10).__eq_eq(true);
  47753. $ctx1.sendIdx["=="]=9;
  47754. self._assert_($9);
  47755. $ctx1.sendIdx["assert:"]=3;
  47756. $12=true._yourself();
  47757. $ctx1.sendIdx["yourself"]=2;
  47758. $11=$recv($12).__eq_eq(true._yourself());
  47759. self._assert_($11);
  47760. return self;
  47761. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  47762. },
  47763. args: [],
  47764. 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",
  47765. referencedClasses: [],
  47766. messageSends: ["deny:", "==", "assert:", "yourself"]
  47767. }),
  47768. $globals.BooleanTest);
  47769. $core.addMethod(
  47770. $core.method({
  47771. selector: "testIfTrueIfFalse",
  47772. protocol: 'tests',
  47773. fn: function (){
  47774. var self=this;
  47775. return $core.withContext(function($ctx1) {
  47776. var $1,$2,$3,$4,$5,$6,$7,$8;
  47777. if($core.assert(true)){
  47778. $1="alternative block";
  47779. };
  47780. self._assert_equals_($1,"alternative block");
  47781. $ctx1.sendIdx["assert:equals:"]=1;
  47782. if(!$core.assert(true)){
  47783. $2="alternative block";
  47784. };
  47785. self._assert_equals_($2,nil);
  47786. $ctx1.sendIdx["assert:equals:"]=2;
  47787. if($core.assert(false)){
  47788. $3="alternative block";
  47789. };
  47790. self._assert_equals_($3,nil);
  47791. $ctx1.sendIdx["assert:equals:"]=3;
  47792. if(!$core.assert(false)){
  47793. $4="alternative block";
  47794. };
  47795. self._assert_equals_($4,"alternative block");
  47796. $ctx1.sendIdx["assert:equals:"]=4;
  47797. if($core.assert(false)){
  47798. $5="alternative block";
  47799. } else {
  47800. $5="alternative block2";
  47801. };
  47802. self._assert_equals_($5,"alternative block2");
  47803. $ctx1.sendIdx["assert:equals:"]=5;
  47804. if($core.assert(false)){
  47805. $6="alternative block2";
  47806. } else {
  47807. $6="alternative block";
  47808. };
  47809. self._assert_equals_($6,"alternative block");
  47810. $ctx1.sendIdx["assert:equals:"]=6;
  47811. if($core.assert(true)){
  47812. $7="alternative block";
  47813. } else {
  47814. $7="alternative block2";
  47815. };
  47816. self._assert_equals_($7,"alternative block");
  47817. $ctx1.sendIdx["assert:equals:"]=7;
  47818. if($core.assert(true)){
  47819. $8="alternative block2";
  47820. } else {
  47821. $8="alternative block";
  47822. };
  47823. self._assert_equals_($8,"alternative block2");
  47824. return self;
  47825. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  47826. },
  47827. args: [],
  47828. 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'.",
  47829. referencedClasses: [],
  47830. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  47831. }),
  47832. $globals.BooleanTest);
  47833. $core.addMethod(
  47834. $core.method({
  47835. selector: "testIfTrueIfFalseWithBoxing",
  47836. protocol: 'tests',
  47837. fn: function (){
  47838. var self=this;
  47839. return $core.withContext(function($ctx1) {
  47840. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  47841. $2=true._yourself();
  47842. $ctx1.sendIdx["yourself"]=1;
  47843. if($core.assert($2)){
  47844. $1="alternative block";
  47845. };
  47846. self._assert_equals_($1,"alternative block");
  47847. $ctx1.sendIdx["assert:equals:"]=1;
  47848. $4=true._yourself();
  47849. $ctx1.sendIdx["yourself"]=2;
  47850. if(!$core.assert($4)){
  47851. $3="alternative block";
  47852. };
  47853. self._assert_equals_($3,nil);
  47854. $ctx1.sendIdx["assert:equals:"]=2;
  47855. $6=false._yourself();
  47856. $ctx1.sendIdx["yourself"]=3;
  47857. if($core.assert($6)){
  47858. $5="alternative block";
  47859. };
  47860. self._assert_equals_($5,nil);
  47861. $ctx1.sendIdx["assert:equals:"]=3;
  47862. $8=false._yourself();
  47863. $ctx1.sendIdx["yourself"]=4;
  47864. if(!$core.assert($8)){
  47865. $7="alternative block";
  47866. };
  47867. self._assert_equals_($7,"alternative block");
  47868. $ctx1.sendIdx["assert:equals:"]=4;
  47869. $10=false._yourself();
  47870. $ctx1.sendIdx["yourself"]=5;
  47871. if($core.assert($10)){
  47872. $9="alternative block";
  47873. } else {
  47874. $9="alternative block2";
  47875. };
  47876. self._assert_equals_($9,"alternative block2");
  47877. $ctx1.sendIdx["assert:equals:"]=5;
  47878. $12=false._yourself();
  47879. $ctx1.sendIdx["yourself"]=6;
  47880. if($core.assert($12)){
  47881. $11="alternative block2";
  47882. } else {
  47883. $11="alternative block";
  47884. };
  47885. self._assert_equals_($11,"alternative block");
  47886. $ctx1.sendIdx["assert:equals:"]=6;
  47887. $14=true._yourself();
  47888. $ctx1.sendIdx["yourself"]=7;
  47889. if($core.assert($14)){
  47890. $13="alternative block";
  47891. } else {
  47892. $13="alternative block2";
  47893. };
  47894. self._assert_equals_($13,"alternative block");
  47895. $ctx1.sendIdx["assert:equals:"]=7;
  47896. $16=true._yourself();
  47897. if($core.assert($16)){
  47898. $15="alternative block2";
  47899. } else {
  47900. $15="alternative block";
  47901. };
  47902. self._assert_equals_($15,"alternative block2");
  47903. return self;
  47904. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  47905. },
  47906. args: [],
  47907. 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'.",
  47908. referencedClasses: [],
  47909. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  47910. }),
  47911. $globals.BooleanTest);
  47912. $core.addMethod(
  47913. $core.method({
  47914. selector: "testLogic",
  47915. protocol: 'tests',
  47916. fn: function (){
  47917. var self=this;
  47918. return $core.withContext(function($ctx1) {
  47919. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  47920. $1=true.__and(true);
  47921. $ctx1.sendIdx["&"]=1;
  47922. self._assert_($1);
  47923. $ctx1.sendIdx["assert:"]=1;
  47924. $2=true.__and(false);
  47925. $ctx1.sendIdx["&"]=2;
  47926. self._deny_($2);
  47927. $ctx1.sendIdx["deny:"]=1;
  47928. $3=false.__and(true);
  47929. $ctx1.sendIdx["&"]=3;
  47930. self._deny_($3);
  47931. $ctx1.sendIdx["deny:"]=2;
  47932. $5=false.__and(false);
  47933. $ctx1.sendIdx["&"]=4;
  47934. $4=self._deny_($5);
  47935. $ctx1.sendIdx["deny:"]=3;
  47936. $6=true.__or(true);
  47937. $ctx1.sendIdx["|"]=1;
  47938. self._assert_($6);
  47939. $ctx1.sendIdx["assert:"]=2;
  47940. $7=true.__or(false);
  47941. $ctx1.sendIdx["|"]=2;
  47942. self._assert_($7);
  47943. $ctx1.sendIdx["assert:"]=3;
  47944. $8=false.__or(true);
  47945. $ctx1.sendIdx["|"]=3;
  47946. self._assert_($8);
  47947. $ctx1.sendIdx["assert:"]=4;
  47948. $10=false.__or(false);
  47949. $ctx1.sendIdx["|"]=4;
  47950. $9=self._deny_($10);
  47951. $ctx1.sendIdx["deny:"]=4;
  47952. $12=(1).__gt((0));
  47953. $ctx1.sendIdx[">"]=1;
  47954. $11=true.__and($12);
  47955. $ctx1.sendIdx["&"]=5;
  47956. self._assert_($11);
  47957. $ctx1.sendIdx["assert:"]=5;
  47958. $14=(1).__gt((0));
  47959. $ctx1.sendIdx[">"]=2;
  47960. $13=$recv($14).__and(false);
  47961. $ctx1.sendIdx["&"]=6;
  47962. self._deny_($13);
  47963. $ctx1.sendIdx["deny:"]=5;
  47964. $16=(1).__gt((0));
  47965. $ctx1.sendIdx[">"]=3;
  47966. $17=(1).__gt((2));
  47967. $ctx1.sendIdx[">"]=4;
  47968. $15=$recv($16).__and($17);
  47969. self._deny_($15);
  47970. $19=(1).__gt((0));
  47971. $ctx1.sendIdx[">"]=5;
  47972. $18=false.__or($19);
  47973. $ctx1.sendIdx["|"]=5;
  47974. self._assert_($18);
  47975. $ctx1.sendIdx["assert:"]=6;
  47976. $21=(1).__gt((0));
  47977. $ctx1.sendIdx[">"]=6;
  47978. $20=$recv($21).__or(false);
  47979. $ctx1.sendIdx["|"]=6;
  47980. self._assert_($20);
  47981. $ctx1.sendIdx["assert:"]=7;
  47982. $23=(1).__gt((0));
  47983. $ctx1.sendIdx[">"]=7;
  47984. $22=$recv($23).__or((1).__gt((2)));
  47985. self._assert_($22);
  47986. return self;
  47987. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  47988. },
  47989. args: [],
  47990. 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))",
  47991. referencedClasses: [],
  47992. messageSends: ["assert:", "&", "deny:", "|", ">"]
  47993. }),
  47994. $globals.BooleanTest);
  47995. $core.addMethod(
  47996. $core.method({
  47997. selector: "testLogicKeywords",
  47998. protocol: 'tests',
  47999. fn: function (){
  48000. var self=this;
  48001. return $core.withContext(function($ctx1) {
  48002. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  48003. $1=true._and_((function(){
  48004. return true;
  48005. }));
  48006. $ctx1.sendIdx["and:"]=1;
  48007. self._assert_($1);
  48008. $ctx1.sendIdx["assert:"]=1;
  48009. $2=true._and_((function(){
  48010. return false;
  48011. }));
  48012. $ctx1.sendIdx["and:"]=2;
  48013. self._deny_($2);
  48014. $ctx1.sendIdx["deny:"]=1;
  48015. $3=false._and_((function(){
  48016. return true;
  48017. }));
  48018. $ctx1.sendIdx["and:"]=3;
  48019. self._deny_($3);
  48020. $ctx1.sendIdx["deny:"]=2;
  48021. $5=false._and_((function(){
  48022. return false;
  48023. }));
  48024. $ctx1.sendIdx["and:"]=4;
  48025. $4=self._deny_($5);
  48026. $ctx1.sendIdx["deny:"]=3;
  48027. $6=true._or_((function(){
  48028. return true;
  48029. }));
  48030. $ctx1.sendIdx["or:"]=1;
  48031. self._assert_($6);
  48032. $ctx1.sendIdx["assert:"]=2;
  48033. $7=true._or_((function(){
  48034. return false;
  48035. }));
  48036. $ctx1.sendIdx["or:"]=2;
  48037. self._assert_($7);
  48038. $ctx1.sendIdx["assert:"]=3;
  48039. $8=false._or_((function(){
  48040. return true;
  48041. }));
  48042. $ctx1.sendIdx["or:"]=3;
  48043. self._assert_($8);
  48044. $ctx1.sendIdx["assert:"]=4;
  48045. $10=false._or_((function(){
  48046. return false;
  48047. }));
  48048. $ctx1.sendIdx["or:"]=4;
  48049. $9=self._deny_($10);
  48050. $ctx1.sendIdx["deny:"]=4;
  48051. $11=true._and_((function(){
  48052. return $core.withContext(function($ctx2) {
  48053. return (1).__gt((0));
  48054. $ctx2.sendIdx[">"]=1;
  48055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  48056. }));
  48057. $ctx1.sendIdx["and:"]=5;
  48058. self._assert_($11);
  48059. $ctx1.sendIdx["assert:"]=5;
  48060. $13=(1).__gt((0));
  48061. $ctx1.sendIdx[">"]=2;
  48062. $12=$recv($13)._and_((function(){
  48063. return false;
  48064. }));
  48065. $ctx1.sendIdx["and:"]=6;
  48066. self._deny_($12);
  48067. $ctx1.sendIdx["deny:"]=5;
  48068. $15=(1).__gt((0));
  48069. $ctx1.sendIdx[">"]=3;
  48070. $14=$recv($15)._and_((function(){
  48071. return $core.withContext(function($ctx2) {
  48072. return (1).__gt((2));
  48073. $ctx2.sendIdx[">"]=4;
  48074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  48075. }));
  48076. self._deny_($14);
  48077. $16=false._or_((function(){
  48078. return $core.withContext(function($ctx2) {
  48079. return (1).__gt((0));
  48080. $ctx2.sendIdx[">"]=5;
  48081. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  48082. }));
  48083. $ctx1.sendIdx["or:"]=5;
  48084. self._assert_($16);
  48085. $ctx1.sendIdx["assert:"]=6;
  48086. $18=(1).__gt((0));
  48087. $ctx1.sendIdx[">"]=6;
  48088. $17=$recv($18)._or_((function(){
  48089. return false;
  48090. }));
  48091. $ctx1.sendIdx["or:"]=6;
  48092. self._assert_($17);
  48093. $ctx1.sendIdx["assert:"]=7;
  48094. $20=(1).__gt((0));
  48095. $ctx1.sendIdx[">"]=7;
  48096. $19=$recv($20)._or_((function(){
  48097. return $core.withContext(function($ctx2) {
  48098. return (1).__gt((2));
  48099. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  48100. }));
  48101. self._assert_($19);
  48102. return self;
  48103. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  48104. },
  48105. args: [],
  48106. 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 ])",
  48107. referencedClasses: [],
  48108. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  48109. }),
  48110. $globals.BooleanTest);
  48111. $core.addMethod(
  48112. $core.method({
  48113. selector: "testNonBooleanError",
  48114. protocol: 'tests',
  48115. fn: function (){
  48116. var self=this;
  48117. return $core.withContext(function($ctx1) {
  48118. self._should_raise_((function(){
  48119. return $core.withContext(function($ctx2) {
  48120. if($core.assert("")){
  48121. } else {
  48122. };
  48123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48124. }),$globals.NonBooleanReceiver);
  48125. return self;
  48126. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  48127. },
  48128. args: [],
  48129. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  48130. referencedClasses: ["NonBooleanReceiver"],
  48131. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  48132. }),
  48133. $globals.BooleanTest);
  48134. $core.addClass('ClassBuilderTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  48135. $core.addMethod(
  48136. $core.method({
  48137. selector: "setUp",
  48138. protocol: 'running',
  48139. fn: function (){
  48140. var self=this;
  48141. return $core.withContext(function($ctx1) {
  48142. self["@builder"]=$recv($globals.ClassBuilder)._new();
  48143. return self;
  48144. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  48145. },
  48146. args: [],
  48147. source: "setUp\x0a\x09builder := ClassBuilder new",
  48148. referencedClasses: ["ClassBuilder"],
  48149. messageSends: ["new"]
  48150. }),
  48151. $globals.ClassBuilderTest);
  48152. $core.addMethod(
  48153. $core.method({
  48154. selector: "tearDown",
  48155. protocol: 'running',
  48156. fn: function (){
  48157. var self=this;
  48158. return $core.withContext(function($ctx1) {
  48159. var $1,$receiver;
  48160. $1=self["@theClass"];
  48161. if(($receiver = $1) == null || $receiver.isNil){
  48162. $1;
  48163. } else {
  48164. $recv($globals.Smalltalk)._removeClass_(self["@theClass"]);
  48165. self["@theClass"]=nil;
  48166. self["@theClass"];
  48167. };
  48168. return self;
  48169. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  48170. },
  48171. args: [],
  48172. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  48173. referencedClasses: ["Smalltalk"],
  48174. messageSends: ["ifNotNil:", "removeClass:"]
  48175. }),
  48176. $globals.ClassBuilderTest);
  48177. $core.addMethod(
  48178. $core.method({
  48179. selector: "testClassCopy",
  48180. protocol: 'tests',
  48181. fn: function (){
  48182. var self=this;
  48183. return $core.withContext(function($ctx1) {
  48184. var $2,$1,$4,$3,$6,$5,$8,$7;
  48185. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48186. $2=$recv(self["@theClass"])._superclass();
  48187. $ctx1.sendIdx["superclass"]=1;
  48188. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48189. $ctx1.sendIdx["=="]=1;
  48190. self._assert_($1);
  48191. $ctx1.sendIdx["assert:"]=1;
  48192. $4=$recv(self["@theClass"])._instanceVariableNames();
  48193. $ctx1.sendIdx["instanceVariableNames"]=1;
  48194. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48195. $ctx1.sendIdx["=="]=2;
  48196. self._assert_($3);
  48197. $ctx1.sendIdx["assert:"]=2;
  48198. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48199. $ctx1.sendIdx["assert:equals:"]=1;
  48200. $6=$recv(self["@theClass"])._package();
  48201. $ctx1.sendIdx["package"]=1;
  48202. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48203. self._assert_($5);
  48204. $8=$recv(self["@theClass"])._methodDictionary();
  48205. $ctx1.sendIdx["methodDictionary"]=1;
  48206. $7=$recv($8)._keys();
  48207. $ctx1.sendIdx["keys"]=1;
  48208. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48209. return self;
  48210. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  48211. },
  48212. args: [],
  48213. 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",
  48214. referencedClasses: ["ObjectMock"],
  48215. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  48216. }),
  48217. $globals.ClassBuilderTest);
  48218. $core.addMethod(
  48219. $core.method({
  48220. selector: "testClassMigration",
  48221. protocol: 'tests',
  48222. fn: function (){
  48223. var self=this;
  48224. var instance,oldClass;
  48225. return $core.withContext(function($ctx1) {
  48226. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  48227. oldClass=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48228. $2=$recv($globals.Smalltalk)._globals();
  48229. $ctx1.sendIdx["globals"]=1;
  48230. $1=$recv($2)._at_("ObjectMock2");
  48231. $ctx1.sendIdx["at:"]=1;
  48232. instance=$recv($1)._new();
  48233. $4=$recv($globals.Smalltalk)._globals();
  48234. $ctx1.sendIdx["globals"]=2;
  48235. $3=$recv($4)._at_("ObjectMock2");
  48236. $ctx1.sendIdx["at:"]=2;
  48237. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  48238. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  48239. $ctx1.sendIdx["=="]=1;
  48240. self._deny_($5);
  48241. $ctx1.sendIdx["deny:"]=1;
  48242. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  48243. $ctx1.sendIdx["=="]=2;
  48244. self._assert_($6);
  48245. $ctx1.sendIdx["assert:"]=1;
  48246. self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  48247. $ctx1.sendIdx["assert:"]=2;
  48248. $7=$recv($globals.ObjectMock2)._selectors();
  48249. $ctx1.sendIdx["selectors"]=1;
  48250. self._assert_equals_($7,$recv(oldClass)._selectors());
  48251. $ctx1.sendIdx["assert:equals:"]=1;
  48252. $8=$recv($globals.ObjectMock2)._comment();
  48253. $ctx1.sendIdx["comment"]=1;
  48254. self._assert_equals_($8,$recv(oldClass)._comment());
  48255. $ctx1.sendIdx["assert:equals:"]=2;
  48256. $9=$recv($recv($globals.ObjectMock2)._package())._name();
  48257. $ctx1.sendIdx["name"]=1;
  48258. self._assert_equals_($9,"Kernel-Tests");
  48259. $11=$recv(instance)._class();
  48260. $ctx1.sendIdx["class"]=1;
  48261. $10=$recv($11).__eq_eq($globals.ObjectMock2);
  48262. self._deny_($10);
  48263. self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  48264. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  48265. return self;
  48266. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  48267. },
  48268. args: [],
  48269. 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",
  48270. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  48271. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  48272. }),
  48273. $globals.ClassBuilderTest);
  48274. $core.addMethod(
  48275. $core.method({
  48276. selector: "testClassMigrationWithClassInstanceVariables",
  48277. protocol: 'tests',
  48278. fn: function (){
  48279. var self=this;
  48280. return $core.withContext(function($ctx1) {
  48281. var $1;
  48282. $recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48283. $1=$recv($globals.ObjectMock2)._class();
  48284. $ctx1.sendIdx["class"]=1;
  48285. $recv($1)._instanceVariableNames_("foo bar");
  48286. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  48287. self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  48288. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  48289. return self;
  48290. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  48291. },
  48292. args: [],
  48293. 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",
  48294. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  48295. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  48296. }),
  48297. $globals.ClassBuilderTest);
  48298. $core.addMethod(
  48299. $core.method({
  48300. selector: "testClassMigrationWithSubclasses",
  48301. protocol: 'tests',
  48302. fn: function (){
  48303. var self=this;
  48304. return $core.withContext(function($ctx1) {
  48305. var $2,$1,$4,$3;
  48306. $recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48307. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  48308. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  48309. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  48310. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  48311. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  48312. $2=$recv($globals.ObjectMock)._subclasses();
  48313. $ctx1.sendIdx["subclasses"]=1;
  48314. $1=$recv($2)._includes_($globals.ObjectMock2);
  48315. $ctx1.sendIdx["includes:"]=1;
  48316. self._assert_($1);
  48317. $ctx1.sendIdx["assert:"]=1;
  48318. $4=$recv($globals.ObjectMock2)._subclasses();
  48319. $ctx1.sendIdx["subclasses"]=2;
  48320. $3=$recv($4)._includes_($globals.ObjectMock3);
  48321. $ctx1.sendIdx["includes:"]=2;
  48322. self._assert_($3);
  48323. $ctx1.sendIdx["assert:"]=2;
  48324. self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  48325. $recv($recv($globals.ObjectMock)._allSubclasses())._do_((function(each){
  48326. return $core.withContext(function($ctx2) {
  48327. return $recv($globals.Smalltalk)._removeClass_(each);
  48328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48329. }));
  48330. return self;
  48331. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  48332. },
  48333. args: [],
  48334. 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 ]",
  48335. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  48336. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"]
  48337. }),
  48338. $globals.ClassBuilderTest);
  48339. $core.addMethod(
  48340. $core.method({
  48341. selector: "testInstanceVariableNames",
  48342. protocol: 'tests',
  48343. fn: function (){
  48344. var self=this;
  48345. return $core.withContext(function($ctx1) {
  48346. self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  48347. return self;
  48348. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  48349. },
  48350. args: [],
  48351. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  48352. referencedClasses: [],
  48353. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  48354. }),
  48355. $globals.ClassBuilderTest);
  48356. $core.addClass('ClassTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  48357. $core.addMethod(
  48358. $core.method({
  48359. selector: "jsConstructor",
  48360. protocol: 'running',
  48361. fn: function (){
  48362. var self=this;
  48363. return $core.withContext(function($ctx1) {
  48364. function Foo(){}
  48365. Foo.prototype.valueOf = function () {return 4;};
  48366. return Foo;
  48367. ;
  48368. return self;
  48369. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  48370. },
  48371. args: [],
  48372. source: "jsConstructor\x0a\x09<\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09>",
  48373. referencedClasses: [],
  48374. messageSends: []
  48375. }),
  48376. $globals.ClassTest);
  48377. $core.addMethod(
  48378. $core.method({
  48379. selector: "setUp",
  48380. protocol: 'running',
  48381. fn: function (){
  48382. var self=this;
  48383. return $core.withContext(function($ctx1) {
  48384. self["@builder"]=$recv($globals.ClassBuilder)._new();
  48385. return self;
  48386. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  48387. },
  48388. args: [],
  48389. source: "setUp\x0a\x09builder := ClassBuilder new",
  48390. referencedClasses: ["ClassBuilder"],
  48391. messageSends: ["new"]
  48392. }),
  48393. $globals.ClassTest);
  48394. $core.addMethod(
  48395. $core.method({
  48396. selector: "tearDown",
  48397. protocol: 'running',
  48398. fn: function (){
  48399. var self=this;
  48400. return $core.withContext(function($ctx1) {
  48401. var $1,$receiver;
  48402. $1=self["@theClass"];
  48403. if(($receiver = $1) == null || $receiver.isNil){
  48404. $1;
  48405. } else {
  48406. $recv($globals.Smalltalk)._removeClass_(self["@theClass"]);
  48407. self["@theClass"]=nil;
  48408. self["@theClass"];
  48409. };
  48410. return self;
  48411. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  48412. },
  48413. args: [],
  48414. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  48415. referencedClasses: ["Smalltalk"],
  48416. messageSends: ["ifNotNil:", "removeClass:"]
  48417. }),
  48418. $globals.ClassTest);
  48419. $core.addMethod(
  48420. $core.method({
  48421. selector: "testAllSubclasses",
  48422. protocol: 'tests',
  48423. fn: function (){
  48424. var self=this;
  48425. var subclasses,index;
  48426. return $core.withContext(function($ctx1) {
  48427. subclasses=$recv($globals.Object)._subclasses();
  48428. $ctx1.sendIdx["subclasses"]=1;
  48429. index=(1);
  48430. $recv((function(){
  48431. return $core.withContext(function($ctx2) {
  48432. return $recv(index).__gt($recv(subclasses)._size());
  48433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48434. }))._whileFalse_((function(){
  48435. return $core.withContext(function($ctx2) {
  48436. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  48437. index=$recv(index).__plus((1));
  48438. return index;
  48439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48440. }));
  48441. self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  48442. return self;
  48443. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  48444. },
  48445. args: [],
  48446. 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",
  48447. referencedClasses: ["Object"],
  48448. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  48449. }),
  48450. $globals.ClassTest);
  48451. $core.addMethod(
  48452. $core.method({
  48453. selector: "testMetaclassSubclasses",
  48454. protocol: 'tests',
  48455. fn: function (){
  48456. var self=this;
  48457. var subclasses;
  48458. return $core.withContext(function($ctx1) {
  48459. var $4,$3,$2,$1;
  48460. $4=$recv($globals.Object)._class();
  48461. $ctx1.sendIdx["class"]=1;
  48462. $3=$recv($4)._instanceClass();
  48463. $2=$recv($3)._subclasses();
  48464. $ctx1.sendIdx["subclasses"]=1;
  48465. $1=$recv($2)._select_((function(each){
  48466. return $core.withContext(function($ctx2) {
  48467. return $recv($recv(each)._isMetaclass())._not();
  48468. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48469. }));
  48470. subclasses=$recv($1)._collect_((function(each){
  48471. return $core.withContext(function($ctx2) {
  48472. return $recv(each)._theMetaClass();
  48473. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48474. }));
  48475. self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  48476. return self;
  48477. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  48478. },
  48479. args: [],
  48480. 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",
  48481. referencedClasses: ["Object"],
  48482. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  48483. }),
  48484. $globals.ClassTest);
  48485. $core.addMethod(
  48486. $core.method({
  48487. selector: "testSetJavaScriptConstructor",
  48488. protocol: 'tests',
  48489. fn: function (){
  48490. var self=this;
  48491. var instance;
  48492. return $core.withContext(function($ctx1) {
  48493. var $2,$1,$4,$3,$6,$5,$8,$7;
  48494. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48495. $recv(self["@theClass"])._javascriptConstructor_(self._jsConstructor());
  48496. $2=$recv(self["@theClass"])._superclass();
  48497. $ctx1.sendIdx["superclass"]=1;
  48498. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48499. $ctx1.sendIdx["=="]=1;
  48500. self._assert_($1);
  48501. $ctx1.sendIdx["assert:"]=1;
  48502. $4=$recv(self["@theClass"])._instanceVariableNames();
  48503. $ctx1.sendIdx["instanceVariableNames"]=1;
  48504. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48505. $ctx1.sendIdx["=="]=2;
  48506. self._assert_($3);
  48507. $ctx1.sendIdx["assert:"]=2;
  48508. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48509. $ctx1.sendIdx["assert:equals:"]=1;
  48510. $6=$recv(self["@theClass"])._package();
  48511. $ctx1.sendIdx["package"]=1;
  48512. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48513. $ctx1.sendIdx["=="]=3;
  48514. self._assert_($5);
  48515. $ctx1.sendIdx["assert:"]=3;
  48516. $8=$recv(self["@theClass"])._methodDictionary();
  48517. $ctx1.sendIdx["methodDictionary"]=1;
  48518. $7=$recv($8)._keys();
  48519. $ctx1.sendIdx["keys"]=1;
  48520. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48521. $ctx1.sendIdx["assert:equals:"]=2;
  48522. instance=$recv(self["@theClass"])._new();
  48523. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  48524. self._assert_equals_($recv(instance)._value(),(4));
  48525. $ctx1.sendIdx["assert:equals:"]=3;
  48526. self._shouldnt_raise_((function(){
  48527. return $core.withContext(function($ctx2) {
  48528. return $recv(instance)._foo_((9));
  48529. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48530. }),$globals.Error);
  48531. self._assert_equals_($recv(instance)._foo(),(9));
  48532. return self;
  48533. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  48534. },
  48535. args: [],
  48536. 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",
  48537. referencedClasses: ["ObjectMock", "Error"],
  48538. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  48539. }),
  48540. $globals.ClassTest);
  48541. $core.addMethod(
  48542. $core.method({
  48543. selector: "testTrickySetJavaScriptConstructor",
  48544. protocol: 'tests',
  48545. fn: function (){
  48546. var self=this;
  48547. var instance;
  48548. return $core.withContext(function($ctx1) {
  48549. var $2,$1,$4,$3,$6,$5,$8,$7;
  48550. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48551. $recv(self["@theClass"])._javascriptConstructor_(self._trickyJsConstructor());
  48552. $2=$recv(self["@theClass"])._superclass();
  48553. $ctx1.sendIdx["superclass"]=1;
  48554. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48555. $ctx1.sendIdx["=="]=1;
  48556. self._assert_($1);
  48557. $ctx1.sendIdx["assert:"]=1;
  48558. $4=$recv(self["@theClass"])._instanceVariableNames();
  48559. $ctx1.sendIdx["instanceVariableNames"]=1;
  48560. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48561. $ctx1.sendIdx["=="]=2;
  48562. self._assert_($3);
  48563. $ctx1.sendIdx["assert:"]=2;
  48564. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48565. $ctx1.sendIdx["assert:equals:"]=1;
  48566. $6=$recv(self["@theClass"])._package();
  48567. $ctx1.sendIdx["package"]=1;
  48568. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48569. $ctx1.sendIdx["=="]=3;
  48570. self._assert_($5);
  48571. $ctx1.sendIdx["assert:"]=3;
  48572. $8=$recv(self["@theClass"])._methodDictionary();
  48573. $ctx1.sendIdx["methodDictionary"]=1;
  48574. $7=$recv($8)._keys();
  48575. $ctx1.sendIdx["keys"]=1;
  48576. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48577. $ctx1.sendIdx["assert:equals:"]=2;
  48578. instance=$recv(self["@theClass"])._new();
  48579. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  48580. self._assert_equals_($recv(instance)._value(),(4));
  48581. $ctx1.sendIdx["assert:equals:"]=3;
  48582. self._shouldnt_raise_((function(){
  48583. return $core.withContext(function($ctx2) {
  48584. return $recv(instance)._foo_((9));
  48585. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48586. }),$globals.Error);
  48587. self._assert_equals_($recv(instance)._foo(),(9));
  48588. return self;
  48589. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  48590. },
  48591. args: [],
  48592. 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",
  48593. referencedClasses: ["ObjectMock", "Error"],
  48594. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  48595. }),
  48596. $globals.ClassTest);
  48597. $core.addMethod(
  48598. $core.method({
  48599. selector: "trickyJsConstructor",
  48600. protocol: 'running',
  48601. fn: function (){
  48602. var self=this;
  48603. return $core.withContext(function($ctx1) {
  48604. function Foo(){}
  48605. Foo.prototype.valueOf = function () {return 4;};
  48606. Foo.prototype._foo = function () {return "bar";};
  48607. return Foo;
  48608. ;
  48609. return self;
  48610. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  48611. },
  48612. args: [],
  48613. source: "trickyJsConstructor\x0a\x09<\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>",
  48614. referencedClasses: [],
  48615. messageSends: []
  48616. }),
  48617. $globals.ClassTest);
  48618. $core.addClass('CollectionTest', $globals.TestCase, ['sampleBlock'], 'Kernel-Tests');
  48619. $core.addMethod(
  48620. $core.method({
  48621. selector: "assertSameContents:as:",
  48622. protocol: 'convenience',
  48623. fn: function (aCollection,anotherCollection){
  48624. var self=this;
  48625. return $core.withContext(function($ctx1) {
  48626. var $2,$1,$4,$3;
  48627. $2=$recv(aCollection)._size();
  48628. $ctx1.sendIdx["size"]=1;
  48629. $1=$recv($2).__eq($recv(anotherCollection)._size());
  48630. $ctx1.sendIdx["="]=1;
  48631. self._assert_($1);
  48632. $ctx1.sendIdx["assert:"]=1;
  48633. $recv(aCollection)._do_((function(each){
  48634. return $core.withContext(function($ctx2) {
  48635. $4=$recv(aCollection)._occurrencesOf_(each);
  48636. $ctx2.sendIdx["occurrencesOf:"]=1;
  48637. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  48638. return self._assert_($3);
  48639. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48640. }));
  48641. return self;
  48642. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  48643. },
  48644. args: ["aCollection", "anotherCollection"],
  48645. 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)) ]",
  48646. referencedClasses: [],
  48647. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  48648. }),
  48649. $globals.CollectionTest);
  48650. $core.addMethod(
  48651. $core.method({
  48652. selector: "collection",
  48653. protocol: 'fixture',
  48654. fn: function (){
  48655. var self=this;
  48656. return $core.withContext(function($ctx1) {
  48657. self._subclassResponsibility();
  48658. return self;
  48659. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  48660. },
  48661. args: [],
  48662. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  48663. referencedClasses: [],
  48664. messageSends: ["subclassResponsibility"]
  48665. }),
  48666. $globals.CollectionTest);
  48667. $core.addMethod(
  48668. $core.method({
  48669. selector: "collectionClass",
  48670. protocol: 'fixture',
  48671. fn: function (){
  48672. var self=this;
  48673. return $core.withContext(function($ctx1) {
  48674. return $recv(self._class())._collectionClass();
  48675. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  48676. },
  48677. args: [],
  48678. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  48679. referencedClasses: [],
  48680. messageSends: ["collectionClass", "class"]
  48681. }),
  48682. $globals.CollectionTest);
  48683. $core.addMethod(
  48684. $core.method({
  48685. selector: "collectionOfPrintStrings",
  48686. protocol: 'fixture',
  48687. fn: function (){
  48688. var self=this;
  48689. return $core.withContext(function($ctx1) {
  48690. self._subclassResponsibility();
  48691. return self;
  48692. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  48693. },
  48694. args: [],
  48695. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  48696. referencedClasses: [],
  48697. messageSends: ["subclassResponsibility"]
  48698. }),
  48699. $globals.CollectionTest);
  48700. $core.addMethod(
  48701. $core.method({
  48702. selector: "collectionSize",
  48703. protocol: 'fixture',
  48704. fn: function (){
  48705. var self=this;
  48706. return $core.withContext(function($ctx1) {
  48707. self._subclassResponsibility();
  48708. return self;
  48709. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  48710. },
  48711. args: [],
  48712. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  48713. referencedClasses: [],
  48714. messageSends: ["subclassResponsibility"]
  48715. }),
  48716. $globals.CollectionTest);
  48717. $core.addMethod(
  48718. $core.method({
  48719. selector: "collectionWithDuplicates",
  48720. protocol: 'fixture',
  48721. fn: function (){
  48722. var self=this;
  48723. return $core.withContext(function($ctx1) {
  48724. self._subclassResponsibility();
  48725. return self;
  48726. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  48727. },
  48728. args: [],
  48729. 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",
  48730. referencedClasses: [],
  48731. messageSends: ["subclassResponsibility"]
  48732. }),
  48733. $globals.CollectionTest);
  48734. $core.addMethod(
  48735. $core.method({
  48736. selector: "collectionWithNewValue",
  48737. protocol: 'fixture',
  48738. fn: function (){
  48739. var self=this;
  48740. return $core.withContext(function($ctx1) {
  48741. self._subclassResponsibility();
  48742. return self;
  48743. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  48744. },
  48745. args: [],
  48746. 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",
  48747. referencedClasses: [],
  48748. messageSends: ["subclassResponsibility"]
  48749. }),
  48750. $globals.CollectionTest);
  48751. $core.addMethod(
  48752. $core.method({
  48753. selector: "initialize",
  48754. protocol: 'initialization',
  48755. fn: function (){
  48756. var self=this;
  48757. return $core.withContext(function($ctx1) {
  48758. (
  48759. $ctx1.supercall = true,
  48760. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  48761. $ctx1.supercall = false;
  48762. self["@sampleBlock"]=(function(){
  48763. });
  48764. return self;
  48765. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  48766. },
  48767. args: [],
  48768. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  48769. referencedClasses: [],
  48770. messageSends: ["initialize"]
  48771. }),
  48772. $globals.CollectionTest);
  48773. $core.addMethod(
  48774. $core.method({
  48775. selector: "isCollectionReadOnly",
  48776. protocol: 'testing',
  48777. fn: function (){
  48778. var self=this;
  48779. return false;
  48780. },
  48781. args: [],
  48782. source: "isCollectionReadOnly\x0a\x09^ false",
  48783. referencedClasses: [],
  48784. messageSends: []
  48785. }),
  48786. $globals.CollectionTest);
  48787. $core.addMethod(
  48788. $core.method({
  48789. selector: "sampleNewValue",
  48790. protocol: 'fixture',
  48791. fn: function (){
  48792. var self=this;
  48793. return "N";
  48794. },
  48795. args: [],
  48796. 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'",
  48797. referencedClasses: [],
  48798. messageSends: []
  48799. }),
  48800. $globals.CollectionTest);
  48801. $core.addMethod(
  48802. $core.method({
  48803. selector: "sampleNewValueAsCollection",
  48804. protocol: 'fixture',
  48805. fn: function (){
  48806. var self=this;
  48807. return $core.withContext(function($ctx1) {
  48808. return $recv(self._collectionClass())._with_(self._sampleNewValue());
  48809. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  48810. },
  48811. args: [],
  48812. 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",
  48813. referencedClasses: [],
  48814. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  48815. }),
  48816. $globals.CollectionTest);
  48817. $core.addMethod(
  48818. $core.method({
  48819. selector: "testAddAll",
  48820. protocol: 'tests',
  48821. fn: function (){
  48822. var self=this;
  48823. return $core.withContext(function($ctx1) {
  48824. 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;
  48825. $2=self._collection();
  48826. $ctx1.sendIdx["collection"]=1;
  48827. $4=self._collectionClass();
  48828. $ctx1.sendIdx["collectionClass"]=1;
  48829. $3=$recv($4)._new();
  48830. $ctx1.sendIdx["new"]=1;
  48831. $recv($2)._addAll_($3);
  48832. $ctx1.sendIdx["addAll:"]=1;
  48833. $5=$recv($2)._yourself();
  48834. $ctx1.sendIdx["yourself"]=1;
  48835. $1=$5;
  48836. $6=self._collection();
  48837. $ctx1.sendIdx["collection"]=2;
  48838. self._assert_equals_($1,$6);
  48839. $ctx1.sendIdx["assert:equals:"]=1;
  48840. $9=self._collectionClass();
  48841. $ctx1.sendIdx["collectionClass"]=2;
  48842. $8=$recv($9)._new();
  48843. $ctx1.sendIdx["new"]=2;
  48844. $10=self._collection();
  48845. $ctx1.sendIdx["collection"]=3;
  48846. $recv($8)._addAll_($10);
  48847. $ctx1.sendIdx["addAll:"]=2;
  48848. $11=$recv($8)._yourself();
  48849. $ctx1.sendIdx["yourself"]=2;
  48850. $7=$11;
  48851. $12=self._collection();
  48852. $ctx1.sendIdx["collection"]=4;
  48853. self._assert_equals_($7,$12);
  48854. $ctx1.sendIdx["assert:equals:"]=2;
  48855. $15=self._collectionClass();
  48856. $ctx1.sendIdx["collectionClass"]=3;
  48857. $14=$recv($15)._new();
  48858. $ctx1.sendIdx["new"]=3;
  48859. $17=self._collectionClass();
  48860. $ctx1.sendIdx["collectionClass"]=4;
  48861. $16=$recv($17)._new();
  48862. $ctx1.sendIdx["new"]=4;
  48863. $recv($14)._addAll_($16);
  48864. $ctx1.sendIdx["addAll:"]=3;
  48865. $18=$recv($14)._yourself();
  48866. $ctx1.sendIdx["yourself"]=3;
  48867. $13=$18;
  48868. self._assert_equals_($13,$recv(self._collectionClass())._new());
  48869. $ctx1.sendIdx["assert:equals:"]=3;
  48870. $20=self._collection();
  48871. $ctx1.sendIdx["collection"]=5;
  48872. $21=self._sampleNewValueAsCollection();
  48873. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  48874. $recv($20)._addAll_($21);
  48875. $ctx1.sendIdx["addAll:"]=4;
  48876. $22=$recv($20)._yourself();
  48877. $ctx1.sendIdx["yourself"]=4;
  48878. $19=$22;
  48879. $23=self._collectionWithNewValue();
  48880. $ctx1.sendIdx["collectionWithNewValue"]=1;
  48881. self._assert_equals_($19,$23);
  48882. $25=self._sampleNewValueAsCollection();
  48883. $recv($25)._addAll_(self._collection());
  48884. $24=$recv($25)._yourself();
  48885. self._assertSameContents_as_($24,self._collectionWithNewValue());
  48886. return self;
  48887. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  48888. },
  48889. args: [],
  48890. 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",
  48891. referencedClasses: [],
  48892. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  48893. }),
  48894. $globals.CollectionTest);
  48895. $core.addMethod(
  48896. $core.method({
  48897. selector: "testAllSatisfy",
  48898. protocol: 'tests',
  48899. fn: function (){
  48900. var self=this;
  48901. var collection,anyOne;
  48902. return $core.withContext(function($ctx1) {
  48903. var $1;
  48904. collection=self._collection();
  48905. anyOne=$recv(collection)._anyOne();
  48906. $1=$recv(collection)._allSatisfy_((function(each){
  48907. return $core.withContext(function($ctx2) {
  48908. return $recv(collection)._includes_(each);
  48909. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48910. }));
  48911. $ctx1.sendIdx["allSatisfy:"]=1;
  48912. self._assert_($1);
  48913. self._deny_($recv(collection)._allSatisfy_((function(each){
  48914. return $core.withContext(function($ctx2) {
  48915. return $recv(each).__tild_eq(anyOne);
  48916. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48917. })));
  48918. return self;
  48919. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  48920. },
  48921. args: [],
  48922. 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 ])",
  48923. referencedClasses: [],
  48924. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  48925. }),
  48926. $globals.CollectionTest);
  48927. $core.addMethod(
  48928. $core.method({
  48929. selector: "testAnyOne",
  48930. protocol: 'tests',
  48931. fn: function (){
  48932. var self=this;
  48933. return $core.withContext(function($ctx1) {
  48934. var $2,$1;
  48935. self._should_raise_((function(){
  48936. return $core.withContext(function($ctx2) {
  48937. return $recv($recv(self._collectionClass())._new())._anyOne();
  48938. $ctx2.sendIdx["anyOne"]=1;
  48939. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48940. }),$globals.Error);
  48941. $2=self._collection();
  48942. $ctx1.sendIdx["collection"]=1;
  48943. $1=$recv($2)._includes_($recv(self._collection())._anyOne());
  48944. self._assert_($1);
  48945. return self;
  48946. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  48947. },
  48948. args: [],
  48949. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  48950. referencedClasses: ["Error"],
  48951. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  48952. }),
  48953. $globals.CollectionTest);
  48954. $core.addMethod(
  48955. $core.method({
  48956. selector: "testAnySatisfy",
  48957. protocol: 'tests',
  48958. fn: function (){
  48959. var self=this;
  48960. var anyOne;
  48961. return $core.withContext(function($ctx1) {
  48962. var $1,$3,$2;
  48963. $1=self._collection();
  48964. $ctx1.sendIdx["collection"]=1;
  48965. anyOne=$recv($1)._anyOne();
  48966. $3=self._collection();
  48967. $ctx1.sendIdx["collection"]=2;
  48968. $2=$recv($3)._anySatisfy_((function(each){
  48969. return $core.withContext(function($ctx2) {
  48970. return $recv(each).__eq(anyOne);
  48971. $ctx2.sendIdx["="]=1;
  48972. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48973. }));
  48974. $ctx1.sendIdx["anySatisfy:"]=1;
  48975. self._assert_($2);
  48976. self._deny_($recv(self._collection())._anySatisfy_((function(each){
  48977. return $core.withContext(function($ctx2) {
  48978. return $recv(each).__eq($recv($globals.Object)._new());
  48979. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48980. })));
  48981. return self;
  48982. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  48983. },
  48984. args: [],
  48985. 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 ])",
  48986. referencedClasses: ["Object"],
  48987. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  48988. }),
  48989. $globals.CollectionTest);
  48990. $core.addMethod(
  48991. $core.method({
  48992. selector: "testAsArray",
  48993. protocol: 'tests',
  48994. fn: function (){
  48995. var self=this;
  48996. return $core.withContext(function($ctx1) {
  48997. var $1;
  48998. $1=self._collection();
  48999. $ctx1.sendIdx["collection"]=1;
  49000. self._assertSameContents_as_($1,$recv(self._collection())._asArray());
  49001. return self;
  49002. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  49003. },
  49004. args: [],
  49005. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  49006. referencedClasses: [],
  49007. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  49008. }),
  49009. $globals.CollectionTest);
  49010. $core.addMethod(
  49011. $core.method({
  49012. selector: "testAsOrderedCollection",
  49013. protocol: 'tests',
  49014. fn: function (){
  49015. var self=this;
  49016. return $core.withContext(function($ctx1) {
  49017. var $1;
  49018. $1=self._collection();
  49019. $ctx1.sendIdx["collection"]=1;
  49020. self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection());
  49021. return self;
  49022. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  49023. },
  49024. args: [],
  49025. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  49026. referencedClasses: [],
  49027. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  49028. }),
  49029. $globals.CollectionTest);
  49030. $core.addMethod(
  49031. $core.method({
  49032. selector: "testAsSet",
  49033. protocol: 'tests',
  49034. fn: function (){
  49035. var self=this;
  49036. var c,set;
  49037. return $core.withContext(function($ctx1) {
  49038. c=self._collectionWithDuplicates();
  49039. set=$recv(c)._asSet();
  49040. self._assert_equals_($recv(set)._size(),(6));
  49041. $recv(c)._do_((function(each){
  49042. return $core.withContext(function($ctx2) {
  49043. return self._assert_($recv(set)._includes_(each));
  49044. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49045. }));
  49046. return self;
  49047. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  49048. },
  49049. args: [],
  49050. 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) ]",
  49051. referencedClasses: [],
  49052. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  49053. }),
  49054. $globals.CollectionTest);
  49055. $core.addMethod(
  49056. $core.method({
  49057. selector: "testCollect",
  49058. protocol: 'tests',
  49059. fn: function (){
  49060. var self=this;
  49061. return $core.withContext(function($ctx1) {
  49062. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  49063. $2=self._collection();
  49064. $ctx1.sendIdx["collection"]=1;
  49065. $1=$recv($2)._collect_((function(each){
  49066. return each;
  49067. }));
  49068. $ctx1.sendIdx["collect:"]=1;
  49069. $3=self._collection();
  49070. $ctx1.sendIdx["collection"]=2;
  49071. self._assert_equals_($1,$3);
  49072. $ctx1.sendIdx["assert:equals:"]=1;
  49073. $5=self._collectionWithNewValue();
  49074. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49075. $4=$recv($5)._collect_((function(each){
  49076. return each;
  49077. }));
  49078. $ctx1.sendIdx["collect:"]=2;
  49079. self._assert_equals_($4,self._collectionWithNewValue());
  49080. $ctx1.sendIdx["assert:equals:"]=2;
  49081. $8=self._collectionClass();
  49082. $ctx1.sendIdx["collectionClass"]=1;
  49083. $7=$recv($8)._new();
  49084. $ctx1.sendIdx["new"]=1;
  49085. $6=$recv($7)._collect_((function(each){
  49086. return $core.withContext(function($ctx2) {
  49087. return $recv(each)._printString();
  49088. $ctx2.sendIdx["printString"]=1;
  49089. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  49090. }));
  49091. $ctx1.sendIdx["collect:"]=3;
  49092. self._assert_equals_($6,$recv(self._collectionClass())._new());
  49093. $ctx1.sendIdx["assert:equals:"]=3;
  49094. $11=self._collection();
  49095. $ctx1.sendIdx["collection"]=3;
  49096. $10=$recv($11)._collect_((function(){
  49097. return $core.withContext(function($ctx2) {
  49098. return self._sampleNewValue();
  49099. $ctx2.sendIdx["sampleNewValue"]=1;
  49100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  49101. }));
  49102. $ctx1.sendIdx["collect:"]=4;
  49103. $9=$recv($10)._detect_((function(){
  49104. return true;
  49105. }));
  49106. self._assert_equals_($9,self._sampleNewValue());
  49107. $ctx1.sendIdx["assert:equals:"]=4;
  49108. self._assert_equals_($recv(self._collection())._collect_((function(each){
  49109. return $core.withContext(function($ctx2) {
  49110. return $recv(each)._printString();
  49111. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49112. })),self._collectionOfPrintStrings());
  49113. return self;
  49114. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  49115. },
  49116. args: [],
  49117. 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",
  49118. referencedClasses: [],
  49119. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  49120. }),
  49121. $globals.CollectionTest);
  49122. $core.addMethod(
  49123. $core.method({
  49124. selector: "testComma",
  49125. protocol: 'tests',
  49126. fn: function (){
  49127. var self=this;
  49128. return $core.withContext(function($ctx1) {
  49129. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  49130. $2=self._collection();
  49131. $ctx1.sendIdx["collection"]=1;
  49132. $4=self._collectionClass();
  49133. $ctx1.sendIdx["collectionClass"]=1;
  49134. $3=$recv($4)._new();
  49135. $ctx1.sendIdx["new"]=1;
  49136. $1=$recv($2).__comma($3);
  49137. $ctx1.sendIdx[","]=1;
  49138. $5=self._collection();
  49139. $ctx1.sendIdx["collection"]=2;
  49140. self._assert_equals_($1,$5);
  49141. $ctx1.sendIdx["assert:equals:"]=1;
  49142. $8=self._collectionClass();
  49143. $ctx1.sendIdx["collectionClass"]=2;
  49144. $7=$recv($8)._new();
  49145. $ctx1.sendIdx["new"]=2;
  49146. $9=self._collection();
  49147. $ctx1.sendIdx["collection"]=3;
  49148. $6=$recv($7).__comma($9);
  49149. $ctx1.sendIdx[","]=2;
  49150. $10=self._collection();
  49151. $ctx1.sendIdx["collection"]=4;
  49152. self._assert_equals_($6,$10);
  49153. $ctx1.sendIdx["assert:equals:"]=2;
  49154. $13=self._collectionClass();
  49155. $ctx1.sendIdx["collectionClass"]=3;
  49156. $12=$recv($13)._new();
  49157. $ctx1.sendIdx["new"]=3;
  49158. $15=self._collectionClass();
  49159. $ctx1.sendIdx["collectionClass"]=4;
  49160. $14=$recv($15)._new();
  49161. $ctx1.sendIdx["new"]=4;
  49162. $11=$recv($12).__comma($14);
  49163. $ctx1.sendIdx[","]=3;
  49164. self._assert_equals_($11,$recv(self._collectionClass())._new());
  49165. $ctx1.sendIdx["assert:equals:"]=3;
  49166. $17=self._collection();
  49167. $ctx1.sendIdx["collection"]=5;
  49168. $18=self._sampleNewValueAsCollection();
  49169. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  49170. $16=$recv($17).__comma($18);
  49171. $ctx1.sendIdx[","]=4;
  49172. $19=self._collectionWithNewValue();
  49173. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49174. self._assert_equals_($16,$19);
  49175. self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  49176. return self;
  49177. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  49178. },
  49179. args: [],
  49180. 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",
  49181. referencedClasses: [],
  49182. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  49183. }),
  49184. $globals.CollectionTest);
  49185. $core.addMethod(
  49186. $core.method({
  49187. selector: "testCopy",
  49188. protocol: 'tests',
  49189. fn: function (){
  49190. var self=this;
  49191. return $core.withContext(function($ctx1) {
  49192. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  49193. $3=self._collectionClass();
  49194. $ctx1.sendIdx["collectionClass"]=1;
  49195. $2=$recv($3)._new();
  49196. $ctx1.sendIdx["new"]=1;
  49197. $1=$recv($2)._copy();
  49198. $ctx1.sendIdx["copy"]=1;
  49199. $5=self._collectionClass();
  49200. $ctx1.sendIdx["collectionClass"]=2;
  49201. $4=$recv($5)._new();
  49202. $ctx1.sendIdx["new"]=2;
  49203. self._assert_equals_($1,$4);
  49204. $ctx1.sendIdx["assert:equals:"]=1;
  49205. $7=self._collection();
  49206. $ctx1.sendIdx["collection"]=1;
  49207. $6=$recv($7)._copy();
  49208. $ctx1.sendIdx["copy"]=2;
  49209. $8=self._collection();
  49210. $ctx1.sendIdx["collection"]=2;
  49211. self._assert_equals_($6,$8);
  49212. $ctx1.sendIdx["assert:equals:"]=2;
  49213. $10=self._collectionWithNewValue();
  49214. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49215. $9=$recv($10)._copy();
  49216. $ctx1.sendIdx["copy"]=3;
  49217. $11=self._collectionWithNewValue();
  49218. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49219. self._assert_equals_($9,$11);
  49220. $15=self._collectionClass();
  49221. $ctx1.sendIdx["collectionClass"]=3;
  49222. $14=$recv($15)._new();
  49223. $ctx1.sendIdx["new"]=3;
  49224. $13=$recv($14)._copy();
  49225. $ctx1.sendIdx["copy"]=4;
  49226. $16=self._collection();
  49227. $ctx1.sendIdx["collection"]=3;
  49228. $12=$recv($13).__eq($16);
  49229. $ctx1.sendIdx["="]=1;
  49230. self._deny_($12);
  49231. $ctx1.sendIdx["deny:"]=1;
  49232. $19=self._collection();
  49233. $ctx1.sendIdx["collection"]=4;
  49234. $18=$recv($19)._copy();
  49235. $ctx1.sendIdx["copy"]=5;
  49236. $17=$recv($18).__eq($recv(self._collectionClass())._new());
  49237. $ctx1.sendIdx["="]=2;
  49238. self._deny_($17);
  49239. $ctx1.sendIdx["deny:"]=2;
  49240. self._deny_($recv($recv(self._collection())._copy()).__eq(self._collectionWithNewValue()));
  49241. return self;
  49242. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  49243. },
  49244. args: [],
  49245. 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",
  49246. referencedClasses: [],
  49247. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  49248. }),
  49249. $globals.CollectionTest);
  49250. $core.addMethod(
  49251. $core.method({
  49252. selector: "testCopySeparates",
  49253. protocol: 'tests',
  49254. fn: function (){
  49255. var self=this;
  49256. var original,copy;
  49257. return $core.withContext(function($ctx1) {
  49258. original=self._collection();
  49259. $ctx1.sendIdx["collection"]=1;
  49260. copy=$recv(original)._copy();
  49261. $recv(copy)._addAll_(self._sampleNewValueAsCollection());
  49262. self._assert_($recv(original).__eq(self._collection()));
  49263. return self;
  49264. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  49265. },
  49266. args: [],
  49267. 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",
  49268. referencedClasses: [],
  49269. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  49270. }),
  49271. $globals.CollectionTest);
  49272. $core.addMethod(
  49273. $core.method({
  49274. selector: "testDetect",
  49275. protocol: 'tests',
  49276. fn: function (){
  49277. var self=this;
  49278. return $core.withContext(function($ctx1) {
  49279. var $1,$2,$3,$4,$6,$5,$7;
  49280. self._shouldnt_raise_((function(){
  49281. return $core.withContext(function($ctx2) {
  49282. $1=self._collection();
  49283. $ctx2.sendIdx["collection"]=1;
  49284. return $recv($1)._detect_((function(){
  49285. return true;
  49286. }));
  49287. $ctx2.sendIdx["detect:"]=1;
  49288. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49289. }),$globals.Error);
  49290. self._should_raise_((function(){
  49291. return $core.withContext(function($ctx2) {
  49292. $2=self._collection();
  49293. $ctx2.sendIdx["collection"]=2;
  49294. return $recv($2)._detect_((function(){
  49295. return false;
  49296. }));
  49297. $ctx2.sendIdx["detect:"]=2;
  49298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49299. }),$globals.Error);
  49300. $ctx1.sendIdx["should:raise:"]=1;
  49301. $3=$recv(self._sampleNewValueAsCollection())._detect_((function(){
  49302. return true;
  49303. }));
  49304. $ctx1.sendIdx["detect:"]=3;
  49305. $4=self._sampleNewValue();
  49306. $ctx1.sendIdx["sampleNewValue"]=1;
  49307. self._assert_equals_($3,$4);
  49308. $ctx1.sendIdx["assert:equals:"]=1;
  49309. $5=$recv(self._collectionWithNewValue())._detect_((function(each){
  49310. return $core.withContext(function($ctx2) {
  49311. $6=self._sampleNewValue();
  49312. $ctx2.sendIdx["sampleNewValue"]=2;
  49313. return $recv(each).__eq($6);
  49314. $ctx2.sendIdx["="]=1;
  49315. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49316. }));
  49317. $ctx1.sendIdx["detect:"]=4;
  49318. $7=self._sampleNewValue();
  49319. $ctx1.sendIdx["sampleNewValue"]=3;
  49320. self._assert_equals_($5,$7);
  49321. self._should_raise_((function(){
  49322. return $core.withContext(function($ctx2) {
  49323. return $recv(self._collection())._detect_((function(each){
  49324. return $core.withContext(function($ctx3) {
  49325. return $recv(each).__eq(self._sampleNewValue());
  49326. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  49327. }));
  49328. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  49329. }),$globals.Error);
  49330. return self;
  49331. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  49332. },
  49333. args: [],
  49334. 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",
  49335. referencedClasses: ["Error"],
  49336. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  49337. }),
  49338. $globals.CollectionTest);
  49339. $core.addMethod(
  49340. $core.method({
  49341. selector: "testDetectIfNone",
  49342. protocol: 'tests',
  49343. fn: function (){
  49344. var self=this;
  49345. var sentinel;
  49346. return $core.withContext(function($ctx1) {
  49347. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  49348. sentinel=$recv($globals.Object)._new();
  49349. $3=self._collection();
  49350. $ctx1.sendIdx["collection"]=1;
  49351. $2=$recv($3)._detect_ifNone_((function(){
  49352. return true;
  49353. }),(function(){
  49354. return sentinel;
  49355. }));
  49356. $ctx1.sendIdx["detect:ifNone:"]=1;
  49357. $1=$recv($2).__tild_eq(sentinel);
  49358. self._assert_($1);
  49359. $5=self._collection();
  49360. $ctx1.sendIdx["collection"]=2;
  49361. $4=$recv($5)._detect_ifNone_((function(){
  49362. return false;
  49363. }),(function(){
  49364. return sentinel;
  49365. }));
  49366. $ctx1.sendIdx["detect:ifNone:"]=2;
  49367. self._assert_equals_($4,sentinel);
  49368. $ctx1.sendIdx["assert:equals:"]=1;
  49369. $6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  49370. return true;
  49371. }),(function(){
  49372. return sentinel;
  49373. }));
  49374. $ctx1.sendIdx["detect:ifNone:"]=3;
  49375. $7=self._sampleNewValue();
  49376. $ctx1.sendIdx["sampleNewValue"]=1;
  49377. self._assert_equals_($6,$7);
  49378. $ctx1.sendIdx["assert:equals:"]=2;
  49379. $8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){
  49380. return $core.withContext(function($ctx2) {
  49381. $9=self._sampleNewValue();
  49382. $ctx2.sendIdx["sampleNewValue"]=2;
  49383. return $recv(each).__eq($9);
  49384. $ctx2.sendIdx["="]=1;
  49385. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  49386. }),(function(){
  49387. return sentinel;
  49388. }));
  49389. $ctx1.sendIdx["detect:ifNone:"]=4;
  49390. $10=self._sampleNewValue();
  49391. $ctx1.sendIdx["sampleNewValue"]=3;
  49392. self._assert_equals_($8,$10);
  49393. $ctx1.sendIdx["assert:equals:"]=3;
  49394. self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){
  49395. return $core.withContext(function($ctx2) {
  49396. return $recv(each).__eq(self._sampleNewValue());
  49397. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  49398. }),(function(){
  49399. return sentinel;
  49400. })),sentinel);
  49401. return self;
  49402. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  49403. },
  49404. args: [],
  49405. 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",
  49406. referencedClasses: ["Object"],
  49407. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  49408. }),
  49409. $globals.CollectionTest);
  49410. $core.addMethod(
  49411. $core.method({
  49412. selector: "testDo",
  49413. protocol: 'tests',
  49414. fn: function (){
  49415. var self=this;
  49416. var newCollection;
  49417. return $core.withContext(function($ctx1) {
  49418. var $1,$2;
  49419. newCollection=$recv($globals.OrderedCollection)._new();
  49420. $ctx1.sendIdx["new"]=1;
  49421. $1=self._collection();
  49422. $ctx1.sendIdx["collection"]=1;
  49423. $recv($1)._do_((function(each){
  49424. return $core.withContext(function($ctx2) {
  49425. return $recv(newCollection)._add_(each);
  49426. $ctx2.sendIdx["add:"]=1;
  49427. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49428. }));
  49429. $ctx1.sendIdx["do:"]=1;
  49430. self._assertSameContents_as_(self._collection(),newCollection);
  49431. $ctx1.sendIdx["assertSameContents:as:"]=1;
  49432. newCollection=$recv($globals.OrderedCollection)._new();
  49433. $2=self._collectionWithDuplicates();
  49434. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  49435. $recv($2)._do_((function(each){
  49436. return $core.withContext(function($ctx2) {
  49437. return $recv(newCollection)._add_(each);
  49438. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49439. }));
  49440. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  49441. return self;
  49442. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  49443. },
  49444. args: [],
  49445. 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",
  49446. referencedClasses: ["OrderedCollection"],
  49447. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  49448. }),
  49449. $globals.CollectionTest);
  49450. $core.addMethod(
  49451. $core.method({
  49452. selector: "testEquality",
  49453. protocol: 'tests',
  49454. fn: function (){
  49455. var self=this;
  49456. return $core.withContext(function($ctx1) {
  49457. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  49458. $2=self._collectionClass();
  49459. $ctx1.sendIdx["collectionClass"]=1;
  49460. $1=$recv($2)._new();
  49461. $ctx1.sendIdx["new"]=1;
  49462. $4=self._collectionClass();
  49463. $ctx1.sendIdx["collectionClass"]=2;
  49464. $3=$recv($4)._new();
  49465. $ctx1.sendIdx["new"]=2;
  49466. self._assert_equals_($1,$3);
  49467. $ctx1.sendIdx["assert:equals:"]=1;
  49468. $5=self._collection();
  49469. $ctx1.sendIdx["collection"]=1;
  49470. $6=self._collection();
  49471. $ctx1.sendIdx["collection"]=2;
  49472. self._assert_equals_($5,$6);
  49473. $ctx1.sendIdx["assert:equals:"]=2;
  49474. $7=self._collectionWithNewValue();
  49475. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49476. $8=self._collectionWithNewValue();
  49477. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49478. self._assert_equals_($7,$8);
  49479. $11=self._collectionClass();
  49480. $ctx1.sendIdx["collectionClass"]=3;
  49481. $10=$recv($11)._new();
  49482. $ctx1.sendIdx["new"]=3;
  49483. $12=self._collection();
  49484. $ctx1.sendIdx["collection"]=3;
  49485. $9=$recv($10).__eq($12);
  49486. $ctx1.sendIdx["="]=1;
  49487. self._deny_($9);
  49488. $ctx1.sendIdx["deny:"]=1;
  49489. $14=self._collection();
  49490. $ctx1.sendIdx["collection"]=4;
  49491. $13=$recv($14).__eq($recv(self._collectionClass())._new());
  49492. $ctx1.sendIdx["="]=2;
  49493. self._deny_($13);
  49494. $ctx1.sendIdx["deny:"]=2;
  49495. self._deny_($recv(self._collection()).__eq(self._collectionWithNewValue()));
  49496. return self;
  49497. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  49498. },
  49499. args: [],
  49500. 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",
  49501. referencedClasses: [],
  49502. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  49503. }),
  49504. $globals.CollectionTest);
  49505. $core.addMethod(
  49506. $core.method({
  49507. selector: "testIfEmptyFamily",
  49508. protocol: 'tests',
  49509. fn: function (){
  49510. var self=this;
  49511. return $core.withContext(function($ctx1) {
  49512. 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;
  49513. $3=self._collectionClass();
  49514. $ctx1.sendIdx["collectionClass"]=1;
  49515. $2=$recv($3)._new();
  49516. $ctx1.sendIdx["new"]=1;
  49517. $1=$recv($2)._ifEmpty_((function(){
  49518. return (42);
  49519. }));
  49520. $ctx1.sendIdx["ifEmpty:"]=1;
  49521. self._assert_equals_($1,(42));
  49522. $ctx1.sendIdx["assert:equals:"]=1;
  49523. $5=self._collection();
  49524. $ctx1.sendIdx["collection"]=1;
  49525. $4=$recv($5)._ifEmpty_((function(){
  49526. return (42);
  49527. }));
  49528. $6=self._collection();
  49529. $ctx1.sendIdx["collection"]=2;
  49530. self._assert_equals_($4,$6);
  49531. $ctx1.sendIdx["assert:equals:"]=2;
  49532. $9=self._collectionClass();
  49533. $ctx1.sendIdx["collectionClass"]=2;
  49534. $8=$recv($9)._new();
  49535. $ctx1.sendIdx["new"]=2;
  49536. $7=$recv($8)._ifNotEmpty_((function(){
  49537. return (42);
  49538. }));
  49539. $ctx1.sendIdx["ifNotEmpty:"]=1;
  49540. $11=self._collectionClass();
  49541. $ctx1.sendIdx["collectionClass"]=3;
  49542. $10=$recv($11)._new();
  49543. $ctx1.sendIdx["new"]=3;
  49544. self._assert_equals_($7,$10);
  49545. $ctx1.sendIdx["assert:equals:"]=3;
  49546. $13=self._collection();
  49547. $ctx1.sendIdx["collection"]=3;
  49548. $12=$recv($13)._ifNotEmpty_((function(){
  49549. return (42);
  49550. }));
  49551. $ctx1.sendIdx["ifNotEmpty:"]=2;
  49552. self._assert_equals_($12,(42));
  49553. $ctx1.sendIdx["assert:equals:"]=4;
  49554. $15=self._collection();
  49555. $ctx1.sendIdx["collection"]=4;
  49556. $14=$recv($15)._ifNotEmpty_((function(col){
  49557. return col;
  49558. }));
  49559. $16=self._collection();
  49560. $ctx1.sendIdx["collection"]=5;
  49561. self._assert_equals_($14,$16);
  49562. $ctx1.sendIdx["assert:equals:"]=5;
  49563. $19=self._collectionClass();
  49564. $ctx1.sendIdx["collectionClass"]=4;
  49565. $18=$recv($19)._new();
  49566. $ctx1.sendIdx["new"]=4;
  49567. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  49568. return (42);
  49569. }),(function(){
  49570. return (999);
  49571. }));
  49572. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  49573. self._assert_equals_($17,(42));
  49574. $ctx1.sendIdx["assert:equals:"]=6;
  49575. $21=self._collection();
  49576. $ctx1.sendIdx["collection"]=6;
  49577. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  49578. return (42);
  49579. }),(function(){
  49580. return (999);
  49581. }));
  49582. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  49583. self._assert_equals_($20,(999));
  49584. $ctx1.sendIdx["assert:equals:"]=7;
  49585. $23=self._collection();
  49586. $ctx1.sendIdx["collection"]=7;
  49587. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  49588. return (42);
  49589. }),(function(col){
  49590. return col;
  49591. }));
  49592. $24=self._collection();
  49593. $ctx1.sendIdx["collection"]=8;
  49594. self._assert_equals_($22,$24);
  49595. $ctx1.sendIdx["assert:equals:"]=8;
  49596. $25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  49597. return (42);
  49598. }),(function(){
  49599. return (999);
  49600. }));
  49601. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  49602. self._assert_equals_($25,(999));
  49603. $ctx1.sendIdx["assert:equals:"]=9;
  49604. $27=self._collection();
  49605. $ctx1.sendIdx["collection"]=9;
  49606. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  49607. return (42);
  49608. }),(function(){
  49609. return (999);
  49610. }));
  49611. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  49612. self._assert_equals_($26,(42));
  49613. $ctx1.sendIdx["assert:equals:"]=10;
  49614. $29=self._collection();
  49615. $ctx1.sendIdx["collection"]=10;
  49616. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  49617. return col;
  49618. }),(function(){
  49619. return (999);
  49620. }));
  49621. self._assert_equals_($28,self._collection());
  49622. return self;
  49623. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  49624. },
  49625. args: [],
  49626. 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.",
  49627. referencedClasses: [],
  49628. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  49629. }),
  49630. $globals.CollectionTest);
  49631. $core.addMethod(
  49632. $core.method({
  49633. selector: "testIsEmpty",
  49634. protocol: 'tests',
  49635. fn: function (){
  49636. var self=this;
  49637. return $core.withContext(function($ctx1) {
  49638. var $1;
  49639. $1=$recv($recv(self._collectionClass())._new())._isEmpty();
  49640. $ctx1.sendIdx["isEmpty"]=1;
  49641. self._assert_($1);
  49642. self._deny_($recv(self._collection())._isEmpty());
  49643. return self;
  49644. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  49645. },
  49646. args: [],
  49647. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  49648. referencedClasses: [],
  49649. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  49650. }),
  49651. $globals.CollectionTest);
  49652. $core.addMethod(
  49653. $core.method({
  49654. selector: "testNoneSatisfy",
  49655. protocol: 'tests',
  49656. fn: function (){
  49657. var self=this;
  49658. var anyOne;
  49659. return $core.withContext(function($ctx1) {
  49660. var $1,$3,$2;
  49661. $1=self._collection();
  49662. $ctx1.sendIdx["collection"]=1;
  49663. anyOne=$recv($1)._anyOne();
  49664. $3=self._collection();
  49665. $ctx1.sendIdx["collection"]=2;
  49666. $2=$recv($3)._noneSatisfy_((function(each){
  49667. return $core.withContext(function($ctx2) {
  49668. return $recv(each).__eq(anyOne);
  49669. $ctx2.sendIdx["="]=1;
  49670. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49671. }));
  49672. $ctx1.sendIdx["noneSatisfy:"]=1;
  49673. self._deny_($2);
  49674. self._assert_($recv(self._collection())._noneSatisfy_((function(each){
  49675. return $core.withContext(function($ctx2) {
  49676. return $recv(each).__eq($recv($globals.Object)._new());
  49677. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49678. })));
  49679. return self;
  49680. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  49681. },
  49682. args: [],
  49683. 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 ])",
  49684. referencedClasses: ["Object"],
  49685. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  49686. }),
  49687. $globals.CollectionTest);
  49688. $core.addMethod(
  49689. $core.method({
  49690. selector: "testRemoveAll",
  49691. protocol: 'tests',
  49692. fn: function (){
  49693. var self=this;
  49694. return $core.withContext(function($ctx1) {
  49695. var $2,$1;
  49696. $2=self._collection();
  49697. $recv($2)._removeAll();
  49698. $1=$recv($2)._yourself();
  49699. self._assert_equals_($1,$recv(self._collectionClass())._new());
  49700. return self;
  49701. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  49702. },
  49703. args: [],
  49704. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  49705. referencedClasses: [],
  49706. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  49707. }),
  49708. $globals.CollectionTest);
  49709. $core.addMethod(
  49710. $core.method({
  49711. selector: "testSelect",
  49712. protocol: 'tests',
  49713. fn: function (){
  49714. var self=this;
  49715. return $core.withContext(function($ctx1) {
  49716. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  49717. $2=self._collection();
  49718. $ctx1.sendIdx["collection"]=1;
  49719. $1=$recv($2)._select_((function(){
  49720. return false;
  49721. }));
  49722. $ctx1.sendIdx["select:"]=1;
  49723. $4=self._collectionClass();
  49724. $ctx1.sendIdx["collectionClass"]=1;
  49725. $3=$recv($4)._new();
  49726. $ctx1.sendIdx["new"]=1;
  49727. self._assert_equals_($1,$3);
  49728. $ctx1.sendIdx["assert:equals:"]=1;
  49729. $6=self._collection();
  49730. $ctx1.sendIdx["collection"]=2;
  49731. $5=$recv($6)._select_((function(){
  49732. return true;
  49733. }));
  49734. $ctx1.sendIdx["select:"]=2;
  49735. $7=self._collection();
  49736. $ctx1.sendIdx["collection"]=3;
  49737. self._assert_equals_($5,$7);
  49738. $ctx1.sendIdx["assert:equals:"]=2;
  49739. $9=self._collectionWithNewValue();
  49740. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49741. $8=$recv($9)._select_((function(each){
  49742. return $core.withContext(function($ctx2) {
  49743. $10=self._sampleNewValue();
  49744. $ctx2.sendIdx["sampleNewValue"]=1;
  49745. return $recv(each).__eq($10);
  49746. $ctx2.sendIdx["="]=1;
  49747. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  49748. }));
  49749. $ctx1.sendIdx["select:"]=3;
  49750. self._assert_equals_($8,self._sampleNewValueAsCollection());
  49751. $ctx1.sendIdx["assert:equals:"]=3;
  49752. $12=self._collectionWithNewValue();
  49753. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49754. $11=$recv($12)._select_((function(each){
  49755. return $core.withContext(function($ctx2) {
  49756. $13=self._sampleNewValue();
  49757. $ctx2.sendIdx["sampleNewValue"]=2;
  49758. return $recv(each).__tild_eq($13);
  49759. $ctx2.sendIdx["~="]=1;
  49760. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  49761. }));
  49762. $ctx1.sendIdx["select:"]=4;
  49763. $14=self._collection();
  49764. $ctx1.sendIdx["collection"]=4;
  49765. self._assert_equals_($11,$14);
  49766. $ctx1.sendIdx["assert:equals:"]=4;
  49767. $16=self._collection();
  49768. $ctx1.sendIdx["collection"]=5;
  49769. $15=$recv($16)._select_((function(each){
  49770. return $core.withContext(function($ctx2) {
  49771. $17=self._sampleNewValue();
  49772. $ctx2.sendIdx["sampleNewValue"]=3;
  49773. return $recv(each).__eq($17);
  49774. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  49775. }));
  49776. $ctx1.sendIdx["select:"]=5;
  49777. self._assert_equals_($15,$recv(self._collectionClass())._new());
  49778. $ctx1.sendIdx["assert:equals:"]=5;
  49779. self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){
  49780. return $core.withContext(function($ctx2) {
  49781. return $recv(each).__tild_eq(self._sampleNewValue());
  49782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49783. })),self._collection());
  49784. return self;
  49785. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  49786. },
  49787. args: [],
  49788. 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",
  49789. referencedClasses: [],
  49790. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  49791. }),
  49792. $globals.CollectionTest);
  49793. $core.addMethod(
  49794. $core.method({
  49795. selector: "testSingle",
  49796. protocol: 'tests',
  49797. fn: function (){
  49798. var self=this;
  49799. return $core.withContext(function($ctx1) {
  49800. self._should_raise_((function(){
  49801. return $core.withContext(function($ctx2) {
  49802. return $recv($recv(self._collectionClass())._new())._single();
  49803. $ctx2.sendIdx["single"]=1;
  49804. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49805. }),$globals.Error);
  49806. $ctx1.sendIdx["should:raise:"]=1;
  49807. self._should_raise_((function(){
  49808. return $core.withContext(function($ctx2) {
  49809. return $recv(self._collection())._single();
  49810. $ctx2.sendIdx["single"]=2;
  49811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  49812. }),$globals.Error);
  49813. self._assert_equals_($recv(self._sampleNewValueAsCollection())._single(),self._sampleNewValue());
  49814. return self;
  49815. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  49816. },
  49817. args: [],
  49818. 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",
  49819. referencedClasses: ["Error"],
  49820. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  49821. }),
  49822. $globals.CollectionTest);
  49823. $core.addMethod(
  49824. $core.method({
  49825. selector: "testSize",
  49826. protocol: 'tests',
  49827. fn: function (){
  49828. var self=this;
  49829. return $core.withContext(function($ctx1) {
  49830. var $1,$2;
  49831. $1=$recv($recv(self._collectionClass())._new())._size();
  49832. $ctx1.sendIdx["size"]=1;
  49833. self._assert_equals_($1,(0));
  49834. $ctx1.sendIdx["assert:equals:"]=1;
  49835. $2=$recv(self._sampleNewValueAsCollection())._size();
  49836. $ctx1.sendIdx["size"]=2;
  49837. self._assert_equals_($2,(1));
  49838. $ctx1.sendIdx["assert:equals:"]=2;
  49839. self._assert_equals_($recv(self._collection())._size(),self._collectionSize());
  49840. return self;
  49841. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  49842. },
  49843. args: [],
  49844. 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",
  49845. referencedClasses: [],
  49846. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  49847. }),
  49848. $globals.CollectionTest);
  49849. $core.addMethod(
  49850. $core.method({
  49851. selector: "collectionClass",
  49852. protocol: 'fixture',
  49853. fn: function (){
  49854. var self=this;
  49855. return nil;
  49856. },
  49857. args: [],
  49858. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  49859. referencedClasses: [],
  49860. messageSends: []
  49861. }),
  49862. $globals.CollectionTest.klass);
  49863. $core.addMethod(
  49864. $core.method({
  49865. selector: "isAbstract",
  49866. protocol: 'testing',
  49867. fn: function (){
  49868. var self=this;
  49869. return $core.withContext(function($ctx1) {
  49870. return $recv(self._collectionClass())._isNil();
  49871. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)});
  49872. },
  49873. args: [],
  49874. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  49875. referencedClasses: [],
  49876. messageSends: ["isNil", "collectionClass"]
  49877. }),
  49878. $globals.CollectionTest.klass);
  49879. $core.addClass('IndexableCollectionTest', $globals.CollectionTest, [], 'Kernel-Tests');
  49880. $core.addMethod(
  49881. $core.method({
  49882. selector: "collectionWithNewValue",
  49883. protocol: 'fixture',
  49884. fn: function (){
  49885. var self=this;
  49886. return $core.withContext(function($ctx1) {
  49887. self._subclassResponsibility();
  49888. return self;
  49889. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  49890. },
  49891. args: [],
  49892. 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",
  49893. referencedClasses: [],
  49894. messageSends: ["subclassResponsibility"]
  49895. }),
  49896. $globals.IndexableCollectionTest);
  49897. $core.addMethod(
  49898. $core.method({
  49899. selector: "sampleNewIndex",
  49900. protocol: 'fixture',
  49901. fn: function (){
  49902. var self=this;
  49903. return $core.withContext(function($ctx1) {
  49904. self._subclassResponsibility();
  49905. return self;
  49906. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  49907. },
  49908. args: [],
  49909. 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",
  49910. referencedClasses: [],
  49911. messageSends: ["subclassResponsibility"]
  49912. }),
  49913. $globals.IndexableCollectionTest);
  49914. $core.addMethod(
  49915. $core.method({
  49916. selector: "sampleNonIndexesDo:",
  49917. protocol: 'fixture',
  49918. fn: function (aBlock){
  49919. var self=this;
  49920. return $core.withContext(function($ctx1) {
  49921. self._subclassResponsibility();
  49922. return self;
  49923. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  49924. },
  49925. args: ["aBlock"],
  49926. 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",
  49927. referencedClasses: [],
  49928. messageSends: ["subclassResponsibility"]
  49929. }),
  49930. $globals.IndexableCollectionTest);
  49931. $core.addMethod(
  49932. $core.method({
  49933. selector: "samplesDo:",
  49934. protocol: 'fixture',
  49935. fn: function (aBlock){
  49936. var self=this;
  49937. return $core.withContext(function($ctx1) {
  49938. self._subclassResponsibility();
  49939. return self;
  49940. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  49941. },
  49942. args: ["aBlock"],
  49943. 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",
  49944. referencedClasses: [],
  49945. messageSends: ["subclassResponsibility"]
  49946. }),
  49947. $globals.IndexableCollectionTest);
  49948. $core.addMethod(
  49949. $core.method({
  49950. selector: "testAt",
  49951. protocol: 'tests',
  49952. fn: function (){
  49953. var self=this;
  49954. return $core.withContext(function($ctx1) {
  49955. var $1;
  49956. self._nonIndexesDo_((function(each){
  49957. return $core.withContext(function($ctx2) {
  49958. return self._should_raise_((function(){
  49959. return $core.withContext(function($ctx3) {
  49960. $1=self._collection();
  49961. $ctx3.sendIdx["collection"]=1;
  49962. return $recv($1)._at_(each);
  49963. $ctx3.sendIdx["at:"]=1;
  49964. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49965. }),$globals.Error);
  49966. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49967. }));
  49968. self._samplesDo_((function(index,value){
  49969. return $core.withContext(function($ctx2) {
  49970. return self._assert_equals_($recv(self._collection())._at_(index),value);
  49971. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  49972. }));
  49973. return self;
  49974. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  49975. },
  49976. args: [],
  49977. 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 ]",
  49978. referencedClasses: ["Error"],
  49979. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  49980. }),
  49981. $globals.IndexableCollectionTest);
  49982. $core.addMethod(
  49983. $core.method({
  49984. selector: "testAtIfAbsent",
  49985. protocol: 'tests',
  49986. fn: function (){
  49987. var self=this;
  49988. return $core.withContext(function($ctx1) {
  49989. var $2,$1,$3;
  49990. self._nonIndexesDo_((function(each){
  49991. return $core.withContext(function($ctx2) {
  49992. $2=self._collection();
  49993. $ctx2.sendIdx["collection"]=1;
  49994. $1=$recv($2)._at_ifAbsent_(each,(function(){
  49995. return $core.withContext(function($ctx3) {
  49996. return self._sampleNewValue();
  49997. $ctx3.sendIdx["sampleNewValue"]=1;
  49998. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49999. }));
  50000. $ctx2.sendIdx["at:ifAbsent:"]=1;
  50001. $3=self._sampleNewValue();
  50002. $ctx2.sendIdx["sampleNewValue"]=2;
  50003. return self._assert_equals_($1,$3);
  50004. $ctx2.sendIdx["assert:equals:"]=1;
  50005. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50006. }));
  50007. self._samplesDo_((function(index,value){
  50008. return $core.withContext(function($ctx2) {
  50009. return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){
  50010. return $core.withContext(function($ctx3) {
  50011. return self._sampleNewValue();
  50012. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  50013. })),value);
  50014. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50015. }));
  50016. return self;
  50017. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  50018. },
  50019. args: [],
  50020. 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 ].",
  50021. referencedClasses: [],
  50022. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  50023. }),
  50024. $globals.IndexableCollectionTest);
  50025. $core.addMethod(
  50026. $core.method({
  50027. selector: "testAtIfAbsentPut",
  50028. protocol: 'tests',
  50029. fn: function (){
  50030. var self=this;
  50031. var newCollection;
  50032. return $core.withContext(function($ctx1) {
  50033. var $1;
  50034. newCollection=self._collection();
  50035. $ctx1.sendIdx["collection"]=1;
  50036. self._samplesDo_((function(index,value){
  50037. return $core.withContext(function($ctx2) {
  50038. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  50039. return $core.withContext(function($ctx3) {
  50040. return self._sampleNewValue();
  50041. $ctx3.sendIdx["sampleNewValue"]=1;
  50042. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50043. }));
  50044. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  50045. return self._assert_equals_($1,value);
  50046. $ctx2.sendIdx["assert:equals:"]=1;
  50047. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50048. }));
  50049. self._assert_equals_(newCollection,self._collection());
  50050. $ctx1.sendIdx["assert:equals:"]=2;
  50051. self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  50052. return $core.withContext(function($ctx2) {
  50053. return self._sampleNewValue();
  50054. $ctx2.sendIdx["sampleNewValue"]=2;
  50055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  50056. })),self._sampleNewValue());
  50057. $ctx1.sendIdx["assert:equals:"]=3;
  50058. self._assert_equals_(newCollection,self._collectionWithNewValue());
  50059. return self;
  50060. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  50061. },
  50062. args: [],
  50063. 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",
  50064. referencedClasses: [],
  50065. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  50066. }),
  50067. $globals.IndexableCollectionTest);
  50068. $core.addMethod(
  50069. $core.method({
  50070. selector: "testAtIfPresent",
  50071. protocol: 'tests',
  50072. fn: function (){
  50073. var self=this;
  50074. var visited,sentinel;
  50075. return $core.withContext(function($ctx1) {
  50076. var $2,$1,$4,$3;
  50077. sentinel=$recv($globals.Object)._new();
  50078. self._nonIndexesDo_((function(each){
  50079. return $core.withContext(function($ctx2) {
  50080. visited=nil;
  50081. visited;
  50082. $2=self._collection();
  50083. $ctx2.sendIdx["collection"]=1;
  50084. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  50085. visited=value1;
  50086. visited;
  50087. return sentinel;
  50088. }));
  50089. $ctx2.sendIdx["at:ifPresent:"]=1;
  50090. self._assert_equals_($1,nil);
  50091. $ctx2.sendIdx["assert:equals:"]=1;
  50092. return self._assert_($recv(visited)._isNil());
  50093. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50094. }));
  50095. self._samplesDo_((function(index,value){
  50096. return $core.withContext(function($ctx2) {
  50097. visited=nil;
  50098. visited;
  50099. $4=self._collection();
  50100. $ctx2.sendIdx["collection"]=2;
  50101. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  50102. visited=value2;
  50103. visited;
  50104. return sentinel;
  50105. }));
  50106. self._assert_equals_($3,sentinel);
  50107. $ctx2.sendIdx["assert:equals:"]=2;
  50108. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  50109. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  50110. }));
  50111. return self;
  50112. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  50113. },
  50114. args: [],
  50115. 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) ]",
  50116. referencedClasses: ["Object"],
  50117. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  50118. }),
  50119. $globals.IndexableCollectionTest);
  50120. $core.addMethod(
  50121. $core.method({
  50122. selector: "testAtIfPresentIfAbsent",
  50123. protocol: 'tests',
  50124. fn: function (){
  50125. var self=this;
  50126. var visited,sentinel;
  50127. return $core.withContext(function($ctx1) {
  50128. var $2,$1,$3,$5,$4;
  50129. sentinel=$recv($globals.Object)._new();
  50130. self._nonIndexesDo_((function(each){
  50131. return $core.withContext(function($ctx2) {
  50132. visited=nil;
  50133. visited;
  50134. $2=self._collection();
  50135. $ctx2.sendIdx["collection"]=1;
  50136. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  50137. visited=value1;
  50138. visited;
  50139. return sentinel;
  50140. }),(function(){
  50141. return $core.withContext(function($ctx3) {
  50142. return self._sampleNewValue();
  50143. $ctx3.sendIdx["sampleNewValue"]=1;
  50144. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  50145. }));
  50146. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  50147. $3=self._sampleNewValue();
  50148. $ctx2.sendIdx["sampleNewValue"]=2;
  50149. self._assert_equals_($1,$3);
  50150. $ctx2.sendIdx["assert:equals:"]=1;
  50151. return self._assert_($recv(visited)._isNil());
  50152. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50153. }));
  50154. self._samplesDo_((function(index,value){
  50155. return $core.withContext(function($ctx2) {
  50156. visited=nil;
  50157. visited;
  50158. $5=self._collection();
  50159. $ctx2.sendIdx["collection"]=2;
  50160. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  50161. visited=value2;
  50162. visited;
  50163. return sentinel;
  50164. }),(function(){
  50165. return $core.withContext(function($ctx3) {
  50166. return self._sampleNewValue();
  50167. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  50168. }));
  50169. self._assert_equals_($4,sentinel);
  50170. $ctx2.sendIdx["assert:equals:"]=2;
  50171. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  50172. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  50173. }));
  50174. return self;
  50175. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  50176. },
  50177. args: [],
  50178. 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) ]",
  50179. referencedClasses: ["Object"],
  50180. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  50181. }),
  50182. $globals.IndexableCollectionTest);
  50183. $core.addMethod(
  50184. $core.method({
  50185. selector: "testAtPut",
  50186. protocol: 'tests',
  50187. fn: function (){
  50188. var self=this;
  50189. var newCollection;
  50190. return $core.withContext(function($ctx1) {
  50191. newCollection=self._collection();
  50192. $ctx1.sendIdx["collection"]=1;
  50193. self._samplesDo_((function(index,value){
  50194. return $core.withContext(function($ctx2) {
  50195. return $recv(newCollection)._at_put_(index,value);
  50196. $ctx2.sendIdx["at:put:"]=1;
  50197. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50198. }));
  50199. self._assert_equals_(newCollection,self._collection());
  50200. $ctx1.sendIdx["assert:equals:"]=1;
  50201. $recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  50202. self._assert_equals_(newCollection,self._collectionWithNewValue());
  50203. return self;
  50204. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  50205. },
  50206. args: [],
  50207. 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",
  50208. referencedClasses: [],
  50209. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  50210. }),
  50211. $globals.IndexableCollectionTest);
  50212. $core.addMethod(
  50213. $core.method({
  50214. selector: "testIndexOf",
  50215. protocol: 'tests',
  50216. fn: function (){
  50217. var self=this;
  50218. return $core.withContext(function($ctx1) {
  50219. var $1;
  50220. self._should_raise_((function(){
  50221. return $core.withContext(function($ctx2) {
  50222. $1=self._collection();
  50223. $ctx2.sendIdx["collection"]=1;
  50224. return $recv($1)._indexOf_(self._sampleNewValue());
  50225. $ctx2.sendIdx["indexOf:"]=1;
  50226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50227. }),$globals.Error);
  50228. self._samplesDo_((function(index,value){
  50229. return $core.withContext(function($ctx2) {
  50230. return self._assert_equals_($recv(self._collection())._indexOf_(value),index);
  50231. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  50232. }));
  50233. return self;
  50234. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  50235. },
  50236. args: [],
  50237. 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 ]",
  50238. referencedClasses: ["Error"],
  50239. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  50240. }),
  50241. $globals.IndexableCollectionTest);
  50242. $core.addMethod(
  50243. $core.method({
  50244. selector: "testIndexOfWithNull",
  50245. protocol: 'tests',
  50246. fn: function (){
  50247. var self=this;
  50248. var jsNull;
  50249. return $core.withContext(function($ctx1) {
  50250. var $2,$1;
  50251. jsNull=$recv($globals.JSON)._parse_("null");
  50252. self._samplesDo_((function(index,value){
  50253. return $core.withContext(function($ctx2) {
  50254. $2=self._collection();
  50255. $recv($2)._at_put_(index,jsNull);
  50256. $1=$recv($2)._indexOf_(jsNull);
  50257. return self._assert_equals_($1,index);
  50258. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50259. }));
  50260. return self;
  50261. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  50262. },
  50263. args: [],
  50264. 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 ]",
  50265. referencedClasses: ["JSON"],
  50266. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  50267. }),
  50268. $globals.IndexableCollectionTest);
  50269. $core.addMethod(
  50270. $core.method({
  50271. selector: "testWithIndexDo",
  50272. protocol: 'tests',
  50273. fn: function (){
  50274. var self=this;
  50275. var collection;
  50276. return $core.withContext(function($ctx1) {
  50277. collection=self._collection();
  50278. $ctx1.sendIdx["collection"]=1;
  50279. $recv(self._collection())._withIndexDo_((function(each,index){
  50280. return $core.withContext(function($ctx2) {
  50281. return self._assert_equals_($recv(collection)._at_(index),each);
  50282. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  50283. }));
  50284. return self;
  50285. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  50286. },
  50287. args: [],
  50288. 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 ]",
  50289. referencedClasses: [],
  50290. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  50291. }),
  50292. $globals.IndexableCollectionTest);
  50293. $core.addClass('AssociativeCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  50294. $core.addMethod(
  50295. $core.method({
  50296. selector: "collectionKeys",
  50297. protocol: 'fixture',
  50298. fn: function (){
  50299. var self=this;
  50300. return $core.withContext(function($ctx1) {
  50301. self._subclassResponsibility();
  50302. return self;
  50303. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  50304. },
  50305. args: [],
  50306. source: "collectionKeys\x0a\x09self subclassResponsibility",
  50307. referencedClasses: [],
  50308. messageSends: ["subclassResponsibility"]
  50309. }),
  50310. $globals.AssociativeCollectionTest);
  50311. $core.addMethod(
  50312. $core.method({
  50313. selector: "collectionValues",
  50314. protocol: 'fixture',
  50315. fn: function (){
  50316. var self=this;
  50317. return $core.withContext(function($ctx1) {
  50318. self._subclassResponsibility();
  50319. return self;
  50320. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  50321. },
  50322. args: [],
  50323. source: "collectionValues\x0a\x09self subclassResponsibility",
  50324. referencedClasses: [],
  50325. messageSends: ["subclassResponsibility"]
  50326. }),
  50327. $globals.AssociativeCollectionTest);
  50328. $core.addMethod(
  50329. $core.method({
  50330. selector: "nonIndexesDo:",
  50331. protocol: 'fixture',
  50332. fn: function (aBlock){
  50333. var self=this;
  50334. return $core.withContext(function($ctx1) {
  50335. $recv(aBlock)._value_((5));
  50336. $ctx1.sendIdx["value:"]=1;
  50337. $recv(aBlock)._value_((function(){
  50338. }));
  50339. $ctx1.sendIdx["value:"]=2;
  50340. $recv(aBlock)._value_($recv($globals.Object)._new());
  50341. $ctx1.sendIdx["value:"]=3;
  50342. $recv(aBlock)._value_("z");
  50343. return self;
  50344. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  50345. },
  50346. args: ["aBlock"],
  50347. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  50348. referencedClasses: ["Object"],
  50349. messageSends: ["value:", "new"]
  50350. }),
  50351. $globals.AssociativeCollectionTest);
  50352. $core.addMethod(
  50353. $core.method({
  50354. selector: "sampleNewIndex",
  50355. protocol: 'fixture',
  50356. fn: function (){
  50357. var self=this;
  50358. return "new";
  50359. },
  50360. args: [],
  50361. source: "sampleNewIndex\x0a\x09^ 'new'",
  50362. referencedClasses: [],
  50363. messageSends: []
  50364. }),
  50365. $globals.AssociativeCollectionTest);
  50366. $core.addMethod(
  50367. $core.method({
  50368. selector: "samplesDo:",
  50369. protocol: 'fixture',
  50370. fn: function (aBlock){
  50371. var self=this;
  50372. return $core.withContext(function($ctx1) {
  50373. $recv(aBlock)._value_value_("a",(2));
  50374. return self;
  50375. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  50376. },
  50377. args: ["aBlock"],
  50378. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  50379. referencedClasses: [],
  50380. messageSends: ["value:value:"]
  50381. }),
  50382. $globals.AssociativeCollectionTest);
  50383. $core.addMethod(
  50384. $core.method({
  50385. selector: "testAddAll",
  50386. protocol: 'tests',
  50387. fn: function (){
  50388. var self=this;
  50389. return $core.withContext(function($ctx1) {
  50390. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  50391. (
  50392. $ctx1.supercall = true,
  50393. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($recv(self), []));
  50394. $ctx1.supercall = false;
  50395. $2=self._collection();
  50396. $ctx1.sendIdx["collection"]=1;
  50397. $3=self._collection();
  50398. $ctx1.sendIdx["collection"]=2;
  50399. $recv($2)._addAll_($3);
  50400. $ctx1.sendIdx["addAll:"]=1;
  50401. $4=$recv($2)._yourself();
  50402. $ctx1.sendIdx["yourself"]=1;
  50403. $1=$4;
  50404. $5=self._collection();
  50405. $ctx1.sendIdx["collection"]=3;
  50406. self._assert_equals_($1,$5);
  50407. $ctx1.sendIdx["assert:equals:"]=1;
  50408. $7=self._collection();
  50409. $ctx1.sendIdx["collection"]=4;
  50410. $8=self._collectionWithNewValue();
  50411. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50412. $recv($7)._addAll_($8);
  50413. $ctx1.sendIdx["addAll:"]=2;
  50414. $9=$recv($7)._yourself();
  50415. $ctx1.sendIdx["yourself"]=2;
  50416. $6=$9;
  50417. $10=self._collectionWithNewValue();
  50418. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50419. self._assert_equals_($6,$10);
  50420. $ctx1.sendIdx["assert:equals:"]=2;
  50421. $12=self._collectionWithNewValue();
  50422. $ctx1.sendIdx["collectionWithNewValue"]=3;
  50423. $recv($12)._addAll_(self._collection());
  50424. $11=$recv($12)._yourself();
  50425. self._assert_equals_($11,self._collectionWithNewValue());
  50426. return self;
  50427. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  50428. },
  50429. args: [],
  50430. 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",
  50431. referencedClasses: [],
  50432. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  50433. }),
  50434. $globals.AssociativeCollectionTest);
  50435. $core.addMethod(
  50436. $core.method({
  50437. selector: "testAsDictionary",
  50438. protocol: 'tests',
  50439. fn: function (){
  50440. var self=this;
  50441. return $core.withContext(function($ctx1) {
  50442. self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  50443. return self;
  50444. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  50445. },
  50446. args: [],
  50447. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  50448. referencedClasses: ["Dictionary"],
  50449. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  50450. }),
  50451. $globals.AssociativeCollectionTest);
  50452. $core.addMethod(
  50453. $core.method({
  50454. selector: "testAsHashedCollection",
  50455. protocol: 'tests',
  50456. fn: function (){
  50457. var self=this;
  50458. return $core.withContext(function($ctx1) {
  50459. self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  50460. return self;
  50461. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  50462. },
  50463. args: [],
  50464. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  50465. referencedClasses: ["HashedCollection"],
  50466. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  50467. }),
  50468. $globals.AssociativeCollectionTest);
  50469. $core.addMethod(
  50470. $core.method({
  50471. selector: "testComma",
  50472. protocol: 'tests',
  50473. fn: function (){
  50474. var self=this;
  50475. return $core.withContext(function($ctx1) {
  50476. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  50477. (
  50478. $ctx1.supercall = true,
  50479. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($recv(self), []));
  50480. $ctx1.supercall = false;
  50481. $2=self._collection();
  50482. $ctx1.sendIdx["collection"]=1;
  50483. $3=self._collection();
  50484. $ctx1.sendIdx["collection"]=2;
  50485. $1=$recv($2).__comma($3);
  50486. $ctx1.sendIdx[","]=1;
  50487. $4=self._collection();
  50488. $ctx1.sendIdx["collection"]=3;
  50489. self._assert_equals_($1,$4);
  50490. $ctx1.sendIdx["assert:equals:"]=1;
  50491. $6=self._collection();
  50492. $ctx1.sendIdx["collection"]=4;
  50493. $7=self._collectionWithNewValue();
  50494. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50495. $5=$recv($6).__comma($7);
  50496. $ctx1.sendIdx[","]=2;
  50497. $8=self._collectionWithNewValue();
  50498. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50499. self._assert_equals_($5,$8);
  50500. $ctx1.sendIdx["assert:equals:"]=2;
  50501. $10=self._collectionWithNewValue();
  50502. $ctx1.sendIdx["collectionWithNewValue"]=3;
  50503. $9=$recv($10).__comma(self._collection());
  50504. self._assert_equals_($9,self._collectionWithNewValue());
  50505. return self;
  50506. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  50507. },
  50508. args: [],
  50509. 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",
  50510. referencedClasses: [],
  50511. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  50512. }),
  50513. $globals.AssociativeCollectionTest);
  50514. $core.addMethod(
  50515. $core.method({
  50516. selector: "testFrom",
  50517. protocol: 'tests',
  50518. fn: function (){
  50519. var self=this;
  50520. var associations;
  50521. return $core.withContext(function($ctx1) {
  50522. var $1;
  50523. $1="a".__minus_gt((1));
  50524. $ctx1.sendIdx["->"]=1;
  50525. associations=[$1,"b".__minus_gt((2))];
  50526. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  50527. return self;
  50528. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  50529. },
  50530. args: [],
  50531. 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 }.",
  50532. referencedClasses: [],
  50533. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  50534. }),
  50535. $globals.AssociativeCollectionTest);
  50536. $core.addMethod(
  50537. $core.method({
  50538. selector: "testKeys",
  50539. protocol: 'tests',
  50540. fn: function (){
  50541. var self=this;
  50542. return $core.withContext(function($ctx1) {
  50543. var $2,$1,$3,$4;
  50544. $2=$recv($recv(self._collectionClass())._new())._keys();
  50545. $ctx1.sendIdx["keys"]=1;
  50546. $1=$recv($2)._isEmpty();
  50547. self._assert_($1);
  50548. $3=$recv(self._collection())._keys();
  50549. $ctx1.sendIdx["keys"]=2;
  50550. $4=self._collectionKeys();
  50551. $ctx1.sendIdx["collectionKeys"]=1;
  50552. self._assertSameContents_as_($3,$4);
  50553. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50554. self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  50555. return self;
  50556. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  50557. },
  50558. args: [],
  50559. 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 }",
  50560. referencedClasses: [],
  50561. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  50562. }),
  50563. $globals.AssociativeCollectionTest);
  50564. $core.addMethod(
  50565. $core.method({
  50566. selector: "testNewFromPairs",
  50567. protocol: 'tests',
  50568. fn: function (){
  50569. var self=this;
  50570. var flattenedAssociations;
  50571. return $core.withContext(function($ctx1) {
  50572. flattenedAssociations=["a",(1),"b",(2)];
  50573. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  50574. return self;
  50575. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  50576. },
  50577. args: [],
  50578. 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 }.",
  50579. referencedClasses: [],
  50580. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  50581. }),
  50582. $globals.AssociativeCollectionTest);
  50583. $core.addMethod(
  50584. $core.method({
  50585. selector: "testPrintString",
  50586. protocol: 'tests',
  50587. fn: function (){
  50588. var self=this;
  50589. return $core.withContext(function($ctx1) {
  50590. var $3,$2,$1,$4;
  50591. $3=self._collectionClass();
  50592. $ctx1.sendIdx["collectionClass"]=1;
  50593. $2=$recv($3)._new();
  50594. $recv($2)._at_put_("firstname","James");
  50595. $ctx1.sendIdx["at:put:"]=1;
  50596. $recv($2)._at_put_("lastname","Bond");
  50597. $1=$recv($2)._printString();
  50598. $4=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  50599. $ctx1.sendIdx[","]=1;
  50600. self._assert_equals_($1,$4);
  50601. return self;
  50602. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  50603. },
  50604. args: [],
  50605. 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'')'",
  50606. referencedClasses: [],
  50607. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  50608. }),
  50609. $globals.AssociativeCollectionTest);
  50610. $core.addMethod(
  50611. $core.method({
  50612. selector: "testRemoveKey",
  50613. protocol: 'tests',
  50614. fn: function (){
  50615. var self=this;
  50616. return $core.withContext(function($ctx1) {
  50617. var $1,$2,$3,$5,$6,$4,$8,$7;
  50618. self._nonIndexesDo_((function(each){
  50619. var collection;
  50620. return $core.withContext(function($ctx2) {
  50621. collection=self._collection();
  50622. $ctx2.sendIdx["collection"]=1;
  50623. collection;
  50624. self._should_raise_((function(){
  50625. return $core.withContext(function($ctx3) {
  50626. return $recv(collection)._removeKey_(each);
  50627. $ctx3.sendIdx["removeKey:"]=1;
  50628. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50629. }),$globals.Error);
  50630. $1=collection;
  50631. $2=self._collection();
  50632. $ctx2.sendIdx["collection"]=2;
  50633. return self._assert_equals_($1,$2);
  50634. $ctx2.sendIdx["assert:equals:"]=1;
  50635. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  50636. }));
  50637. self._samplesDo_((function(index,value){
  50638. var collection;
  50639. return $core.withContext(function($ctx2) {
  50640. collection=self._collection();
  50641. $ctx2.sendIdx["collection"]=3;
  50642. collection;
  50643. $3=$recv(collection)._removeKey_(index);
  50644. $ctx2.sendIdx["removeKey:"]=2;
  50645. self._assert_equals_($3,value);
  50646. $ctx2.sendIdx["assert:equals:"]=2;
  50647. $5=collection;
  50648. $6=self._collection();
  50649. $ctx2.sendIdx["collection"]=4;
  50650. $4=$recv($5).__eq($6);
  50651. return self._deny_($4);
  50652. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  50653. }));
  50654. $8=self._collectionWithNewValue();
  50655. $recv($8)._removeKey_(self._sampleNewIndex());
  50656. $7=$recv($8)._yourself();
  50657. self._assert_equals_($7,self._collection());
  50658. return self;
  50659. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  50660. },
  50661. args: [],
  50662. 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",
  50663. referencedClasses: ["Error"],
  50664. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  50665. }),
  50666. $globals.AssociativeCollectionTest);
  50667. $core.addMethod(
  50668. $core.method({
  50669. selector: "testRemoveKeyIfAbsent",
  50670. protocol: 'tests',
  50671. fn: function (){
  50672. var self=this;
  50673. return $core.withContext(function($ctx1) {
  50674. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  50675. self._nonIndexesDo_((function(each){
  50676. var collection;
  50677. return $core.withContext(function($ctx2) {
  50678. collection=self._collection();
  50679. $ctx2.sendIdx["collection"]=1;
  50680. collection;
  50681. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  50682. return $core.withContext(function($ctx3) {
  50683. return self._sampleNewValue();
  50684. $ctx3.sendIdx["sampleNewValue"]=1;
  50685. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50686. }));
  50687. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  50688. $2=self._sampleNewValue();
  50689. $ctx2.sendIdx["sampleNewValue"]=2;
  50690. self._assert_equals_($1,$2);
  50691. $ctx2.sendIdx["assert:equals:"]=1;
  50692. $3=collection;
  50693. $4=self._collection();
  50694. $ctx2.sendIdx["collection"]=2;
  50695. return self._assert_equals_($3,$4);
  50696. $ctx2.sendIdx["assert:equals:"]=2;
  50697. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  50698. }));
  50699. self._samplesDo_((function(index,value){
  50700. var collection;
  50701. return $core.withContext(function($ctx2) {
  50702. collection=self._collection();
  50703. $ctx2.sendIdx["collection"]=3;
  50704. collection;
  50705. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  50706. return $core.withContext(function($ctx3) {
  50707. return self._sampleNewValue();
  50708. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  50709. }));
  50710. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  50711. self._assert_equals_($5,value);
  50712. $ctx2.sendIdx["assert:equals:"]=3;
  50713. $7=collection;
  50714. $8=self._collection();
  50715. $ctx2.sendIdx["collection"]=4;
  50716. $6=$recv($7).__eq($8);
  50717. return self._deny_($6);
  50718. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  50719. }));
  50720. $10=self._collectionWithNewValue();
  50721. $recv($10)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  50722. return $core.withContext(function($ctx2) {
  50723. return self._assert_(false);
  50724. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  50725. }));
  50726. $9=$recv($10)._yourself();
  50727. self._assert_equals_($9,self._collection());
  50728. return self;
  50729. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  50730. },
  50731. args: [],
  50732. 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",
  50733. referencedClasses: [],
  50734. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  50735. }),
  50736. $globals.AssociativeCollectionTest);
  50737. $core.addMethod(
  50738. $core.method({
  50739. selector: "testValues",
  50740. protocol: 'tests',
  50741. fn: function (){
  50742. var self=this;
  50743. return $core.withContext(function($ctx1) {
  50744. var $2,$1,$3,$4;
  50745. $2=$recv($recv(self._collectionClass())._new())._values();
  50746. $ctx1.sendIdx["values"]=1;
  50747. $1=$recv($2)._isEmpty();
  50748. self._assert_($1);
  50749. $3=$recv(self._collection())._values();
  50750. $ctx1.sendIdx["values"]=2;
  50751. $4=self._collectionValues();
  50752. $ctx1.sendIdx["collectionValues"]=1;
  50753. self._assertSameContents_as_($3,$4);
  50754. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50755. self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()]));
  50756. return self;
  50757. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  50758. },
  50759. args: [],
  50760. 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 }",
  50761. referencedClasses: [],
  50762. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  50763. }),
  50764. $globals.AssociativeCollectionTest);
  50765. $core.addClass('DictionaryTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  50766. $core.addMethod(
  50767. $core.method({
  50768. selector: "collection",
  50769. protocol: 'fixture',
  50770. fn: function (){
  50771. var self=this;
  50772. return $core.withContext(function($ctx1) {
  50773. var $1;
  50774. $1=$recv($globals.Dictionary)._new();
  50775. $recv($1)._at_put_((1),(1));
  50776. $ctx1.sendIdx["at:put:"]=1;
  50777. $recv($1)._at_put_("a",(2));
  50778. $ctx1.sendIdx["at:put:"]=2;
  50779. $recv($1)._at_put_(true,(3));
  50780. $ctx1.sendIdx["at:put:"]=3;
  50781. $recv($1)._at_put_((1).__at((3)),(-4));
  50782. $ctx1.sendIdx["at:put:"]=4;
  50783. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50784. return $recv($1)._yourself();
  50785. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  50786. },
  50787. args: [],
  50788. 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",
  50789. referencedClasses: ["Dictionary"],
  50790. messageSends: ["at:put:", "new", "@", "yourself"]
  50791. }),
  50792. $globals.DictionaryTest);
  50793. $core.addMethod(
  50794. $core.method({
  50795. selector: "collectionKeys",
  50796. protocol: 'fixture',
  50797. fn: function (){
  50798. var self=this;
  50799. return $core.withContext(function($ctx1) {
  50800. return [(1),"a",true,(1).__at((3)),self["@sampleBlock"]];
  50801. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  50802. },
  50803. args: [],
  50804. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  50805. referencedClasses: [],
  50806. messageSends: ["@"]
  50807. }),
  50808. $globals.DictionaryTest);
  50809. $core.addMethod(
  50810. $core.method({
  50811. selector: "collectionOfPrintStrings",
  50812. protocol: 'fixture',
  50813. fn: function (){
  50814. var self=this;
  50815. return $core.withContext(function($ctx1) {
  50816. var $1;
  50817. $1=$recv($globals.Dictionary)._new();
  50818. $recv($1)._at_put_((1),"1");
  50819. $ctx1.sendIdx["at:put:"]=1;
  50820. $recv($1)._at_put_("a","2");
  50821. $ctx1.sendIdx["at:put:"]=2;
  50822. $recv($1)._at_put_(true,"3");
  50823. $ctx1.sendIdx["at:put:"]=3;
  50824. $recv($1)._at_put_((1).__at((3)),"-4");
  50825. $ctx1.sendIdx["at:put:"]=4;
  50826. $recv($1)._at_put_(self["@sampleBlock"],"9");
  50827. return $recv($1)._yourself();
  50828. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  50829. },
  50830. args: [],
  50831. 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",
  50832. referencedClasses: ["Dictionary"],
  50833. messageSends: ["at:put:", "new", "@", "yourself"]
  50834. }),
  50835. $globals.DictionaryTest);
  50836. $core.addMethod(
  50837. $core.method({
  50838. selector: "collectionSize",
  50839. protocol: 'fixture',
  50840. fn: function (){
  50841. var self=this;
  50842. return (5);
  50843. },
  50844. args: [],
  50845. source: "collectionSize\x0a\x09^ 5",
  50846. referencedClasses: [],
  50847. messageSends: []
  50848. }),
  50849. $globals.DictionaryTest);
  50850. $core.addMethod(
  50851. $core.method({
  50852. selector: "collectionValues",
  50853. protocol: 'fixture',
  50854. fn: function (){
  50855. var self=this;
  50856. return [(1),(2),(3),(-4),(9)];
  50857. },
  50858. args: [],
  50859. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  50860. referencedClasses: [],
  50861. messageSends: []
  50862. }),
  50863. $globals.DictionaryTest);
  50864. $core.addMethod(
  50865. $core.method({
  50866. selector: "collectionWithDuplicates",
  50867. protocol: 'fixture',
  50868. fn: function (){
  50869. var self=this;
  50870. return $core.withContext(function($ctx1) {
  50871. var $1;
  50872. $1=$recv($globals.Dictionary)._new();
  50873. $recv($1)._at_put_((1),(1));
  50874. $ctx1.sendIdx["at:put:"]=1;
  50875. $recv($1)._at_put_("a",(2));
  50876. $ctx1.sendIdx["at:put:"]=2;
  50877. $recv($1)._at_put_(true,(3));
  50878. $ctx1.sendIdx["at:put:"]=3;
  50879. $recv($1)._at_put_((4),(-4));
  50880. $ctx1.sendIdx["at:put:"]=4;
  50881. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50882. $ctx1.sendIdx["at:put:"]=5;
  50883. $recv($1)._at_put_("b",(1));
  50884. $ctx1.sendIdx["at:put:"]=6;
  50885. $recv($1)._at_put_((3),(3));
  50886. $ctx1.sendIdx["at:put:"]=7;
  50887. $recv($1)._at_put_(false,(12));
  50888. return $recv($1)._yourself();
  50889. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  50890. },
  50891. args: [],
  50892. 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",
  50893. referencedClasses: ["Dictionary"],
  50894. messageSends: ["at:put:", "new", "yourself"]
  50895. }),
  50896. $globals.DictionaryTest);
  50897. $core.addMethod(
  50898. $core.method({
  50899. selector: "collectionWithNewValue",
  50900. protocol: 'fixture',
  50901. fn: function (){
  50902. var self=this;
  50903. return $core.withContext(function($ctx1) {
  50904. var $1;
  50905. $1=$recv($globals.Dictionary)._new();
  50906. $recv($1)._at_put_((1),(1));
  50907. $ctx1.sendIdx["at:put:"]=1;
  50908. $recv($1)._at_put_("a",(2));
  50909. $ctx1.sendIdx["at:put:"]=2;
  50910. $recv($1)._at_put_(true,(3));
  50911. $ctx1.sendIdx["at:put:"]=3;
  50912. $recv($1)._at_put_((1).__at((3)),(-4));
  50913. $ctx1.sendIdx["at:put:"]=4;
  50914. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50915. $ctx1.sendIdx["at:put:"]=5;
  50916. $recv($1)._at_put_("new","N");
  50917. return $recv($1)._yourself();
  50918. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  50919. },
  50920. args: [],
  50921. 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",
  50922. referencedClasses: ["Dictionary"],
  50923. messageSends: ["at:put:", "new", "@", "yourself"]
  50924. }),
  50925. $globals.DictionaryTest);
  50926. $core.addMethod(
  50927. $core.method({
  50928. selector: "sampleNewValueAsCollection",
  50929. protocol: 'fixture',
  50930. fn: function (){
  50931. var self=this;
  50932. return $core.withContext(function($ctx1) {
  50933. var $1;
  50934. $1=$recv($globals.Dictionary)._new();
  50935. $recv($1)._at_put_("new","N");
  50936. return $recv($1)._yourself();
  50937. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  50938. },
  50939. args: [],
  50940. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  50941. referencedClasses: ["Dictionary"],
  50942. messageSends: ["at:put:", "new", "yourself"]
  50943. }),
  50944. $globals.DictionaryTest);
  50945. $core.addMethod(
  50946. $core.method({
  50947. selector: "samplesDo:",
  50948. protocol: 'fixture',
  50949. fn: function (aBlock){
  50950. var self=this;
  50951. return $core.withContext(function($ctx1) {
  50952. (
  50953. $ctx1.supercall = true,
  50954. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  50955. $ctx1.supercall = false;
  50956. $recv(aBlock)._value_value_(true,(3));
  50957. $ctx1.sendIdx["value:value:"]=1;
  50958. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  50959. $ctx1.sendIdx["value:value:"]=2;
  50960. $recv(aBlock)._value_value_(self["@sampleBlock"],(9));
  50961. return self;
  50962. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  50963. },
  50964. args: ["aBlock"],
  50965. 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",
  50966. referencedClasses: [],
  50967. messageSends: ["samplesDo:", "value:value:", "@"]
  50968. }),
  50969. $globals.DictionaryTest);
  50970. $core.addMethod(
  50971. $core.method({
  50972. selector: "testAccessing",
  50973. protocol: 'tests',
  50974. fn: function (){
  50975. var self=this;
  50976. var d;
  50977. return $core.withContext(function($ctx1) {
  50978. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  50979. d=$recv($globals.Dictionary)._new();
  50980. $recv(d)._at_put_("hello","world");
  50981. $ctx1.sendIdx["at:put:"]=1;
  50982. $1=$recv(d)._at_("hello");
  50983. $ctx1.sendIdx["at:"]=1;
  50984. self._assert_equals_($1,"world");
  50985. $ctx1.sendIdx["assert:equals:"]=1;
  50986. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  50987. return nil;
  50988. }));
  50989. $ctx1.sendIdx["at:ifAbsent:"]=1;
  50990. self._assert_equals_($2,"world");
  50991. $ctx1.sendIdx["assert:equals:"]=2;
  50992. self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  50993. return nil;
  50994. }))).__eq("world"));
  50995. $ctx1.sendIdx["deny:"]=1;
  50996. $3=$recv(d)._includesKey_("hello");
  50997. $ctx1.sendIdx["includesKey:"]=1;
  50998. self._assert_($3);
  50999. $ctx1.sendIdx["assert:"]=1;
  51000. $4=$recv(d)._includesKey_("foo");
  51001. $ctx1.sendIdx["includesKey:"]=2;
  51002. self._deny_($4);
  51003. $ctx1.sendIdx["deny:"]=2;
  51004. $recv(d)._at_put_((1),(2));
  51005. $ctx1.sendIdx["at:put:"]=2;
  51006. $5=$recv(d)._at_((1));
  51007. $ctx1.sendIdx["at:"]=2;
  51008. self._assert_equals_($5,(2));
  51009. $ctx1.sendIdx["assert:equals:"]=3;
  51010. $6=d;
  51011. $7=(1).__at((3));
  51012. $ctx1.sendIdx["@"]=1;
  51013. $recv($6)._at_put_($7,(3));
  51014. $9=d;
  51015. $10=(1).__at((3));
  51016. $ctx1.sendIdx["@"]=2;
  51017. $8=$recv($9)._at_($10);
  51018. self._assert_equals_($8,(3));
  51019. $12=d;
  51020. $13=(1).__at((3));
  51021. $ctx1.sendIdx["@"]=3;
  51022. $11=$recv($12)._includesKey_($13);
  51023. $ctx1.sendIdx["includesKey:"]=3;
  51024. self._assert_($11);
  51025. self._deny_($recv(d)._includesKey_((3).__at((1))));
  51026. return self;
  51027. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  51028. },
  51029. args: [],
  51030. 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)",
  51031. referencedClasses: ["Dictionary"],
  51032. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  51033. }),
  51034. $globals.DictionaryTest);
  51035. $core.addMethod(
  51036. $core.method({
  51037. selector: "testDynamicDictionaries",
  51038. protocol: 'tests',
  51039. fn: function (){
  51040. var self=this;
  51041. return $core.withContext(function($ctx1) {
  51042. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  51043. return self;
  51044. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  51045. },
  51046. args: [],
  51047. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  51048. referencedClasses: ["Dictionary"],
  51049. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  51050. }),
  51051. $globals.DictionaryTest);
  51052. $core.addMethod(
  51053. $core.method({
  51054. selector: "collectionClass",
  51055. protocol: 'fixture',
  51056. fn: function (){
  51057. var self=this;
  51058. return $globals.Dictionary;
  51059. },
  51060. args: [],
  51061. source: "collectionClass\x0a\x09^ Dictionary",
  51062. referencedClasses: ["Dictionary"],
  51063. messageSends: []
  51064. }),
  51065. $globals.DictionaryTest.klass);
  51066. $core.addClass('HashedCollectionTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  51067. $core.addMethod(
  51068. $core.method({
  51069. selector: "collection",
  51070. protocol: 'fixture',
  51071. fn: function (){
  51072. var self=this;
  51073. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  51074. },
  51075. args: [],
  51076. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  51077. referencedClasses: [],
  51078. messageSends: []
  51079. }),
  51080. $globals.HashedCollectionTest);
  51081. $core.addMethod(
  51082. $core.method({
  51083. selector: "collectionKeys",
  51084. protocol: 'fixture',
  51085. fn: function (){
  51086. var self=this;
  51087. return ["b","a","c","d"];
  51088. },
  51089. args: [],
  51090. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  51091. referencedClasses: [],
  51092. messageSends: []
  51093. }),
  51094. $globals.HashedCollectionTest);
  51095. $core.addMethod(
  51096. $core.method({
  51097. selector: "collectionOfPrintStrings",
  51098. protocol: 'fixture',
  51099. fn: function (){
  51100. var self=this;
  51101. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  51102. },
  51103. args: [],
  51104. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  51105. referencedClasses: [],
  51106. messageSends: []
  51107. }),
  51108. $globals.HashedCollectionTest);
  51109. $core.addMethod(
  51110. $core.method({
  51111. selector: "collectionSize",
  51112. protocol: 'fixture',
  51113. fn: function (){
  51114. var self=this;
  51115. return (4);
  51116. },
  51117. args: [],
  51118. source: "collectionSize\x0a\x09^ 4",
  51119. referencedClasses: [],
  51120. messageSends: []
  51121. }),
  51122. $globals.HashedCollectionTest);
  51123. $core.addMethod(
  51124. $core.method({
  51125. selector: "collectionValues",
  51126. protocol: 'fixture',
  51127. fn: function (){
  51128. var self=this;
  51129. return [(1),(2),(3),(-4)];
  51130. },
  51131. args: [],
  51132. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  51133. referencedClasses: [],
  51134. messageSends: []
  51135. }),
  51136. $globals.HashedCollectionTest);
  51137. $core.addMethod(
  51138. $core.method({
  51139. selector: "collectionWithDuplicates",
  51140. protocol: 'fixture',
  51141. fn: function (){
  51142. var self=this;
  51143. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  51144. },
  51145. args: [],
  51146. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  51147. referencedClasses: [],
  51148. messageSends: []
  51149. }),
  51150. $globals.HashedCollectionTest);
  51151. $core.addMethod(
  51152. $core.method({
  51153. selector: "collectionWithNewValue",
  51154. protocol: 'fixture',
  51155. fn: function (){
  51156. var self=this;
  51157. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  51158. },
  51159. args: [],
  51160. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  51161. referencedClasses: [],
  51162. messageSends: []
  51163. }),
  51164. $globals.HashedCollectionTest);
  51165. $core.addMethod(
  51166. $core.method({
  51167. selector: "sampleNewValueAsCollection",
  51168. protocol: 'fixture',
  51169. fn: function (){
  51170. var self=this;
  51171. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  51172. },
  51173. args: [],
  51174. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  51175. referencedClasses: [],
  51176. messageSends: []
  51177. }),
  51178. $globals.HashedCollectionTest);
  51179. $core.addMethod(
  51180. $core.method({
  51181. selector: "testDynamicDictionaries",
  51182. protocol: 'tests',
  51183. fn: function (){
  51184. var self=this;
  51185. return $core.withContext(function($ctx1) {
  51186. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  51187. return self;
  51188. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  51189. },
  51190. args: [],
  51191. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  51192. referencedClasses: ["HashedCollection"],
  51193. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  51194. }),
  51195. $globals.HashedCollectionTest);
  51196. $core.addMethod(
  51197. $core.method({
  51198. selector: "collectionClass",
  51199. protocol: 'fixture',
  51200. fn: function (){
  51201. var self=this;
  51202. return $globals.HashedCollection;
  51203. },
  51204. args: [],
  51205. source: "collectionClass\x0a\x09^ HashedCollection",
  51206. referencedClasses: ["HashedCollection"],
  51207. messageSends: []
  51208. }),
  51209. $globals.HashedCollectionTest.klass);
  51210. $core.addClass('SequenceableCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  51211. $core.addMethod(
  51212. $core.method({
  51213. selector: "collectionFirst",
  51214. protocol: 'fixture',
  51215. fn: function (){
  51216. var self=this;
  51217. return $core.withContext(function($ctx1) {
  51218. self._subclassResponsibility();
  51219. return self;
  51220. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  51221. },
  51222. args: [],
  51223. source: "collectionFirst\x0a\x09self subclassResponsibility",
  51224. referencedClasses: [],
  51225. messageSends: ["subclassResponsibility"]
  51226. }),
  51227. $globals.SequenceableCollectionTest);
  51228. $core.addMethod(
  51229. $core.method({
  51230. selector: "collectionFirstTwo",
  51231. protocol: 'fixture',
  51232. fn: function (){
  51233. var self=this;
  51234. return $core.withContext(function($ctx1) {
  51235. self._subclassResponsibility();
  51236. return self;
  51237. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  51238. },
  51239. args: [],
  51240. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  51241. referencedClasses: [],
  51242. messageSends: ["subclassResponsibility"]
  51243. }),
  51244. $globals.SequenceableCollectionTest);
  51245. $core.addMethod(
  51246. $core.method({
  51247. selector: "collectionLast",
  51248. protocol: 'fixture',
  51249. fn: function (){
  51250. var self=this;
  51251. return $core.withContext(function($ctx1) {
  51252. self._subclassResponsibility();
  51253. return self;
  51254. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  51255. },
  51256. args: [],
  51257. source: "collectionLast\x0a\x09self subclassResponsibility",
  51258. referencedClasses: [],
  51259. messageSends: ["subclassResponsibility"]
  51260. }),
  51261. $globals.SequenceableCollectionTest);
  51262. $core.addMethod(
  51263. $core.method({
  51264. selector: "collectionLastTwo",
  51265. protocol: 'fixture',
  51266. fn: function (){
  51267. var self=this;
  51268. return $core.withContext(function($ctx1) {
  51269. self._subclassResponsibility();
  51270. return self;
  51271. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  51272. },
  51273. args: [],
  51274. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  51275. referencedClasses: [],
  51276. messageSends: ["subclassResponsibility"]
  51277. }),
  51278. $globals.SequenceableCollectionTest);
  51279. $core.addMethod(
  51280. $core.method({
  51281. selector: "nonIndexesDo:",
  51282. protocol: 'fixture',
  51283. fn: function (aBlock){
  51284. var self=this;
  51285. return $core.withContext(function($ctx1) {
  51286. $recv(aBlock)._value_((0));
  51287. $ctx1.sendIdx["value:"]=1;
  51288. $recv(aBlock)._value_($recv(self._collectionSize()).__plus((1)));
  51289. $ctx1.sendIdx["value:"]=2;
  51290. $recv(aBlock)._value_("z");
  51291. return self;
  51292. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  51293. },
  51294. args: ["aBlock"],
  51295. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  51296. referencedClasses: [],
  51297. messageSends: ["value:", "+", "collectionSize"]
  51298. }),
  51299. $globals.SequenceableCollectionTest);
  51300. $core.addMethod(
  51301. $core.method({
  51302. selector: "samplesDo:",
  51303. protocol: 'fixture',
  51304. fn: function (aBlock){
  51305. var self=this;
  51306. return $core.withContext(function($ctx1) {
  51307. $recv(aBlock)._value_value_((1),self._collectionFirst());
  51308. $ctx1.sendIdx["value:value:"]=1;
  51309. $recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  51310. return self;
  51311. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  51312. },
  51313. args: ["aBlock"],
  51314. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  51315. referencedClasses: [],
  51316. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  51317. }),
  51318. $globals.SequenceableCollectionTest);
  51319. $core.addMethod(
  51320. $core.method({
  51321. selector: "testBeginsWith",
  51322. protocol: 'tests',
  51323. fn: function (){
  51324. var self=this;
  51325. return $core.withContext(function($ctx1) {
  51326. var $2,$1,$4,$5,$3,$7,$6;
  51327. $2=self._collection();
  51328. $ctx1.sendIdx["collection"]=1;
  51329. $1=$recv($2)._beginsWith_($recv(self._collectionClass())._new());
  51330. $ctx1.sendIdx["beginsWith:"]=1;
  51331. self._assert_($1);
  51332. $ctx1.sendIdx["assert:"]=1;
  51333. $4=self._collection();
  51334. $ctx1.sendIdx["collection"]=2;
  51335. $5=self._collection();
  51336. $ctx1.sendIdx["collection"]=3;
  51337. $3=$recv($4)._beginsWith_($5);
  51338. $ctx1.sendIdx["beginsWith:"]=2;
  51339. self._assert_($3);
  51340. $ctx1.sendIdx["assert:"]=2;
  51341. $7=self._collection();
  51342. $ctx1.sendIdx["collection"]=4;
  51343. $6=$recv($7)._beginsWith_(self._collectionFirstTwo());
  51344. $ctx1.sendIdx["beginsWith:"]=3;
  51345. self._assert_($6);
  51346. self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo()));
  51347. return self;
  51348. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  51349. },
  51350. args: [],
  51351. 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)",
  51352. referencedClasses: [],
  51353. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  51354. }),
  51355. $globals.SequenceableCollectionTest);
  51356. $core.addMethod(
  51357. $core.method({
  51358. selector: "testEndsWith",
  51359. protocol: 'tests',
  51360. fn: function (){
  51361. var self=this;
  51362. return $core.withContext(function($ctx1) {
  51363. var $2,$1,$4,$5,$3,$7,$6;
  51364. $2=self._collection();
  51365. $ctx1.sendIdx["collection"]=1;
  51366. $1=$recv($2)._endsWith_($recv(self._collectionClass())._new());
  51367. $ctx1.sendIdx["endsWith:"]=1;
  51368. self._assert_($1);
  51369. $ctx1.sendIdx["assert:"]=1;
  51370. $4=self._collection();
  51371. $ctx1.sendIdx["collection"]=2;
  51372. $5=self._collection();
  51373. $ctx1.sendIdx["collection"]=3;
  51374. $3=$recv($4)._endsWith_($5);
  51375. $ctx1.sendIdx["endsWith:"]=2;
  51376. self._assert_($3);
  51377. $ctx1.sendIdx["assert:"]=2;
  51378. $7=self._collection();
  51379. $ctx1.sendIdx["collection"]=4;
  51380. $6=$recv($7)._endsWith_(self._collectionLastTwo());
  51381. $ctx1.sendIdx["endsWith:"]=3;
  51382. self._assert_($6);
  51383. self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo()));
  51384. return self;
  51385. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  51386. },
  51387. args: [],
  51388. 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)",
  51389. referencedClasses: [],
  51390. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  51391. }),
  51392. $globals.SequenceableCollectionTest);
  51393. $core.addMethod(
  51394. $core.method({
  51395. selector: "testFirst",
  51396. protocol: 'tests',
  51397. fn: function (){
  51398. var self=this;
  51399. return $core.withContext(function($ctx1) {
  51400. self._assert_equals_($recv(self._collection())._first(),self._collectionFirst());
  51401. return self;
  51402. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  51403. },
  51404. args: [],
  51405. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  51406. referencedClasses: [],
  51407. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  51408. }),
  51409. $globals.SequenceableCollectionTest);
  51410. $core.addMethod(
  51411. $core.method({
  51412. selector: "testFirstN",
  51413. protocol: 'tests',
  51414. fn: function (){
  51415. var self=this;
  51416. return $core.withContext(function($ctx1) {
  51417. var $2,$1,$4,$3,$6,$5,$7;
  51418. $2=self._collection();
  51419. $ctx1.sendIdx["collection"]=1;
  51420. $1=$recv($2)._first_((2));
  51421. $ctx1.sendIdx["first:"]=1;
  51422. self._assert_equals_($1,self._collectionFirstTwo());
  51423. $ctx1.sendIdx["assert:equals:"]=1;
  51424. $4=self._collection();
  51425. $ctx1.sendIdx["collection"]=2;
  51426. $3=$recv($4)._first_((0));
  51427. $ctx1.sendIdx["first:"]=2;
  51428. self._assert_equals_($3,$recv(self._collectionClass())._new());
  51429. $ctx1.sendIdx["assert:equals:"]=2;
  51430. $6=self._collection();
  51431. $ctx1.sendIdx["collection"]=3;
  51432. $5=$recv($6)._first_(self._collectionSize());
  51433. $ctx1.sendIdx["first:"]=3;
  51434. $7=self._collection();
  51435. $ctx1.sendIdx["collection"]=4;
  51436. self._assert_equals_($5,$7);
  51437. self._should_raise_((function(){
  51438. return $core.withContext(function($ctx2) {
  51439. return $recv(self._collection())._first_((33));
  51440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51441. }),$globals.Error);
  51442. return self;
  51443. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  51444. },
  51445. args: [],
  51446. 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",
  51447. referencedClasses: ["Error"],
  51448. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  51449. }),
  51450. $globals.SequenceableCollectionTest);
  51451. $core.addMethod(
  51452. $core.method({
  51453. selector: "testFourth",
  51454. protocol: 'tests',
  51455. fn: function (){
  51456. var self=this;
  51457. return $core.withContext(function($ctx1) {
  51458. var $2,$1;
  51459. $2=self._collection();
  51460. $ctx1.sendIdx["collection"]=1;
  51461. $1=$recv($2)._fourth();
  51462. self._assert_equals_($1,$recv(self._collection())._at_((4)));
  51463. return self;
  51464. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  51465. },
  51466. args: [],
  51467. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  51468. referencedClasses: [],
  51469. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  51470. }),
  51471. $globals.SequenceableCollectionTest);
  51472. $core.addMethod(
  51473. $core.method({
  51474. selector: "testIndexOfStartingAt",
  51475. protocol: 'tests',
  51476. fn: function (){
  51477. var self=this;
  51478. var jsNull;
  51479. return $core.withContext(function($ctx1) {
  51480. var $2,$1,$4,$3;
  51481. jsNull=$recv($globals.JSON)._parse_("null");
  51482. self._samplesDo_((function(index,value){
  51483. return $core.withContext(function($ctx2) {
  51484. $2=self._collection();
  51485. $ctx2.sendIdx["collection"]=1;
  51486. $1=$recv($2)._indexOf_startingAt_(value,(1));
  51487. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  51488. self._assert_equals_($1,index);
  51489. $ctx2.sendIdx["assert:equals:"]=1;
  51490. $4=self._collection();
  51491. $ctx2.sendIdx["collection"]=2;
  51492. $3=$recv($4)._indexOf_startingAt_(value,index);
  51493. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  51494. self._assert_equals_($3,index);
  51495. $ctx2.sendIdx["assert:equals:"]=2;
  51496. return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  51497. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51498. }));
  51499. return self;
  51500. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  51501. },
  51502. args: [],
  51503. 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 ]",
  51504. referencedClasses: ["JSON"],
  51505. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  51506. }),
  51507. $globals.SequenceableCollectionTest);
  51508. $core.addMethod(
  51509. $core.method({
  51510. selector: "testIndexOfStartingAtWithNull",
  51511. protocol: 'tests',
  51512. fn: function (){
  51513. var self=this;
  51514. var jsNull;
  51515. return $core.withContext(function($ctx1) {
  51516. var $1,$2;
  51517. jsNull=$recv($globals.JSON)._parse_("null");
  51518. self._samplesDo_((function(index,value){
  51519. var collection;
  51520. return $core.withContext(function($ctx2) {
  51521. collection=self._collection();
  51522. collection;
  51523. $recv(collection)._at_put_(index,jsNull);
  51524. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  51525. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  51526. self._assert_equals_($1,index);
  51527. $ctx2.sendIdx["assert:equals:"]=1;
  51528. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  51529. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  51530. self._assert_equals_($2,index);
  51531. $ctx2.sendIdx["assert:equals:"]=2;
  51532. return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  51533. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  51534. }));
  51535. return self;
  51536. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  51537. },
  51538. args: [],
  51539. 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 ]",
  51540. referencedClasses: ["JSON"],
  51541. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  51542. }),
  51543. $globals.SequenceableCollectionTest);
  51544. $core.addMethod(
  51545. $core.method({
  51546. selector: "testLast",
  51547. protocol: 'tests',
  51548. fn: function (){
  51549. var self=this;
  51550. return $core.withContext(function($ctx1) {
  51551. self._assert_equals_($recv(self._collection())._last(),self._collectionLast());
  51552. return self;
  51553. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  51554. },
  51555. args: [],
  51556. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  51557. referencedClasses: [],
  51558. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  51559. }),
  51560. $globals.SequenceableCollectionTest);
  51561. $core.addMethod(
  51562. $core.method({
  51563. selector: "testLastN",
  51564. protocol: 'tests',
  51565. fn: function (){
  51566. var self=this;
  51567. return $core.withContext(function($ctx1) {
  51568. var $2,$1,$4,$3,$6,$5,$7;
  51569. $2=self._collection();
  51570. $ctx1.sendIdx["collection"]=1;
  51571. $1=$recv($2)._last_((2));
  51572. $ctx1.sendIdx["last:"]=1;
  51573. self._assert_equals_($1,self._collectionLastTwo());
  51574. $ctx1.sendIdx["assert:equals:"]=1;
  51575. $4=self._collection();
  51576. $ctx1.sendIdx["collection"]=2;
  51577. $3=$recv($4)._last_((0));
  51578. $ctx1.sendIdx["last:"]=2;
  51579. self._assert_equals_($3,$recv(self._collectionClass())._new());
  51580. $ctx1.sendIdx["assert:equals:"]=2;
  51581. $6=self._collection();
  51582. $ctx1.sendIdx["collection"]=3;
  51583. $5=$recv($6)._last_(self._collectionSize());
  51584. $ctx1.sendIdx["last:"]=3;
  51585. $7=self._collection();
  51586. $ctx1.sendIdx["collection"]=4;
  51587. self._assert_equals_($5,$7);
  51588. self._should_raise_((function(){
  51589. return $core.withContext(function($ctx2) {
  51590. return $recv(self._collection())._last_((33));
  51591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51592. }),$globals.Error);
  51593. return self;
  51594. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  51595. },
  51596. args: [],
  51597. 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",
  51598. referencedClasses: ["Error"],
  51599. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  51600. }),
  51601. $globals.SequenceableCollectionTest);
  51602. $core.addMethod(
  51603. $core.method({
  51604. selector: "testSecond",
  51605. protocol: 'tests',
  51606. fn: function (){
  51607. var self=this;
  51608. return $core.withContext(function($ctx1) {
  51609. var $2,$1;
  51610. $2=self._collection();
  51611. $ctx1.sendIdx["collection"]=1;
  51612. $1=$recv($2)._second();
  51613. self._assert_equals_($1,$recv(self._collection())._at_((2)));
  51614. return self;
  51615. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  51616. },
  51617. args: [],
  51618. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  51619. referencedClasses: [],
  51620. messageSends: ["assert:equals:", "second", "collection", "at:"]
  51621. }),
  51622. $globals.SequenceableCollectionTest);
  51623. $core.addMethod(
  51624. $core.method({
  51625. selector: "testThird",
  51626. protocol: 'tests',
  51627. fn: function (){
  51628. var self=this;
  51629. return $core.withContext(function($ctx1) {
  51630. var $2,$1;
  51631. $2=self._collection();
  51632. $ctx1.sendIdx["collection"]=1;
  51633. $1=$recv($2)._third();
  51634. self._assert_equals_($1,$recv(self._collection())._at_((3)));
  51635. return self;
  51636. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  51637. },
  51638. args: [],
  51639. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  51640. referencedClasses: [],
  51641. messageSends: ["assert:equals:", "third", "collection", "at:"]
  51642. }),
  51643. $globals.SequenceableCollectionTest);
  51644. $core.addClass('ArrayTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  51645. $core.addMethod(
  51646. $core.method({
  51647. selector: "collection",
  51648. protocol: 'fixture',
  51649. fn: function (){
  51650. var self=this;
  51651. return [(1), (2), (3), (-4)];
  51652. },
  51653. args: [],
  51654. source: "collection\x0a\x09^ #(1 2 3 -4)",
  51655. referencedClasses: [],
  51656. messageSends: []
  51657. }),
  51658. $globals.ArrayTest);
  51659. $core.addMethod(
  51660. $core.method({
  51661. selector: "collectionFirst",
  51662. protocol: 'fixture',
  51663. fn: function (){
  51664. var self=this;
  51665. return (1);
  51666. },
  51667. args: [],
  51668. source: "collectionFirst\x0a\x09^ 1",
  51669. referencedClasses: [],
  51670. messageSends: []
  51671. }),
  51672. $globals.ArrayTest);
  51673. $core.addMethod(
  51674. $core.method({
  51675. selector: "collectionFirstTwo",
  51676. protocol: 'fixture',
  51677. fn: function (){
  51678. var self=this;
  51679. return [(1), (2)];
  51680. },
  51681. args: [],
  51682. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  51683. referencedClasses: [],
  51684. messageSends: []
  51685. }),
  51686. $globals.ArrayTest);
  51687. $core.addMethod(
  51688. $core.method({
  51689. selector: "collectionLast",
  51690. protocol: 'fixture',
  51691. fn: function (){
  51692. var self=this;
  51693. return (-4);
  51694. },
  51695. args: [],
  51696. source: "collectionLast\x0a\x09^ -4",
  51697. referencedClasses: [],
  51698. messageSends: []
  51699. }),
  51700. $globals.ArrayTest);
  51701. $core.addMethod(
  51702. $core.method({
  51703. selector: "collectionLastTwo",
  51704. protocol: 'fixture',
  51705. fn: function (){
  51706. var self=this;
  51707. return [(3), (-4)];
  51708. },
  51709. args: [],
  51710. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  51711. referencedClasses: [],
  51712. messageSends: []
  51713. }),
  51714. $globals.ArrayTest);
  51715. $core.addMethod(
  51716. $core.method({
  51717. selector: "collectionOfPrintStrings",
  51718. protocol: 'fixture',
  51719. fn: function (){
  51720. var self=this;
  51721. return ["1", "2", "3", "-4"];
  51722. },
  51723. args: [],
  51724. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  51725. referencedClasses: [],
  51726. messageSends: []
  51727. }),
  51728. $globals.ArrayTest);
  51729. $core.addMethod(
  51730. $core.method({
  51731. selector: "collectionSize",
  51732. protocol: 'fixture',
  51733. fn: function (){
  51734. var self=this;
  51735. return (4);
  51736. },
  51737. args: [],
  51738. source: "collectionSize\x0a\x09^ 4",
  51739. referencedClasses: [],
  51740. messageSends: []
  51741. }),
  51742. $globals.ArrayTest);
  51743. $core.addMethod(
  51744. $core.method({
  51745. selector: "collectionWithDuplicates",
  51746. protocol: 'fixture',
  51747. fn: function (){
  51748. var self=this;
  51749. return ["a", "b", "c", (1), (2), (1), "a", []];
  51750. },
  51751. args: [],
  51752. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  51753. referencedClasses: [],
  51754. messageSends: []
  51755. }),
  51756. $globals.ArrayTest);
  51757. $core.addMethod(
  51758. $core.method({
  51759. selector: "collectionWithNewValue",
  51760. protocol: 'fixture',
  51761. fn: function (){
  51762. var self=this;
  51763. return [(1), (2), (3), (-4), "N"];
  51764. },
  51765. args: [],
  51766. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  51767. referencedClasses: [],
  51768. messageSends: []
  51769. }),
  51770. $globals.ArrayTest);
  51771. $core.addMethod(
  51772. $core.method({
  51773. selector: "sampleNewIndex",
  51774. protocol: 'fixture',
  51775. fn: function (){
  51776. var self=this;
  51777. return (5);
  51778. },
  51779. args: [],
  51780. source: "sampleNewIndex\x0a\x09^ 5",
  51781. referencedClasses: [],
  51782. messageSends: []
  51783. }),
  51784. $globals.ArrayTest);
  51785. $core.addMethod(
  51786. $core.method({
  51787. selector: "samplesDo:",
  51788. protocol: 'fixture',
  51789. fn: function (aBlock){
  51790. var self=this;
  51791. return $core.withContext(function($ctx1) {
  51792. (
  51793. $ctx1.supercall = true,
  51794. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  51795. $ctx1.supercall = false;
  51796. $recv(aBlock)._value_value_((3),(3));
  51797. return self;
  51798. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  51799. },
  51800. args: ["aBlock"],
  51801. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  51802. referencedClasses: [],
  51803. messageSends: ["samplesDo:", "value:value:"]
  51804. }),
  51805. $globals.ArrayTest);
  51806. $core.addMethod(
  51807. $core.method({
  51808. selector: "testAdd",
  51809. protocol: 'tests',
  51810. fn: function (){
  51811. var self=this;
  51812. var array;
  51813. return $core.withContext(function($ctx1) {
  51814. array=self._collection();
  51815. $recv(array)._add_((6));
  51816. self._assert_equals_($recv(array)._last(),(6));
  51817. return self;
  51818. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  51819. },
  51820. args: [],
  51821. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  51822. referencedClasses: [],
  51823. messageSends: ["collection", "add:", "assert:equals:", "last"]
  51824. }),
  51825. $globals.ArrayTest);
  51826. $core.addMethod(
  51827. $core.method({
  51828. selector: "testAddFirst",
  51829. protocol: 'tests',
  51830. fn: function (){
  51831. var self=this;
  51832. return $core.withContext(function($ctx1) {
  51833. var $3,$2,$1;
  51834. $3=self._collection();
  51835. $recv($3)._addFirst_((0));
  51836. $2=$recv($3)._yourself();
  51837. $1=$recv($2)._first();
  51838. self._assert_equals_($1,(0));
  51839. return self;
  51840. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  51841. },
  51842. args: [],
  51843. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  51844. referencedClasses: [],
  51845. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  51846. }),
  51847. $globals.ArrayTest);
  51848. $core.addMethod(
  51849. $core.method({
  51850. selector: "testPrintString",
  51851. protocol: 'tests',
  51852. fn: function (){
  51853. var self=this;
  51854. var array;
  51855. return $core.withContext(function($ctx1) {
  51856. var $1,$2,$3,$4,$5,$6,$7,$8;
  51857. array=$recv($globals.Array)._new();
  51858. $1=$recv(array)._printString();
  51859. $ctx1.sendIdx["printString"]=1;
  51860. self._assert_equals_($1,"an Array ()");
  51861. $ctx1.sendIdx["assert:equals:"]=1;
  51862. $2=array;
  51863. $recv($2)._add_((1));
  51864. $ctx1.sendIdx["add:"]=1;
  51865. $3=$recv($2)._add_((3));
  51866. $ctx1.sendIdx["add:"]=2;
  51867. $4=$recv(array)._printString();
  51868. $ctx1.sendIdx["printString"]=2;
  51869. self._assert_equals_($4,"an Array (1 3)");
  51870. $ctx1.sendIdx["assert:equals:"]=2;
  51871. $recv(array)._add_("foo");
  51872. $5=$recv(array)._printString();
  51873. $ctx1.sendIdx["printString"]=3;
  51874. self._assert_equals_($5,"an Array (1 3 'foo')");
  51875. $ctx1.sendIdx["assert:equals:"]=3;
  51876. $6=array;
  51877. $recv($6)._remove_((1));
  51878. $ctx1.sendIdx["remove:"]=1;
  51879. $recv($6)._remove_((3));
  51880. $7=$recv(array)._printString();
  51881. $ctx1.sendIdx["printString"]=4;
  51882. self._assert_equals_($7,"an Array ('foo')");
  51883. $ctx1.sendIdx["assert:equals:"]=4;
  51884. $recv(array)._addLast_((3));
  51885. $ctx1.sendIdx["addLast:"]=1;
  51886. $8=$recv(array)._printString();
  51887. $ctx1.sendIdx["printString"]=5;
  51888. self._assert_equals_($8,"an Array ('foo' 3)");
  51889. $ctx1.sendIdx["assert:equals:"]=5;
  51890. $recv(array)._addLast_((3));
  51891. self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  51892. return self;
  51893. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  51894. },
  51895. args: [],
  51896. 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)'.",
  51897. referencedClasses: ["Array"],
  51898. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  51899. }),
  51900. $globals.ArrayTest);
  51901. $core.addMethod(
  51902. $core.method({
  51903. selector: "testRemove",
  51904. protocol: 'tests',
  51905. fn: function (){
  51906. var self=this;
  51907. var array;
  51908. return $core.withContext(function($ctx1) {
  51909. array=[(1), (2), (3), (4), (5)];
  51910. $recv(array)._remove_((3));
  51911. $ctx1.sendIdx["remove:"]=1;
  51912. self._assert_equals_(array,[(1), (2), (4), (5)]);
  51913. self._should_raise_((function(){
  51914. return $core.withContext(function($ctx2) {
  51915. return $recv(array)._remove_((3));
  51916. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51917. }),$globals.Error);
  51918. return self;
  51919. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  51920. },
  51921. args: [],
  51922. 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",
  51923. referencedClasses: ["Error"],
  51924. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  51925. }),
  51926. $globals.ArrayTest);
  51927. $core.addMethod(
  51928. $core.method({
  51929. selector: "testRemoveFromTo",
  51930. protocol: 'tests',
  51931. fn: function (){
  51932. var self=this;
  51933. return $core.withContext(function($ctx1) {
  51934. var $1,$2;
  51935. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  51936. $ctx1.sendIdx["removeFrom:to:"]=1;
  51937. self._assert_equals_($1,[(4)]);
  51938. $ctx1.sendIdx["assert:equals:"]=1;
  51939. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  51940. $ctx1.sendIdx["removeFrom:to:"]=2;
  51941. self._assert_equals_($2,[(1), (4)]);
  51942. $ctx1.sendIdx["assert:equals:"]=2;
  51943. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  51944. return self;
  51945. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  51946. },
  51947. args: [],
  51948. 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)",
  51949. referencedClasses: [],
  51950. messageSends: ["assert:equals:", "removeFrom:to:"]
  51951. }),
  51952. $globals.ArrayTest);
  51953. $core.addMethod(
  51954. $core.method({
  51955. selector: "testRemoveIndex",
  51956. protocol: 'tests',
  51957. fn: function (){
  51958. var self=this;
  51959. return $core.withContext(function($ctx1) {
  51960. var $1,$2;
  51961. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  51962. $ctx1.sendIdx["removeIndex:"]=1;
  51963. self._assert_equals_($1,[(1), (3), (4)]);
  51964. $ctx1.sendIdx["assert:equals:"]=1;
  51965. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  51966. $ctx1.sendIdx["removeIndex:"]=2;
  51967. self._assert_equals_($2,[(2), (3), (4)]);
  51968. $ctx1.sendIdx["assert:equals:"]=2;
  51969. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  51970. return self;
  51971. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  51972. },
  51973. args: [],
  51974. 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: #()",
  51975. referencedClasses: [],
  51976. messageSends: ["assert:equals:", "removeIndex:"]
  51977. }),
  51978. $globals.ArrayTest);
  51979. $core.addMethod(
  51980. $core.method({
  51981. selector: "testRemoveLast",
  51982. protocol: 'tests',
  51983. fn: function (){
  51984. var self=this;
  51985. var array;
  51986. return $core.withContext(function($ctx1) {
  51987. array=[(1), (2)];
  51988. $recv(array)._removeLast();
  51989. self._assert_equals_($recv(array)._last(),(1));
  51990. return self;
  51991. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  51992. },
  51993. args: [],
  51994. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  51995. referencedClasses: [],
  51996. messageSends: ["removeLast", "assert:equals:", "last"]
  51997. }),
  51998. $globals.ArrayTest);
  51999. $core.addMethod(
  52000. $core.method({
  52001. selector: "testReversed",
  52002. protocol: 'tests',
  52003. fn: function (){
  52004. var self=this;
  52005. var array;
  52006. return $core.withContext(function($ctx1) {
  52007. array=[(5), (4), (3), (2), (1)];
  52008. self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  52009. return self;
  52010. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  52011. },
  52012. args: [],
  52013. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  52014. referencedClasses: [],
  52015. messageSends: ["assert:equals:", "reversed"]
  52016. }),
  52017. $globals.ArrayTest);
  52018. $core.addMethod(
  52019. $core.method({
  52020. selector: "testSort",
  52021. protocol: 'tests',
  52022. fn: function (){
  52023. var self=this;
  52024. var array;
  52025. return $core.withContext(function($ctx1) {
  52026. array=[(10), (1), (5)];
  52027. $recv(array)._sort();
  52028. self._assert_equals_(array,[(1), (5), (10)]);
  52029. return self;
  52030. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  52031. },
  52032. args: [],
  52033. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  52034. referencedClasses: [],
  52035. messageSends: ["sort", "assert:equals:"]
  52036. }),
  52037. $globals.ArrayTest);
  52038. $core.addMethod(
  52039. $core.method({
  52040. selector: "collectionClass",
  52041. protocol: 'fixture',
  52042. fn: function (){
  52043. var self=this;
  52044. return $globals.Array;
  52045. },
  52046. args: [],
  52047. source: "collectionClass\x0a\x09^ Array",
  52048. referencedClasses: ["Array"],
  52049. messageSends: []
  52050. }),
  52051. $globals.ArrayTest.klass);
  52052. $core.addClass('StringTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  52053. $core.addMethod(
  52054. $core.method({
  52055. selector: "collection",
  52056. protocol: 'fixture',
  52057. fn: function (){
  52058. var self=this;
  52059. return "helLo";
  52060. },
  52061. args: [],
  52062. source: "collection\x0a\x09^ 'helLo'",
  52063. referencedClasses: [],
  52064. messageSends: []
  52065. }),
  52066. $globals.StringTest);
  52067. $core.addMethod(
  52068. $core.method({
  52069. selector: "collectionFirst",
  52070. protocol: 'fixture',
  52071. fn: function (){
  52072. var self=this;
  52073. return "h";
  52074. },
  52075. args: [],
  52076. source: "collectionFirst\x0a\x09^ 'h'",
  52077. referencedClasses: [],
  52078. messageSends: []
  52079. }),
  52080. $globals.StringTest);
  52081. $core.addMethod(
  52082. $core.method({
  52083. selector: "collectionFirstTwo",
  52084. protocol: 'fixture',
  52085. fn: function (){
  52086. var self=this;
  52087. return "he";
  52088. },
  52089. args: [],
  52090. source: "collectionFirstTwo\x0a\x09^ 'he'",
  52091. referencedClasses: [],
  52092. messageSends: []
  52093. }),
  52094. $globals.StringTest);
  52095. $core.addMethod(
  52096. $core.method({
  52097. selector: "collectionLast",
  52098. protocol: 'fixture',
  52099. fn: function (){
  52100. var self=this;
  52101. return "o";
  52102. },
  52103. args: [],
  52104. source: "collectionLast\x0a\x09^ 'o'",
  52105. referencedClasses: [],
  52106. messageSends: []
  52107. }),
  52108. $globals.StringTest);
  52109. $core.addMethod(
  52110. $core.method({
  52111. selector: "collectionLastTwo",
  52112. protocol: 'fixture',
  52113. fn: function (){
  52114. var self=this;
  52115. return "Lo";
  52116. },
  52117. args: [],
  52118. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  52119. referencedClasses: [],
  52120. messageSends: []
  52121. }),
  52122. $globals.StringTest);
  52123. $core.addMethod(
  52124. $core.method({
  52125. selector: "collectionOfPrintStrings",
  52126. protocol: 'fixture',
  52127. fn: function (){
  52128. var self=this;
  52129. return "'h''e''l''L''o'";
  52130. },
  52131. args: [],
  52132. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  52133. referencedClasses: [],
  52134. messageSends: []
  52135. }),
  52136. $globals.StringTest);
  52137. $core.addMethod(
  52138. $core.method({
  52139. selector: "collectionSize",
  52140. protocol: 'fixture',
  52141. fn: function (){
  52142. var self=this;
  52143. return (5);
  52144. },
  52145. args: [],
  52146. source: "collectionSize\x0a\x09^ 5",
  52147. referencedClasses: [],
  52148. messageSends: []
  52149. }),
  52150. $globals.StringTest);
  52151. $core.addMethod(
  52152. $core.method({
  52153. selector: "collectionWithDuplicates",
  52154. protocol: 'fixture',
  52155. fn: function (){
  52156. var self=this;
  52157. return "abbaerten";
  52158. },
  52159. args: [],
  52160. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  52161. referencedClasses: [],
  52162. messageSends: []
  52163. }),
  52164. $globals.StringTest);
  52165. $core.addMethod(
  52166. $core.method({
  52167. selector: "collectionWithNewValue",
  52168. protocol: 'fixture',
  52169. fn: function (){
  52170. var self=this;
  52171. return "helLoN";
  52172. },
  52173. args: [],
  52174. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  52175. referencedClasses: [],
  52176. messageSends: []
  52177. }),
  52178. $globals.StringTest);
  52179. $core.addMethod(
  52180. $core.method({
  52181. selector: "sampleNewValueAsCollection",
  52182. protocol: 'fixture',
  52183. fn: function (){
  52184. var self=this;
  52185. return "N";
  52186. },
  52187. args: [],
  52188. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  52189. referencedClasses: [],
  52190. messageSends: []
  52191. }),
  52192. $globals.StringTest);
  52193. $core.addMethod(
  52194. $core.method({
  52195. selector: "samplesDo:",
  52196. protocol: 'fixture',
  52197. fn: function (aBlock){
  52198. var self=this;
  52199. return $core.withContext(function($ctx1) {
  52200. (
  52201. $ctx1.supercall = true,
  52202. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  52203. $ctx1.supercall = false;
  52204. $recv(aBlock)._value_value_((3),"l");
  52205. return self;
  52206. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  52207. },
  52208. args: ["aBlock"],
  52209. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  52210. referencedClasses: [],
  52211. messageSends: ["samplesDo:", "value:value:"]
  52212. }),
  52213. $globals.StringTest);
  52214. $core.addMethod(
  52215. $core.method({
  52216. selector: "testAddAll",
  52217. protocol: 'tests',
  52218. fn: function (){
  52219. var self=this;
  52220. return $core.withContext(function($ctx1) {
  52221. var $1;
  52222. self._should_raise_((function(){
  52223. return $core.withContext(function($ctx2) {
  52224. $1=self._collection();
  52225. $ctx2.sendIdx["collection"]=1;
  52226. return $recv($1)._addAll_(self._collection());
  52227. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52228. }),$globals.Error);
  52229. return self;
  52230. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  52231. },
  52232. args: [],
  52233. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  52234. referencedClasses: ["Error"],
  52235. messageSends: ["should:raise:", "addAll:", "collection"]
  52236. }),
  52237. $globals.StringTest);
  52238. $core.addMethod(
  52239. $core.method({
  52240. selector: "testAddRemove",
  52241. protocol: 'tests',
  52242. fn: function (){
  52243. var self=this;
  52244. return $core.withContext(function($ctx1) {
  52245. self._should_raise_((function(){
  52246. return $core.withContext(function($ctx2) {
  52247. return "hello"._add_("a");
  52248. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52249. }),$globals.Error);
  52250. $ctx1.sendIdx["should:raise:"]=1;
  52251. self._should_raise_((function(){
  52252. return $core.withContext(function($ctx2) {
  52253. return "hello"._remove_("h");
  52254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  52255. }),$globals.Error);
  52256. return self;
  52257. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  52258. },
  52259. args: [],
  52260. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  52261. referencedClasses: ["Error"],
  52262. messageSends: ["should:raise:", "add:", "remove:"]
  52263. }),
  52264. $globals.StringTest);
  52265. $core.addMethod(
  52266. $core.method({
  52267. selector: "testAsArray",
  52268. protocol: 'tests',
  52269. fn: function (){
  52270. var self=this;
  52271. return $core.withContext(function($ctx1) {
  52272. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  52273. return self;
  52274. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  52275. },
  52276. args: [],
  52277. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  52278. referencedClasses: [],
  52279. messageSends: ["assert:equals:", "asArray"]
  52280. }),
  52281. $globals.StringTest);
  52282. $core.addMethod(
  52283. $core.method({
  52284. selector: "testAsLowerCase",
  52285. protocol: 'tests',
  52286. fn: function (){
  52287. var self=this;
  52288. return $core.withContext(function($ctx1) {
  52289. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  52290. return self;
  52291. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  52292. },
  52293. args: [],
  52294. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  52295. referencedClasses: [],
  52296. messageSends: ["assert:equals:", "asLowercase"]
  52297. }),
  52298. $globals.StringTest);
  52299. $core.addMethod(
  52300. $core.method({
  52301. selector: "testAsNumber",
  52302. protocol: 'tests',
  52303. fn: function (){
  52304. var self=this;
  52305. return $core.withContext(function($ctx1) {
  52306. var $1,$2;
  52307. $1="3"._asNumber();
  52308. $ctx1.sendIdx["asNumber"]=1;
  52309. self._assert_equals_($1,(3));
  52310. $ctx1.sendIdx["assert:equals:"]=1;
  52311. $2="-3"._asNumber();
  52312. $ctx1.sendIdx["asNumber"]=2;
  52313. self._assert_equals_($2,(-3));
  52314. $ctx1.sendIdx["assert:equals:"]=2;
  52315. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  52316. return self;
  52317. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  52318. },
  52319. args: [],
  52320. 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.",
  52321. referencedClasses: [],
  52322. messageSends: ["assert:equals:", "asNumber"]
  52323. }),
  52324. $globals.StringTest);
  52325. $core.addMethod(
  52326. $core.method({
  52327. selector: "testAsUpperCase",
  52328. protocol: 'tests',
  52329. fn: function (){
  52330. var self=this;
  52331. return $core.withContext(function($ctx1) {
  52332. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  52333. return self;
  52334. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  52335. },
  52336. args: [],
  52337. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  52338. referencedClasses: [],
  52339. messageSends: ["assert:equals:", "asUppercase"]
  52340. }),
  52341. $globals.StringTest);
  52342. $core.addMethod(
  52343. $core.method({
  52344. selector: "testAsciiValue",
  52345. protocol: 'tests',
  52346. fn: function (){
  52347. var self=this;
  52348. var characterA,characterU;
  52349. return $core.withContext(function($ctx1) {
  52350. var $1;
  52351. characterA="A";
  52352. characterU="U";
  52353. $1=$recv(characterA)._asciiValue();
  52354. $ctx1.sendIdx["asciiValue"]=1;
  52355. self._assert_equals_($1,(65));
  52356. $ctx1.sendIdx["assert:equals:"]=1;
  52357. self._assert_equals_($recv(characterU)._asciiValue(),(85));
  52358. return self;
  52359. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  52360. },
  52361. args: [],
  52362. 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",
  52363. referencedClasses: [],
  52364. messageSends: ["assert:equals:", "asciiValue"]
  52365. }),
  52366. $globals.StringTest);
  52367. $core.addMethod(
  52368. $core.method({
  52369. selector: "testAtIfAbsentPut",
  52370. protocol: 'tests',
  52371. fn: function (){
  52372. var self=this;
  52373. return $core.withContext(function($ctx1) {
  52374. self._should_raise_((function(){
  52375. return $core.withContext(function($ctx2) {
  52376. return "hello"._at_ifAbsentPut_((6),(function(){
  52377. return "a";
  52378. }));
  52379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52380. }),$globals.Error);
  52381. return self;
  52382. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  52383. },
  52384. args: [],
  52385. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  52386. referencedClasses: ["Error"],
  52387. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  52388. }),
  52389. $globals.StringTest);
  52390. $core.addMethod(
  52391. $core.method({
  52392. selector: "testAtPut",
  52393. protocol: 'tests',
  52394. fn: function (){
  52395. var self=this;
  52396. return $core.withContext(function($ctx1) {
  52397. self._should_raise_((function(){
  52398. return $core.withContext(function($ctx2) {
  52399. return "hello"._at_put_((1),"a");
  52400. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52401. }),$globals.Error);
  52402. return self;
  52403. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  52404. },
  52405. args: [],
  52406. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  52407. referencedClasses: ["Error"],
  52408. messageSends: ["should:raise:", "at:put:"]
  52409. }),
  52410. $globals.StringTest);
  52411. $core.addMethod(
  52412. $core.method({
  52413. selector: "testCapitalized",
  52414. protocol: 'tests',
  52415. fn: function (){
  52416. var self=this;
  52417. return $core.withContext(function($ctx1) {
  52418. var $1,$2,$3;
  52419. $1="test"._capitalized();
  52420. $ctx1.sendIdx["capitalized"]=1;
  52421. self._assert_equals_($1,"Test");
  52422. $ctx1.sendIdx["assert:equals:"]=1;
  52423. $2="Test"._capitalized();
  52424. $ctx1.sendIdx["capitalized"]=2;
  52425. self._assert_equals_($2,"Test");
  52426. $ctx1.sendIdx["assert:equals:"]=2;
  52427. self._assert_equals_(""._capitalized(),"");
  52428. $ctx1.sendIdx["assert:equals:"]=3;
  52429. $3="Test"._isCapitalized();
  52430. $ctx1.sendIdx["isCapitalized"]=1;
  52431. self._assert_equals_($3,true);
  52432. $ctx1.sendIdx["assert:equals:"]=4;
  52433. self._assert_equals_("test"._isCapitalized(),false);
  52434. return self;
  52435. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  52436. },
  52437. args: [],
  52438. 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.",
  52439. referencedClasses: [],
  52440. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  52441. }),
  52442. $globals.StringTest);
  52443. $core.addMethod(
  52444. $core.method({
  52445. selector: "testCharCodeAt",
  52446. protocol: 'tests',
  52447. fn: function (){
  52448. var self=this;
  52449. return $core.withContext(function($ctx1) {
  52450. var $1,$2,$3,$4,$5;
  52451. $1="jackie"._charCodeAt_((1));
  52452. $ctx1.sendIdx["charCodeAt:"]=1;
  52453. self._assert_equals_($1,(106));
  52454. $ctx1.sendIdx["assert:equals:"]=1;
  52455. $2="jackie"._charCodeAt_((2));
  52456. $ctx1.sendIdx["charCodeAt:"]=2;
  52457. self._assert_equals_($2,(97));
  52458. $ctx1.sendIdx["assert:equals:"]=2;
  52459. $3="jackie"._charCodeAt_((3));
  52460. $ctx1.sendIdx["charCodeAt:"]=3;
  52461. self._assert_equals_($3,(99));
  52462. $ctx1.sendIdx["assert:equals:"]=3;
  52463. $4="jackie"._charCodeAt_((4));
  52464. $ctx1.sendIdx["charCodeAt:"]=4;
  52465. self._assert_equals_($4,(107));
  52466. $ctx1.sendIdx["assert:equals:"]=4;
  52467. $5="jackie"._charCodeAt_((5));
  52468. $ctx1.sendIdx["charCodeAt:"]=5;
  52469. self._assert_equals_($5,(105));
  52470. $ctx1.sendIdx["assert:equals:"]=5;
  52471. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  52472. return self;
  52473. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  52474. },
  52475. args: [],
  52476. 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",
  52477. referencedClasses: [],
  52478. messageSends: ["assert:equals:", "charCodeAt:"]
  52479. }),
  52480. $globals.StringTest);
  52481. $core.addMethod(
  52482. $core.method({
  52483. selector: "testCopyFromTo",
  52484. protocol: 'tests',
  52485. fn: function (){
  52486. var self=this;
  52487. return $core.withContext(function($ctx1) {
  52488. var $1;
  52489. $1="jackie"._copyFrom_to_((1),(3));
  52490. $ctx1.sendIdx["copyFrom:to:"]=1;
  52491. self._assert_equals_($1,"jac");
  52492. $ctx1.sendIdx["assert:equals:"]=1;
  52493. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  52494. return self;
  52495. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  52496. },
  52497. args: [],
  52498. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  52499. referencedClasses: [],
  52500. messageSends: ["assert:equals:", "copyFrom:to:"]
  52501. }),
  52502. $globals.StringTest);
  52503. $core.addMethod(
  52504. $core.method({
  52505. selector: "testCopySeparates",
  52506. protocol: 'tests',
  52507. fn: function (){
  52508. var self=this;
  52509. return $core.withContext(function($ctx1) {
  52510. var $3,$2,$1;
  52511. $3=self._collection();
  52512. $ctx1.sendIdx["collection"]=1;
  52513. $2=$recv($3)._copy();
  52514. $1=$recv($2).__eq_eq(self._collection());
  52515. self._assert_($1);
  52516. return self;
  52517. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  52518. },
  52519. args: [],
  52520. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  52521. referencedClasses: [],
  52522. messageSends: ["assert:", "==", "copy", "collection"]
  52523. }),
  52524. $globals.StringTest);
  52525. $core.addMethod(
  52526. $core.method({
  52527. selector: "testCopyWithoutAll",
  52528. protocol: 'tests',
  52529. fn: function (){
  52530. var self=this;
  52531. return $core.withContext(function($ctx1) {
  52532. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  52533. return self;
  52534. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  52535. },
  52536. args: [],
  52537. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  52538. referencedClasses: [],
  52539. messageSends: ["assert:equals:", "copyWithoutAll:"]
  52540. }),
  52541. $globals.StringTest);
  52542. $core.addMethod(
  52543. $core.method({
  52544. selector: "testEquality",
  52545. protocol: 'tests',
  52546. fn: function (){
  52547. var self=this;
  52548. return $core.withContext(function($ctx1) {
  52549. var $1,$2,$3;
  52550. self._assert_equals_("hello","hello");
  52551. $ctx1.sendIdx["assert:equals:"]=1;
  52552. $1="hello".__eq("world");
  52553. $ctx1.sendIdx["="]=1;
  52554. self._deny_($1);
  52555. $ctx1.sendIdx["deny:"]=1;
  52556. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  52557. })));
  52558. $ctx1.sendIdx["="]=2;
  52559. self._deny_($2);
  52560. $ctx1.sendIdx["deny:"]=2;
  52561. $3="hello"._yourself();
  52562. $ctx1.sendIdx["yourself"]=1;
  52563. self._assert_equals_("hello",$3);
  52564. $ctx1.sendIdx["assert:equals:"]=2;
  52565. self._assert_equals_("hello"._yourself(),"hello");
  52566. self._deny_("".__eq((0)));
  52567. return self;
  52568. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  52569. },
  52570. args: [],
  52571. 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",
  52572. referencedClasses: [],
  52573. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  52574. }),
  52575. $globals.StringTest);
  52576. $core.addMethod(
  52577. $core.method({
  52578. selector: "testIdentity",
  52579. protocol: 'tests',
  52580. fn: function (){
  52581. var self=this;
  52582. return $core.withContext(function($ctx1) {
  52583. var $1,$2,$4,$3,$5;
  52584. $1="hello".__eq_eq("hello");
  52585. $ctx1.sendIdx["=="]=1;
  52586. self._assert_($1);
  52587. $ctx1.sendIdx["assert:"]=1;
  52588. $2="hello".__eq_eq("world");
  52589. $ctx1.sendIdx["=="]=2;
  52590. self._deny_($2);
  52591. $ctx1.sendIdx["deny:"]=1;
  52592. $4="hello"._yourself();
  52593. $ctx1.sendIdx["yourself"]=1;
  52594. $3="hello".__eq_eq($4);
  52595. $ctx1.sendIdx["=="]=3;
  52596. self._assert_($3);
  52597. $ctx1.sendIdx["assert:"]=2;
  52598. $5=$recv("hello"._yourself()).__eq_eq("hello");
  52599. $ctx1.sendIdx["=="]=4;
  52600. self._assert_($5);
  52601. self._deny_("".__eq_eq((0)));
  52602. return self;
  52603. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  52604. },
  52605. args: [],
  52606. 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",
  52607. referencedClasses: [],
  52608. messageSends: ["assert:", "==", "deny:", "yourself"]
  52609. }),
  52610. $globals.StringTest);
  52611. $core.addMethod(
  52612. $core.method({
  52613. selector: "testIncludesSubString",
  52614. protocol: 'tests',
  52615. fn: function (){
  52616. var self=this;
  52617. return $core.withContext(function($ctx1) {
  52618. var $1;
  52619. $1="amber"._includesSubString_("ber");
  52620. $ctx1.sendIdx["includesSubString:"]=1;
  52621. self._assert_($1);
  52622. self._deny_("amber"._includesSubString_("zork"));
  52623. return self;
  52624. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  52625. },
  52626. args: [],
  52627. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  52628. referencedClasses: [],
  52629. messageSends: ["assert:", "includesSubString:", "deny:"]
  52630. }),
  52631. $globals.StringTest);
  52632. $core.addMethod(
  52633. $core.method({
  52634. selector: "testIndexOfStartingAtWithNull",
  52635. protocol: 'tests',
  52636. fn: function (){
  52637. var self=this;
  52638. return self;
  52639. },
  52640. args: [],
  52641. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  52642. referencedClasses: [],
  52643. messageSends: []
  52644. }),
  52645. $globals.StringTest);
  52646. $core.addMethod(
  52647. $core.method({
  52648. selector: "testIndexOfWithNull",
  52649. protocol: 'tests',
  52650. fn: function (){
  52651. var self=this;
  52652. return self;
  52653. },
  52654. args: [],
  52655. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  52656. referencedClasses: [],
  52657. messageSends: []
  52658. }),
  52659. $globals.StringTest);
  52660. $core.addMethod(
  52661. $core.method({
  52662. selector: "testIsVowel",
  52663. protocol: 'tests',
  52664. fn: function (){
  52665. var self=this;
  52666. var vowel,consonant;
  52667. return $core.withContext(function($ctx1) {
  52668. var $1;
  52669. vowel="u";
  52670. consonant="z";
  52671. $1=$recv(vowel)._isVowel();
  52672. $ctx1.sendIdx["isVowel"]=1;
  52673. self._assert_equals_($1,true);
  52674. $ctx1.sendIdx["assert:equals:"]=1;
  52675. self._assert_equals_($recv(consonant)._isVowel(),false);
  52676. return self;
  52677. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  52678. },
  52679. args: [],
  52680. 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",
  52681. referencedClasses: [],
  52682. messageSends: ["assert:equals:", "isVowel"]
  52683. }),
  52684. $globals.StringTest);
  52685. $core.addMethod(
  52686. $core.method({
  52687. selector: "testJoin",
  52688. protocol: 'tests',
  52689. fn: function (){
  52690. var self=this;
  52691. return $core.withContext(function($ctx1) {
  52692. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  52693. return self;
  52694. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  52695. },
  52696. args: [],
  52697. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  52698. referencedClasses: [],
  52699. messageSends: ["assert:equals:", "join:"]
  52700. }),
  52701. $globals.StringTest);
  52702. $core.addMethod(
  52703. $core.method({
  52704. selector: "testRemoveAll",
  52705. protocol: 'tests',
  52706. fn: function (){
  52707. var self=this;
  52708. return $core.withContext(function($ctx1) {
  52709. self._should_raise_((function(){
  52710. return $core.withContext(function($ctx2) {
  52711. return $recv(self._collection())._removeAll();
  52712. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52713. }),$globals.Error);
  52714. return self;
  52715. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  52716. },
  52717. args: [],
  52718. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  52719. referencedClasses: ["Error"],
  52720. messageSends: ["should:raise:", "removeAll", "collection"]
  52721. }),
  52722. $globals.StringTest);
  52723. $core.addMethod(
  52724. $core.method({
  52725. selector: "testReversed",
  52726. protocol: 'tests',
  52727. fn: function (){
  52728. var self=this;
  52729. return $core.withContext(function($ctx1) {
  52730. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  52731. return self;
  52732. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  52733. },
  52734. args: [],
  52735. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  52736. referencedClasses: [],
  52737. messageSends: ["assert:equals:", "reversed"]
  52738. }),
  52739. $globals.StringTest);
  52740. $core.addMethod(
  52741. $core.method({
  52742. selector: "testStreamContents",
  52743. protocol: 'tests',
  52744. fn: function (){
  52745. var self=this;
  52746. return $core.withContext(function($ctx1) {
  52747. self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  52748. return $core.withContext(function($ctx2) {
  52749. $recv(aStream)._nextPutAll_("hello");
  52750. $ctx2.sendIdx["nextPutAll:"]=1;
  52751. $recv(aStream)._space();
  52752. return $recv(aStream)._nextPutAll_("world");
  52753. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  52754. })),"hello world");
  52755. return self;
  52756. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  52757. },
  52758. args: [],
  52759. 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'",
  52760. referencedClasses: ["String"],
  52761. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  52762. }),
  52763. $globals.StringTest);
  52764. $core.addMethod(
  52765. $core.method({
  52766. selector: "testSubStrings",
  52767. protocol: 'tests',
  52768. fn: function (){
  52769. var self=this;
  52770. return $core.withContext(function($ctx1) {
  52771. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  52772. return self;
  52773. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  52774. },
  52775. args: [],
  52776. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  52777. referencedClasses: [],
  52778. messageSends: ["assert:equals:", "subStrings:"]
  52779. }),
  52780. $globals.StringTest);
  52781. $core.addMethod(
  52782. $core.method({
  52783. selector: "testTrim",
  52784. protocol: 'tests',
  52785. fn: function (){
  52786. var self=this;
  52787. return $core.withContext(function($ctx1) {
  52788. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  52789. $ctx1.sendIdx["assert:equals:"]=1;
  52790. self._assert_equals_("jackie "._trimRight(),"jackie");
  52791. return self;
  52792. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  52793. },
  52794. args: [],
  52795. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  52796. referencedClasses: [],
  52797. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  52798. }),
  52799. $globals.StringTest);
  52800. $core.addMethod(
  52801. $core.method({
  52802. selector: "testValue",
  52803. protocol: 'tests',
  52804. fn: function (){
  52805. var self=this;
  52806. return $core.withContext(function($ctx1) {
  52807. self._assert_equals_("asString"._value_((1)),"1");
  52808. $ctx1.sendIdx["assert:equals:"]=1;
  52809. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  52810. return self;
  52811. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  52812. },
  52813. args: [],
  52814. 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')",
  52815. referencedClasses: [],
  52816. messageSends: ["assert:equals:", "value:", "collect:"]
  52817. }),
  52818. $globals.StringTest);
  52819. $core.addMethod(
  52820. $core.method({
  52821. selector: "collectionClass",
  52822. protocol: 'fixture',
  52823. fn: function (){
  52824. var self=this;
  52825. return $globals.String;
  52826. },
  52827. args: [],
  52828. source: "collectionClass\x0a\x09^ String",
  52829. referencedClasses: ["String"],
  52830. messageSends: []
  52831. }),
  52832. $globals.StringTest.klass);
  52833. $core.addClass('SetTest', $globals.CollectionTest, [], 'Kernel-Tests');
  52834. $core.addMethod(
  52835. $core.method({
  52836. selector: "collection",
  52837. protocol: 'fixture',
  52838. fn: function (){
  52839. var self=this;
  52840. return $core.withContext(function($ctx1) {
  52841. var $1;
  52842. $1=$recv($globals.Set)._new();
  52843. $recv($1)._add_($globals.Smalltalk);
  52844. $ctx1.sendIdx["add:"]=1;
  52845. $recv($1)._add_(nil);
  52846. $ctx1.sendIdx["add:"]=2;
  52847. $recv($1)._add_((3).__at((3)));
  52848. $ctx1.sendIdx["add:"]=3;
  52849. $recv($1)._add_(false);
  52850. $ctx1.sendIdx["add:"]=4;
  52851. $recv($1)._add_(self["@sampleBlock"]);
  52852. return $recv($1)._yourself();
  52853. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  52854. },
  52855. args: [],
  52856. 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",
  52857. referencedClasses: ["Set", "Smalltalk"],
  52858. messageSends: ["add:", "new", "@", "yourself"]
  52859. }),
  52860. $globals.SetTest);
  52861. $core.addMethod(
  52862. $core.method({
  52863. selector: "collectionOfPrintStrings",
  52864. protocol: 'fixture',
  52865. fn: function (){
  52866. var self=this;
  52867. return $core.withContext(function($ctx1) {
  52868. var $1;
  52869. $1=$recv($globals.Set)._new();
  52870. $recv($1)._add_("a SmalltalkImage");
  52871. $ctx1.sendIdx["add:"]=1;
  52872. $recv($1)._add_("nil");
  52873. $ctx1.sendIdx["add:"]=2;
  52874. $recv($1)._add_("3@3");
  52875. $ctx1.sendIdx["add:"]=3;
  52876. $recv($1)._add_("false");
  52877. $ctx1.sendIdx["add:"]=4;
  52878. $recv($1)._add_("a BlockClosure");
  52879. return $recv($1)._yourself();
  52880. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  52881. },
  52882. args: [],
  52883. 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",
  52884. referencedClasses: ["Set"],
  52885. messageSends: ["add:", "new", "yourself"]
  52886. }),
  52887. $globals.SetTest);
  52888. $core.addMethod(
  52889. $core.method({
  52890. selector: "collectionSize",
  52891. protocol: 'fixture',
  52892. fn: function (){
  52893. var self=this;
  52894. return (5);
  52895. },
  52896. args: [],
  52897. source: "collectionSize\x0a\x09^ 5",
  52898. referencedClasses: [],
  52899. messageSends: []
  52900. }),
  52901. $globals.SetTest);
  52902. $core.addMethod(
  52903. $core.method({
  52904. selector: "collectionWithDuplicates",
  52905. protocol: 'fixture',
  52906. fn: function (){
  52907. var self=this;
  52908. return $core.withContext(function($ctx1) {
  52909. var $1;
  52910. $1=self._collection();
  52911. $recv($1)._add_((0));
  52912. return $recv($1)._yourself();
  52913. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  52914. },
  52915. args: [],
  52916. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  52917. referencedClasses: [],
  52918. messageSends: ["add:", "collection", "yourself"]
  52919. }),
  52920. $globals.SetTest);
  52921. $core.addMethod(
  52922. $core.method({
  52923. selector: "collectionWithNewValue",
  52924. protocol: 'fixture',
  52925. fn: function (){
  52926. var self=this;
  52927. return $core.withContext(function($ctx1) {
  52928. var $1;
  52929. $1=$recv($globals.Set)._new();
  52930. $recv($1)._add_($globals.Smalltalk);
  52931. $ctx1.sendIdx["add:"]=1;
  52932. $recv($1)._add_(nil);
  52933. $ctx1.sendIdx["add:"]=2;
  52934. $recv($1)._add_((3).__at((3)));
  52935. $ctx1.sendIdx["add:"]=3;
  52936. $recv($1)._add_("N");
  52937. $ctx1.sendIdx["add:"]=4;
  52938. $recv($1)._add_(false);
  52939. $ctx1.sendIdx["add:"]=5;
  52940. $recv($1)._add_(self["@sampleBlock"]);
  52941. return $recv($1)._yourself();
  52942. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  52943. },
  52944. args: [],
  52945. 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",
  52946. referencedClasses: ["Set", "Smalltalk"],
  52947. messageSends: ["add:", "new", "@", "yourself"]
  52948. }),
  52949. $globals.SetTest);
  52950. $core.addMethod(
  52951. $core.method({
  52952. selector: "testAddAll",
  52953. protocol: 'tests',
  52954. fn: function (){
  52955. var self=this;
  52956. return $core.withContext(function($ctx1) {
  52957. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  52958. (
  52959. $ctx1.supercall = true,
  52960. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($recv(self), []));
  52961. $ctx1.supercall = false;
  52962. $2=self._collection();
  52963. $ctx1.sendIdx["collection"]=1;
  52964. $3=self._collection();
  52965. $ctx1.sendIdx["collection"]=2;
  52966. $recv($2)._addAll_($3);
  52967. $ctx1.sendIdx["addAll:"]=1;
  52968. $4=$recv($2)._yourself();
  52969. $ctx1.sendIdx["yourself"]=1;
  52970. $1=$4;
  52971. $5=self._collection();
  52972. $ctx1.sendIdx["collection"]=3;
  52973. self._assert_equals_($1,$5);
  52974. $ctx1.sendIdx["assert:equals:"]=1;
  52975. $7=self._collection();
  52976. $ctx1.sendIdx["collection"]=4;
  52977. $8=self._collectionWithNewValue();
  52978. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52979. $recv($7)._addAll_($8);
  52980. $ctx1.sendIdx["addAll:"]=2;
  52981. $9=$recv($7)._yourself();
  52982. $ctx1.sendIdx["yourself"]=2;
  52983. $6=$9;
  52984. $10=self._collectionWithNewValue();
  52985. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52986. self._assert_equals_($6,$10);
  52987. $ctx1.sendIdx["assert:equals:"]=2;
  52988. $12=self._collectionWithNewValue();
  52989. $ctx1.sendIdx["collectionWithNewValue"]=3;
  52990. $recv($12)._addAll_(self._collection());
  52991. $11=$recv($12)._yourself();
  52992. self._assert_equals_($11,self._collectionWithNewValue());
  52993. return self;
  52994. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  52995. },
  52996. args: [],
  52997. 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",
  52998. referencedClasses: [],
  52999. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  53000. }),
  53001. $globals.SetTest);
  53002. $core.addMethod(
  53003. $core.method({
  53004. selector: "testAddRemove",
  53005. protocol: 'tests',
  53006. fn: function (){
  53007. var self=this;
  53008. var set;
  53009. return $core.withContext(function($ctx1) {
  53010. var $1,$2;
  53011. set=$recv($globals.Set)._new();
  53012. self._assert_($recv(set)._isEmpty());
  53013. $ctx1.sendIdx["assert:"]=1;
  53014. $recv(set)._add_((3));
  53015. $ctx1.sendIdx["add:"]=1;
  53016. $1=$recv(set)._includes_((3));
  53017. $ctx1.sendIdx["includes:"]=1;
  53018. self._assert_($1);
  53019. $ctx1.sendIdx["assert:"]=2;
  53020. $recv(set)._add_((5));
  53021. $2=$recv(set)._includes_((5));
  53022. $ctx1.sendIdx["includes:"]=2;
  53023. self._assert_($2);
  53024. $recv(set)._remove_((3));
  53025. self._deny_($recv(set)._includes_((3)));
  53026. return self;
  53027. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  53028. },
  53029. args: [],
  53030. 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)",
  53031. referencedClasses: ["Set"],
  53032. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  53033. }),
  53034. $globals.SetTest);
  53035. $core.addMethod(
  53036. $core.method({
  53037. selector: "testAt",
  53038. protocol: 'tests',
  53039. fn: function (){
  53040. var self=this;
  53041. return $core.withContext(function($ctx1) {
  53042. self._should_raise_((function(){
  53043. return $core.withContext(function($ctx2) {
  53044. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  53045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53046. }),$globals.Error);
  53047. return self;
  53048. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  53049. },
  53050. args: [],
  53051. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  53052. referencedClasses: ["Set", "Error"],
  53053. messageSends: ["should:raise:", "at:put:", "new"]
  53054. }),
  53055. $globals.SetTest);
  53056. $core.addMethod(
  53057. $core.method({
  53058. selector: "testCollect",
  53059. protocol: 'tests',
  53060. fn: function (){
  53061. var self=this;
  53062. return $core.withContext(function($ctx1) {
  53063. var $2,$1;
  53064. (
  53065. $ctx1.supercall = true,
  53066. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($recv(self), []));
  53067. $ctx1.supercall = false;
  53068. $2=[(5), (6), (8)]._asSet();
  53069. $ctx1.sendIdx["asSet"]=1;
  53070. $1=$recv($2)._collect_((function(x){
  53071. return $core.withContext(function($ctx2) {
  53072. return $recv(x).__backslash_backslash((3));
  53073. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53074. }));
  53075. self._assert_equals_($1,[(0), (2)]._asSet());
  53076. return self;
  53077. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  53078. },
  53079. args: [],
  53080. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  53081. referencedClasses: [],
  53082. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  53083. }),
  53084. $globals.SetTest);
  53085. $core.addMethod(
  53086. $core.method({
  53087. selector: "testComma",
  53088. protocol: 'tests',
  53089. fn: function (){
  53090. var self=this;
  53091. return $core.withContext(function($ctx1) {
  53092. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  53093. (
  53094. $ctx1.supercall = true,
  53095. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($recv(self), []));
  53096. $ctx1.supercall = false;
  53097. $2=self._collection();
  53098. $ctx1.sendIdx["collection"]=1;
  53099. $3=self._collection();
  53100. $ctx1.sendIdx["collection"]=2;
  53101. $1=$recv($2).__comma($3);
  53102. $ctx1.sendIdx[","]=1;
  53103. $4=self._collection();
  53104. $ctx1.sendIdx["collection"]=3;
  53105. self._assert_equals_($1,$4);
  53106. $ctx1.sendIdx["assert:equals:"]=1;
  53107. $6=self._collection();
  53108. $ctx1.sendIdx["collection"]=4;
  53109. $7=self._collectionWithNewValue();
  53110. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53111. $5=$recv($6).__comma($7);
  53112. $ctx1.sendIdx[","]=2;
  53113. $8=self._collectionWithNewValue();
  53114. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53115. self._assert_equals_($5,$8);
  53116. $ctx1.sendIdx["assert:equals:"]=2;
  53117. $10=self._collectionWithNewValue();
  53118. $ctx1.sendIdx["collectionWithNewValue"]=3;
  53119. $9=$recv($10).__comma(self._collection());
  53120. self._assert_equals_($9,self._collectionWithNewValue());
  53121. return self;
  53122. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  53123. },
  53124. args: [],
  53125. 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",
  53126. referencedClasses: [],
  53127. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  53128. }),
  53129. $globals.SetTest);
  53130. $core.addMethod(
  53131. $core.method({
  53132. selector: "testComparing",
  53133. protocol: 'tests',
  53134. fn: function (){
  53135. var self=this;
  53136. return $core.withContext(function($ctx1) {
  53137. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  53138. $1=[(0), (2)]._asSet();
  53139. $ctx1.sendIdx["asSet"]=1;
  53140. $2=[(0), (2)]._asSet();
  53141. $ctx1.sendIdx["asSet"]=2;
  53142. self._assert_equals_($1,$2);
  53143. $ctx1.sendIdx["assert:equals:"]=1;
  53144. $3=[(2), (0)]._asSet();
  53145. $ctx1.sendIdx["asSet"]=3;
  53146. $4=[(0), (2)]._asSet();
  53147. $ctx1.sendIdx["asSet"]=4;
  53148. self._assert_equals_($3,$4);
  53149. $6=[(0), (2), (3)]._asSet();
  53150. $ctx1.sendIdx["asSet"]=5;
  53151. $7=[(0), (2)]._asSet();
  53152. $ctx1.sendIdx["asSet"]=6;
  53153. $5=$recv($6).__eq($7);
  53154. $ctx1.sendIdx["="]=1;
  53155. self._deny_($5);
  53156. $ctx1.sendIdx["deny:"]=1;
  53157. $9=[(1), (2)]._asSet();
  53158. $ctx1.sendIdx["asSet"]=7;
  53159. $8=$recv($9).__eq([(0), (2)]._asSet());
  53160. self._deny_($8);
  53161. return self;
  53162. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  53163. },
  53164. args: [],
  53165. 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",
  53166. referencedClasses: [],
  53167. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  53168. }),
  53169. $globals.SetTest);
  53170. $core.addMethod(
  53171. $core.method({
  53172. selector: "testPrintString",
  53173. protocol: 'tests',
  53174. fn: function (){
  53175. var self=this;
  53176. var set;
  53177. return $core.withContext(function($ctx1) {
  53178. var $1,$2,$3,$4,$5,$6,$7,$8;
  53179. set=$recv($globals.Set)._new();
  53180. $1=$recv(set)._printString();
  53181. $ctx1.sendIdx["printString"]=1;
  53182. self._assert_equals_($1,"a Set ()");
  53183. $ctx1.sendIdx["assert:equals:"]=1;
  53184. $2=set;
  53185. $recv($2)._add_((1));
  53186. $ctx1.sendIdx["add:"]=1;
  53187. $3=$recv($2)._add_((3));
  53188. $ctx1.sendIdx["add:"]=2;
  53189. $4=$recv(set)._printString();
  53190. $ctx1.sendIdx["printString"]=2;
  53191. self._assert_equals_($4,"a Set (1 3)");
  53192. $ctx1.sendIdx["assert:equals:"]=2;
  53193. $recv(set)._add_("foo");
  53194. $ctx1.sendIdx["add:"]=3;
  53195. $5=$recv(set)._printString();
  53196. $ctx1.sendIdx["printString"]=3;
  53197. self._assert_equals_($5,"a Set (1 3 'foo')");
  53198. $ctx1.sendIdx["assert:equals:"]=3;
  53199. $6=set;
  53200. $recv($6)._remove_((1));
  53201. $ctx1.sendIdx["remove:"]=1;
  53202. $recv($6)._remove_((3));
  53203. $7=$recv(set)._printString();
  53204. $ctx1.sendIdx["printString"]=4;
  53205. self._assert_equals_($7,"a Set ('foo')");
  53206. $ctx1.sendIdx["assert:equals:"]=4;
  53207. $recv(set)._add_((3));
  53208. $ctx1.sendIdx["add:"]=4;
  53209. $8=$recv(set)._printString();
  53210. $ctx1.sendIdx["printString"]=5;
  53211. self._assert_equals_($8,"a Set (3 'foo')");
  53212. $ctx1.sendIdx["assert:equals:"]=5;
  53213. $recv(set)._add_((3));
  53214. self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  53215. return self;
  53216. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  53217. },
  53218. args: [],
  53219. 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'')'",
  53220. referencedClasses: ["Set"],
  53221. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  53222. }),
  53223. $globals.SetTest);
  53224. $core.addMethod(
  53225. $core.method({
  53226. selector: "testUnboxedObjects",
  53227. protocol: 'tests',
  53228. fn: function (){
  53229. var self=this;
  53230. return $core.withContext(function($ctx1) {
  53231. var $4,$3,$2,$1;
  53232. $4="foo"._yourself();
  53233. $ctx1.sendIdx["yourself"]=1;
  53234. $3=[$4,"foo"._yourself()];
  53235. $2=$recv($3)._asSet();
  53236. $1=$recv($2)._asArray();
  53237. self._assert_equals_($1,["foo"]);
  53238. return self;
  53239. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  53240. },
  53241. args: [],
  53242. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  53243. referencedClasses: [],
  53244. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  53245. }),
  53246. $globals.SetTest);
  53247. $core.addMethod(
  53248. $core.method({
  53249. selector: "testUnicity",
  53250. protocol: 'tests',
  53251. fn: function (){
  53252. var self=this;
  53253. var set;
  53254. return $core.withContext(function($ctx1) {
  53255. var $1;
  53256. set=$recv($globals.Set)._new();
  53257. $recv(set)._add_((21));
  53258. $ctx1.sendIdx["add:"]=1;
  53259. $recv(set)._add_("hello");
  53260. $ctx1.sendIdx["add:"]=2;
  53261. $recv(set)._add_((21));
  53262. $ctx1.sendIdx["add:"]=3;
  53263. $1=$recv(set)._size();
  53264. $ctx1.sendIdx["size"]=1;
  53265. self._assert_equals_($1,(2));
  53266. $ctx1.sendIdx["assert:equals:"]=1;
  53267. $recv(set)._add_("hello");
  53268. self._assert_equals_($recv(set)._size(),(2));
  53269. $ctx1.sendIdx["assert:equals:"]=2;
  53270. self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  53271. return self;
  53272. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  53273. },
  53274. args: [],
  53275. 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')",
  53276. referencedClasses: ["Set"],
  53277. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  53278. }),
  53279. $globals.SetTest);
  53280. $core.addMethod(
  53281. $core.method({
  53282. selector: "collectionClass",
  53283. protocol: 'fixture',
  53284. fn: function (){
  53285. var self=this;
  53286. return $globals.Set;
  53287. },
  53288. args: [],
  53289. source: "collectionClass\x0a\x09^ Set",
  53290. referencedClasses: ["Set"],
  53291. messageSends: []
  53292. }),
  53293. $globals.SetTest.klass);
  53294. $core.addClass('ConsoleTranscriptTest', $globals.TestCase, [], 'Kernel-Tests');
  53295. $core.addMethod(
  53296. $core.method({
  53297. selector: "testShow",
  53298. protocol: 'tests',
  53299. fn: function (){
  53300. var self=this;
  53301. var originalTranscript;
  53302. return $core.withContext(function($ctx1) {
  53303. originalTranscript=$recv($globals.Transcript)._current();
  53304. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  53305. $ctx1.sendIdx["register:"]=1;
  53306. self._shouldnt_raise_((function(){
  53307. return $core.withContext(function($ctx2) {
  53308. return $recv($globals.Transcript)._show_("Hello console!");
  53309. $ctx2.sendIdx["show:"]=1;
  53310. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53311. }),$globals.Error);
  53312. $ctx1.sendIdx["shouldnt:raise:"]=1;
  53313. self._shouldnt_raise_((function(){
  53314. return $core.withContext(function($ctx2) {
  53315. return $recv($globals.Transcript)._show_(console);
  53316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53317. }),$globals.Error);
  53318. $recv($globals.Transcript)._register_(originalTranscript);
  53319. return self;
  53320. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  53321. },
  53322. args: [],
  53323. 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.",
  53324. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  53325. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  53326. }),
  53327. $globals.ConsoleTranscriptTest);
  53328. $core.addClass('DateTest', $globals.TestCase, [], 'Kernel-Tests');
  53329. $core.addMethod(
  53330. $core.method({
  53331. selector: "testEquality",
  53332. protocol: 'tests',
  53333. fn: function (){
  53334. var self=this;
  53335. var now;
  53336. return $core.withContext(function($ctx1) {
  53337. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  53338. now=$recv($globals.Date)._new();
  53339. $1=$recv(now).__eq(now);
  53340. $ctx1.sendIdx["="]=1;
  53341. self._assert_($1);
  53342. $ctx1.sendIdx["assert:"]=1;
  53343. $3=now;
  53344. $4=$recv($globals.Date)._fromMilliseconds_((0));
  53345. $ctx1.sendIdx["fromMilliseconds:"]=1;
  53346. $2=$recv($3).__eq($4);
  53347. $ctx1.sendIdx["="]=2;
  53348. self._deny_($2);
  53349. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  53350. $ctx1.sendIdx["fromMilliseconds:"]=2;
  53351. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  53352. $ctx1.sendIdx["fromMilliseconds:"]=3;
  53353. $5=$recv($6).__eq($7);
  53354. $ctx1.sendIdx["="]=3;
  53355. self._assert_($5);
  53356. $ctx1.sendIdx["assert:"]=2;
  53357. $9=now;
  53358. $11=$recv(now)._asMilliseconds();
  53359. $ctx1.sendIdx["asMilliseconds"]=1;
  53360. $10=$recv($globals.Date)._fromMilliseconds_($11);
  53361. $ctx1.sendIdx["fromMilliseconds:"]=4;
  53362. $8=$recv($9).__eq($10);
  53363. $ctx1.sendIdx["="]=4;
  53364. self._assert_($8);
  53365. $ctx1.sendIdx["assert:"]=3;
  53366. self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  53367. return self;
  53368. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  53369. },
  53370. args: [],
  53371. 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",
  53372. referencedClasses: ["Date"],
  53373. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  53374. }),
  53375. $globals.DateTest);
  53376. $core.addMethod(
  53377. $core.method({
  53378. selector: "testIdentity",
  53379. protocol: 'tests',
  53380. fn: function (){
  53381. var self=this;
  53382. var now;
  53383. return $core.withContext(function($ctx1) {
  53384. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  53385. now=$recv($globals.Date)._new();
  53386. $1=$recv(now).__eq_eq(now);
  53387. $ctx1.sendIdx["=="]=1;
  53388. self._assert_($1);
  53389. $3=now;
  53390. $4=$recv($globals.Date)._fromMilliseconds_((0));
  53391. $ctx1.sendIdx["fromMilliseconds:"]=1;
  53392. $2=$recv($3).__eq_eq($4);
  53393. $ctx1.sendIdx["=="]=2;
  53394. self._deny_($2);
  53395. $ctx1.sendIdx["deny:"]=1;
  53396. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  53397. $ctx1.sendIdx["fromMilliseconds:"]=2;
  53398. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  53399. $ctx1.sendIdx["fromMilliseconds:"]=3;
  53400. $5=$recv($6).__eq_eq($7);
  53401. $ctx1.sendIdx["=="]=3;
  53402. self._deny_($5);
  53403. $ctx1.sendIdx["deny:"]=2;
  53404. $9=now;
  53405. $11=$recv(now)._asMilliseconds();
  53406. $ctx1.sendIdx["asMilliseconds"]=1;
  53407. $10=$recv($globals.Date)._fromMilliseconds_($11);
  53408. $ctx1.sendIdx["fromMilliseconds:"]=4;
  53409. $8=$recv($9).__eq_eq($10);
  53410. $ctx1.sendIdx["=="]=4;
  53411. self._deny_($8);
  53412. $ctx1.sendIdx["deny:"]=3;
  53413. self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  53414. return self;
  53415. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  53416. },
  53417. args: [],
  53418. 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",
  53419. referencedClasses: ["Date"],
  53420. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  53421. }),
  53422. $globals.DateTest);
  53423. $core.addClass('JSObjectProxyTest', $globals.TestCase, [], 'Kernel-Tests');
  53424. $core.addMethod(
  53425. $core.method({
  53426. selector: "jsNull",
  53427. protocol: 'accessing',
  53428. fn: function (){
  53429. var self=this;
  53430. return $core.withContext(function($ctx1) {
  53431. return null;
  53432. return self;
  53433. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  53434. },
  53435. args: [],
  53436. source: "jsNull\x0a\x09<return null>",
  53437. referencedClasses: [],
  53438. messageSends: []
  53439. }),
  53440. $globals.JSObjectProxyTest);
  53441. $core.addMethod(
  53442. $core.method({
  53443. selector: "jsObject",
  53444. protocol: 'accessing',
  53445. fn: function (){
  53446. var self=this;
  53447. return $core.withContext(function($ctx1) {
  53448. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  53449. return self;
  53450. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  53451. },
  53452. args: [],
  53453. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  53454. referencedClasses: [],
  53455. messageSends: []
  53456. }),
  53457. $globals.JSObjectProxyTest);
  53458. $core.addMethod(
  53459. $core.method({
  53460. selector: "jsUndefined",
  53461. protocol: 'accessing',
  53462. fn: function (){
  53463. var self=this;
  53464. return $core.withContext(function($ctx1) {
  53465. return;
  53466. return self;
  53467. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  53468. },
  53469. args: [],
  53470. source: "jsUndefined\x0a\x09<return>",
  53471. referencedClasses: [],
  53472. messageSends: []
  53473. }),
  53474. $globals.JSObjectProxyTest);
  53475. $core.addMethod(
  53476. $core.method({
  53477. selector: "testAtIfAbsent",
  53478. protocol: 'tests',
  53479. fn: function (){
  53480. var self=this;
  53481. var testObject;
  53482. return $core.withContext(function($ctx1) {
  53483. var $1,$2,$3;
  53484. testObject=self._jsObject();
  53485. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  53486. return "Property does not exist";
  53487. }));
  53488. $ctx1.sendIdx["at:ifAbsent:"]=1;
  53489. self._assert_equals_($1,"Property does not exist");
  53490. $ctx1.sendIdx["assert:equals:"]=1;
  53491. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  53492. return "Property does not exist";
  53493. }));
  53494. $ctx1.sendIdx["at:ifAbsent:"]=2;
  53495. self._assert_equals_($2,nil);
  53496. $ctx1.sendIdx["assert:equals:"]=2;
  53497. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  53498. return "Property does not exist";
  53499. }));
  53500. $ctx1.sendIdx["at:ifAbsent:"]=3;
  53501. self._assert_equals_($3,(1));
  53502. $ctx1.sendIdx["assert:equals:"]=3;
  53503. self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  53504. return "Property does not exist";
  53505. })),nil);
  53506. return self;
  53507. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53508. },
  53509. args: [],
  53510. 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.",
  53511. referencedClasses: [],
  53512. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  53513. }),
  53514. $globals.JSObjectProxyTest);
  53515. $core.addMethod(
  53516. $core.method({
  53517. selector: "testAtIfPresent",
  53518. protocol: 'tests',
  53519. fn: function (){
  53520. var self=this;
  53521. var testObject;
  53522. return $core.withContext(function($ctx1) {
  53523. var $2,$1,$4,$3,$6,$5;
  53524. testObject=self._jsObject();
  53525. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  53526. return $core.withContext(function($ctx2) {
  53527. $2=$recv(x)._asString();
  53528. $ctx2.sendIdx["asString"]=1;
  53529. return "hello ".__comma($2);
  53530. $ctx2.sendIdx[","]=1;
  53531. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53532. }));
  53533. $ctx1.sendIdx["at:ifPresent:"]=1;
  53534. self._assert_equals_($1,nil);
  53535. $ctx1.sendIdx["assert:equals:"]=1;
  53536. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  53537. return $core.withContext(function($ctx2) {
  53538. $4=$recv(x)._asString();
  53539. $ctx2.sendIdx["asString"]=2;
  53540. return "hello ".__comma($4);
  53541. $ctx2.sendIdx[","]=2;
  53542. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  53543. }));
  53544. $ctx1.sendIdx["at:ifPresent:"]=2;
  53545. self._assert_equals_($3,"hello nil");
  53546. $ctx1.sendIdx["assert:equals:"]=2;
  53547. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  53548. return $core.withContext(function($ctx2) {
  53549. $6=$recv(x)._asString();
  53550. $ctx2.sendIdx["asString"]=3;
  53551. return "hello ".__comma($6);
  53552. $ctx2.sendIdx[","]=3;
  53553. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  53554. }));
  53555. $ctx1.sendIdx["at:ifPresent:"]=3;
  53556. self._assert_equals_($5,"hello 1");
  53557. $ctx1.sendIdx["assert:equals:"]=3;
  53558. self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  53559. return $core.withContext(function($ctx2) {
  53560. return "hello ".__comma($recv(x)._asString());
  53561. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  53562. })),"hello nil");
  53563. return self;
  53564. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53565. },
  53566. args: [],
  53567. 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'.",
  53568. referencedClasses: [],
  53569. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  53570. }),
  53571. $globals.JSObjectProxyTest);
  53572. $core.addMethod(
  53573. $core.method({
  53574. selector: "testAtIfPresentIfAbsent",
  53575. protocol: 'tests',
  53576. fn: function (){
  53577. var self=this;
  53578. var testObject;
  53579. return $core.withContext(function($ctx1) {
  53580. var $2,$1,$4,$3,$6,$5;
  53581. testObject=self._jsObject();
  53582. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  53583. return $core.withContext(function($ctx2) {
  53584. $2=$recv(x)._asString();
  53585. $ctx2.sendIdx["asString"]=1;
  53586. return "hello ".__comma($2);
  53587. $ctx2.sendIdx[","]=1;
  53588. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53589. }),(function(){
  53590. return "not present";
  53591. }));
  53592. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  53593. self._assert_equals_($1,"not present");
  53594. $ctx1.sendIdx["assert:equals:"]=1;
  53595. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  53596. return $core.withContext(function($ctx2) {
  53597. $4=$recv(x)._asString();
  53598. $ctx2.sendIdx["asString"]=2;
  53599. return "hello ".__comma($4);
  53600. $ctx2.sendIdx[","]=2;
  53601. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  53602. }),(function(){
  53603. return "not present";
  53604. }));
  53605. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  53606. self._assert_equals_($3,"hello nil");
  53607. $ctx1.sendIdx["assert:equals:"]=2;
  53608. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  53609. return $core.withContext(function($ctx2) {
  53610. $6=$recv(x)._asString();
  53611. $ctx2.sendIdx["asString"]=3;
  53612. return "hello ".__comma($6);
  53613. $ctx2.sendIdx[","]=3;
  53614. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  53615. }),(function(){
  53616. return "not present";
  53617. }));
  53618. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  53619. self._assert_equals_($5,"hello 1");
  53620. $ctx1.sendIdx["assert:equals:"]=3;
  53621. self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  53622. return $core.withContext(function($ctx2) {
  53623. return "hello ".__comma($recv(x)._asString());
  53624. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  53625. }),(function(){
  53626. return "not present";
  53627. })),"hello nil");
  53628. return self;
  53629. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53630. },
  53631. args: [],
  53632. 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'.",
  53633. referencedClasses: [],
  53634. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  53635. }),
  53636. $globals.JSObjectProxyTest);
  53637. $core.addMethod(
  53638. $core.method({
  53639. selector: "testAtPut",
  53640. protocol: 'tests',
  53641. fn: function (){
  53642. var self=this;
  53643. var testObject;
  53644. return $core.withContext(function($ctx1) {
  53645. var $2,$1;
  53646. testObject=self._jsObject();
  53647. $2=$recv(testObject)._at_("abc");
  53648. $ctx1.sendIdx["at:"]=1;
  53649. $1=$recv($2).__tild_eq("xyz");
  53650. self._assert_($1);
  53651. self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  53652. $ctx1.sendIdx["assert:equals:"]=1;
  53653. self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  53654. return self;
  53655. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  53656. },
  53657. args: [],
  53658. 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'",
  53659. referencedClasses: [],
  53660. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  53661. }),
  53662. $globals.JSObjectProxyTest);
  53663. $core.addMethod(
  53664. $core.method({
  53665. selector: "testComparison",
  53666. protocol: 'tests',
  53667. fn: function (){
  53668. var self=this;
  53669. return $core.withContext(function($ctx1) {
  53670. var $1,$2;
  53671. self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  53672. $1=$recv(console).__eq(console);
  53673. $ctx1.sendIdx["="]=1;
  53674. self._assert_($1);
  53675. $2=$recv(console).__eq($recv($globals.Object)._new());
  53676. $ctx1.sendIdx["="]=2;
  53677. self._deny_($2);
  53678. $ctx1.sendIdx["deny:"]=1;
  53679. self._deny_($recv(console).__eq(self._jsObject()));
  53680. return self;
  53681. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  53682. },
  53683. args: [],
  53684. 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",
  53685. referencedClasses: ["Object"],
  53686. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  53687. }),
  53688. $globals.JSObjectProxyTest);
  53689. $core.addMethod(
  53690. $core.method({
  53691. selector: "testDNU",
  53692. protocol: 'tests',
  53693. fn: function (){
  53694. var self=this;
  53695. return $core.withContext(function($ctx1) {
  53696. self._should_raise_((function(){
  53697. return $core.withContext(function($ctx2) {
  53698. return $recv(self._jsObject())._foo();
  53699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53700. }),$globals.MessageNotUnderstood);
  53701. return self;
  53702. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  53703. },
  53704. args: [],
  53705. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  53706. referencedClasses: ["MessageNotUnderstood"],
  53707. messageSends: ["should:raise:", "foo", "jsObject"]
  53708. }),
  53709. $globals.JSObjectProxyTest);
  53710. $core.addMethod(
  53711. $core.method({
  53712. selector: "testDNURegression1057",
  53713. protocol: 'tests',
  53714. fn: function (){
  53715. var self=this;
  53716. var jsObject;
  53717. return $core.withContext(function($ctx1) {
  53718. var $1;
  53719. jsObject=[];
  53720. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53721. $ctx1.sendIdx["basicAt:put:"]=1;
  53722. $recv(jsObject)._basicAt_put_("foo",(3));
  53723. self._shouldnt_raise_((function(){
  53724. return $core.withContext(function($ctx2) {
  53725. return $recv(jsObject)._foo();
  53726. $ctx2.sendIdx["foo"]=1;
  53727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53728. }),$globals.Error);
  53729. $ctx1.sendIdx["shouldnt:raise:"]=1;
  53730. $1=$recv(jsObject)._foo();
  53731. $ctx1.sendIdx["foo"]=2;
  53732. self._assert_equals_($1,(3));
  53733. $ctx1.sendIdx["assert:equals:"]=1;
  53734. self._shouldnt_raise_((function(){
  53735. return $core.withContext(function($ctx2) {
  53736. return $recv(jsObject)._foo_((4));
  53737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53738. }),$globals.Error);
  53739. self._assert_equals_($recv(jsObject)._foo(),(4));
  53740. return self;
  53741. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53742. },
  53743. args: [],
  53744. 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",
  53745. referencedClasses: ["Error"],
  53746. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
  53747. }),
  53748. $globals.JSObjectProxyTest);
  53749. $core.addMethod(
  53750. $core.method({
  53751. selector: "testDNURegression1059",
  53752. protocol: 'tests',
  53753. fn: function (){
  53754. var self=this;
  53755. var jsObject;
  53756. return $core.withContext(function($ctx1) {
  53757. jsObject=[];
  53758. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53759. $ctx1.sendIdx["basicAt:put:"]=1;
  53760. $recv(jsObject)._basicAt_put_("x",(3));
  53761. $ctx1.sendIdx["basicAt:put:"]=2;
  53762. $recv(jsObject)._basicAt_put_("x:",(function(){
  53763. return $core.withContext(function($ctx2) {
  53764. return self._error();
  53765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53766. }));
  53767. self._shouldnt_raise_((function(){
  53768. return $core.withContext(function($ctx2) {
  53769. return $recv(jsObject)._x_((4));
  53770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53771. }),$globals.Error);
  53772. self._assert_equals_($recv(jsObject)._x(),(4));
  53773. return self;
  53774. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53775. },
  53776. args: [],
  53777. 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",
  53778. referencedClasses: ["Error"],
  53779. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
  53780. }),
  53781. $globals.JSObjectProxyTest);
  53782. $core.addMethod(
  53783. $core.method({
  53784. selector: "testDNURegression1062",
  53785. protocol: 'tests',
  53786. fn: function (){
  53787. var self=this;
  53788. var jsObject,stored;
  53789. return $core.withContext(function($ctx1) {
  53790. jsObject=[];
  53791. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53792. $ctx1.sendIdx["basicAt:put:"]=1;
  53793. $recv(jsObject)._basicAt_put_("x",(function(v){
  53794. stored=v;
  53795. return stored;
  53796. }));
  53797. self._shouldnt_raise_((function(){
  53798. return $core.withContext(function($ctx2) {
  53799. return $recv(jsObject)._x_((4));
  53800. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53801. }),$globals.Error);
  53802. self._assert_equals_(stored,(4));
  53803. return self;
  53804. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)});
  53805. },
  53806. args: [],
  53807. 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",
  53808. referencedClasses: ["Error"],
  53809. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
  53810. }),
  53811. $globals.JSObjectProxyTest);
  53812. $core.addMethod(
  53813. $core.method({
  53814. selector: "testDNUWithAllowJavaScriptCalls",
  53815. protocol: 'tests',
  53816. fn: function (){
  53817. var self=this;
  53818. var jsObject;
  53819. return $core.withContext(function($ctx1) {
  53820. jsObject=[];
  53821. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53822. self._should_raise_((function(){
  53823. return $core.withContext(function($ctx2) {
  53824. return $recv(jsObject)._foo();
  53825. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53826. }),$globals.MessageNotUnderstood);
  53827. return self;
  53828. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53829. },
  53830. args: [],
  53831. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  53832. referencedClasses: ["MessageNotUnderstood"],
  53833. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  53834. }),
  53835. $globals.JSObjectProxyTest);
  53836. $core.addMethod(
  53837. $core.method({
  53838. selector: "testMessageSend",
  53839. protocol: 'tests',
  53840. fn: function (){
  53841. var self=this;
  53842. return $core.withContext(function($ctx1) {
  53843. var $2,$1,$4,$3;
  53844. $2=self._jsObject();
  53845. $ctx1.sendIdx["jsObject"]=1;
  53846. $1=$recv($2)._a();
  53847. self._assert_equals_($1,(1));
  53848. $ctx1.sendIdx["assert:equals:"]=1;
  53849. $4=self._jsObject();
  53850. $ctx1.sendIdx["jsObject"]=2;
  53851. $3=$recv($4)._b();
  53852. self._assert_equals_($3,(2));
  53853. $ctx1.sendIdx["assert:equals:"]=2;
  53854. self._assert_equals_($recv(self._jsObject())._c_((3)),(3));
  53855. return self;
  53856. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  53857. },
  53858. args: [],
  53859. 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",
  53860. referencedClasses: [],
  53861. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  53862. }),
  53863. $globals.JSObjectProxyTest);
  53864. $core.addMethod(
  53865. $core.method({
  53866. selector: "testMethodWithArguments",
  53867. protocol: 'tests',
  53868. fn: function (){
  53869. var self=this;
  53870. return $core.withContext(function($ctx1) {
  53871. self._assert_equals_($recv(self._jsObject())._c_((1)),(1));
  53872. return self;
  53873. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  53874. },
  53875. args: [],
  53876. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  53877. referencedClasses: [],
  53878. messageSends: ["assert:equals:", "c:", "jsObject"]
  53879. }),
  53880. $globals.JSObjectProxyTest);
  53881. $core.addMethod(
  53882. $core.method({
  53883. selector: "testPrinting",
  53884. protocol: 'tests',
  53885. fn: function (){
  53886. var self=this;
  53887. return $core.withContext(function($ctx1) {
  53888. self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]");
  53889. return self;
  53890. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  53891. },
  53892. args: [],
  53893. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  53894. referencedClasses: [],
  53895. messageSends: ["assert:equals:", "printString", "jsObject"]
  53896. }),
  53897. $globals.JSObjectProxyTest);
  53898. $core.addMethod(
  53899. $core.method({
  53900. selector: "testPropertyThatReturnsEmptyString",
  53901. protocol: 'tests',
  53902. fn: function (){
  53903. var self=this;
  53904. var object;
  53905. return $core.withContext(function($ctx1) {
  53906. var $1;
  53907. object=self._jsObject();
  53908. $1=$recv(object)._d();
  53909. $ctx1.sendIdx["d"]=1;
  53910. self._assert_equals_($1,"");
  53911. $ctx1.sendIdx["assert:equals:"]=1;
  53912. $recv(object)._d_("hello");
  53913. self._assert_equals_($recv(object)._d(),"hello");
  53914. return self;
  53915. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  53916. },
  53917. args: [],
  53918. 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'",
  53919. referencedClasses: [],
  53920. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  53921. }),
  53922. $globals.JSObjectProxyTest);
  53923. $core.addMethod(
  53924. $core.method({
  53925. selector: "testPropertyThatReturnsUndefined",
  53926. protocol: 'tests',
  53927. fn: function (){
  53928. var self=this;
  53929. var object;
  53930. return $core.withContext(function($ctx1) {
  53931. object=self._jsObject();
  53932. self._shouldnt_raise_((function(){
  53933. return $core.withContext(function($ctx2) {
  53934. return $recv(object)._e();
  53935. $ctx2.sendIdx["e"]=1;
  53936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53937. }),$globals.MessageNotUnderstood);
  53938. self._assert_($recv($recv(object)._e())._isNil());
  53939. return self;
  53940. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  53941. },
  53942. args: [],
  53943. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  53944. referencedClasses: ["MessageNotUnderstood"],
  53945. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  53946. }),
  53947. $globals.JSObjectProxyTest);
  53948. $core.addMethod(
  53949. $core.method({
  53950. selector: "testSetPropertyWithFalsyValue",
  53951. protocol: 'tests',
  53952. fn: function (){
  53953. var self=this;
  53954. var jsObject;
  53955. return $core.withContext(function($ctx1) {
  53956. var $1,$2,$3,$4,$5;
  53957. jsObject=self._jsObject();
  53958. $1=$recv(jsObject)._a();
  53959. $ctx1.sendIdx["a"]=1;
  53960. self._assert_equals_($1,(1));
  53961. $ctx1.sendIdx["assert:equals:"]=1;
  53962. $recv(jsObject)._a_(self._jsNull());
  53963. $ctx1.sendIdx["a:"]=1;
  53964. $2=$recv(jsObject)._a();
  53965. $ctx1.sendIdx["a"]=2;
  53966. self._assert_equals_($2,nil);
  53967. $ctx1.sendIdx["assert:equals:"]=2;
  53968. $recv(jsObject)._a_((0));
  53969. $ctx1.sendIdx["a:"]=2;
  53970. $3=$recv(jsObject)._a();
  53971. $ctx1.sendIdx["a"]=3;
  53972. self._assert_equals_($3,(0));
  53973. $ctx1.sendIdx["assert:equals:"]=3;
  53974. $recv(jsObject)._a_(self._jsUndefined());
  53975. $ctx1.sendIdx["a:"]=3;
  53976. $4=$recv(jsObject)._a();
  53977. $ctx1.sendIdx["a"]=4;
  53978. self._assert_equals_($4,nil);
  53979. $ctx1.sendIdx["assert:equals:"]=4;
  53980. $recv(jsObject)._a_("");
  53981. $ctx1.sendIdx["a:"]=4;
  53982. $5=$recv(jsObject)._a();
  53983. $ctx1.sendIdx["a"]=5;
  53984. self._assert_equals_($5,"");
  53985. $ctx1.sendIdx["assert:equals:"]=5;
  53986. $recv(jsObject)._a_(false);
  53987. self._assert_equals_($recv(jsObject)._a(),false);
  53988. return self;
  53989. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53990. },
  53991. args: [],
  53992. 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",
  53993. referencedClasses: [],
  53994. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  53995. }),
  53996. $globals.JSObjectProxyTest);
  53997. $core.addMethod(
  53998. $core.method({
  53999. selector: "testValue",
  54000. protocol: 'tests',
  54001. fn: function (){
  54002. var self=this;
  54003. var testObject;
  54004. return $core.withContext(function($ctx1) {
  54005. testObject=self._jsObject();
  54006. $recv(testObject)._at_put_("value","aValue");
  54007. self._assert_equals_($recv(testObject)._value(),"aValue");
  54008. return self;
  54009. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  54010. },
  54011. args: [],
  54012. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  54013. referencedClasses: [],
  54014. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  54015. }),
  54016. $globals.JSObjectProxyTest);
  54017. $core.addMethod(
  54018. $core.method({
  54019. selector: "testYourself",
  54020. protocol: 'tests',
  54021. fn: function (){
  54022. var self=this;
  54023. var object;
  54024. return $core.withContext(function($ctx1) {
  54025. var $1;
  54026. $1=self._jsObject();
  54027. $recv($1)._d_("test");
  54028. object=$recv($1)._yourself();
  54029. self._assert_equals_($recv(object)._d(),"test");
  54030. return self;
  54031. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  54032. },
  54033. args: [],
  54034. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  54035. referencedClasses: [],
  54036. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  54037. }),
  54038. $globals.JSObjectProxyTest);
  54039. $core.addClass('JavaScriptExceptionTest', $globals.TestCase, [], 'Kernel-Tests');
  54040. $core.addMethod(
  54041. $core.method({
  54042. selector: "testCatchingException",
  54043. protocol: 'tests',
  54044. fn: function (){
  54045. var self=this;
  54046. return $core.withContext(function($ctx1) {
  54047. $recv((function(){
  54048. return $core.withContext(function($ctx2) {
  54049. return self._throwException();
  54050. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54051. }))._on_do_($globals.Error,(function(error){
  54052. return $core.withContext(function($ctx2) {
  54053. return self._assert_($recv($recv(error)._exception()).__eq("test"));
  54054. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  54055. }));
  54056. return self;
  54057. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  54058. },
  54059. args: [],
  54060. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  54061. referencedClasses: ["Error"],
  54062. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  54063. }),
  54064. $globals.JavaScriptExceptionTest);
  54065. $core.addMethod(
  54066. $core.method({
  54067. selector: "testRaisingException",
  54068. protocol: 'tests',
  54069. fn: function (){
  54070. var self=this;
  54071. return $core.withContext(function($ctx1) {
  54072. self._should_raise_((function(){
  54073. return $core.withContext(function($ctx2) {
  54074. return self._throwException();
  54075. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54076. }),$globals.JavaScriptException);
  54077. return self;
  54078. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  54079. },
  54080. args: [],
  54081. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  54082. referencedClasses: ["JavaScriptException"],
  54083. messageSends: ["should:raise:", "throwException"]
  54084. }),
  54085. $globals.JavaScriptExceptionTest);
  54086. $core.addMethod(
  54087. $core.method({
  54088. selector: "throwException",
  54089. protocol: 'helpers',
  54090. fn: function (){
  54091. var self=this;
  54092. return $core.withContext(function($ctx1) {
  54093. throw 'test';
  54094. return self;
  54095. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  54096. },
  54097. args: [],
  54098. source: "throwException\x0a\x09<throw 'test'>",
  54099. referencedClasses: [],
  54100. messageSends: []
  54101. }),
  54102. $globals.JavaScriptExceptionTest);
  54103. $core.addClass('MessageSendTest', $globals.TestCase, [], 'Kernel-Tests');
  54104. $core.addMethod(
  54105. $core.method({
  54106. selector: "testValue",
  54107. protocol: 'tests',
  54108. fn: function (){
  54109. var self=this;
  54110. var messageSend;
  54111. return $core.withContext(function($ctx1) {
  54112. var $1;
  54113. $1=$recv($globals.MessageSend)._new();
  54114. $ctx1.sendIdx["new"]=1;
  54115. $recv($1)._receiver_($recv($globals.Object)._new());
  54116. $recv($1)._selector_("asString");
  54117. messageSend=$recv($1)._yourself();
  54118. self._assert_equals_($recv(messageSend)._value(),"an Object");
  54119. return self;
  54120. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  54121. },
  54122. args: [],
  54123. 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'",
  54124. referencedClasses: ["MessageSend", "Object"],
  54125. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  54126. }),
  54127. $globals.MessageSendTest);
  54128. $core.addMethod(
  54129. $core.method({
  54130. selector: "testValueWithArguments",
  54131. protocol: 'tests',
  54132. fn: function (){
  54133. var self=this;
  54134. var messageSend;
  54135. return $core.withContext(function($ctx1) {
  54136. var $1;
  54137. $1=$recv($globals.MessageSend)._new();
  54138. $recv($1)._receiver_((2));
  54139. $recv($1)._selector_("+");
  54140. messageSend=$recv($1)._yourself();
  54141. self._assert_equals_($recv(messageSend)._value_((3)),(5));
  54142. $ctx1.sendIdx["assert:equals:"]=1;
  54143. self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  54144. return self;
  54145. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  54146. },
  54147. args: [],
  54148. 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",
  54149. referencedClasses: ["MessageSend"],
  54150. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  54151. }),
  54152. $globals.MessageSendTest);
  54153. $core.addClass('MethodInheritanceTest', $globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  54154. $core.addMethod(
  54155. $core.method({
  54156. selector: "codeGeneratorClass",
  54157. protocol: 'accessing',
  54158. fn: function (){
  54159. var self=this;
  54160. return $globals.CodeGenerator;
  54161. },
  54162. args: [],
  54163. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  54164. referencedClasses: ["CodeGenerator"],
  54165. messageSends: []
  54166. }),
  54167. $globals.MethodInheritanceTest);
  54168. $core.addMethod(
  54169. $core.method({
  54170. selector: "compiler",
  54171. protocol: 'factory',
  54172. fn: function (){
  54173. var self=this;
  54174. return $core.withContext(function($ctx1) {
  54175. var $1;
  54176. $1=$recv($globals.Compiler)._new();
  54177. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  54178. return $recv($1)._yourself();
  54179. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  54180. },
  54181. args: [],
  54182. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  54183. referencedClasses: ["Compiler"],
  54184. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  54185. }),
  54186. $globals.MethodInheritanceTest);
  54187. $core.addMethod(
  54188. $core.method({
  54189. selector: "deinstallBottom",
  54190. protocol: 'testing',
  54191. fn: function (){
  54192. var self=this;
  54193. return $core.withContext(function($ctx1) {
  54194. $recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  54195. return self;
  54196. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  54197. },
  54198. args: [],
  54199. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  54200. referencedClasses: [],
  54201. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  54202. }),
  54203. $globals.MethodInheritanceTest);
  54204. $core.addMethod(
  54205. $core.method({
  54206. selector: "deinstallMiddle",
  54207. protocol: 'testing',
  54208. fn: function (){
  54209. var self=this;
  54210. return $core.withContext(function($ctx1) {
  54211. $recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  54212. return self;
  54213. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  54214. },
  54215. args: [],
  54216. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  54217. referencedClasses: [],
  54218. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  54219. }),
  54220. $globals.MethodInheritanceTest);
  54221. $core.addMethod(
  54222. $core.method({
  54223. selector: "deinstallTop",
  54224. protocol: 'testing',
  54225. fn: function (){
  54226. var self=this;
  54227. return $core.withContext(function($ctx1) {
  54228. $recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  54229. return self;
  54230. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  54231. },
  54232. args: [],
  54233. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  54234. referencedClasses: [],
  54235. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  54236. }),
  54237. $globals.MethodInheritanceTest);
  54238. $core.addMethod(
  54239. $core.method({
  54240. selector: "installBottom:",
  54241. protocol: 'testing',
  54242. fn: function (aString){
  54243. var self=this;
  54244. return $core.withContext(function($ctx1) {
  54245. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  54246. return self;
  54247. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  54248. },
  54249. args: ["aString"],
  54250. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  54251. referencedClasses: [],
  54252. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  54253. }),
  54254. $globals.MethodInheritanceTest);
  54255. $core.addMethod(
  54256. $core.method({
  54257. selector: "installMiddle:",
  54258. protocol: 'testing',
  54259. fn: function (aString){
  54260. var self=this;
  54261. return $core.withContext(function($ctx1) {
  54262. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  54263. return self;
  54264. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  54265. },
  54266. args: ["aString"],
  54267. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  54268. referencedClasses: [],
  54269. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  54270. }),
  54271. $globals.MethodInheritanceTest);
  54272. $core.addMethod(
  54273. $core.method({
  54274. selector: "installTop:",
  54275. protocol: 'testing',
  54276. fn: function (aString){
  54277. var self=this;
  54278. return $core.withContext(function($ctx1) {
  54279. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  54280. return self;
  54281. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  54282. },
  54283. args: ["aString"],
  54284. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  54285. referencedClasses: [],
  54286. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  54287. }),
  54288. $globals.MethodInheritanceTest);
  54289. $core.addMethod(
  54290. $core.method({
  54291. selector: "setUp",
  54292. protocol: 'initialization',
  54293. fn: function (){
  54294. var self=this;
  54295. return $core.withContext(function($ctx1) {
  54296. self["@receiverTop"]=$recv(self._targetClassTop())._new();
  54297. $ctx1.sendIdx["new"]=1;
  54298. self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new();
  54299. $ctx1.sendIdx["new"]=2;
  54300. self["@receiverBottom"]=$recv(self._targetClassBottom())._new();
  54301. self["@method"]=nil;
  54302. self["@performBlock"]=(function(){
  54303. return $core.withContext(function($ctx2) {
  54304. return self._error_("performBlock not initialized");
  54305. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54306. });
  54307. return self;
  54308. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  54309. },
  54310. args: [],
  54311. 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' ]",
  54312. referencedClasses: [],
  54313. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  54314. }),
  54315. $globals.MethodInheritanceTest);
  54316. $core.addMethod(
  54317. $core.method({
  54318. selector: "shouldMNU",
  54319. protocol: 'testing',
  54320. fn: function (){
  54321. var self=this;
  54322. return $core.withContext(function($ctx1) {
  54323. self._shouldMNUTop();
  54324. self._shouldMNUMiddle();
  54325. self._shouldMNUBottom();
  54326. return self;
  54327. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  54328. },
  54329. args: [],
  54330. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  54331. referencedClasses: [],
  54332. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  54333. }),
  54334. $globals.MethodInheritanceTest);
  54335. $core.addMethod(
  54336. $core.method({
  54337. selector: "shouldMNUBottom",
  54338. protocol: 'testing',
  54339. fn: function (){
  54340. var self=this;
  54341. return $core.withContext(function($ctx1) {
  54342. self._should_raise_((function(){
  54343. return $core.withContext(function($ctx2) {
  54344. return $recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54345. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54346. }),$globals.MessageNotUnderstood);
  54347. return self;
  54348. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  54349. },
  54350. args: [],
  54351. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  54352. referencedClasses: ["MessageNotUnderstood"],
  54353. messageSends: ["should:raise:", "value:"]
  54354. }),
  54355. $globals.MethodInheritanceTest);
  54356. $core.addMethod(
  54357. $core.method({
  54358. selector: "shouldMNUMiddle",
  54359. protocol: 'testing',
  54360. fn: function (){
  54361. var self=this;
  54362. return $core.withContext(function($ctx1) {
  54363. self._should_raise_((function(){
  54364. return $core.withContext(function($ctx2) {
  54365. return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54366. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54367. }),$globals.MessageNotUnderstood);
  54368. return self;
  54369. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  54370. },
  54371. args: [],
  54372. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  54373. referencedClasses: ["MessageNotUnderstood"],
  54374. messageSends: ["should:raise:", "value:"]
  54375. }),
  54376. $globals.MethodInheritanceTest);
  54377. $core.addMethod(
  54378. $core.method({
  54379. selector: "shouldMNUTop",
  54380. protocol: 'testing',
  54381. fn: function (){
  54382. var self=this;
  54383. return $core.withContext(function($ctx1) {
  54384. self._should_raise_((function(){
  54385. return $core.withContext(function($ctx2) {
  54386. return $recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54387. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54388. }),$globals.MessageNotUnderstood);
  54389. return self;
  54390. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  54391. },
  54392. args: [],
  54393. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  54394. referencedClasses: ["MessageNotUnderstood"],
  54395. messageSends: ["should:raise:", "value:"]
  54396. }),
  54397. $globals.MethodInheritanceTest);
  54398. $core.addMethod(
  54399. $core.method({
  54400. selector: "shouldReturn:",
  54401. protocol: 'testing',
  54402. fn: function (anObject){
  54403. var self=this;
  54404. var result;
  54405. return $core.withContext(function($ctx1) {
  54406. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54407. $ctx1.sendIdx["value:"]=1;
  54408. self._assert_equals_(["top",anObject],["top",result]);
  54409. $ctx1.sendIdx["assert:equals:"]=1;
  54410. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54411. $ctx1.sendIdx["value:"]=2;
  54412. self._assert_equals_(["middle",anObject],["middle",result]);
  54413. $ctx1.sendIdx["assert:equals:"]=2;
  54414. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54415. self._assert_equals_(["bottom",anObject],["bottom",result]);
  54416. return self;
  54417. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  54418. },
  54419. args: ["anObject"],
  54420. 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 }",
  54421. referencedClasses: [],
  54422. messageSends: ["value:", "assert:equals:"]
  54423. }),
  54424. $globals.MethodInheritanceTest);
  54425. $core.addMethod(
  54426. $core.method({
  54427. selector: "shouldReturn:and:and:",
  54428. protocol: 'testing',
  54429. fn: function (anObject,anObject2,anObject3){
  54430. var self=this;
  54431. var result;
  54432. return $core.withContext(function($ctx1) {
  54433. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54434. $ctx1.sendIdx["value:"]=1;
  54435. self._assert_equals_(["top",anObject],["top",result]);
  54436. $ctx1.sendIdx["assert:equals:"]=1;
  54437. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54438. $ctx1.sendIdx["value:"]=2;
  54439. self._assert_equals_(["middle",anObject2],["middle",result]);
  54440. $ctx1.sendIdx["assert:equals:"]=2;
  54441. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54442. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  54443. return self;
  54444. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  54445. },
  54446. args: ["anObject", "anObject2", "anObject3"],
  54447. 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 }",
  54448. referencedClasses: [],
  54449. messageSends: ["value:", "assert:equals:"]
  54450. }),
  54451. $globals.MethodInheritanceTest);
  54452. $core.addMethod(
  54453. $core.method({
  54454. selector: "targetClassBottom",
  54455. protocol: 'accessing',
  54456. fn: function (){
  54457. var self=this;
  54458. return $globals.JavaScriptException;
  54459. },
  54460. args: [],
  54461. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  54462. referencedClasses: ["JavaScriptException"],
  54463. messageSends: []
  54464. }),
  54465. $globals.MethodInheritanceTest);
  54466. $core.addMethod(
  54467. $core.method({
  54468. selector: "targetClassMiddle",
  54469. protocol: 'accessing',
  54470. fn: function (){
  54471. var self=this;
  54472. return $globals.Error;
  54473. },
  54474. args: [],
  54475. source: "targetClassMiddle\x0a\x09^ Error",
  54476. referencedClasses: ["Error"],
  54477. messageSends: []
  54478. }),
  54479. $globals.MethodInheritanceTest);
  54480. $core.addMethod(
  54481. $core.method({
  54482. selector: "targetClassTop",
  54483. protocol: 'accessing',
  54484. fn: function (){
  54485. var self=this;
  54486. return $globals.Object;
  54487. },
  54488. args: [],
  54489. source: "targetClassTop\x0a\x09^ Object",
  54490. referencedClasses: ["Object"],
  54491. messageSends: []
  54492. }),
  54493. $globals.MethodInheritanceTest);
  54494. $core.addMethod(
  54495. $core.method({
  54496. selector: "tearDown",
  54497. protocol: 'initialization',
  54498. fn: function (){
  54499. var self=this;
  54500. return $core.withContext(function($ctx1) {
  54501. $recv((function(){
  54502. return $core.withContext(function($ctx2) {
  54503. return self._deinstallTop();
  54504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54505. }))._on_do_($globals.Error,(function(){
  54506. }));
  54507. $ctx1.sendIdx["on:do:"]=1;
  54508. $recv((function(){
  54509. return $core.withContext(function($ctx2) {
  54510. return self._deinstallMiddle();
  54511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  54512. }))._on_do_($globals.Error,(function(){
  54513. }));
  54514. $ctx1.sendIdx["on:do:"]=2;
  54515. $recv((function(){
  54516. return $core.withContext(function($ctx2) {
  54517. return self._deinstallBottom();
  54518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54519. }))._on_do_($globals.Error,(function(){
  54520. }));
  54521. return self;
  54522. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  54523. },
  54524. args: [],
  54525. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  54526. referencedClasses: ["Error"],
  54527. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  54528. }),
  54529. $globals.MethodInheritanceTest);
  54530. $core.addMethod(
  54531. $core.method({
  54532. selector: "testMNU11",
  54533. protocol: 'tests',
  54534. fn: function (){
  54535. var self=this;
  54536. return $core.withContext(function($ctx1) {
  54537. self["@performBlock"]=(function(x){
  54538. return $core.withContext(function($ctx2) {
  54539. return $recv(x)._foo();
  54540. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54541. });
  54542. self._shouldMNU();
  54543. $ctx1.sendIdx["shouldMNU"]=1;
  54544. self._installTop_("foo ^ false");
  54545. $ctx1.sendIdx["installTop:"]=1;
  54546. self._installTop_("foo ^ true");
  54547. self._deinstallTop();
  54548. self._shouldMNU();
  54549. return self;
  54550. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  54551. },
  54552. args: [],
  54553. 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",
  54554. referencedClasses: [],
  54555. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  54556. }),
  54557. $globals.MethodInheritanceTest);
  54558. $core.addMethod(
  54559. $core.method({
  54560. selector: "testMNU22",
  54561. protocol: 'tests',
  54562. fn: function (){
  54563. var self=this;
  54564. return $core.withContext(function($ctx1) {
  54565. self["@performBlock"]=(function(x){
  54566. return $core.withContext(function($ctx2) {
  54567. return $recv(x)._foo();
  54568. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54569. });
  54570. self._shouldMNU();
  54571. $ctx1.sendIdx["shouldMNU"]=1;
  54572. self._installMiddle_("foo ^ false");
  54573. $ctx1.sendIdx["installMiddle:"]=1;
  54574. self._installMiddle_("foo ^ true");
  54575. self._deinstallMiddle();
  54576. self._shouldMNU();
  54577. return self;
  54578. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  54579. },
  54580. args: [],
  54581. 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",
  54582. referencedClasses: [],
  54583. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  54584. }),
  54585. $globals.MethodInheritanceTest);
  54586. $core.addMethod(
  54587. $core.method({
  54588. selector: "testReturns1",
  54589. protocol: 'tests',
  54590. fn: function (){
  54591. var self=this;
  54592. return $core.withContext(function($ctx1) {
  54593. self["@performBlock"]=(function(x){
  54594. return $core.withContext(function($ctx2) {
  54595. return $recv(x)._foo();
  54596. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54597. });
  54598. self._installTop_("foo ^ false");
  54599. $ctx1.sendIdx["installTop:"]=1;
  54600. self._shouldReturn_(false);
  54601. $ctx1.sendIdx["shouldReturn:"]=1;
  54602. self._installTop_("foo ^ true");
  54603. self._shouldReturn_(true);
  54604. return self;
  54605. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  54606. },
  54607. args: [],
  54608. 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",
  54609. referencedClasses: [],
  54610. messageSends: ["foo", "installTop:", "shouldReturn:"]
  54611. }),
  54612. $globals.MethodInheritanceTest);
  54613. $core.addClass('NumberTest', $globals.TestCase, [], 'Kernel-Tests');
  54614. $core.addMethod(
  54615. $core.method({
  54616. selector: "testAbs",
  54617. protocol: 'tests',
  54618. fn: function (){
  54619. var self=this;
  54620. return $core.withContext(function($ctx1) {
  54621. var $1;
  54622. $1=(4)._abs();
  54623. $ctx1.sendIdx["abs"]=1;
  54624. self._assert_equals_($1,(4));
  54625. $ctx1.sendIdx["assert:equals:"]=1;
  54626. self._assert_equals_((-4)._abs(),(4));
  54627. return self;
  54628. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  54629. },
  54630. args: [],
  54631. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  54632. referencedClasses: [],
  54633. messageSends: ["assert:equals:", "abs"]
  54634. }),
  54635. $globals.NumberTest);
  54636. $core.addMethod(
  54637. $core.method({
  54638. selector: "testArithmetic",
  54639. protocol: 'tests',
  54640. fn: function (){
  54641. var self=this;
  54642. return $core.withContext(function($ctx1) {
  54643. var $1,$2,$3,$5,$4;
  54644. $1=(1.5).__plus((1));
  54645. $ctx1.sendIdx["+"]=1;
  54646. self._assert_equals_($1,(2.5));
  54647. $ctx1.sendIdx["assert:equals:"]=1;
  54648. $2=(2).__minus((1));
  54649. $ctx1.sendIdx["-"]=1;
  54650. self._assert_equals_($2,(1));
  54651. $ctx1.sendIdx["assert:equals:"]=2;
  54652. self._assert_equals_((-2).__minus((1)),(-3));
  54653. $ctx1.sendIdx["assert:equals:"]=3;
  54654. self._assert_equals_((12).__slash((2)),(6));
  54655. $ctx1.sendIdx["assert:equals:"]=4;
  54656. $3=(3).__star((4));
  54657. $ctx1.sendIdx["*"]=1;
  54658. self._assert_equals_($3,(12));
  54659. $ctx1.sendIdx["assert:equals:"]=5;
  54660. self._assert_equals_((7).__slash_slash((2)),(3));
  54661. $ctx1.sendIdx["assert:equals:"]=6;
  54662. self._assert_equals_((7).__backslash_backslash((2)),(1));
  54663. $ctx1.sendIdx["assert:equals:"]=7;
  54664. $5=(1).__plus((2));
  54665. $ctx1.sendIdx["+"]=2;
  54666. $4=$recv($5).__star((3));
  54667. $ctx1.sendIdx["*"]=2;
  54668. self._assert_equals_($4,(9));
  54669. $ctx1.sendIdx["assert:equals:"]=8;
  54670. self._assert_equals_((1).__plus((2).__star((3))),(7));
  54671. return self;
  54672. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  54673. },
  54674. args: [],
  54675. 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",
  54676. referencedClasses: [],
  54677. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  54678. }),
  54679. $globals.NumberTest);
  54680. $core.addMethod(
  54681. $core.method({
  54682. selector: "testAsNumber",
  54683. protocol: 'tests',
  54684. fn: function (){
  54685. var self=this;
  54686. return $core.withContext(function($ctx1) {
  54687. self._assert_equals_((3)._asNumber(),(3));
  54688. return self;
  54689. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  54690. },
  54691. args: [],
  54692. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  54693. referencedClasses: [],
  54694. messageSends: ["assert:equals:", "asNumber"]
  54695. }),
  54696. $globals.NumberTest);
  54697. $core.addMethod(
  54698. $core.method({
  54699. selector: "testCeiling",
  54700. protocol: 'tests',
  54701. fn: function (){
  54702. var self=this;
  54703. return $core.withContext(function($ctx1) {
  54704. var $1,$2;
  54705. $1=(1.2)._ceiling();
  54706. $ctx1.sendIdx["ceiling"]=1;
  54707. self._assert_equals_($1,(2));
  54708. $ctx1.sendIdx["assert:equals:"]=1;
  54709. $2=(-1.2)._ceiling();
  54710. $ctx1.sendIdx["ceiling"]=2;
  54711. self._assert_equals_($2,(-1));
  54712. $ctx1.sendIdx["assert:equals:"]=2;
  54713. self._assert_equals_((1)._ceiling(),(1));
  54714. return self;
  54715. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  54716. },
  54717. args: [],
  54718. 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.",
  54719. referencedClasses: [],
  54720. messageSends: ["assert:equals:", "ceiling"]
  54721. }),
  54722. $globals.NumberTest);
  54723. $core.addMethod(
  54724. $core.method({
  54725. selector: "testComparison",
  54726. protocol: 'tests',
  54727. fn: function (){
  54728. var self=this;
  54729. return $core.withContext(function($ctx1) {
  54730. var $1,$2,$3,$4;
  54731. $1=(3).__gt((2));
  54732. $ctx1.sendIdx[">"]=1;
  54733. self._assert_($1);
  54734. $ctx1.sendIdx["assert:"]=1;
  54735. $2=(2).__lt((3));
  54736. $ctx1.sendIdx["<"]=1;
  54737. self._assert_($2);
  54738. $ctx1.sendIdx["assert:"]=2;
  54739. self._deny_((3).__lt((2)));
  54740. $ctx1.sendIdx["deny:"]=1;
  54741. self._deny_((2).__gt((3)));
  54742. $3=(3).__gt_eq((3));
  54743. $ctx1.sendIdx[">="]=1;
  54744. self._assert_($3);
  54745. $ctx1.sendIdx["assert:"]=3;
  54746. self._assert_((3.1).__gt_eq((3)));
  54747. $ctx1.sendIdx["assert:"]=4;
  54748. $4=(3).__lt_eq((3));
  54749. $ctx1.sendIdx["<="]=1;
  54750. self._assert_($4);
  54751. $ctx1.sendIdx["assert:"]=5;
  54752. self._assert_((3).__lt_eq((3.1)));
  54753. return self;
  54754. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  54755. },
  54756. args: [],
  54757. 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",
  54758. referencedClasses: [],
  54759. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  54760. }),
  54761. $globals.NumberTest);
  54762. $core.addMethod(
  54763. $core.method({
  54764. selector: "testCopying",
  54765. protocol: 'tests',
  54766. fn: function (){
  54767. var self=this;
  54768. return $core.withContext(function($ctx1) {
  54769. var $1;
  54770. $1=$recv((1)._copy()).__eq_eq((1));
  54771. $ctx1.sendIdx["=="]=1;
  54772. self._assert_($1);
  54773. $ctx1.sendIdx["assert:"]=1;
  54774. self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  54775. return self;
  54776. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  54777. },
  54778. args: [],
  54779. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  54780. referencedClasses: [],
  54781. messageSends: ["assert:", "==", "copy", "deepCopy"]
  54782. }),
  54783. $globals.NumberTest);
  54784. $core.addMethod(
  54785. $core.method({
  54786. selector: "testEquality",
  54787. protocol: 'tests',
  54788. fn: function (){
  54789. var self=this;
  54790. return $core.withContext(function($ctx1) {
  54791. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  54792. $1=(1).__eq((1));
  54793. $ctx1.sendIdx["="]=1;
  54794. self._assert_($1);
  54795. $ctx1.sendIdx["assert:"]=1;
  54796. $2=(0).__eq((0));
  54797. $ctx1.sendIdx["="]=2;
  54798. self._assert_($2);
  54799. $ctx1.sendIdx["assert:"]=2;
  54800. $3=(1).__eq((0));
  54801. $ctx1.sendIdx["="]=3;
  54802. self._deny_($3);
  54803. $ctx1.sendIdx["deny:"]=1;
  54804. $5=(1)._yourself();
  54805. $ctx1.sendIdx["yourself"]=1;
  54806. $4=$recv($5).__eq((1));
  54807. $ctx1.sendIdx["="]=4;
  54808. self._assert_($4);
  54809. $ctx1.sendIdx["assert:"]=3;
  54810. $7=(1)._yourself();
  54811. $ctx1.sendIdx["yourself"]=2;
  54812. $6=(1).__eq($7);
  54813. $ctx1.sendIdx["="]=5;
  54814. self._assert_($6);
  54815. $ctx1.sendIdx["assert:"]=4;
  54816. $9=(1)._yourself();
  54817. $ctx1.sendIdx["yourself"]=3;
  54818. $8=$recv($9).__eq((1)._yourself());
  54819. $ctx1.sendIdx["="]=6;
  54820. self._assert_($8);
  54821. $10=(0).__eq(false);
  54822. $ctx1.sendIdx["="]=7;
  54823. self._deny_($10);
  54824. $ctx1.sendIdx["deny:"]=2;
  54825. $11=false.__eq((0));
  54826. $ctx1.sendIdx["="]=8;
  54827. self._deny_($11);
  54828. $ctx1.sendIdx["deny:"]=3;
  54829. $12="".__eq((0));
  54830. $ctx1.sendIdx["="]=9;
  54831. self._deny_($12);
  54832. $ctx1.sendIdx["deny:"]=4;
  54833. self._deny_((0).__eq(""));
  54834. return self;
  54835. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  54836. },
  54837. args: [],
  54838. 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 = ''",
  54839. referencedClasses: [],
  54840. messageSends: ["assert:", "=", "deny:", "yourself"]
  54841. }),
  54842. $globals.NumberTest);
  54843. $core.addMethod(
  54844. $core.method({
  54845. selector: "testFloor",
  54846. protocol: 'tests',
  54847. fn: function (){
  54848. var self=this;
  54849. return $core.withContext(function($ctx1) {
  54850. var $1,$2;
  54851. $1=(1.2)._floor();
  54852. $ctx1.sendIdx["floor"]=1;
  54853. self._assert_equals_($1,(1));
  54854. $ctx1.sendIdx["assert:equals:"]=1;
  54855. $2=(-1.2)._floor();
  54856. $ctx1.sendIdx["floor"]=2;
  54857. self._assert_equals_($2,(-2));
  54858. $ctx1.sendIdx["assert:equals:"]=2;
  54859. self._assert_equals_((1)._floor(),(1));
  54860. return self;
  54861. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  54862. },
  54863. args: [],
  54864. 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.",
  54865. referencedClasses: [],
  54866. messageSends: ["assert:equals:", "floor"]
  54867. }),
  54868. $globals.NumberTest);
  54869. $core.addMethod(
  54870. $core.method({
  54871. selector: "testHexNumbers",
  54872. protocol: 'tests',
  54873. fn: function (){
  54874. var self=this;
  54875. return $core.withContext(function($ctx1) {
  54876. var $1,$2,$3,$4,$5;
  54877. self._assert_equals_((9),(9));
  54878. $ctx1.sendIdx["assert:equals:"]=1;
  54879. $1=(10)._truncated();
  54880. $ctx1.sendIdx["truncated"]=1;
  54881. self._assert_equals_($1,(10));
  54882. $ctx1.sendIdx["assert:equals:"]=2;
  54883. $2=(11)._truncated();
  54884. $ctx1.sendIdx["truncated"]=2;
  54885. self._assert_equals_($2,(11));
  54886. $ctx1.sendIdx["assert:equals:"]=3;
  54887. $3=(12)._truncated();
  54888. $ctx1.sendIdx["truncated"]=3;
  54889. self._assert_equals_($3,(12));
  54890. $ctx1.sendIdx["assert:equals:"]=4;
  54891. $4=(13)._truncated();
  54892. $ctx1.sendIdx["truncated"]=4;
  54893. self._assert_equals_($4,(13));
  54894. $ctx1.sendIdx["assert:equals:"]=5;
  54895. $5=(14)._truncated();
  54896. $ctx1.sendIdx["truncated"]=5;
  54897. self._assert_equals_($5,(14));
  54898. $ctx1.sendIdx["assert:equals:"]=6;
  54899. self._assert_equals_((15)._truncated(),(15));
  54900. return self;
  54901. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  54902. },
  54903. args: [],
  54904. 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",
  54905. referencedClasses: [],
  54906. messageSends: ["assert:equals:", "truncated"]
  54907. }),
  54908. $globals.NumberTest);
  54909. $core.addMethod(
  54910. $core.method({
  54911. selector: "testIdentity",
  54912. protocol: 'tests',
  54913. fn: function (){
  54914. var self=this;
  54915. return $core.withContext(function($ctx1) {
  54916. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  54917. $1=(1).__eq_eq((1));
  54918. $ctx1.sendIdx["=="]=1;
  54919. self._assert_($1);
  54920. $ctx1.sendIdx["assert:"]=1;
  54921. $2=(0).__eq_eq((0));
  54922. $ctx1.sendIdx["=="]=2;
  54923. self._assert_($2);
  54924. $ctx1.sendIdx["assert:"]=2;
  54925. $3=(1).__eq_eq((0));
  54926. $ctx1.sendIdx["=="]=3;
  54927. self._deny_($3);
  54928. $ctx1.sendIdx["deny:"]=1;
  54929. $5=(1)._yourself();
  54930. $ctx1.sendIdx["yourself"]=1;
  54931. $4=$recv($5).__eq_eq((1));
  54932. $ctx1.sendIdx["=="]=4;
  54933. self._assert_($4);
  54934. $ctx1.sendIdx["assert:"]=3;
  54935. $7=(1)._yourself();
  54936. $ctx1.sendIdx["yourself"]=2;
  54937. $6=(1).__eq_eq($7);
  54938. $ctx1.sendIdx["=="]=5;
  54939. self._assert_($6);
  54940. $ctx1.sendIdx["assert:"]=4;
  54941. $9=(1)._yourself();
  54942. $ctx1.sendIdx["yourself"]=3;
  54943. $8=$recv($9).__eq_eq((1)._yourself());
  54944. $ctx1.sendIdx["=="]=6;
  54945. self._assert_($8);
  54946. self._deny_((1).__eq_eq((2)));
  54947. return self;
  54948. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  54949. },
  54950. args: [],
  54951. 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",
  54952. referencedClasses: [],
  54953. messageSends: ["assert:", "==", "deny:", "yourself"]
  54954. }),
  54955. $globals.NumberTest);
  54956. $core.addMethod(
  54957. $core.method({
  54958. selector: "testInvalidHexNumbers",
  54959. protocol: 'tests',
  54960. fn: function (){
  54961. var self=this;
  54962. return $core.withContext(function($ctx1) {
  54963. self._should_raise_((function(){
  54964. return $core.withContext(function($ctx2) {
  54965. return (16)._rG();
  54966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54967. }),$globals.MessageNotUnderstood);
  54968. $ctx1.sendIdx["should:raise:"]=1;
  54969. self._should_raise_((function(){
  54970. return $core.withContext(function($ctx2) {
  54971. return (16)._rg();
  54972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54973. }),$globals.MessageNotUnderstood);
  54974. $ctx1.sendIdx["should:raise:"]=2;
  54975. self._should_raise_((function(){
  54976. return $core.withContext(function($ctx2) {
  54977. return (16)._rH();
  54978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  54979. }),$globals.MessageNotUnderstood);
  54980. $ctx1.sendIdx["should:raise:"]=3;
  54981. self._should_raise_((function(){
  54982. return $core.withContext(function($ctx2) {
  54983. return (16)._rh();
  54984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  54985. }),$globals.MessageNotUnderstood);
  54986. $ctx1.sendIdx["should:raise:"]=4;
  54987. self._should_raise_((function(){
  54988. return $core.withContext(function($ctx2) {
  54989. return (16)._rI();
  54990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54991. }),$globals.MessageNotUnderstood);
  54992. $ctx1.sendIdx["should:raise:"]=5;
  54993. self._should_raise_((function(){
  54994. return $core.withContext(function($ctx2) {
  54995. return (16)._ri();
  54996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  54997. }),$globals.MessageNotUnderstood);
  54998. $ctx1.sendIdx["should:raise:"]=6;
  54999. self._should_raise_((function(){
  55000. return $core.withContext(function($ctx2) {
  55001. return (16)._rJ();
  55002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  55003. }),$globals.MessageNotUnderstood);
  55004. $ctx1.sendIdx["should:raise:"]=7;
  55005. self._should_raise_((function(){
  55006. return $core.withContext(function($ctx2) {
  55007. return (16)._rj();
  55008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  55009. }),$globals.MessageNotUnderstood);
  55010. $ctx1.sendIdx["should:raise:"]=8;
  55011. self._should_raise_((function(){
  55012. return $core.withContext(function($ctx2) {
  55013. return (16)._rK();
  55014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  55015. }),$globals.MessageNotUnderstood);
  55016. $ctx1.sendIdx["should:raise:"]=9;
  55017. self._should_raise_((function(){
  55018. return $core.withContext(function($ctx2) {
  55019. return (16)._rk();
  55020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  55021. }),$globals.MessageNotUnderstood);
  55022. $ctx1.sendIdx["should:raise:"]=10;
  55023. self._should_raise_((function(){
  55024. return $core.withContext(function($ctx2) {
  55025. return (16)._rL();
  55026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  55027. }),$globals.MessageNotUnderstood);
  55028. $ctx1.sendIdx["should:raise:"]=11;
  55029. self._should_raise_((function(){
  55030. return $core.withContext(function($ctx2) {
  55031. return (16)._rl();
  55032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  55033. }),$globals.MessageNotUnderstood);
  55034. $ctx1.sendIdx["should:raise:"]=12;
  55035. self._should_raise_((function(){
  55036. return $core.withContext(function($ctx2) {
  55037. return (16)._rM();
  55038. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  55039. }),$globals.MessageNotUnderstood);
  55040. $ctx1.sendIdx["should:raise:"]=13;
  55041. self._should_raise_((function(){
  55042. return $core.withContext(function($ctx2) {
  55043. return (16)._rm();
  55044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  55045. }),$globals.MessageNotUnderstood);
  55046. $ctx1.sendIdx["should:raise:"]=14;
  55047. self._should_raise_((function(){
  55048. return $core.withContext(function($ctx2) {
  55049. return (16)._rN();
  55050. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  55051. }),$globals.MessageNotUnderstood);
  55052. $ctx1.sendIdx["should:raise:"]=15;
  55053. self._should_raise_((function(){
  55054. return $core.withContext(function($ctx2) {
  55055. return (16)._rn();
  55056. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  55057. }),$globals.MessageNotUnderstood);
  55058. $ctx1.sendIdx["should:raise:"]=16;
  55059. self._should_raise_((function(){
  55060. return $core.withContext(function($ctx2) {
  55061. return (16)._rO();
  55062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  55063. }),$globals.MessageNotUnderstood);
  55064. $ctx1.sendIdx["should:raise:"]=17;
  55065. self._should_raise_((function(){
  55066. return $core.withContext(function($ctx2) {
  55067. return (16)._ro();
  55068. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  55069. }),$globals.MessageNotUnderstood);
  55070. $ctx1.sendIdx["should:raise:"]=18;
  55071. self._should_raise_((function(){
  55072. return $core.withContext(function($ctx2) {
  55073. return (16)._rP();
  55074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  55075. }),$globals.MessageNotUnderstood);
  55076. $ctx1.sendIdx["should:raise:"]=19;
  55077. self._should_raise_((function(){
  55078. return $core.withContext(function($ctx2) {
  55079. return (16)._rp();
  55080. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  55081. }),$globals.MessageNotUnderstood);
  55082. $ctx1.sendIdx["should:raise:"]=20;
  55083. self._should_raise_((function(){
  55084. return $core.withContext(function($ctx2) {
  55085. return (16)._rQ();
  55086. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  55087. }),$globals.MessageNotUnderstood);
  55088. $ctx1.sendIdx["should:raise:"]=21;
  55089. self._should_raise_((function(){
  55090. return $core.withContext(function($ctx2) {
  55091. return (16)._rq();
  55092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  55093. }),$globals.MessageNotUnderstood);
  55094. $ctx1.sendIdx["should:raise:"]=22;
  55095. self._should_raise_((function(){
  55096. return $core.withContext(function($ctx2) {
  55097. return (16)._rR();
  55098. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  55099. }),$globals.MessageNotUnderstood);
  55100. $ctx1.sendIdx["should:raise:"]=23;
  55101. self._should_raise_((function(){
  55102. return $core.withContext(function($ctx2) {
  55103. return (16)._rr();
  55104. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  55105. }),$globals.MessageNotUnderstood);
  55106. $ctx1.sendIdx["should:raise:"]=24;
  55107. self._should_raise_((function(){
  55108. return $core.withContext(function($ctx2) {
  55109. return (16)._rS();
  55110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  55111. }),$globals.MessageNotUnderstood);
  55112. $ctx1.sendIdx["should:raise:"]=25;
  55113. self._should_raise_((function(){
  55114. return $core.withContext(function($ctx2) {
  55115. return (16)._rs();
  55116. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  55117. }),$globals.MessageNotUnderstood);
  55118. $ctx1.sendIdx["should:raise:"]=26;
  55119. self._should_raise_((function(){
  55120. return $core.withContext(function($ctx2) {
  55121. return (16)._rT();
  55122. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  55123. }),$globals.MessageNotUnderstood);
  55124. $ctx1.sendIdx["should:raise:"]=27;
  55125. self._should_raise_((function(){
  55126. return $core.withContext(function($ctx2) {
  55127. return (16)._rt();
  55128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  55129. }),$globals.MessageNotUnderstood);
  55130. $ctx1.sendIdx["should:raise:"]=28;
  55131. self._should_raise_((function(){
  55132. return $core.withContext(function($ctx2) {
  55133. return (16)._rU();
  55134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  55135. }),$globals.MessageNotUnderstood);
  55136. $ctx1.sendIdx["should:raise:"]=29;
  55137. self._should_raise_((function(){
  55138. return $core.withContext(function($ctx2) {
  55139. return (16)._ru();
  55140. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  55141. }),$globals.MessageNotUnderstood);
  55142. $ctx1.sendIdx["should:raise:"]=30;
  55143. self._should_raise_((function(){
  55144. return $core.withContext(function($ctx2) {
  55145. return (16)._rV();
  55146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  55147. }),$globals.MessageNotUnderstood);
  55148. $ctx1.sendIdx["should:raise:"]=31;
  55149. self._should_raise_((function(){
  55150. return $core.withContext(function($ctx2) {
  55151. return (16)._rv();
  55152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  55153. }),$globals.MessageNotUnderstood);
  55154. $ctx1.sendIdx["should:raise:"]=32;
  55155. self._should_raise_((function(){
  55156. return $core.withContext(function($ctx2) {
  55157. return (16)._rW();
  55158. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  55159. }),$globals.MessageNotUnderstood);
  55160. $ctx1.sendIdx["should:raise:"]=33;
  55161. self._should_raise_((function(){
  55162. return $core.withContext(function($ctx2) {
  55163. return (16)._rw();
  55164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  55165. }),$globals.MessageNotUnderstood);
  55166. $ctx1.sendIdx["should:raise:"]=34;
  55167. self._should_raise_((function(){
  55168. return $core.withContext(function($ctx2) {
  55169. return (16)._rX();
  55170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  55171. }),$globals.MessageNotUnderstood);
  55172. $ctx1.sendIdx["should:raise:"]=35;
  55173. self._should_raise_((function(){
  55174. return $core.withContext(function($ctx2) {
  55175. return (16)._rx();
  55176. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  55177. }),$globals.MessageNotUnderstood);
  55178. $ctx1.sendIdx["should:raise:"]=36;
  55179. self._should_raise_((function(){
  55180. return $core.withContext(function($ctx2) {
  55181. return (16)._rY();
  55182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  55183. }),$globals.MessageNotUnderstood);
  55184. $ctx1.sendIdx["should:raise:"]=37;
  55185. self._should_raise_((function(){
  55186. return $core.withContext(function($ctx2) {
  55187. return (16)._ry();
  55188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  55189. }),$globals.MessageNotUnderstood);
  55190. $ctx1.sendIdx["should:raise:"]=38;
  55191. self._should_raise_((function(){
  55192. return $core.withContext(function($ctx2) {
  55193. return (16)._rZ();
  55194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  55195. }),$globals.MessageNotUnderstood);
  55196. $ctx1.sendIdx["should:raise:"]=39;
  55197. self._should_raise_((function(){
  55198. return $core.withContext(function($ctx2) {
  55199. return (16)._rz();
  55200. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  55201. }),$globals.MessageNotUnderstood);
  55202. $ctx1.sendIdx["should:raise:"]=40;
  55203. self._should_raise_((function(){
  55204. return $core.withContext(function($ctx2) {
  55205. return (11259375)._Z();
  55206. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  55207. }),$globals.MessageNotUnderstood);
  55208. return self;
  55209. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  55210. },
  55211. args: [],
  55212. 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.",
  55213. referencedClasses: ["MessageNotUnderstood"],
  55214. 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"]
  55215. }),
  55216. $globals.NumberTest);
  55217. $core.addMethod(
  55218. $core.method({
  55219. selector: "testLog",
  55220. protocol: 'tests',
  55221. fn: function (){
  55222. var self=this;
  55223. return $core.withContext(function($ctx1) {
  55224. self._assert_equals_((10000)._log(),(4));
  55225. $ctx1.sendIdx["assert:equals:"]=1;
  55226. self._assert_equals_((512)._log_((2)),(9));
  55227. $ctx1.sendIdx["assert:equals:"]=2;
  55228. self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  55229. return self;
  55230. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  55231. },
  55232. args: [],
  55233. 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.",
  55234. referencedClasses: ["Number"],
  55235. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  55236. }),
  55237. $globals.NumberTest);
  55238. $core.addMethod(
  55239. $core.method({
  55240. selector: "testMinMax",
  55241. protocol: 'tests',
  55242. fn: function (){
  55243. var self=this;
  55244. return $core.withContext(function($ctx1) {
  55245. self._assert_equals_((2)._max_((5)),(5));
  55246. $ctx1.sendIdx["assert:equals:"]=1;
  55247. self._assert_equals_((2)._min_((5)),(2));
  55248. return self;
  55249. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  55250. },
  55251. args: [],
  55252. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  55253. referencedClasses: [],
  55254. messageSends: ["assert:equals:", "max:", "min:"]
  55255. }),
  55256. $globals.NumberTest);
  55257. $core.addMethod(
  55258. $core.method({
  55259. selector: "testNegated",
  55260. protocol: 'tests',
  55261. fn: function (){
  55262. var self=this;
  55263. return $core.withContext(function($ctx1) {
  55264. var $1;
  55265. $1=(3)._negated();
  55266. $ctx1.sendIdx["negated"]=1;
  55267. self._assert_equals_($1,(-3));
  55268. $ctx1.sendIdx["assert:equals:"]=1;
  55269. self._assert_equals_((-3)._negated(),(3));
  55270. return self;
  55271. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  55272. },
  55273. args: [],
  55274. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  55275. referencedClasses: [],
  55276. messageSends: ["assert:equals:", "negated"]
  55277. }),
  55278. $globals.NumberTest);
  55279. $core.addMethod(
  55280. $core.method({
  55281. selector: "testPrintShowingDecimalPlaces",
  55282. protocol: 'tests',
  55283. fn: function (){
  55284. var self=this;
  55285. return $core.withContext(function($ctx1) {
  55286. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  55287. $1=(23)._printShowingDecimalPlaces_((2));
  55288. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  55289. self._assert_equals_($1,"23.00");
  55290. $ctx1.sendIdx["assert:equals:"]=1;
  55291. $2=(23.5698)._printShowingDecimalPlaces_((2));
  55292. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  55293. self._assert_equals_($2,"23.57");
  55294. $ctx1.sendIdx["assert:equals:"]=2;
  55295. $4=(234.567)._negated();
  55296. $ctx1.sendIdx["negated"]=1;
  55297. $3=$recv($4)._printShowingDecimalPlaces_((5));
  55298. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  55299. self._assert_equals_($3,"-234.56700");
  55300. $ctx1.sendIdx["assert:equals:"]=3;
  55301. $5=(23.4567)._printShowingDecimalPlaces_((0));
  55302. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  55303. self._assert_equals_($5,"23");
  55304. $ctx1.sendIdx["assert:equals:"]=4;
  55305. $6=(23.5567)._printShowingDecimalPlaces_((0));
  55306. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  55307. self._assert_equals_($6,"24");
  55308. $ctx1.sendIdx["assert:equals:"]=5;
  55309. $8=(23.4567)._negated();
  55310. $ctx1.sendIdx["negated"]=2;
  55311. $7=$recv($8)._printShowingDecimalPlaces_((0));
  55312. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  55313. self._assert_equals_($7,"-23");
  55314. $ctx1.sendIdx["assert:equals:"]=6;
  55315. $10=(23.5567)._negated();
  55316. $ctx1.sendIdx["negated"]=3;
  55317. $9=$recv($10)._printShowingDecimalPlaces_((0));
  55318. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  55319. self._assert_equals_($9,"-24");
  55320. $ctx1.sendIdx["assert:equals:"]=7;
  55321. $11=(100000000)._printShowingDecimalPlaces_((1));
  55322. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  55323. self._assert_equals_($11,"100000000.0");
  55324. $ctx1.sendIdx["assert:equals:"]=8;
  55325. $12=(0.98)._printShowingDecimalPlaces_((5));
  55326. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  55327. self._assert_equals_($12,"0.98000");
  55328. $ctx1.sendIdx["assert:equals:"]=9;
  55329. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  55330. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  55331. self._assert_equals_($13,"-0.98");
  55332. $ctx1.sendIdx["assert:equals:"]=10;
  55333. $14=(2.567)._printShowingDecimalPlaces_((2));
  55334. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  55335. self._assert_equals_($14,"2.57");
  55336. $ctx1.sendIdx["assert:equals:"]=11;
  55337. $15=(-2.567)._printShowingDecimalPlaces_((2));
  55338. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  55339. self._assert_equals_($15,"-2.57");
  55340. $ctx1.sendIdx["assert:equals:"]=12;
  55341. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  55342. return self;
  55343. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  55344. },
  55345. args: [],
  55346. 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'.",
  55347. referencedClasses: [],
  55348. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  55349. }),
  55350. $globals.NumberTest);
  55351. $core.addMethod(
  55352. $core.method({
  55353. selector: "testRaisedTo",
  55354. protocol: 'tests',
  55355. fn: function (){
  55356. var self=this;
  55357. return $core.withContext(function($ctx1) {
  55358. var $1,$2,$3;
  55359. $1=(2)._raisedTo_((4));
  55360. $ctx1.sendIdx["raisedTo:"]=1;
  55361. self._assert_equals_($1,(16));
  55362. $ctx1.sendIdx["assert:equals:"]=1;
  55363. $2=(2)._raisedTo_((0));
  55364. $ctx1.sendIdx["raisedTo:"]=2;
  55365. self._assert_equals_($2,(1));
  55366. $ctx1.sendIdx["assert:equals:"]=2;
  55367. $3=(2)._raisedTo_((-3));
  55368. $ctx1.sendIdx["raisedTo:"]=3;
  55369. self._assert_equals_($3,(0.125));
  55370. $ctx1.sendIdx["assert:equals:"]=3;
  55371. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  55372. $ctx1.sendIdx["assert:equals:"]=4;
  55373. self._assert_equals_((2).__star_star((4)),(16));
  55374. return self;
  55375. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  55376. },
  55377. args: [],
  55378. 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.",
  55379. referencedClasses: [],
  55380. messageSends: ["assert:equals:", "raisedTo:", "**"]
  55381. }),
  55382. $globals.NumberTest);
  55383. $core.addMethod(
  55384. $core.method({
  55385. selector: "testRounded",
  55386. protocol: 'tests',
  55387. fn: function (){
  55388. var self=this;
  55389. return $core.withContext(function($ctx1) {
  55390. var $1,$2;
  55391. $1=(3)._rounded();
  55392. $ctx1.sendIdx["rounded"]=1;
  55393. self._assert_equals_($1,(3));
  55394. $ctx1.sendIdx["assert:equals:"]=1;
  55395. $2=(3.212)._rounded();
  55396. $ctx1.sendIdx["rounded"]=2;
  55397. self._assert_equals_($2,(3));
  55398. $ctx1.sendIdx["assert:equals:"]=2;
  55399. self._assert_equals_((3.51)._rounded(),(4));
  55400. return self;
  55401. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  55402. },
  55403. args: [],
  55404. 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",
  55405. referencedClasses: [],
  55406. messageSends: ["assert:equals:", "rounded"]
  55407. }),
  55408. $globals.NumberTest);
  55409. $core.addMethod(
  55410. $core.method({
  55411. selector: "testSign",
  55412. protocol: 'tests',
  55413. fn: function (){
  55414. var self=this;
  55415. return $core.withContext(function($ctx1) {
  55416. var $1,$2;
  55417. $1=(5)._sign();
  55418. $ctx1.sendIdx["sign"]=1;
  55419. self._assert_equals_($1,(1));
  55420. $ctx1.sendIdx["assert:equals:"]=1;
  55421. $2=(0)._sign();
  55422. $ctx1.sendIdx["sign"]=2;
  55423. self._assert_equals_($2,(0));
  55424. $ctx1.sendIdx["assert:equals:"]=2;
  55425. self._assert_equals_((-1.4)._sign(),(-1));
  55426. return self;
  55427. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  55428. },
  55429. args: [],
  55430. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  55431. referencedClasses: [],
  55432. messageSends: ["assert:equals:", "sign"]
  55433. }),
  55434. $globals.NumberTest);
  55435. $core.addMethod(
  55436. $core.method({
  55437. selector: "testSqrt",
  55438. protocol: 'tests',
  55439. fn: function (){
  55440. var self=this;
  55441. return $core.withContext(function($ctx1) {
  55442. var $1;
  55443. $1=(4)._sqrt();
  55444. $ctx1.sendIdx["sqrt"]=1;
  55445. self._assert_equals_($1,(2));
  55446. $ctx1.sendIdx["assert:equals:"]=1;
  55447. self._assert_equals_((16)._sqrt(),(4));
  55448. return self;
  55449. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  55450. },
  55451. args: [],
  55452. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  55453. referencedClasses: [],
  55454. messageSends: ["assert:equals:", "sqrt"]
  55455. }),
  55456. $globals.NumberTest);
  55457. $core.addMethod(
  55458. $core.method({
  55459. selector: "testSquared",
  55460. protocol: 'tests',
  55461. fn: function (){
  55462. var self=this;
  55463. return $core.withContext(function($ctx1) {
  55464. self._assert_equals_((4)._squared(),(16));
  55465. return self;
  55466. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  55467. },
  55468. args: [],
  55469. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  55470. referencedClasses: [],
  55471. messageSends: ["assert:equals:", "squared"]
  55472. }),
  55473. $globals.NumberTest);
  55474. $core.addMethod(
  55475. $core.method({
  55476. selector: "testTimesRepeat",
  55477. protocol: 'tests',
  55478. fn: function (){
  55479. var self=this;
  55480. var i;
  55481. return $core.withContext(function($ctx1) {
  55482. i=(0);
  55483. (0)._timesRepeat_((function(){
  55484. return $core.withContext(function($ctx2) {
  55485. i=$recv(i).__plus((1));
  55486. $ctx2.sendIdx["+"]=1;
  55487. return i;
  55488. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55489. }));
  55490. $ctx1.sendIdx["timesRepeat:"]=1;
  55491. self._assert_equals_(i,(0));
  55492. $ctx1.sendIdx["assert:equals:"]=1;
  55493. (5)._timesRepeat_((function(){
  55494. return $core.withContext(function($ctx2) {
  55495. i=$recv(i).__plus((1));
  55496. return i;
  55497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55498. }));
  55499. self._assert_equals_(i,(5));
  55500. return self;
  55501. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  55502. },
  55503. args: [],
  55504. 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",
  55505. referencedClasses: [],
  55506. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  55507. }),
  55508. $globals.NumberTest);
  55509. $core.addMethod(
  55510. $core.method({
  55511. selector: "testTo",
  55512. protocol: 'tests',
  55513. fn: function (){
  55514. var self=this;
  55515. return $core.withContext(function($ctx1) {
  55516. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  55517. return self;
  55518. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  55519. },
  55520. args: [],
  55521. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  55522. referencedClasses: [],
  55523. messageSends: ["assert:equals:", "to:"]
  55524. }),
  55525. $globals.NumberTest);
  55526. $core.addMethod(
  55527. $core.method({
  55528. selector: "testToBy",
  55529. protocol: 'tests',
  55530. fn: function (){
  55531. var self=this;
  55532. return $core.withContext(function($ctx1) {
  55533. var $1;
  55534. $1=(0)._to_by_((6),(2));
  55535. $ctx1.sendIdx["to:by:"]=1;
  55536. self._assert_equals_($1,[(0), (2), (4), (6)]);
  55537. self._should_raise_((function(){
  55538. return $core.withContext(function($ctx2) {
  55539. return (1)._to_by_((4),(0));
  55540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55541. }),$globals.Error);
  55542. return self;
  55543. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  55544. },
  55545. args: [],
  55546. 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",
  55547. referencedClasses: ["Error"],
  55548. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  55549. }),
  55550. $globals.NumberTest);
  55551. $core.addMethod(
  55552. $core.method({
  55553. selector: "testTrigonometry",
  55554. protocol: 'tests',
  55555. fn: function (){
  55556. var self=this;
  55557. return $core.withContext(function($ctx1) {
  55558. self._assert_equals_((0)._cos(),(1));
  55559. $ctx1.sendIdx["assert:equals:"]=1;
  55560. self._assert_equals_((0)._sin(),(0));
  55561. $ctx1.sendIdx["assert:equals:"]=2;
  55562. self._assert_equals_((0)._tan(),(0));
  55563. $ctx1.sendIdx["assert:equals:"]=3;
  55564. self._assert_equals_((1)._arcCos(),(0));
  55565. $ctx1.sendIdx["assert:equals:"]=4;
  55566. self._assert_equals_((0)._arcSin(),(0));
  55567. $ctx1.sendIdx["assert:equals:"]=5;
  55568. self._assert_equals_((0)._arcTan(),(0));
  55569. return self;
  55570. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  55571. },
  55572. args: [],
  55573. 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.",
  55574. referencedClasses: [],
  55575. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  55576. }),
  55577. $globals.NumberTest);
  55578. $core.addMethod(
  55579. $core.method({
  55580. selector: "testTruncated",
  55581. protocol: 'tests',
  55582. fn: function (){
  55583. var self=this;
  55584. return $core.withContext(function($ctx1) {
  55585. var $1,$2;
  55586. $1=(3)._truncated();
  55587. $ctx1.sendIdx["truncated"]=1;
  55588. self._assert_equals_($1,(3));
  55589. $ctx1.sendIdx["assert:equals:"]=1;
  55590. $2=(3.212)._truncated();
  55591. $ctx1.sendIdx["truncated"]=2;
  55592. self._assert_equals_($2,(3));
  55593. $ctx1.sendIdx["assert:equals:"]=2;
  55594. self._assert_equals_((3.51)._truncated(),(3));
  55595. return self;
  55596. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  55597. },
  55598. args: [],
  55599. 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",
  55600. referencedClasses: [],
  55601. messageSends: ["assert:equals:", "truncated"]
  55602. }),
  55603. $globals.NumberTest);
  55604. $core.addClass('ObjectMock', $globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  55605. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  55606. $core.addMethod(
  55607. $core.method({
  55608. selector: "foo",
  55609. protocol: 'not yet classified',
  55610. fn: function (){
  55611. var self=this;
  55612. return self["@foo"];
  55613. },
  55614. args: [],
  55615. source: "foo\x0a\x09^ foo",
  55616. referencedClasses: [],
  55617. messageSends: []
  55618. }),
  55619. $globals.ObjectMock);
  55620. $core.addMethod(
  55621. $core.method({
  55622. selector: "foo:",
  55623. protocol: 'not yet classified',
  55624. fn: function (anObject){
  55625. var self=this;
  55626. self["@foo"]=anObject;
  55627. return self;
  55628. },
  55629. args: ["anObject"],
  55630. source: "foo: anObject\x0a\x09foo := anObject",
  55631. referencedClasses: [],
  55632. messageSends: []
  55633. }),
  55634. $globals.ObjectMock);
  55635. $core.addClass('ObjectTest', $globals.TestCase, [], 'Kernel-Tests');
  55636. $core.addMethod(
  55637. $core.method({
  55638. selector: "notDefined",
  55639. protocol: 'tests',
  55640. fn: function (){
  55641. var self=this;
  55642. return $core.withContext(function($ctx1) {
  55643. return void 0;;
  55644. return self;
  55645. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  55646. },
  55647. args: [],
  55648. source: "notDefined\x0a\x09<return void 0;>",
  55649. referencedClasses: [],
  55650. messageSends: []
  55651. }),
  55652. $globals.ObjectTest);
  55653. $core.addMethod(
  55654. $core.method({
  55655. selector: "testBasicAccess",
  55656. protocol: 'tests',
  55657. fn: function (){
  55658. var self=this;
  55659. var o;
  55660. return $core.withContext(function($ctx1) {
  55661. var $1;
  55662. o=$recv($globals.Object)._new();
  55663. $recv(o)._basicAt_put_("a",(1));
  55664. $1=$recv(o)._basicAt_("a");
  55665. $ctx1.sendIdx["basicAt:"]=1;
  55666. self._assert_equals_($1,(1));
  55667. $ctx1.sendIdx["assert:equals:"]=1;
  55668. self._assert_equals_($recv(o)._basicAt_("b"),nil);
  55669. return self;
  55670. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  55671. },
  55672. args: [],
  55673. 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",
  55674. referencedClasses: ["Object"],
  55675. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  55676. }),
  55677. $globals.ObjectTest);
  55678. $core.addMethod(
  55679. $core.method({
  55680. selector: "testBasicPerform",
  55681. protocol: 'tests',
  55682. fn: function (){
  55683. var self=this;
  55684. var o;
  55685. return $core.withContext(function($ctx1) {
  55686. o=$recv($globals.Object)._new();
  55687. $recv(o)._basicAt_put_("func",(function(){
  55688. return "hello";
  55689. }));
  55690. $ctx1.sendIdx["basicAt:put:"]=1;
  55691. $recv(o)._basicAt_put_("func2",(function(a){
  55692. return $core.withContext(function($ctx2) {
  55693. return $recv(a).__plus((1));
  55694. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  55695. }));
  55696. self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  55697. $ctx1.sendIdx["assert:equals:"]=1;
  55698. self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  55699. return self;
  55700. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  55701. },
  55702. args: [],
  55703. 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",
  55704. referencedClasses: ["Object"],
  55705. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  55706. }),
  55707. $globals.ObjectTest);
  55708. $core.addMethod(
  55709. $core.method({
  55710. selector: "testDNU",
  55711. protocol: 'tests',
  55712. fn: function (){
  55713. var self=this;
  55714. return $core.withContext(function($ctx1) {
  55715. self._should_raise_((function(){
  55716. return $core.withContext(function($ctx2) {
  55717. return $recv($recv($globals.Object)._new())._foo();
  55718. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55719. }),$globals.MessageNotUnderstood);
  55720. return self;
  55721. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  55722. },
  55723. args: [],
  55724. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  55725. referencedClasses: ["Object", "MessageNotUnderstood"],
  55726. messageSends: ["should:raise:", "foo", "new"]
  55727. }),
  55728. $globals.ObjectTest);
  55729. $core.addMethod(
  55730. $core.method({
  55731. selector: "testEquality",
  55732. protocol: 'tests',
  55733. fn: function (){
  55734. var self=this;
  55735. var o;
  55736. return $core.withContext(function($ctx1) {
  55737. var $1,$2,$4,$3;
  55738. o=$recv($globals.Object)._new();
  55739. $ctx1.sendIdx["new"]=1;
  55740. $1=$recv(o).__eq($recv($globals.Object)._new());
  55741. $ctx1.sendIdx["="]=1;
  55742. self._deny_($1);
  55743. $2=$recv(o).__eq(o);
  55744. $ctx1.sendIdx["="]=2;
  55745. self._assert_($2);
  55746. $ctx1.sendIdx["assert:"]=1;
  55747. $4=$recv(o)._yourself();
  55748. $ctx1.sendIdx["yourself"]=1;
  55749. $3=$recv($4).__eq(o);
  55750. $ctx1.sendIdx["="]=3;
  55751. self._assert_($3);
  55752. $ctx1.sendIdx["assert:"]=2;
  55753. self._assert_($recv(o).__eq($recv(o)._yourself()));
  55754. return self;
  55755. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  55756. },
  55757. args: [],
  55758. 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)",
  55759. referencedClasses: ["Object"],
  55760. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  55761. }),
  55762. $globals.ObjectTest);
  55763. $core.addMethod(
  55764. $core.method({
  55765. selector: "testHalt",
  55766. protocol: 'tests',
  55767. fn: function (){
  55768. var self=this;
  55769. return $core.withContext(function($ctx1) {
  55770. self._should_raise_((function(){
  55771. return $core.withContext(function($ctx2) {
  55772. return $recv($recv($globals.Object)._new())._halt();
  55773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55774. }),$globals.Error);
  55775. return self;
  55776. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  55777. },
  55778. args: [],
  55779. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  55780. referencedClasses: ["Object", "Error"],
  55781. messageSends: ["should:raise:", "halt", "new"]
  55782. }),
  55783. $globals.ObjectTest);
  55784. $core.addMethod(
  55785. $core.method({
  55786. selector: "testIdentity",
  55787. protocol: 'tests',
  55788. fn: function (){
  55789. var self=this;
  55790. var o;
  55791. return $core.withContext(function($ctx1) {
  55792. var $1,$2,$4,$3;
  55793. o=$recv($globals.Object)._new();
  55794. $ctx1.sendIdx["new"]=1;
  55795. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  55796. $ctx1.sendIdx["=="]=1;
  55797. self._deny_($1);
  55798. $2=$recv(o).__eq_eq(o);
  55799. $ctx1.sendIdx["=="]=2;
  55800. self._assert_($2);
  55801. $ctx1.sendIdx["assert:"]=1;
  55802. $4=$recv(o)._yourself();
  55803. $ctx1.sendIdx["yourself"]=1;
  55804. $3=$recv($4).__eq_eq(o);
  55805. $ctx1.sendIdx["=="]=3;
  55806. self._assert_($3);
  55807. $ctx1.sendIdx["assert:"]=2;
  55808. self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  55809. return self;
  55810. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  55811. },
  55812. args: [],
  55813. 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",
  55814. referencedClasses: ["Object"],
  55815. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  55816. }),
  55817. $globals.ObjectTest);
  55818. $core.addMethod(
  55819. $core.method({
  55820. selector: "testIfNil",
  55821. protocol: 'tests',
  55822. fn: function (){
  55823. var self=this;
  55824. return $core.withContext(function($ctx1) {
  55825. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  55826. $2=$recv($globals.Object)._new();
  55827. $ctx1.sendIdx["new"]=1;
  55828. $1=$recv($2)._isNil();
  55829. self._deny_($1);
  55830. $ctx1.sendIdx["deny:"]=1;
  55831. $5=$recv($globals.Object)._new();
  55832. $ctx1.sendIdx["new"]=2;
  55833. if(($receiver = $5) == null || $receiver.isNil){
  55834. $4=true;
  55835. } else {
  55836. $4=$5;
  55837. };
  55838. $3=$recv($4).__eq(true);
  55839. self._deny_($3);
  55840. $7=$recv($globals.Object)._new();
  55841. $ctx1.sendIdx["new"]=3;
  55842. if(($receiver = $7) == null || $receiver.isNil){
  55843. $6=$7;
  55844. } else {
  55845. $6=true;
  55846. };
  55847. self._assert_equals_($6,true);
  55848. $ctx1.sendIdx["assert:equals:"]=1;
  55849. $9=$recv($globals.Object)._new();
  55850. $ctx1.sendIdx["new"]=4;
  55851. if(($receiver = $9) == null || $receiver.isNil){
  55852. $8=false;
  55853. } else {
  55854. $8=true;
  55855. };
  55856. self._assert_equals_($8,true);
  55857. $ctx1.sendIdx["assert:equals:"]=2;
  55858. $11=$recv($globals.Object)._new();
  55859. if(($receiver = $11) == null || $receiver.isNil){
  55860. $10=false;
  55861. } else {
  55862. $10=true;
  55863. };
  55864. self._assert_equals_($10,true);
  55865. return self;
  55866. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  55867. },
  55868. args: [],
  55869. 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",
  55870. referencedClasses: ["Object"],
  55871. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  55872. }),
  55873. $globals.ObjectTest);
  55874. $core.addMethod(
  55875. $core.method({
  55876. selector: "testInstVars",
  55877. protocol: 'tests',
  55878. fn: function (){
  55879. var self=this;
  55880. var o;
  55881. return $core.withContext(function($ctx1) {
  55882. var $1,$2;
  55883. o=$recv($globals.ObjectMock)._new();
  55884. $1=$recv(o)._instVarAt_("foo");
  55885. $ctx1.sendIdx["instVarAt:"]=1;
  55886. self._assert_equals_($1,nil);
  55887. $ctx1.sendIdx["assert:equals:"]=1;
  55888. $recv(o)._instVarAt_put_("foo",(1));
  55889. $2=$recv(o)._instVarAt_("foo");
  55890. $ctx1.sendIdx["instVarAt:"]=2;
  55891. self._assert_equals_($2,(1));
  55892. $ctx1.sendIdx["assert:equals:"]=2;
  55893. self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  55894. return self;
  55895. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  55896. },
  55897. args: [],
  55898. 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",
  55899. referencedClasses: ["ObjectMock"],
  55900. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  55901. }),
  55902. $globals.ObjectTest);
  55903. $core.addMethod(
  55904. $core.method({
  55905. selector: "testNilUndefined",
  55906. protocol: 'tests',
  55907. fn: function (){
  55908. var self=this;
  55909. return $core.withContext(function($ctx1) {
  55910. self._assert_equals_(self._notDefined(),nil);
  55911. return self;
  55912. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  55913. },
  55914. args: [],
  55915. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  55916. referencedClasses: [],
  55917. messageSends: ["assert:equals:", "notDefined"]
  55918. }),
  55919. $globals.ObjectTest);
  55920. $core.addMethod(
  55921. $core.method({
  55922. selector: "testYourself",
  55923. protocol: 'tests',
  55924. fn: function (){
  55925. var self=this;
  55926. var o;
  55927. return $core.withContext(function($ctx1) {
  55928. o=$recv($globals.ObjectMock)._new();
  55929. self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  55930. return self;
  55931. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  55932. },
  55933. args: [],
  55934. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  55935. referencedClasses: ["ObjectMock"],
  55936. messageSends: ["new", "assert:", "==", "yourself"]
  55937. }),
  55938. $globals.ObjectTest);
  55939. $core.addMethod(
  55940. $core.method({
  55941. selector: "testidentityHash",
  55942. protocol: 'tests',
  55943. fn: function (){
  55944. var self=this;
  55945. var o1,o2;
  55946. return $core.withContext(function($ctx1) {
  55947. var $2,$3,$1,$5,$4;
  55948. o1=$recv($globals.Object)._new();
  55949. $ctx1.sendIdx["new"]=1;
  55950. o2=$recv($globals.Object)._new();
  55951. $2=$recv(o1)._identityHash();
  55952. $ctx1.sendIdx["identityHash"]=1;
  55953. $3=$recv(o1)._identityHash();
  55954. $ctx1.sendIdx["identityHash"]=2;
  55955. $1=$recv($2).__eq_eq($3);
  55956. $ctx1.sendIdx["=="]=1;
  55957. self._assert_($1);
  55958. $5=$recv(o1)._identityHash();
  55959. $ctx1.sendIdx["identityHash"]=3;
  55960. $4=$recv($5).__eq_eq($recv(o2)._identityHash());
  55961. self._deny_($4);
  55962. return self;
  55963. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)});
  55964. },
  55965. args: [],
  55966. 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",
  55967. referencedClasses: ["Object"],
  55968. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  55969. }),
  55970. $globals.ObjectTest);
  55971. $core.addClass('PointTest', $globals.TestCase, [], 'Kernel-Tests');
  55972. $core.addMethod(
  55973. $core.method({
  55974. selector: "testAccessing",
  55975. protocol: 'tests',
  55976. fn: function (){
  55977. var self=this;
  55978. return $core.withContext(function($ctx1) {
  55979. var $2,$1,$3,$6,$5,$4;
  55980. $2=$recv($globals.Point)._x_y_((3),(4));
  55981. $ctx1.sendIdx["x:y:"]=1;
  55982. $1=$recv($2)._x();
  55983. $ctx1.sendIdx["x"]=1;
  55984. self._assert_equals_($1,(3));
  55985. $ctx1.sendIdx["assert:equals:"]=1;
  55986. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  55987. $ctx1.sendIdx["y"]=1;
  55988. self._assert_equals_($3,(4));
  55989. $ctx1.sendIdx["assert:equals:"]=2;
  55990. $6=$recv($globals.Point)._new();
  55991. $ctx1.sendIdx["new"]=1;
  55992. $5=$recv($6)._x_((3));
  55993. $4=$recv($5)._x();
  55994. self._assert_equals_($4,(3));
  55995. $ctx1.sendIdx["assert:equals:"]=3;
  55996. self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  55997. return self;
  55998. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  55999. },
  56000. args: [],
  56001. 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",
  56002. referencedClasses: ["Point"],
  56003. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  56004. }),
  56005. $globals.PointTest);
  56006. $core.addMethod(
  56007. $core.method({
  56008. selector: "testArithmetic",
  56009. protocol: 'tests',
  56010. fn: function (){
  56011. var self=this;
  56012. return $core.withContext(function($ctx1) {
  56013. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  56014. $2=(3).__at((4));
  56015. $ctx1.sendIdx["@"]=1;
  56016. $3=(3).__at((4));
  56017. $ctx1.sendIdx["@"]=2;
  56018. $1=$recv($2).__star($3);
  56019. $4=$recv($globals.Point)._x_y_((9),(16));
  56020. $ctx1.sendIdx["x:y:"]=1;
  56021. self._assert_equals_($1,$4);
  56022. $ctx1.sendIdx["assert:equals:"]=1;
  56023. $6=(3).__at((4));
  56024. $ctx1.sendIdx["@"]=3;
  56025. $7=(3).__at((4));
  56026. $ctx1.sendIdx["@"]=4;
  56027. $5=$recv($6).__plus($7);
  56028. $8=$recv($globals.Point)._x_y_((6),(8));
  56029. $ctx1.sendIdx["x:y:"]=2;
  56030. self._assert_equals_($5,$8);
  56031. $ctx1.sendIdx["assert:equals:"]=2;
  56032. $10=(3).__at((4));
  56033. $ctx1.sendIdx["@"]=5;
  56034. $11=(3).__at((4));
  56035. $ctx1.sendIdx["@"]=6;
  56036. $9=$recv($10).__minus($11);
  56037. $12=$recv($globals.Point)._x_y_((0),(0));
  56038. $ctx1.sendIdx["x:y:"]=3;
  56039. self._assert_equals_($9,$12);
  56040. $ctx1.sendIdx["assert:equals:"]=3;
  56041. $14=(6).__at((8));
  56042. $ctx1.sendIdx["@"]=7;
  56043. $13=$recv($14).__slash((3).__at((4)));
  56044. self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  56045. return self;
  56046. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  56047. },
  56048. args: [],
  56049. 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)",
  56050. referencedClasses: ["Point"],
  56051. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  56052. }),
  56053. $globals.PointTest);
  56054. $core.addMethod(
  56055. $core.method({
  56056. selector: "testAt",
  56057. protocol: 'tests',
  56058. fn: function (){
  56059. var self=this;
  56060. return $core.withContext(function($ctx1) {
  56061. self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  56062. return self;
  56063. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  56064. },
  56065. args: [],
  56066. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  56067. referencedClasses: ["Point"],
  56068. messageSends: ["assert:equals:", "@", "x:y:"]
  56069. }),
  56070. $globals.PointTest);
  56071. $core.addMethod(
  56072. $core.method({
  56073. selector: "testComparison",
  56074. protocol: 'tests',
  56075. fn: function (){
  56076. var self=this;
  56077. return $core.withContext(function($ctx1) {
  56078. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  56079. $2=(3).__at((4));
  56080. $ctx1.sendIdx["@"]=1;
  56081. $3=(4).__at((5));
  56082. $ctx1.sendIdx["@"]=2;
  56083. $1=$recv($2).__lt($3);
  56084. $ctx1.sendIdx["<"]=1;
  56085. self._assert_($1);
  56086. $ctx1.sendIdx["assert:"]=1;
  56087. $5=(3).__at((4));
  56088. $ctx1.sendIdx["@"]=3;
  56089. $6=(4).__at((4));
  56090. $ctx1.sendIdx["@"]=4;
  56091. $4=$recv($5).__lt($6);
  56092. self._deny_($4);
  56093. $ctx1.sendIdx["deny:"]=1;
  56094. $8=(4).__at((5));
  56095. $ctx1.sendIdx["@"]=5;
  56096. $9=(4).__at((5));
  56097. $ctx1.sendIdx["@"]=6;
  56098. $7=$recv($8).__lt_eq($9);
  56099. $ctx1.sendIdx["<="]=1;
  56100. self._assert_($7);
  56101. $ctx1.sendIdx["assert:"]=2;
  56102. $11=(4).__at((5));
  56103. $ctx1.sendIdx["@"]=7;
  56104. $12=(3).__at((5));
  56105. $ctx1.sendIdx["@"]=8;
  56106. $10=$recv($11).__lt_eq($12);
  56107. self._deny_($10);
  56108. $ctx1.sendIdx["deny:"]=2;
  56109. $14=(5).__at((6));
  56110. $ctx1.sendIdx["@"]=9;
  56111. $15=(4).__at((5));
  56112. $ctx1.sendIdx["@"]=10;
  56113. $13=$recv($14).__gt($15);
  56114. $ctx1.sendIdx[">"]=1;
  56115. self._assert_($13);
  56116. $ctx1.sendIdx["assert:"]=3;
  56117. $17=(5).__at((6));
  56118. $ctx1.sendIdx["@"]=11;
  56119. $18=(6).__at((6));
  56120. $ctx1.sendIdx["@"]=12;
  56121. $16=$recv($17).__gt($18);
  56122. self._deny_($16);
  56123. $ctx1.sendIdx["deny:"]=3;
  56124. $20=(4).__at((5));
  56125. $ctx1.sendIdx["@"]=13;
  56126. $21=(4).__at((5));
  56127. $ctx1.sendIdx["@"]=14;
  56128. $19=$recv($20).__gt_eq($21);
  56129. $ctx1.sendIdx[">="]=1;
  56130. self._assert_($19);
  56131. $23=(4).__at((5));
  56132. $ctx1.sendIdx["@"]=15;
  56133. $22=$recv($23).__gt_eq((5).__at((5)));
  56134. self._deny_($22);
  56135. return self;
  56136. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  56137. },
  56138. args: [],
  56139. 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)",
  56140. referencedClasses: [],
  56141. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  56142. }),
  56143. $globals.PointTest);
  56144. $core.addMethod(
  56145. $core.method({
  56146. selector: "testEgality",
  56147. protocol: 'tests',
  56148. fn: function (){
  56149. var self=this;
  56150. return $core.withContext(function($ctx1) {
  56151. var $2,$3,$1,$5,$4;
  56152. $2=(3).__at((4));
  56153. $ctx1.sendIdx["@"]=1;
  56154. $3=(3).__at((4));
  56155. $ctx1.sendIdx["@"]=2;
  56156. $1=$recv($2).__eq($3);
  56157. $ctx1.sendIdx["="]=1;
  56158. self._assert_($1);
  56159. $5=(3).__at((5));
  56160. $ctx1.sendIdx["@"]=3;
  56161. $4=$recv($5).__eq((3).__at((6)));
  56162. self._deny_($4);
  56163. return self;
  56164. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  56165. },
  56166. args: [],
  56167. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  56168. referencedClasses: [],
  56169. messageSends: ["assert:", "=", "@", "deny:"]
  56170. }),
  56171. $globals.PointTest);
  56172. $core.addMethod(
  56173. $core.method({
  56174. selector: "testNew",
  56175. protocol: 'tests',
  56176. fn: function (){
  56177. var self=this;
  56178. return $core.withContext(function($ctx1) {
  56179. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  56180. $3=$recv($globals.Point)._new();
  56181. $ctx1.sendIdx["new"]=1;
  56182. $2=$recv($3)._x_((3));
  56183. $ctx1.sendIdx["x:"]=1;
  56184. $1=$recv($2)._y();
  56185. $ctx1.sendIdx["y"]=1;
  56186. self._assert_equals_($1,nil);
  56187. $ctx1.sendIdx["assert:equals:"]=1;
  56188. $7=$recv($globals.Point)._new();
  56189. $ctx1.sendIdx["new"]=2;
  56190. $6=$recv($7)._x_((3));
  56191. $5=$recv($6)._x();
  56192. $ctx1.sendIdx["x"]=1;
  56193. $4=$recv($5).__eq((0));
  56194. $ctx1.sendIdx["="]=1;
  56195. self._deny_($4);
  56196. $ctx1.sendIdx["deny:"]=1;
  56197. $10=$recv($globals.Point)._new();
  56198. $ctx1.sendIdx["new"]=3;
  56199. $9=$recv($10)._y_((4));
  56200. $ctx1.sendIdx["y:"]=1;
  56201. $8=$recv($9)._x();
  56202. self._assert_equals_($8,nil);
  56203. self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  56204. return self;
  56205. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  56206. },
  56207. args: [],
  56208. 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",
  56209. referencedClasses: ["Point"],
  56210. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  56211. }),
  56212. $globals.PointTest);
  56213. $core.addMethod(
  56214. $core.method({
  56215. selector: "testTranslateBy",
  56216. protocol: 'tests',
  56217. fn: function (){
  56218. var self=this;
  56219. return $core.withContext(function($ctx1) {
  56220. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  56221. $2=(3).__at((3));
  56222. $ctx1.sendIdx["@"]=1;
  56223. $3=(0).__at((1));
  56224. $ctx1.sendIdx["@"]=2;
  56225. $1=$recv($2)._translateBy_($3);
  56226. $ctx1.sendIdx["translateBy:"]=1;
  56227. $4=(3).__at((4));
  56228. $ctx1.sendIdx["@"]=3;
  56229. self._assert_equals_($1,$4);
  56230. $ctx1.sendIdx["assert:equals:"]=1;
  56231. $6=(3).__at((3));
  56232. $ctx1.sendIdx["@"]=4;
  56233. $8=(1)._negated();
  56234. $ctx1.sendIdx["negated"]=1;
  56235. $7=(0).__at($8);
  56236. $ctx1.sendIdx["@"]=5;
  56237. $5=$recv($6)._translateBy_($7);
  56238. $ctx1.sendIdx["translateBy:"]=2;
  56239. $9=(3).__at((2));
  56240. $ctx1.sendIdx["@"]=6;
  56241. self._assert_equals_($5,$9);
  56242. $ctx1.sendIdx["assert:equals:"]=2;
  56243. $11=(3).__at((3));
  56244. $ctx1.sendIdx["@"]=7;
  56245. $12=(2).__at((3));
  56246. $ctx1.sendIdx["@"]=8;
  56247. $10=$recv($11)._translateBy_($12);
  56248. $ctx1.sendIdx["translateBy:"]=3;
  56249. $13=(5).__at((6));
  56250. $ctx1.sendIdx["@"]=9;
  56251. self._assert_equals_($10,$13);
  56252. $ctx1.sendIdx["assert:equals:"]=3;
  56253. $15=(3).__at((3));
  56254. $ctx1.sendIdx["@"]=10;
  56255. $16=$recv((3)._negated()).__at((0));
  56256. $ctx1.sendIdx["@"]=11;
  56257. $14=$recv($15)._translateBy_($16);
  56258. self._assert_equals_($14,(0).__at((3)));
  56259. return self;
  56260. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  56261. },
  56262. args: [],
  56263. 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.",
  56264. referencedClasses: [],
  56265. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  56266. }),
  56267. $globals.PointTest);
  56268. $core.addClass('QueueTest', $globals.TestCase, [], 'Kernel-Tests');
  56269. $core.addMethod(
  56270. $core.method({
  56271. selector: "testNextIfAbsent",
  56272. protocol: 'tests',
  56273. fn: function (){
  56274. var self=this;
  56275. var queue;
  56276. return $core.withContext(function($ctx1) {
  56277. var $2,$1;
  56278. queue=$recv($globals.Queue)._new();
  56279. $recv(queue)._nextPut_("index1");
  56280. $2=$recv(queue)._nextIfAbsent_("empty");
  56281. $ctx1.sendIdx["nextIfAbsent:"]=1;
  56282. $1=$recv($2).__eq("index1");
  56283. $ctx1.sendIdx["="]=1;
  56284. self._assert_($1);
  56285. self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  56286. return self;
  56287. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  56288. },
  56289. args: [],
  56290. 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'",
  56291. referencedClasses: ["Queue"],
  56292. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  56293. }),
  56294. $globals.QueueTest);
  56295. $core.addMethod(
  56296. $core.method({
  56297. selector: "testQueueNext",
  56298. protocol: 'tests',
  56299. fn: function (){
  56300. var self=this;
  56301. var queue;
  56302. return $core.withContext(function($ctx1) {
  56303. var $1,$3,$2,$5,$4;
  56304. queue=$recv($globals.Queue)._new();
  56305. $1=queue;
  56306. $recv($1)._nextPut_("index1");
  56307. $ctx1.sendIdx["nextPut:"]=1;
  56308. $recv($1)._nextPut_("index2");
  56309. $3=$recv(queue)._next();
  56310. $ctx1.sendIdx["next"]=1;
  56311. $2=$recv($3).__eq("index1");
  56312. $ctx1.sendIdx["="]=1;
  56313. self._assert_($2);
  56314. $5=$recv(queue)._next();
  56315. $ctx1.sendIdx["next"]=2;
  56316. $4=$recv($5).__eq("index");
  56317. self._deny_($4);
  56318. self._should_raise_((function(){
  56319. return $core.withContext(function($ctx2) {
  56320. return $recv(queue)._next();
  56321. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56322. }),$globals.Error);
  56323. return self;
  56324. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  56325. },
  56326. args: [],
  56327. 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",
  56328. referencedClasses: ["Queue", "Error"],
  56329. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  56330. }),
  56331. $globals.QueueTest);
  56332. $core.addClass('RandomTest', $globals.TestCase, [], 'Kernel-Tests');
  56333. $core.addMethod(
  56334. $core.method({
  56335. selector: "testAtRandomNumber",
  56336. protocol: 'tests',
  56337. fn: function (){
  56338. var self=this;
  56339. var val;
  56340. return $core.withContext(function($ctx1) {
  56341. (100)._timesRepeat_((function(){
  56342. return $core.withContext(function($ctx2) {
  56343. val=(10)._atRandom();
  56344. val;
  56345. self._assert_($recv(val).__gt((0)));
  56346. $ctx2.sendIdx["assert:"]=1;
  56347. return self._assert_($recv(val).__lt((11)));
  56348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56349. }));
  56350. return self;
  56351. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  56352. },
  56353. args: [],
  56354. 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]",
  56355. referencedClasses: [],
  56356. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  56357. }),
  56358. $globals.RandomTest);
  56359. $core.addMethod(
  56360. $core.method({
  56361. selector: "testAtRandomSequenceableCollection",
  56362. protocol: 'tests',
  56363. fn: function (){
  56364. var self=this;
  56365. var val;
  56366. return $core.withContext(function($ctx1) {
  56367. var $3,$4,$2,$1;
  56368. (100)._timesRepeat_((function(){
  56369. return $core.withContext(function($ctx2) {
  56370. val="abc"._atRandom();
  56371. val;
  56372. $3=$recv(val).__eq("a");
  56373. $ctx2.sendIdx["="]=1;
  56374. $4=$recv(val).__eq("b");
  56375. $ctx2.sendIdx["="]=2;
  56376. $2=$recv($3).__or($4);
  56377. $1=$recv($2).__or($recv(val).__eq("c"));
  56378. $ctx2.sendIdx["|"]=1;
  56379. return self._assert_($1);
  56380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56381. }));
  56382. return self;
  56383. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  56384. },
  56385. args: [],
  56386. 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].",
  56387. referencedClasses: [],
  56388. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  56389. }),
  56390. $globals.RandomTest);
  56391. $core.addMethod(
  56392. $core.method({
  56393. selector: "textNext",
  56394. protocol: 'tests',
  56395. fn: function (){
  56396. var self=this;
  56397. return $core.withContext(function($ctx1) {
  56398. var $1;
  56399. (10000)._timesRepeat_((function(){
  56400. var current,next;
  56401. return $core.withContext(function($ctx2) {
  56402. next=$recv($recv($globals.Random)._new())._next();
  56403. next;
  56404. self._assert_($recv(next).__gt_eq((0)));
  56405. $ctx2.sendIdx["assert:"]=1;
  56406. self._assert_($recv(next).__lt((1)));
  56407. $1=$recv(current).__eq(next);
  56408. $ctx2.sendIdx["="]=1;
  56409. self._deny_($1);
  56410. return $recv(next).__eq(current);
  56411. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  56412. }));
  56413. return self;
  56414. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  56415. },
  56416. args: [],
  56417. 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 ]",
  56418. referencedClasses: ["Random"],
  56419. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  56420. }),
  56421. $globals.RandomTest);
  56422. $core.addClass('StreamTest', $globals.TestCase, [], 'Kernel-Tests');
  56423. $core.addMethod(
  56424. $core.method({
  56425. selector: "collectionClass",
  56426. protocol: 'accessing',
  56427. fn: function (){
  56428. var self=this;
  56429. return $core.withContext(function($ctx1) {
  56430. return $recv(self._class())._collectionClass();
  56431. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  56432. },
  56433. args: [],
  56434. source: "collectionClass\x0a\x09^ self class collectionClass",
  56435. referencedClasses: [],
  56436. messageSends: ["collectionClass", "class"]
  56437. }),
  56438. $globals.StreamTest);
  56439. $core.addMethod(
  56440. $core.method({
  56441. selector: "newCollection",
  56442. protocol: 'accessing',
  56443. fn: function (){
  56444. var self=this;
  56445. return $core.withContext(function($ctx1) {
  56446. return $recv(self._collectionClass())._new();
  56447. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  56448. },
  56449. args: [],
  56450. source: "newCollection\x0a\x09^ self collectionClass new",
  56451. referencedClasses: [],
  56452. messageSends: ["new", "collectionClass"]
  56453. }),
  56454. $globals.StreamTest);
  56455. $core.addMethod(
  56456. $core.method({
  56457. selector: "newStream",
  56458. protocol: 'accessing',
  56459. fn: function (){
  56460. var self=this;
  56461. return $core.withContext(function($ctx1) {
  56462. return $recv($recv(self._collectionClass())._new())._stream();
  56463. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  56464. },
  56465. args: [],
  56466. source: "newStream\x0a\x09^ self collectionClass new stream",
  56467. referencedClasses: [],
  56468. messageSends: ["stream", "new", "collectionClass"]
  56469. }),
  56470. $globals.StreamTest);
  56471. $core.addMethod(
  56472. $core.method({
  56473. selector: "testAtStartAtEnd",
  56474. protocol: 'tests',
  56475. fn: function (){
  56476. var self=this;
  56477. var stream;
  56478. return $core.withContext(function($ctx1) {
  56479. var $1,$2,$3,$4;
  56480. stream=self._newStream();
  56481. $1=$recv(stream)._atStart();
  56482. $ctx1.sendIdx["atStart"]=1;
  56483. self._assert_($1);
  56484. $ctx1.sendIdx["assert:"]=1;
  56485. $2=$recv(stream)._atEnd();
  56486. $ctx1.sendIdx["atEnd"]=1;
  56487. self._assert_($2);
  56488. $ctx1.sendIdx["assert:"]=2;
  56489. $recv(stream)._nextPutAll_(self._newCollection());
  56490. $3=$recv(stream)._atEnd();
  56491. $ctx1.sendIdx["atEnd"]=2;
  56492. self._assert_($3);
  56493. $4=$recv(stream)._atStart();
  56494. $ctx1.sendIdx["atStart"]=2;
  56495. self._deny_($4);
  56496. $ctx1.sendIdx["deny:"]=1;
  56497. $recv(stream)._position_((1));
  56498. self._deny_($recv(stream)._atEnd());
  56499. $ctx1.sendIdx["deny:"]=2;
  56500. self._deny_($recv(stream)._atStart());
  56501. return self;
  56502. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  56503. },
  56504. args: [],
  56505. 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",
  56506. referencedClasses: [],
  56507. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  56508. }),
  56509. $globals.StreamTest);
  56510. $core.addMethod(
  56511. $core.method({
  56512. selector: "testContents",
  56513. protocol: 'tests',
  56514. fn: function (){
  56515. var self=this;
  56516. var stream;
  56517. return $core.withContext(function($ctx1) {
  56518. var $1,$2;
  56519. stream=self._newStream();
  56520. $1=stream;
  56521. $2=self._newCollection();
  56522. $ctx1.sendIdx["newCollection"]=1;
  56523. $recv($1)._nextPutAll_($2);
  56524. self._assert_equals_($recv(stream)._contents(),self._newCollection());
  56525. return self;
  56526. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  56527. },
  56528. args: [],
  56529. 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",
  56530. referencedClasses: [],
  56531. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  56532. }),
  56533. $globals.StreamTest);
  56534. $core.addMethod(
  56535. $core.method({
  56536. selector: "testIsEmpty",
  56537. protocol: 'tests',
  56538. fn: function (){
  56539. var self=this;
  56540. var stream;
  56541. return $core.withContext(function($ctx1) {
  56542. var $1;
  56543. stream=self._newStream();
  56544. $1=$recv(stream)._isEmpty();
  56545. $ctx1.sendIdx["isEmpty"]=1;
  56546. self._assert_($1);
  56547. $recv(stream)._nextPutAll_(self._newCollection());
  56548. self._deny_($recv(stream)._isEmpty());
  56549. return self;
  56550. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  56551. },
  56552. args: [],
  56553. 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",
  56554. referencedClasses: [],
  56555. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  56556. }),
  56557. $globals.StreamTest);
  56558. $core.addMethod(
  56559. $core.method({
  56560. selector: "testPosition",
  56561. protocol: 'tests',
  56562. fn: function (){
  56563. var self=this;
  56564. var collection,stream;
  56565. return $core.withContext(function($ctx1) {
  56566. var $1,$2,$3;
  56567. collection=self._newCollection();
  56568. stream=self._newStream();
  56569. $recv(stream)._nextPutAll_(collection);
  56570. $1=$recv(stream)._position();
  56571. $ctx1.sendIdx["position"]=1;
  56572. self._assert_equals_($1,$recv(collection)._size());
  56573. $ctx1.sendIdx["assert:equals:"]=1;
  56574. $recv(stream)._position_((0));
  56575. $2=$recv(stream)._position();
  56576. $ctx1.sendIdx["position"]=2;
  56577. self._assert_equals_($2,(0));
  56578. $ctx1.sendIdx["assert:equals:"]=2;
  56579. $recv(stream)._next();
  56580. $ctx1.sendIdx["next"]=1;
  56581. $3=$recv(stream)._position();
  56582. $ctx1.sendIdx["position"]=3;
  56583. self._assert_equals_($3,(1));
  56584. $ctx1.sendIdx["assert:equals:"]=3;
  56585. $recv(stream)._next();
  56586. self._assert_equals_($recv(stream)._position(),(2));
  56587. return self;
  56588. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  56589. },
  56590. args: [],
  56591. 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",
  56592. referencedClasses: [],
  56593. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  56594. }),
  56595. $globals.StreamTest);
  56596. $core.addMethod(
  56597. $core.method({
  56598. selector: "testReading",
  56599. protocol: 'tests',
  56600. fn: function (){
  56601. var self=this;
  56602. var stream,collection;
  56603. return $core.withContext(function($ctx1) {
  56604. var $1,$2;
  56605. collection=self._newCollection();
  56606. stream=self._newStream();
  56607. $1=stream;
  56608. $recv($1)._nextPutAll_(collection);
  56609. $recv($1)._position_((0));
  56610. $recv(collection)._do_((function(each){
  56611. return $core.withContext(function($ctx2) {
  56612. $2=$recv(stream)._next();
  56613. $ctx2.sendIdx["next"]=1;
  56614. return self._assert_equals_($2,each);
  56615. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56616. }));
  56617. self._assert_($recv($recv(stream)._next())._isNil());
  56618. return self;
  56619. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  56620. },
  56621. args: [],
  56622. 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",
  56623. referencedClasses: [],
  56624. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  56625. }),
  56626. $globals.StreamTest);
  56627. $core.addMethod(
  56628. $core.method({
  56629. selector: "testStreamContents",
  56630. protocol: 'tests',
  56631. fn: function (){
  56632. var self=this;
  56633. return self;
  56634. },
  56635. args: [],
  56636. source: "testStreamContents",
  56637. referencedClasses: [],
  56638. messageSends: []
  56639. }),
  56640. $globals.StreamTest);
  56641. $core.addMethod(
  56642. $core.method({
  56643. selector: "testWrite",
  56644. protocol: 'tests',
  56645. fn: function (){
  56646. var self=this;
  56647. var stream,collection;
  56648. return $core.withContext(function($ctx1) {
  56649. collection=self._newCollection();
  56650. stream=self._newStream();
  56651. $recv(collection)._do_((function(each){
  56652. return $core.withContext(function($ctx2) {
  56653. return $recv(stream).__lt_lt(each);
  56654. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56655. }));
  56656. self._assert_equals_($recv(stream)._contents(),collection);
  56657. return self;
  56658. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  56659. },
  56660. args: [],
  56661. 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",
  56662. referencedClasses: [],
  56663. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  56664. }),
  56665. $globals.StreamTest);
  56666. $core.addMethod(
  56667. $core.method({
  56668. selector: "testWriting",
  56669. protocol: 'tests',
  56670. fn: function (){
  56671. var self=this;
  56672. var stream,collection;
  56673. return $core.withContext(function($ctx1) {
  56674. var $1;
  56675. collection=self._newCollection();
  56676. stream=self._newStream();
  56677. $ctx1.sendIdx["newStream"]=1;
  56678. $recv(collection)._do_((function(each){
  56679. return $core.withContext(function($ctx2) {
  56680. return $recv(stream)._nextPut_(each);
  56681. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56682. }));
  56683. $1=$recv(stream)._contents();
  56684. $ctx1.sendIdx["contents"]=1;
  56685. self._assert_equals_($1,collection);
  56686. $ctx1.sendIdx["assert:equals:"]=1;
  56687. stream=self._newStream();
  56688. $recv(stream)._nextPutAll_(collection);
  56689. self._assert_equals_($recv(stream)._contents(),collection);
  56690. return self;
  56691. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  56692. },
  56693. args: [],
  56694. 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",
  56695. referencedClasses: [],
  56696. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  56697. }),
  56698. $globals.StreamTest);
  56699. $core.addMethod(
  56700. $core.method({
  56701. selector: "collectionClass",
  56702. protocol: 'accessing',
  56703. fn: function (){
  56704. var self=this;
  56705. return nil;
  56706. },
  56707. args: [],
  56708. source: "collectionClass\x0a\x09^ nil",
  56709. referencedClasses: [],
  56710. messageSends: []
  56711. }),
  56712. $globals.StreamTest.klass);
  56713. $core.addMethod(
  56714. $core.method({
  56715. selector: "isAbstract",
  56716. protocol: 'testing',
  56717. fn: function (){
  56718. var self=this;
  56719. return $core.withContext(function($ctx1) {
  56720. return $recv(self._collectionClass())._isNil();
  56721. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)});
  56722. },
  56723. args: [],
  56724. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  56725. referencedClasses: [],
  56726. messageSends: ["isNil", "collectionClass"]
  56727. }),
  56728. $globals.StreamTest.klass);
  56729. $core.addClass('ArrayStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  56730. $core.addMethod(
  56731. $core.method({
  56732. selector: "newCollection",
  56733. protocol: 'accessing',
  56734. fn: function (){
  56735. var self=this;
  56736. return $core.withContext(function($ctx1) {
  56737. return [true,(1),(3).__at((4)),"foo"];
  56738. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  56739. },
  56740. args: [],
  56741. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  56742. referencedClasses: [],
  56743. messageSends: ["@"]
  56744. }),
  56745. $globals.ArrayStreamTest);
  56746. $core.addMethod(
  56747. $core.method({
  56748. selector: "collectionClass",
  56749. protocol: 'accessing',
  56750. fn: function (){
  56751. var self=this;
  56752. return $globals.Array;
  56753. },
  56754. args: [],
  56755. source: "collectionClass\x0a\x09^ Array",
  56756. referencedClasses: ["Array"],
  56757. messageSends: []
  56758. }),
  56759. $globals.ArrayStreamTest.klass);
  56760. $core.addClass('StringStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  56761. $core.addMethod(
  56762. $core.method({
  56763. selector: "newCollection",
  56764. protocol: 'accessing',
  56765. fn: function (){
  56766. var self=this;
  56767. return "hello world";
  56768. },
  56769. args: [],
  56770. source: "newCollection\x0a\x09^ 'hello world'",
  56771. referencedClasses: [],
  56772. messageSends: []
  56773. }),
  56774. $globals.StringStreamTest);
  56775. $core.addMethod(
  56776. $core.method({
  56777. selector: "collectionClass",
  56778. protocol: 'accessing',
  56779. fn: function (){
  56780. var self=this;
  56781. return $globals.String;
  56782. },
  56783. args: [],
  56784. source: "collectionClass\x0a\x09^ String",
  56785. referencedClasses: ["String"],
  56786. messageSends: []
  56787. }),
  56788. $globals.StringStreamTest.klass);
  56789. $core.addClass('UndefinedTest', $globals.TestCase, [], 'Kernel-Tests');
  56790. $core.addMethod(
  56791. $core.method({
  56792. selector: "testCopying",
  56793. protocol: 'tests',
  56794. fn: function (){
  56795. var self=this;
  56796. return $core.withContext(function($ctx1) {
  56797. self._assert_equals_(nil._copy(),nil);
  56798. return self;
  56799. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  56800. },
  56801. args: [],
  56802. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  56803. referencedClasses: [],
  56804. messageSends: ["assert:equals:", "copy"]
  56805. }),
  56806. $globals.UndefinedTest);
  56807. $core.addMethod(
  56808. $core.method({
  56809. selector: "testDeepCopy",
  56810. protocol: 'tests',
  56811. fn: function (){
  56812. var self=this;
  56813. return $core.withContext(function($ctx1) {
  56814. self._assert_($recv(nil._deepCopy()).__eq(nil));
  56815. return self;
  56816. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  56817. },
  56818. args: [],
  56819. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  56820. referencedClasses: [],
  56821. messageSends: ["assert:", "=", "deepCopy"]
  56822. }),
  56823. $globals.UndefinedTest);
  56824. $core.addMethod(
  56825. $core.method({
  56826. selector: "testIfNil",
  56827. protocol: 'tests',
  56828. fn: function (){
  56829. var self=this;
  56830. return $core.withContext(function($ctx1) {
  56831. var $1,$3,$2,$4,$6,$5,$receiver;
  56832. if(($receiver = nil) == null || $receiver.isNil){
  56833. $1=true;
  56834. } else {
  56835. $1=nil;
  56836. };
  56837. self._assert_equals_($1,true);
  56838. $ctx1.sendIdx["assert:equals:"]=1;
  56839. if(($receiver = nil) == null || $receiver.isNil){
  56840. $3=nil;
  56841. } else {
  56842. $3=true;
  56843. };
  56844. $2=$recv($3).__eq(true);
  56845. $ctx1.sendIdx["="]=1;
  56846. self._deny_($2);
  56847. $ctx1.sendIdx["deny:"]=1;
  56848. if(($receiver = nil) == null || $receiver.isNil){
  56849. $4=true;
  56850. } else {
  56851. $4=false;
  56852. };
  56853. self._assert_equals_($4,true);
  56854. if(($receiver = nil) == null || $receiver.isNil){
  56855. $6=false;
  56856. } else {
  56857. $6=true;
  56858. };
  56859. $5=$recv($6).__eq(true);
  56860. self._deny_($5);
  56861. return self;
  56862. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  56863. },
  56864. args: [],
  56865. 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",
  56866. referencedClasses: [],
  56867. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  56868. }),
  56869. $globals.UndefinedTest);
  56870. $core.addMethod(
  56871. $core.method({
  56872. selector: "testIsNil",
  56873. protocol: 'tests',
  56874. fn: function (){
  56875. var self=this;
  56876. return $core.withContext(function($ctx1) {
  56877. self._assert_(nil._isNil());
  56878. self._deny_(nil._notNil());
  56879. return self;
  56880. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  56881. },
  56882. args: [],
  56883. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  56884. referencedClasses: [],
  56885. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  56886. }),
  56887. $globals.UndefinedTest);
  56888. });
  56889. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  56890. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  56891. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  56892. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  56893. $core.addPackage('SUnit-Tests');
  56894. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  56895. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  56896. $core.addClass('ExampleSetTest', $globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
  56897. $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.";
  56898. $core.addMethod(
  56899. $core.method({
  56900. selector: "setUp",
  56901. protocol: 'running',
  56902. fn: function (){
  56903. var self=this;
  56904. return $core.withContext(function($ctx1) {
  56905. self["@empty"]=$recv($globals.Set)._new();
  56906. self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  56907. return self;
  56908. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  56909. },
  56910. args: [],
  56911. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  56912. referencedClasses: ["Set"],
  56913. messageSends: ["new", "with:with:"]
  56914. }),
  56915. $globals.ExampleSetTest);
  56916. $core.addMethod(
  56917. $core.method({
  56918. selector: "testAdd",
  56919. protocol: 'tests',
  56920. fn: function (){
  56921. var self=this;
  56922. return $core.withContext(function($ctx1) {
  56923. $recv(self["@empty"])._add_((5));
  56924. self._assert_($recv(self["@empty"])._includes_((5)));
  56925. return self;
  56926. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  56927. },
  56928. args: [],
  56929. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  56930. referencedClasses: [],
  56931. messageSends: ["add:", "assert:", "includes:"]
  56932. }),
  56933. $globals.ExampleSetTest);
  56934. $core.addMethod(
  56935. $core.method({
  56936. selector: "testGrow",
  56937. protocol: 'tests',
  56938. fn: function (){
  56939. var self=this;
  56940. return $core.withContext(function($ctx1) {
  56941. $recv(self["@empty"])._addAll_((1)._to_((100)));
  56942. self._assert_equals_($recv(self["@empty"])._size(),(100));
  56943. return self;
  56944. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  56945. },
  56946. args: [],
  56947. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  56948. referencedClasses: [],
  56949. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  56950. }),
  56951. $globals.ExampleSetTest);
  56952. $core.addMethod(
  56953. $core.method({
  56954. selector: "testIllegal",
  56955. protocol: 'tests',
  56956. fn: function (){
  56957. var self=this;
  56958. return $core.withContext(function($ctx1) {
  56959. self._should_raise_((function(){
  56960. return $core.withContext(function($ctx2) {
  56961. return $recv(self["@empty"])._at_((5));
  56962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56963. }),$globals.Error);
  56964. $ctx1.sendIdx["should:raise:"]=1;
  56965. self._should_raise_((function(){
  56966. return $core.withContext(function($ctx2) {
  56967. return $recv(self["@empty"])._at_put_((5),"abc");
  56968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56969. }),$globals.Error);
  56970. return self;
  56971. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  56972. },
  56973. args: [],
  56974. 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",
  56975. referencedClasses: ["Error"],
  56976. messageSends: ["should:raise:", "at:", "at:put:"]
  56977. }),
  56978. $globals.ExampleSetTest);
  56979. $core.addMethod(
  56980. $core.method({
  56981. selector: "testIncludes",
  56982. protocol: 'tests',
  56983. fn: function (){
  56984. var self=this;
  56985. return $core.withContext(function($ctx1) {
  56986. var $1;
  56987. $1=$recv(self["@full"])._includes_((5));
  56988. $ctx1.sendIdx["includes:"]=1;
  56989. self._assert_($1);
  56990. $ctx1.sendIdx["assert:"]=1;
  56991. self._assert_($recv(self["@full"])._includes_("abc"));
  56992. return self;
  56993. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  56994. },
  56995. args: [],
  56996. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  56997. referencedClasses: [],
  56998. messageSends: ["assert:", "includes:"]
  56999. }),
  57000. $globals.ExampleSetTest);
  57001. $core.addMethod(
  57002. $core.method({
  57003. selector: "testOccurrences",
  57004. protocol: 'tests',
  57005. fn: function (){
  57006. var self=this;
  57007. return $core.withContext(function($ctx1) {
  57008. var $1,$2;
  57009. $1=$recv(self["@empty"])._occurrencesOf_((0));
  57010. $ctx1.sendIdx["occurrencesOf:"]=1;
  57011. self._assert_equals_($1,(0));
  57012. $ctx1.sendIdx["assert:equals:"]=1;
  57013. $2=$recv(self["@full"])._occurrencesOf_((5));
  57014. $ctx1.sendIdx["occurrencesOf:"]=2;
  57015. self._assert_equals_($2,(1));
  57016. $ctx1.sendIdx["assert:equals:"]=2;
  57017. $recv(self["@full"])._add_((5));
  57018. self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1));
  57019. return self;
  57020. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  57021. },
  57022. args: [],
  57023. 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",
  57024. referencedClasses: [],
  57025. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  57026. }),
  57027. $globals.ExampleSetTest);
  57028. $core.addMethod(
  57029. $core.method({
  57030. selector: "testRemove",
  57031. protocol: 'tests',
  57032. fn: function (){
  57033. var self=this;
  57034. return $core.withContext(function($ctx1) {
  57035. var $1;
  57036. $recv(self["@full"])._remove_((5));
  57037. $1=$recv(self["@full"])._includes_("abc");
  57038. $ctx1.sendIdx["includes:"]=1;
  57039. self._assert_($1);
  57040. self._deny_($recv(self["@full"])._includes_((5)));
  57041. return self;
  57042. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  57043. },
  57044. args: [],
  57045. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  57046. referencedClasses: [],
  57047. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  57048. }),
  57049. $globals.ExampleSetTest);
  57050. $core.addClass('SUnitAsyncTest', $globals.TestCase, ['flag'], 'SUnit-Tests');
  57051. $core.addMethod(
  57052. $core.method({
  57053. selector: "fakeError",
  57054. protocol: 'helpers',
  57055. fn: function (){
  57056. var self=this;
  57057. return $core.withContext(function($ctx1) {
  57058. self["@flag"]="bad";
  57059. self._timeout_((30));
  57060. self["@flag"]=$recv(self._async_((function(){
  57061. return $core.withContext(function($ctx2) {
  57062. self["@flag"]="ok";
  57063. self["@flag"];
  57064. return self._error_("Intentional");
  57065. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57066. })))._valueWithTimeout_((20));
  57067. return self;
  57068. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  57069. },
  57070. args: [],
  57071. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  57072. referencedClasses: [],
  57073. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  57074. }),
  57075. $globals.SUnitAsyncTest);
  57076. $core.addMethod(
  57077. $core.method({
  57078. selector: "fakeErrorFailingInTearDown",
  57079. protocol: 'helpers',
  57080. fn: function (){
  57081. var self=this;
  57082. return $core.withContext(function($ctx1) {
  57083. self["@flag"]="bad";
  57084. self._timeout_((30));
  57085. self["@flag"]=$recv(self._async_((function(){
  57086. return $core.withContext(function($ctx2) {
  57087. return self._error_("Intentional");
  57088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57089. })))._valueWithTimeout_((20));
  57090. return self;
  57091. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  57092. },
  57093. args: [],
  57094. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  57095. referencedClasses: [],
  57096. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  57097. }),
  57098. $globals.SUnitAsyncTest);
  57099. $core.addMethod(
  57100. $core.method({
  57101. selector: "fakeFailure",
  57102. protocol: 'helpers',
  57103. fn: function (){
  57104. var self=this;
  57105. return $core.withContext(function($ctx1) {
  57106. self["@flag"]="bad";
  57107. self._timeout_((30));
  57108. self["@flag"]=$recv(self._async_((function(){
  57109. return $core.withContext(function($ctx2) {
  57110. self["@flag"]="ok";
  57111. self["@flag"];
  57112. return self._assert_(false);
  57113. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57114. })))._valueWithTimeout_((20));
  57115. return self;
  57116. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  57117. },
  57118. args: [],
  57119. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  57120. referencedClasses: [],
  57121. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  57122. }),
  57123. $globals.SUnitAsyncTest);
  57124. $core.addMethod(
  57125. $core.method({
  57126. selector: "fakeMultipleTimeoutFailing",
  57127. protocol: 'helpers',
  57128. fn: function (){
  57129. var self=this;
  57130. return $core.withContext(function($ctx1) {
  57131. var $1;
  57132. self._timeout_((100));
  57133. $ctx1.sendIdx["timeout:"]=1;
  57134. $1=self._async_((function(){
  57135. return $core.withContext(function($ctx2) {
  57136. self._timeout_((20));
  57137. return $recv(self._async_((function(){
  57138. return $core.withContext(function($ctx3) {
  57139. return self._finished();
  57140. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57141. })))._valueWithTimeout_((30));
  57142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57143. }));
  57144. $ctx1.sendIdx["async:"]=1;
  57145. $recv($1)._valueWithTimeout_((20));
  57146. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57147. return self;
  57148. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  57149. },
  57150. args: [],
  57151. 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",
  57152. referencedClasses: [],
  57153. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  57154. }),
  57155. $globals.SUnitAsyncTest);
  57156. $core.addMethod(
  57157. $core.method({
  57158. selector: "fakeMultipleTimeoutPassing",
  57159. protocol: 'helpers',
  57160. fn: function (){
  57161. var self=this;
  57162. return $core.withContext(function($ctx1) {
  57163. var $1;
  57164. self._timeout_((20));
  57165. $ctx1.sendIdx["timeout:"]=1;
  57166. $1=self._async_((function(){
  57167. return $core.withContext(function($ctx2) {
  57168. self._timeout_((40));
  57169. return $recv(self._async_((function(){
  57170. return $core.withContext(function($ctx3) {
  57171. return self._finished();
  57172. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57173. })))._valueWithTimeout_((20));
  57174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57175. }));
  57176. $ctx1.sendIdx["async:"]=1;
  57177. $recv($1)._valueWithTimeout_((10));
  57178. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57179. return self;
  57180. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  57181. },
  57182. args: [],
  57183. 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",
  57184. referencedClasses: [],
  57185. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  57186. }),
  57187. $globals.SUnitAsyncTest);
  57188. $core.addMethod(
  57189. $core.method({
  57190. selector: "fakeTimeout",
  57191. protocol: 'helpers',
  57192. fn: function (){
  57193. var self=this;
  57194. return $core.withContext(function($ctx1) {
  57195. self._timeout_((10));
  57196. $recv(self._async_((function(){
  57197. return $core.withContext(function($ctx2) {
  57198. return self._finished();
  57199. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57200. })))._valueWithTimeout_((20));
  57201. return self;
  57202. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  57203. },
  57204. args: [],
  57205. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  57206. referencedClasses: [],
  57207. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  57208. }),
  57209. $globals.SUnitAsyncTest);
  57210. $core.addMethod(
  57211. $core.method({
  57212. selector: "selectorSetOf:",
  57213. protocol: 'private',
  57214. fn: function (aCollection){
  57215. var self=this;
  57216. return $core.withContext(function($ctx1) {
  57217. return $recv($recv(aCollection)._collect_((function(each){
  57218. return $core.withContext(function($ctx2) {
  57219. return $recv(each)._selector();
  57220. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57221. })))._asSet();
  57222. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  57223. },
  57224. args: ["aCollection"],
  57225. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  57226. referencedClasses: [],
  57227. messageSends: ["asSet", "collect:", "selector"]
  57228. }),
  57229. $globals.SUnitAsyncTest);
  57230. $core.addMethod(
  57231. $core.method({
  57232. selector: "setUp",
  57233. protocol: 'running',
  57234. fn: function (){
  57235. var self=this;
  57236. self["@flag"]="ok";
  57237. return self;
  57238. },
  57239. args: [],
  57240. source: "setUp\x0a\x09flag := 'ok'",
  57241. referencedClasses: [],
  57242. messageSends: []
  57243. }),
  57244. $globals.SUnitAsyncTest);
  57245. $core.addMethod(
  57246. $core.method({
  57247. selector: "tearDown",
  57248. protocol: 'running',
  57249. fn: function (){
  57250. var self=this;
  57251. return $core.withContext(function($ctx1) {
  57252. self._assert_equals_("ok",self["@flag"]);
  57253. return self;
  57254. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  57255. },
  57256. args: [],
  57257. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  57258. referencedClasses: [],
  57259. messageSends: ["assert:equals:"]
  57260. }),
  57261. $globals.SUnitAsyncTest);
  57262. $core.addMethod(
  57263. $core.method({
  57264. selector: "testAsyncErrorsAndFailures",
  57265. protocol: 'tests',
  57266. fn: function (){
  57267. var self=this;
  57268. var suite,runner,result,assertBlock;
  57269. return $core.withContext(function($ctx1) {
  57270. var $1,$2,$3,$4;
  57271. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  57272. return $core.withContext(function($ctx2) {
  57273. return $recv(self._class())._selector_(each);
  57274. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57275. }));
  57276. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  57277. self._timeout_((200));
  57278. result=$recv(runner)._result();
  57279. $ctx1.sendIdx["result"]=1;
  57280. assertBlock=self._async_((function(){
  57281. return $core.withContext(function($ctx2) {
  57282. $1=self._selectorSetOf_($recv(result)._errors());
  57283. $ctx2.sendIdx["selectorSetOf:"]=1;
  57284. $2=["fakeError"]._asSet();
  57285. $ctx2.sendIdx["asSet"]=1;
  57286. self._assert_equals_($1,$2);
  57287. $ctx2.sendIdx["assert:equals:"]=1;
  57288. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  57289. return self._finished();
  57290. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57291. }));
  57292. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  57293. return $core.withContext(function($ctx2) {
  57294. $3=$recv($recv(ann)._result()).__eq_eq(result);
  57295. if($core.assert($3)){
  57296. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  57297. return $recv($4)._ifTrue_(assertBlock);
  57298. };
  57299. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  57300. }));
  57301. $recv(runner)._run();
  57302. return self;
  57303. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  57304. },
  57305. args: [],
  57306. 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",
  57307. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  57308. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  57309. }),
  57310. $globals.SUnitAsyncTest);
  57311. $core.addMethod(
  57312. $core.method({
  57313. selector: "testAsyncNeedsTimeout",
  57314. protocol: 'tests',
  57315. fn: function (){
  57316. var self=this;
  57317. return $core.withContext(function($ctx1) {
  57318. self._should_raise_((function(){
  57319. return $core.withContext(function($ctx2) {
  57320. return self._async_((function(){
  57321. }));
  57322. $ctx2.sendIdx["async:"]=1;
  57323. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57324. }),$globals.Error);
  57325. self._timeout_((0));
  57326. self._shouldnt_raise_((function(){
  57327. return $core.withContext(function($ctx2) {
  57328. return self._async_((function(){
  57329. }));
  57330. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  57331. }),$globals.Error);
  57332. self._finished();
  57333. return self;
  57334. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  57335. },
  57336. args: [],
  57337. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  57338. referencedClasses: ["Error"],
  57339. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  57340. }),
  57341. $globals.SUnitAsyncTest);
  57342. $core.addMethod(
  57343. $core.method({
  57344. selector: "testFinishedNeedsTimeout",
  57345. protocol: 'tests',
  57346. fn: function (){
  57347. var self=this;
  57348. return $core.withContext(function($ctx1) {
  57349. self._should_raise_((function(){
  57350. return $core.withContext(function($ctx2) {
  57351. return self._finished();
  57352. $ctx2.sendIdx["finished"]=1;
  57353. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57354. }),$globals.Error);
  57355. self._timeout_((0));
  57356. self._shouldnt_raise_((function(){
  57357. return $core.withContext(function($ctx2) {
  57358. return self._finished();
  57359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57360. }),$globals.Error);
  57361. return self;
  57362. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  57363. },
  57364. args: [],
  57365. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  57366. referencedClasses: ["Error"],
  57367. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  57368. }),
  57369. $globals.SUnitAsyncTest);
  57370. $core.addMethod(
  57371. $core.method({
  57372. selector: "testIsAsyncReturnsCorrectValues",
  57373. protocol: 'tests',
  57374. fn: function (){
  57375. var self=this;
  57376. return $core.withContext(function($ctx1) {
  57377. var $1,$2;
  57378. $1=self._isAsync();
  57379. $ctx1.sendIdx["isAsync"]=1;
  57380. self._deny_($1);
  57381. $ctx1.sendIdx["deny:"]=1;
  57382. self._timeout_((0));
  57383. $2=self._isAsync();
  57384. $ctx1.sendIdx["isAsync"]=2;
  57385. self._assert_($2);
  57386. self._finished();
  57387. self._deny_(self._isAsync());
  57388. return self;
  57389. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  57390. },
  57391. args: [],
  57392. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  57393. referencedClasses: [],
  57394. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  57395. }),
  57396. $globals.SUnitAsyncTest);
  57397. $core.addMethod(
  57398. $core.method({
  57399. selector: "testPass",
  57400. protocol: 'tests',
  57401. fn: function (){
  57402. var self=this;
  57403. return $core.withContext(function($ctx1) {
  57404. self["@flag"]="bad";
  57405. self._timeout_((10));
  57406. self["@flag"]=$recv(self._async_((function(){
  57407. return $core.withContext(function($ctx2) {
  57408. self._assert_(true);
  57409. self._finished();
  57410. self["@flag"]="ok";
  57411. return self["@flag"];
  57412. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57413. })))._valueWithTimeout_((5));
  57414. return self;
  57415. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  57416. },
  57417. args: [],
  57418. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  57419. referencedClasses: [],
  57420. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  57421. }),
  57422. $globals.SUnitAsyncTest);
  57423. $core.addMethod(
  57424. $core.method({
  57425. selector: "testTimeouts",
  57426. protocol: 'tests',
  57427. fn: function (){
  57428. var self=this;
  57429. var suite,runner,result,assertBlock;
  57430. return $core.withContext(function($ctx1) {
  57431. var $1,$2,$3;
  57432. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  57433. return $core.withContext(function($ctx2) {
  57434. return $recv(self._class())._selector_(each);
  57435. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57436. }));
  57437. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  57438. self._timeout_((200));
  57439. result=$recv(runner)._result();
  57440. $ctx1.sendIdx["result"]=1;
  57441. assertBlock=self._async_((function(){
  57442. return $core.withContext(function($ctx2) {
  57443. $1=self._selectorSetOf_($recv(result)._errors());
  57444. $ctx2.sendIdx["selectorSetOf:"]=1;
  57445. self._assert_equals_($1,$recv($globals.Set)._new());
  57446. $ctx2.sendIdx["assert:equals:"]=1;
  57447. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  57448. return self._finished();
  57449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57450. }));
  57451. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  57452. return $core.withContext(function($ctx2) {
  57453. $2=$recv($recv(ann)._result()).__eq_eq(result);
  57454. if($core.assert($2)){
  57455. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  57456. return $recv($3)._ifTrue_(assertBlock);
  57457. };
  57458. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  57459. }));
  57460. $recv(runner)._run();
  57461. return self;
  57462. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  57463. },
  57464. args: [],
  57465. 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",
  57466. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  57467. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  57468. }),
  57469. $globals.SUnitAsyncTest);
  57470. $core.addMethod(
  57471. $core.method({
  57472. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  57473. protocol: 'tests',
  57474. fn: function (){
  57475. var self=this;
  57476. var x;
  57477. return $core.withContext(function($ctx1) {
  57478. var $1;
  57479. self["@flag"]="bad";
  57480. self._timeout_((10));
  57481. x=(0);
  57482. $1=self._async_((function(){
  57483. return $core.withContext(function($ctx2) {
  57484. self._finished();
  57485. $ctx2.sendIdx["finished"]=1;
  57486. self["@flag"]="ok";
  57487. self["@flag"];
  57488. x=$recv(x).__plus((1));
  57489. $ctx2.sendIdx["+"]=1;
  57490. x;
  57491. return self._assert_equals_(x,(1));
  57492. $ctx2.sendIdx["assert:equals:"]=1;
  57493. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57494. }));
  57495. $ctx1.sendIdx["async:"]=1;
  57496. self["@flag"]=$recv($1)._valueWithTimeout_((0));
  57497. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57498. self["@flag"]=$recv(self._async_((function(){
  57499. return $core.withContext(function($ctx2) {
  57500. self._finished();
  57501. self["@flag"]="ok";
  57502. self["@flag"];
  57503. x=$recv(x).__plus((1));
  57504. x;
  57505. return self._assert_equals_(x,(1));
  57506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57507. })))._valueWithTimeout_((0));
  57508. return self;
  57509. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  57510. },
  57511. args: [],
  57512. 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.",
  57513. referencedClasses: [],
  57514. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  57515. }),
  57516. $globals.SUnitAsyncTest);
  57517. });
  57518. define('amber/devel',[
  57519. './lang',
  57520. './compatibility', // pre-fetch, dep of ./boot
  57521. './boot', // pre-fetch, dep of ./helpers
  57522. './helpers', // pre-fetch, dep of ./deploy
  57523. './deploy', // pre-fetch, dep of ./lang
  57524. // --- packages of the development only Amber begin here ---
  57525. 'amber_core/SUnit',
  57526. 'amber_core/Compiler-Tests',
  57527. 'amber_core/Kernel-Tests',
  57528. 'amber_core/SUnit-Tests'
  57529. // --- packages of the development only Amber end here ---
  57530. ], function (amber) { return amber; });
  57531. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  57532. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  57533. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  57534. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  57535. $core.addPackage('AmberCli');
  57536. $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
  57537. $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  57538. $core.addClass('AmberCli', $globals.Object, [], 'AmberCli');
  57539. $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.";
  57540. $core.addMethod(
  57541. $core.method({
  57542. selector: "commandLineSwitches",
  57543. protocol: 'commandline',
  57544. fn: function (){
  57545. var self=this;
  57546. var switches;
  57547. return $core.withContext(function($ctx1) {
  57548. switches=$recv($recv(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  57549. return $core.withContext(function($ctx2) {
  57550. return $recv(each)._selector();
  57551. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57552. }));
  57553. $ctx1.sendIdx["collect:"]=1;
  57554. switches=$recv(switches)._select_((function(each){
  57555. return $core.withContext(function($ctx2) {
  57556. return $recv(each)._match_("^[^:]*:$");
  57557. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  57558. }));
  57559. switches=$recv(switches)._collect_((function(each){
  57560. return $core.withContext(function($ctx2) {
  57561. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  57562. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  57563. }));
  57564. return switches;
  57565. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.klass)});
  57566. },
  57567. args: [],
  57568. 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",
  57569. referencedClasses: [],
  57570. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  57571. }),
  57572. $globals.AmberCli.klass);
  57573. $core.addMethod(
  57574. $core.method({
  57575. selector: "config:",
  57576. protocol: 'commands',
  57577. fn: function (args){
  57578. var self=this;
  57579. return $core.withContext(function($ctx1) {
  57580. $recv($recv($globals.Configurator)._new())._start();
  57581. return self;
  57582. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.klass)});
  57583. },
  57584. args: ["args"],
  57585. source: "config: args\x0a\x09Configurator new start",
  57586. referencedClasses: ["Configurator"],
  57587. messageSends: ["start", "new"]
  57588. }),
  57589. $globals.AmberCli.klass);
  57590. $core.addMethod(
  57591. $core.method({
  57592. selector: "handleArguments:",
  57593. protocol: 'commandline',
  57594. fn: function (args){
  57595. var self=this;
  57596. var selector;
  57597. return $core.withContext(function($ctx1) {
  57598. var $1;
  57599. $1=$recv(args)._first();
  57600. $ctx1.sendIdx["first"]=1;
  57601. selector=self._selectorForCommandLineSwitch_($1);
  57602. $recv(args)._remove_($recv(args)._first());
  57603. self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  57604. return self;
  57605. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.klass)});
  57606. },
  57607. args: ["args"],
  57608. 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)",
  57609. referencedClasses: ["Array"],
  57610. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  57611. }),
  57612. $globals.AmberCli.klass);
  57613. $core.addMethod(
  57614. $core.method({
  57615. selector: "help:",
  57616. protocol: 'commands',
  57617. fn: function (args){
  57618. var self=this;
  57619. return $core.withContext(function($ctx1) {
  57620. $recv($globals.Transcript)._show_("Available commands");
  57621. $recv(self._commandLineSwitches())._do_((function(each){
  57622. return $core.withContext(function($ctx2) {
  57623. return $recv(console)._log_(each);
  57624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57625. }));
  57626. return self;
  57627. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.klass)});
  57628. },
  57629. args: ["args"],
  57630. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  57631. referencedClasses: ["Transcript"],
  57632. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  57633. }),
  57634. $globals.AmberCli.klass);
  57635. $core.addMethod(
  57636. $core.method({
  57637. selector: "init:",
  57638. protocol: 'commands',
  57639. fn: function (args){
  57640. var self=this;
  57641. return $core.withContext(function($ctx1) {
  57642. $recv($recv($globals.Initer)._new())._start();
  57643. return self;
  57644. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.klass)});
  57645. },
  57646. args: ["args"],
  57647. source: "init: args\x0a\x09Initer new start",
  57648. referencedClasses: ["Initer"],
  57649. messageSends: ["start", "new"]
  57650. }),
  57651. $globals.AmberCli.klass);
  57652. $core.addMethod(
  57653. $core.method({
  57654. selector: "main",
  57655. protocol: 'startup',
  57656. fn: function (){
  57657. var self=this;
  57658. var args,packageJSON;
  57659. return $core.withContext(function($ctx1) {
  57660. var $7,$6,$5,$4,$3,$2,$1;
  57661. var $early={};
  57662. try {
  57663. packageJSON=$recv(require)._value_("../package.json");
  57664. $7=$recv(packageJSON)._version();
  57665. $ctx1.sendIdx["version"]=1;
  57666. $6="Welcome to Amber CLI version ".__comma($7);
  57667. $5=$recv($6).__comma(" (Amber ");
  57668. $ctx1.sendIdx[","]=5;
  57669. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  57670. $ctx1.sendIdx[","]=4;
  57671. $3=$recv($4).__comma(", NodeJS ");
  57672. $ctx1.sendIdx[","]=3;
  57673. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  57674. $ctx1.sendIdx[","]=2;
  57675. $1=$recv($2).__comma(").");
  57676. $ctx1.sendIdx[","]=1;
  57677. $recv($globals.Transcript)._show_($1);
  57678. args=$recv(process)._argv();
  57679. $recv(args)._removeFrom_to_((1),(2));
  57680. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  57681. return $core.withContext(function($ctx2) {
  57682. return self._help_(nil);
  57683. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57684. }),(function(){
  57685. return $core.withContext(function($ctx2) {
  57686. throw $early=[self._handleArguments_(args)];
  57687. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57688. }));
  57689. return self;
  57690. }
  57691. catch(e) {if(e===$early)return e[0]; throw e}
  57692. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.klass)});
  57693. },
  57694. args: [],
  57695. 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]",
  57696. referencedClasses: ["Transcript", "Smalltalk"],
  57697. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  57698. }),
  57699. $globals.AmberCli.klass);
  57700. $core.addMethod(
  57701. $core.method({
  57702. selector: "repl:",
  57703. protocol: 'commands',
  57704. fn: function (args){
  57705. var self=this;
  57706. return $core.withContext(function($ctx1) {
  57707. return $recv($recv($globals.Repl)._new())._createInterface();
  57708. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.klass)});
  57709. },
  57710. args: ["args"],
  57711. source: "repl: args\x0a\x09^ Repl new createInterface",
  57712. referencedClasses: ["Repl"],
  57713. messageSends: ["createInterface", "new"]
  57714. }),
  57715. $globals.AmberCli.klass);
  57716. $core.addMethod(
  57717. $core.method({
  57718. selector: "selectorForCommandLineSwitch:",
  57719. protocol: 'commandline',
  57720. fn: function (aSwitch){
  57721. var self=this;
  57722. var command,selector;
  57723. return $core.withContext(function($ctx1) {
  57724. var $1;
  57725. $1=$recv(self._commandLineSwitches())._includes_(aSwitch);
  57726. if($core.assert($1)){
  57727. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  57728. return $core.withContext(function($ctx2) {
  57729. return $recv($recv(each)._second())._asUppercase();
  57730. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  57731. }))).__comma(":");
  57732. selector;
  57733. } else {
  57734. selector="help:";
  57735. selector;
  57736. };
  57737. return selector;
  57738. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.klass)});
  57739. },
  57740. args: ["aSwitch"],
  57741. 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",
  57742. referencedClasses: [],
  57743. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  57744. }),
  57745. $globals.AmberCli.klass);
  57746. $core.addMethod(
  57747. $core.method({
  57748. selector: "serve:",
  57749. protocol: 'commands',
  57750. fn: function (args){
  57751. var self=this;
  57752. return $core.withContext(function($ctx1) {
  57753. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  57754. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.klass)});
  57755. },
  57756. args: ["args"],
  57757. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  57758. referencedClasses: ["FileServer"],
  57759. messageSends: ["start", "createServerWithArguments:"]
  57760. }),
  57761. $globals.AmberCli.klass);
  57762. $core.addMethod(
  57763. $core.method({
  57764. selector: "version:",
  57765. protocol: 'commands',
  57766. fn: function (arguments_){
  57767. var self=this;
  57768. return self;
  57769. },
  57770. args: ["arguments"],
  57771. source: "version: arguments",
  57772. referencedClasses: [],
  57773. messageSends: []
  57774. }),
  57775. $globals.AmberCli.klass);
  57776. $core.addClass('BaseFileManipulator', $globals.Object, ['path', 'fs'], 'AmberCli');
  57777. $core.addMethod(
  57778. $core.method({
  57779. selector: "dirname",
  57780. protocol: 'private',
  57781. fn: function (){
  57782. var self=this;
  57783. return $core.withContext(function($ctx1) {
  57784. return __dirname;
  57785. return self;
  57786. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  57787. },
  57788. args: [],
  57789. source: "dirname\x0a\x09<return __dirname>",
  57790. referencedClasses: [],
  57791. messageSends: []
  57792. }),
  57793. $globals.BaseFileManipulator);
  57794. $core.addMethod(
  57795. $core.method({
  57796. selector: "initialize",
  57797. protocol: 'initialization',
  57798. fn: function (){
  57799. var self=this;
  57800. return $core.withContext(function($ctx1) {
  57801. (
  57802. $ctx1.supercall = true,
  57803. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  57804. $ctx1.supercall = false;
  57805. self["@path"]=$recv(require)._value_("path");
  57806. $ctx1.sendIdx["value:"]=1;
  57807. self["@fs"]=$recv(require)._value_("fs");
  57808. return self;
  57809. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  57810. },
  57811. args: [],
  57812. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  57813. referencedClasses: [],
  57814. messageSends: ["initialize", "value:"]
  57815. }),
  57816. $globals.BaseFileManipulator);
  57817. $core.addMethod(
  57818. $core.method({
  57819. selector: "rootDirname",
  57820. protocol: 'private',
  57821. fn: function (){
  57822. var self=this;
  57823. return $core.withContext(function($ctx1) {
  57824. return $recv(self["@path"])._join_with_(self._dirname(),"..");
  57825. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  57826. },
  57827. args: [],
  57828. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  57829. referencedClasses: [],
  57830. messageSends: ["join:with:", "dirname"]
  57831. }),
  57832. $globals.BaseFileManipulator);
  57833. $core.addClass('Configurator', $globals.BaseFileManipulator, [], 'AmberCli');
  57834. $core.addMethod(
  57835. $core.method({
  57836. selector: "initialize",
  57837. protocol: 'initialization',
  57838. fn: function (){
  57839. var self=this;
  57840. return $core.withContext(function($ctx1) {
  57841. (
  57842. $ctx1.supercall = true,
  57843. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  57844. $ctx1.supercall = false;
  57845. return self;
  57846. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  57847. },
  57848. args: [],
  57849. source: "initialize\x0a\x09super initialize",
  57850. referencedClasses: [],
  57851. messageSends: ["initialize"]
  57852. }),
  57853. $globals.Configurator);
  57854. $core.addMethod(
  57855. $core.method({
  57856. selector: "start",
  57857. protocol: 'action',
  57858. fn: function (){
  57859. var self=this;
  57860. return $core.withContext(function($ctx1) {
  57861. var $receiver;
  57862. self._writeConfigThenDo_((function(err){
  57863. return $core.withContext(function($ctx2) {
  57864. if(($receiver = err) == null || $receiver.isNil){
  57865. return $recv(process)._exit();
  57866. } else {
  57867. return $recv(process)._exit_((111));
  57868. };
  57869. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  57870. }));
  57871. return self;
  57872. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  57873. },
  57874. args: [],
  57875. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  57876. referencedClasses: [],
  57877. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  57878. }),
  57879. $globals.Configurator);
  57880. $core.addMethod(
  57881. $core.method({
  57882. selector: "writeConfigThenDo:",
  57883. protocol: 'action',
  57884. fn: function (aBlock){
  57885. var self=this;
  57886. return $core.withContext(function($ctx1) {
  57887. $recv($recv($recv(require)._value_("amber-dev"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  57888. return self;
  57889. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  57890. },
  57891. args: ["aBlock"],
  57892. source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  57893. referencedClasses: [],
  57894. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  57895. }),
  57896. $globals.Configurator);
  57897. $core.addClass('FileServer', $globals.BaseFileManipulator, ['http', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  57898. $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.";
  57899. $core.addMethod(
  57900. $core.method({
  57901. selector: "base64Decode:",
  57902. protocol: 'private',
  57903. fn: function (aString){
  57904. var self=this;
  57905. return $core.withContext(function($ctx1) {
  57906. return (new Buffer(aString, 'base64').toString());
  57907. return self;
  57908. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  57909. },
  57910. args: ["aString"],
  57911. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  57912. referencedClasses: [],
  57913. messageSends: []
  57914. }),
  57915. $globals.FileServer);
  57916. $core.addMethod(
  57917. $core.method({
  57918. selector: "basePath",
  57919. protocol: 'accessing',
  57920. fn: function (){
  57921. var self=this;
  57922. return $core.withContext(function($ctx1) {
  57923. var $1,$receiver;
  57924. $1=self["@basePath"];
  57925. if(($receiver = $1) == null || $receiver.isNil){
  57926. return $recv(self._class())._defaultBasePath();
  57927. } else {
  57928. return $1;
  57929. };
  57930. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  57931. },
  57932. args: [],
  57933. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  57934. referencedClasses: [],
  57935. messageSends: ["ifNil:", "defaultBasePath", "class"]
  57936. }),
  57937. $globals.FileServer);
  57938. $core.addMethod(
  57939. $core.method({
  57940. selector: "basePath:",
  57941. protocol: 'accessing',
  57942. fn: function (aString){
  57943. var self=this;
  57944. return $core.withContext(function($ctx1) {
  57945. self["@basePath"]=aString;
  57946. self._validateBasePath();
  57947. return self;
  57948. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  57949. },
  57950. args: ["aString"],
  57951. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  57952. referencedClasses: [],
  57953. messageSends: ["validateBasePath"]
  57954. }),
  57955. $globals.FileServer);
  57956. $core.addMethod(
  57957. $core.method({
  57958. selector: "checkDirectoryLayout",
  57959. protocol: 'initialization',
  57960. fn: function (){
  57961. var self=this;
  57962. return $core.withContext(function($ctx1) {
  57963. var $1;
  57964. $1=$recv(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  57965. if(!$core.assert($1)){
  57966. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  57967. $ctx1.sendIdx["warn:"]=1;
  57968. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  57969. $ctx1.sendIdx["warn:"]=2;
  57970. $recv(console)._warn_(" You can also specify a page to be served by default,");
  57971. $ctx1.sendIdx["warn:"]=3;
  57972. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  57973. };
  57974. return self;
  57975. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  57976. },
  57977. args: [],
  57978. 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.'].",
  57979. referencedClasses: [],
  57980. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  57981. }),
  57982. $globals.FileServer);
  57983. $core.addMethod(
  57984. $core.method({
  57985. selector: "fallbackPage",
  57986. protocol: 'accessing',
  57987. fn: function (){
  57988. var self=this;
  57989. return self["@fallbackPage"];
  57990. },
  57991. args: [],
  57992. source: "fallbackPage\x0a\x09^ fallbackPage",
  57993. referencedClasses: [],
  57994. messageSends: []
  57995. }),
  57996. $globals.FileServer);
  57997. $core.addMethod(
  57998. $core.method({
  57999. selector: "fallbackPage:",
  58000. protocol: 'accessing',
  58001. fn: function (aString){
  58002. var self=this;
  58003. self["@fallbackPage"]=aString;
  58004. return self;
  58005. },
  58006. args: ["aString"],
  58007. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  58008. referencedClasses: [],
  58009. messageSends: []
  58010. }),
  58011. $globals.FileServer);
  58012. $core.addMethod(
  58013. $core.method({
  58014. selector: "handleGETRequest:respondTo:",
  58015. protocol: 'request handling',
  58016. fn: function (aRequest,aResponse){
  58017. var self=this;
  58018. var uri,filename;
  58019. return $core.withContext(function($ctx1) {
  58020. var $1;
  58021. uri=$recv(self["@url"])._parse_($recv(aRequest)._url());
  58022. filename=$recv(self["@path"])._join_with_(self._basePath(),$recv(uri)._pathname());
  58023. $recv(self["@fs"])._exists_do_(filename,(function(aBoolean){
  58024. return $core.withContext(function($ctx2) {
  58025. if($core.assert(aBoolean)){
  58026. $1=$recv($recv(self["@fs"])._statSync_(filename))._isDirectory();
  58027. if($core.assert($1)){
  58028. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  58029. } else {
  58030. return self._respondFileNamed_to_(filename,aResponse);
  58031. };
  58032. } else {
  58033. return self._respondNotFoundTo_(aResponse);
  58034. };
  58035. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  58036. }));
  58037. return self;
  58038. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  58039. },
  58040. args: ["aRequest", "aResponse"],
  58041. 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]]]",
  58042. referencedClasses: [],
  58043. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  58044. }),
  58045. $globals.FileServer);
  58046. $core.addMethod(
  58047. $core.method({
  58048. selector: "handleOPTIONSRequest:respondTo:",
  58049. protocol: 'request handling',
  58050. fn: function (aRequest,aResponse){
  58051. var self=this;
  58052. return $core.withContext(function($ctx1) {
  58053. $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)]));
  58054. $recv(aResponse)._end();
  58055. return self;
  58056. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  58057. },
  58058. args: ["aRequest", "aResponse"],
  58059. 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",
  58060. referencedClasses: [],
  58061. messageSends: ["writeHead:options:", "end"]
  58062. }),
  58063. $globals.FileServer);
  58064. $core.addMethod(
  58065. $core.method({
  58066. selector: "handlePUTRequest:respondTo:",
  58067. protocol: 'request handling',
  58068. fn: function (aRequest,aResponse){
  58069. var self=this;
  58070. var file,stream;
  58071. return $core.withContext(function($ctx1) {
  58072. var $1,$2,$3,$4;
  58073. $1=self._isAuthenticated_(aRequest);
  58074. if(!$core.assert($1)){
  58075. self._respondAuthenticationRequiredTo_(aResponse);
  58076. return nil;
  58077. };
  58078. file=".".__comma($recv(aRequest)._url());
  58079. $ctx1.sendIdx[","]=1;
  58080. stream=$recv(self["@fs"])._createWriteStream_(file);
  58081. $recv(stream)._on_do_("error",(function(error){
  58082. return $core.withContext(function($ctx2) {
  58083. $2=console;
  58084. $3="Error creating WriteStream for file ".__comma(file);
  58085. $ctx2.sendIdx[","]=2;
  58086. $recv($2)._warn_($3);
  58087. $ctx2.sendIdx["warn:"]=1;
  58088. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  58089. $ctx2.sendIdx["warn:"]=2;
  58090. $recv(console)._warn_(" The exact error is: ".__comma(error));
  58091. return self._respondNotCreatedTo_(aResponse);
  58092. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  58093. }));
  58094. $ctx1.sendIdx["on:do:"]=1;
  58095. $recv(stream)._on_do_("close",(function(){
  58096. return $core.withContext(function($ctx2) {
  58097. return self._respondCreatedTo_(aResponse);
  58098. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58099. }));
  58100. $ctx1.sendIdx["on:do:"]=2;
  58101. $recv(aRequest)._setEncoding_("utf8");
  58102. $recv(aRequest)._on_do_("data",(function(data){
  58103. return $core.withContext(function($ctx2) {
  58104. return $recv(stream)._write_(data);
  58105. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  58106. }));
  58107. $ctx1.sendIdx["on:do:"]=3;
  58108. $recv(aRequest)._on_do_("end",(function(){
  58109. return $core.withContext(function($ctx2) {
  58110. $4=$recv(stream)._writable();
  58111. if($core.assert($4)){
  58112. return $recv(stream)._end();
  58113. };
  58114. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58115. }));
  58116. return self;
  58117. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  58118. },
  58119. args: ["aRequest", "aResponse"],
  58120. 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]]",
  58121. referencedClasses: [],
  58122. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  58123. }),
  58124. $globals.FileServer);
  58125. $core.addMethod(
  58126. $core.method({
  58127. selector: "handleRequest:respondTo:",
  58128. protocol: 'request handling',
  58129. fn: function (aRequest,aResponse){
  58130. var self=this;
  58131. return $core.withContext(function($ctx1) {
  58132. var $2,$1,$4,$3,$5;
  58133. $2=$recv(aRequest)._method();
  58134. $ctx1.sendIdx["method"]=1;
  58135. $1=$recv($2).__eq("PUT");
  58136. $ctx1.sendIdx["="]=1;
  58137. if($core.assert($1)){
  58138. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  58139. };
  58140. $4=$recv(aRequest)._method();
  58141. $ctx1.sendIdx["method"]=2;
  58142. $3=$recv($4).__eq("GET");
  58143. $ctx1.sendIdx["="]=2;
  58144. if($core.assert($3)){
  58145. self._handleGETRequest_respondTo_(aRequest,aResponse);
  58146. };
  58147. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  58148. if($core.assert($5)){
  58149. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  58150. };
  58151. return self;
  58152. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  58153. },
  58154. args: ["aRequest", "aResponse"],
  58155. 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]",
  58156. referencedClasses: [],
  58157. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  58158. }),
  58159. $globals.FileServer);
  58160. $core.addMethod(
  58161. $core.method({
  58162. selector: "host",
  58163. protocol: 'accessing',
  58164. fn: function (){
  58165. var self=this;
  58166. return self["@host"];
  58167. },
  58168. args: [],
  58169. source: "host\x0a\x09^ host",
  58170. referencedClasses: [],
  58171. messageSends: []
  58172. }),
  58173. $globals.FileServer);
  58174. $core.addMethod(
  58175. $core.method({
  58176. selector: "host:",
  58177. protocol: 'accessing',
  58178. fn: function (hostname){
  58179. var self=this;
  58180. self["@host"]=hostname;
  58181. return self;
  58182. },
  58183. args: ["hostname"],
  58184. source: "host: hostname\x0a\x09host := hostname",
  58185. referencedClasses: [],
  58186. messageSends: []
  58187. }),
  58188. $globals.FileServer);
  58189. $core.addMethod(
  58190. $core.method({
  58191. selector: "initialize",
  58192. protocol: 'initialization',
  58193. fn: function (){
  58194. var self=this;
  58195. return $core.withContext(function($ctx1) {
  58196. var $1;
  58197. (
  58198. $ctx1.supercall = true,
  58199. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  58200. $ctx1.supercall = false;
  58201. self["@http"]=self._require_("http");
  58202. $ctx1.sendIdx["require:"]=1;
  58203. self["@util"]=self._require_("util");
  58204. $ctx1.sendIdx["require:"]=2;
  58205. self["@url"]=self._require_("url");
  58206. $1=self._class();
  58207. $ctx1.sendIdx["class"]=1;
  58208. self["@host"]=$recv($1)._defaultHost();
  58209. self["@port"]=$recv(self._class())._defaultPort();
  58210. self["@username"]=nil;
  58211. self["@password"]=nil;
  58212. self["@fallbackPage"]=nil;
  58213. return self;
  58214. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  58215. },
  58216. args: [],
  58217. 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.",
  58218. referencedClasses: [],
  58219. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  58220. }),
  58221. $globals.FileServer);
  58222. $core.addMethod(
  58223. $core.method({
  58224. selector: "isAuthenticated:",
  58225. protocol: 'private',
  58226. fn: function (aRequest){
  58227. var self=this;
  58228. var header,token,auth,parts;
  58229. return $core.withContext(function($ctx1) {
  58230. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  58231. var $early={};
  58232. try {
  58233. $2=$recv(self["@username"])._isNil();
  58234. $ctx1.sendIdx["isNil"]=1;
  58235. $1=$recv($2)._and_((function(){
  58236. return $core.withContext(function($ctx2) {
  58237. return $recv(self["@password"])._isNil();
  58238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58239. }));
  58240. $ctx1.sendIdx["and:"]=1;
  58241. if($core.assert($1)){
  58242. return true;
  58243. };
  58244. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  58245. $ctx1.sendIdx["at:"]=1;
  58246. if(($receiver = $3) == null || $receiver.isNil){
  58247. header="";
  58248. } else {
  58249. header=$3;
  58250. };
  58251. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  58252. throw $early=[false];
  58253. }),(function(){
  58254. return $core.withContext(function($ctx2) {
  58255. $4=$recv(header)._tokenize_(" ");
  58256. $ctx2.sendIdx["tokenize:"]=1;
  58257. if(($receiver = $4) == null || $receiver.isNil){
  58258. token="";
  58259. } else {
  58260. token=$4;
  58261. };
  58262. token;
  58263. $5=$recv(token)._at_((2));
  58264. $ctx2.sendIdx["at:"]=2;
  58265. auth=self._base64Decode_($5);
  58266. auth;
  58267. parts=$recv(auth)._tokenize_(":");
  58268. parts;
  58269. $8=self["@username"];
  58270. $9=$recv(parts)._at_((1));
  58271. $ctx2.sendIdx["at:"]=3;
  58272. $7=$recv($8).__eq($9);
  58273. $ctx2.sendIdx["="]=1;
  58274. $6=$recv($7)._and_((function(){
  58275. return $core.withContext(function($ctx3) {
  58276. return $recv(self["@password"]).__eq($recv(parts)._at_((2)));
  58277. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  58278. }));
  58279. if($core.assert($6)){
  58280. throw $early=[true];
  58281. } else {
  58282. throw $early=[false];
  58283. };
  58284. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58285. }));
  58286. return self;
  58287. }
  58288. catch(e) {if(e===$early)return e[0]; throw e}
  58289. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  58290. },
  58291. args: ["aRequest"],
  58292. 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].",
  58293. referencedClasses: [],
  58294. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  58295. }),
  58296. $globals.FileServer);
  58297. $core.addMethod(
  58298. $core.method({
  58299. selector: "password:",
  58300. protocol: 'accessing',
  58301. fn: function (aPassword){
  58302. var self=this;
  58303. self["@password"]=aPassword;
  58304. return self;
  58305. },
  58306. args: ["aPassword"],
  58307. source: "password: aPassword\x0a\x09password := aPassword.",
  58308. referencedClasses: [],
  58309. messageSends: []
  58310. }),
  58311. $globals.FileServer);
  58312. $core.addMethod(
  58313. $core.method({
  58314. selector: "port",
  58315. protocol: 'accessing',
  58316. fn: function (){
  58317. var self=this;
  58318. return self["@port"];
  58319. },
  58320. args: [],
  58321. source: "port\x0a\x09^ port",
  58322. referencedClasses: [],
  58323. messageSends: []
  58324. }),
  58325. $globals.FileServer);
  58326. $core.addMethod(
  58327. $core.method({
  58328. selector: "port:",
  58329. protocol: 'accessing',
  58330. fn: function (aNumber){
  58331. var self=this;
  58332. self["@port"]=aNumber;
  58333. return self;
  58334. },
  58335. args: ["aNumber"],
  58336. source: "port: aNumber\x0a\x09port := aNumber",
  58337. referencedClasses: [],
  58338. messageSends: []
  58339. }),
  58340. $globals.FileServer);
  58341. $core.addMethod(
  58342. $core.method({
  58343. selector: "require:",
  58344. protocol: 'private',
  58345. fn: function (aModuleString){
  58346. var self=this;
  58347. return $core.withContext(function($ctx1) {
  58348. return $recv(require)._value_(aModuleString);
  58349. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  58350. },
  58351. args: ["aModuleString"],
  58352. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  58353. referencedClasses: [],
  58354. messageSends: ["value:"]
  58355. }),
  58356. $globals.FileServer);
  58357. $core.addMethod(
  58358. $core.method({
  58359. selector: "respondAuthenticationRequiredTo:",
  58360. protocol: 'request handling',
  58361. fn: function (aResponse){
  58362. var self=this;
  58363. return $core.withContext(function($ctx1) {
  58364. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  58365. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  58366. $recv(aResponse)._end();
  58367. return self;
  58368. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  58369. },
  58370. args: ["aResponse"],
  58371. 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.",
  58372. referencedClasses: [],
  58373. messageSends: ["writeHead:options:", "write:", "end"]
  58374. }),
  58375. $globals.FileServer);
  58376. $core.addMethod(
  58377. $core.method({
  58378. selector: "respondCreatedTo:",
  58379. protocol: 'request handling',
  58380. fn: function (aResponse){
  58381. var self=this;
  58382. return $core.withContext(function($ctx1) {
  58383. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  58384. $recv(aResponse)._end();
  58385. return self;
  58386. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  58387. },
  58388. args: ["aResponse"],
  58389. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  58390. referencedClasses: [],
  58391. messageSends: ["writeHead:options:", "end"]
  58392. }),
  58393. $globals.FileServer);
  58394. $core.addMethod(
  58395. $core.method({
  58396. selector: "respondDirectoryNamed:from:to:",
  58397. protocol: 'request handling',
  58398. fn: function (aDirname,aUrl,aResponse){
  58399. var self=this;
  58400. return $core.withContext(function($ctx1) {
  58401. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  58402. $2=$recv(aUrl)._pathname();
  58403. $ctx1.sendIdx["pathname"]=1;
  58404. $1=$recv($2)._endsWith_("/");
  58405. if($core.assert($1)){
  58406. $3=$recv(aDirname).__comma("index.html");
  58407. $ctx1.sendIdx[","]=1;
  58408. self._respondFileNamed_to_($3,aResponse);
  58409. } else {
  58410. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  58411. $7=$recv(aUrl)._search();
  58412. if(($receiver = $7) == null || $receiver.isNil){
  58413. $6="";
  58414. } else {
  58415. $6=$7;
  58416. };
  58417. $4=$recv($5).__comma($6);
  58418. $ctx1.sendIdx[","]=2;
  58419. self._respondRedirect_to_($4,aResponse);
  58420. };
  58421. return self;
  58422. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  58423. },
  58424. args: ["aDirname", "aUrl", "aResponse"],
  58425. 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]",
  58426. referencedClasses: [],
  58427. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  58428. }),
  58429. $globals.FileServer);
  58430. $core.addMethod(
  58431. $core.method({
  58432. selector: "respondFileNamed:to:",
  58433. protocol: 'request handling',
  58434. fn: function (aFilename,aResponse){
  58435. var self=this;
  58436. var type,filename;
  58437. return $core.withContext(function($ctx1) {
  58438. var $1,$2,$3,$4;
  58439. filename=aFilename;
  58440. $recv(self["@fs"])._readFile_do_(filename,(function(ex,file){
  58441. return $core.withContext(function($ctx2) {
  58442. $1=$recv(ex)._notNil();
  58443. if($core.assert($1)){
  58444. $2=console;
  58445. $3=$recv(filename).__comma(" does not exist");
  58446. $ctx2.sendIdx[","]=1;
  58447. $recv($2)._log_($3);
  58448. return self._respondNotFoundTo_(aResponse);
  58449. } else {
  58450. type=$recv(self._class())._mimeTypeFor_(filename);
  58451. type;
  58452. $4=$recv(type).__eq("application/javascript");
  58453. if($core.assert($4)){
  58454. type=$recv(type).__comma(";charset=utf-8");
  58455. type;
  58456. };
  58457. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  58458. $recv(aResponse)._write_encoding_(file,"binary");
  58459. return $recv(aResponse)._end();
  58460. };
  58461. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  58462. }));
  58463. return self;
  58464. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  58465. },
  58466. args: ["aFilename", "aResponse"],
  58467. 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]]",
  58468. referencedClasses: [],
  58469. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  58470. }),
  58471. $globals.FileServer);
  58472. $core.addMethod(
  58473. $core.method({
  58474. selector: "respondInternalErrorTo:",
  58475. protocol: 'request handling',
  58476. fn: function (aResponse){
  58477. var self=this;
  58478. return $core.withContext(function($ctx1) {
  58479. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  58480. $recv(aResponse)._write_("500 Internal server error");
  58481. $recv(aResponse)._end();
  58482. return self;
  58483. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  58484. },
  58485. args: ["aResponse"],
  58486. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  58487. referencedClasses: [],
  58488. messageSends: ["writeHead:options:", "write:", "end"]
  58489. }),
  58490. $globals.FileServer);
  58491. $core.addMethod(
  58492. $core.method({
  58493. selector: "respondNotCreatedTo:",
  58494. protocol: 'request handling',
  58495. fn: function (aResponse){
  58496. var self=this;
  58497. return $core.withContext(function($ctx1) {
  58498. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  58499. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  58500. $recv(aResponse)._end();
  58501. return self;
  58502. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  58503. },
  58504. args: ["aResponse"],
  58505. 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.",
  58506. referencedClasses: [],
  58507. messageSends: ["writeHead:options:", "write:", "end"]
  58508. }),
  58509. $globals.FileServer);
  58510. $core.addMethod(
  58511. $core.method({
  58512. selector: "respondNotFoundTo:",
  58513. protocol: 'request handling',
  58514. fn: function (aResponse){
  58515. var self=this;
  58516. return $core.withContext(function($ctx1) {
  58517. var $2,$1;
  58518. $2=self._fallbackPage();
  58519. $ctx1.sendIdx["fallbackPage"]=1;
  58520. $1=$recv($2)._isNil();
  58521. if(!$core.assert($1)){
  58522. return self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  58523. };
  58524. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  58525. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  58526. $ctx1.sendIdx["write:"]=1;
  58527. $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>");
  58528. $ctx1.sendIdx["write:"]=2;
  58529. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  58530. $ctx1.sendIdx["write:"]=3;
  58531. $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>");
  58532. $ctx1.sendIdx["write:"]=4;
  58533. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  58534. $ctx1.sendIdx["write:"]=5;
  58535. $recv(aResponse)._write_("</ul></p></body></html>");
  58536. $recv(aResponse)._end();
  58537. return self;
  58538. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  58539. },
  58540. args: ["aResponse"],
  58541. 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",
  58542. referencedClasses: [],
  58543. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  58544. }),
  58545. $globals.FileServer);
  58546. $core.addMethod(
  58547. $core.method({
  58548. selector: "respondOKTo:",
  58549. protocol: 'request handling',
  58550. fn: function (aResponse){
  58551. var self=this;
  58552. return $core.withContext(function($ctx1) {
  58553. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  58554. $recv(aResponse)._end();
  58555. return self;
  58556. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  58557. },
  58558. args: ["aResponse"],
  58559. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  58560. referencedClasses: [],
  58561. messageSends: ["writeHead:options:", "end"]
  58562. }),
  58563. $globals.FileServer);
  58564. $core.addMethod(
  58565. $core.method({
  58566. selector: "respondRedirect:to:",
  58567. protocol: 'request handling',
  58568. fn: function (aString,aResponse){
  58569. var self=this;
  58570. return $core.withContext(function($ctx1) {
  58571. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  58572. $recv(aResponse)._end();
  58573. return self;
  58574. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  58575. },
  58576. args: ["aString", "aResponse"],
  58577. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  58578. referencedClasses: [],
  58579. messageSends: ["writeHead:options:", "end"]
  58580. }),
  58581. $globals.FileServer);
  58582. $core.addMethod(
  58583. $core.method({
  58584. selector: "start",
  58585. protocol: 'starting',
  58586. fn: function (){
  58587. var self=this;
  58588. return $core.withContext(function($ctx1) {
  58589. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  58590. self._checkDirectoryLayout();
  58591. $1=$recv(self["@http"])._createServer_((function(request,response){
  58592. return $core.withContext(function($ctx2) {
  58593. return self._handleRequest_respondTo_(request,response);
  58594. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  58595. }));
  58596. $recv($1)._on_do_("error",(function(error){
  58597. return $core.withContext(function($ctx2) {
  58598. $2=console;
  58599. $3="Error starting server: ".__comma(error);
  58600. $ctx2.sendIdx[","]=1;
  58601. return $recv($2)._log_($3);
  58602. $ctx2.sendIdx["log:"]=1;
  58603. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  58604. }));
  58605. $ctx1.sendIdx["on:do:"]=1;
  58606. $recv($1)._on_do_("listening",(function(){
  58607. return $core.withContext(function($ctx2) {
  58608. $4=console;
  58609. $8=self._host();
  58610. $ctx2.sendIdx["host"]=1;
  58611. $7="Starting file server on http://".__comma($8);
  58612. $6=$recv($7).__comma(":");
  58613. $ctx2.sendIdx[","]=3;
  58614. $10=self._port();
  58615. $ctx2.sendIdx["port"]=1;
  58616. $9=$recv($10)._asString();
  58617. $5=$recv($6).__comma($9);
  58618. $ctx2.sendIdx[","]=2;
  58619. return $recv($4)._log_($5);
  58620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58621. }));
  58622. $recv($1)._listen_host_(self._port(),self._host());
  58623. return self;
  58624. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  58625. },
  58626. args: [],
  58627. 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.",
  58628. referencedClasses: [],
  58629. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  58630. }),
  58631. $globals.FileServer);
  58632. $core.addMethod(
  58633. $core.method({
  58634. selector: "startOn:",
  58635. protocol: 'starting',
  58636. fn: function (aPort){
  58637. var self=this;
  58638. return $core.withContext(function($ctx1) {
  58639. self._port_(aPort);
  58640. self._start();
  58641. return self;
  58642. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  58643. },
  58644. args: ["aPort"],
  58645. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  58646. referencedClasses: [],
  58647. messageSends: ["port:", "start"]
  58648. }),
  58649. $globals.FileServer);
  58650. $core.addMethod(
  58651. $core.method({
  58652. selector: "username:",
  58653. protocol: 'accessing',
  58654. fn: function (aUsername){
  58655. var self=this;
  58656. self["@username"]=aUsername;
  58657. return self;
  58658. },
  58659. args: ["aUsername"],
  58660. source: "username: aUsername\x0a\x09username := aUsername.",
  58661. referencedClasses: [],
  58662. messageSends: []
  58663. }),
  58664. $globals.FileServer);
  58665. $core.addMethod(
  58666. $core.method({
  58667. selector: "validateBasePath",
  58668. protocol: 'private',
  58669. fn: function (){
  58670. var self=this;
  58671. return $core.withContext(function($ctx1) {
  58672. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  58673. $1=self["@fs"];
  58674. $2=self._basePath();
  58675. $ctx1.sendIdx["basePath"]=1;
  58676. $recv($1)._stat_then_($2,(function(err,stat){
  58677. return $core.withContext(function($ctx2) {
  58678. if(($receiver = err) == null || $receiver.isNil){
  58679. $3=$recv(stat)._isDirectory();
  58680. if(!$core.assert($3)){
  58681. $4=console;
  58682. $7=self._basePath();
  58683. $ctx2.sendIdx["basePath"]=2;
  58684. $6="Warning: --base-path parameter ".__comma($7);
  58685. $ctx2.sendIdx[","]=2;
  58686. $5=$recv($6).__comma(" is not a directory.");
  58687. $ctx2.sendIdx[","]=1;
  58688. return $recv($4)._warn_($5);
  58689. $ctx2.sendIdx["warn:"]=1;
  58690. };
  58691. } else {
  58692. $8=console;
  58693. $9=$recv("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  58694. $ctx2.sendIdx[","]=3;
  58695. return $recv($8)._warn_($9);
  58696. };
  58697. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  58698. }));
  58699. return self;
  58700. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  58701. },
  58702. args: [],
  58703. 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.' ]].",
  58704. referencedClasses: [],
  58705. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  58706. }),
  58707. $globals.FileServer);
  58708. $core.addMethod(
  58709. $core.method({
  58710. selector: "withBasePath:",
  58711. protocol: 'private',
  58712. fn: function (aBaseRelativePath){
  58713. var self=this;
  58714. return $core.withContext(function($ctx1) {
  58715. return $recv(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  58716. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  58717. },
  58718. args: ["aBaseRelativePath"],
  58719. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  58720. referencedClasses: [],
  58721. messageSends: ["join:with:", "basePath"]
  58722. }),
  58723. $globals.FileServer);
  58724. $core.addMethod(
  58725. $core.method({
  58726. selector: "writeData:toFileNamed:",
  58727. protocol: 'private',
  58728. fn: function (data,aFilename){
  58729. var self=this;
  58730. return $core.withContext(function($ctx1) {
  58731. $recv(console)._log_(aFilename);
  58732. return self;
  58733. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  58734. },
  58735. args: ["data", "aFilename"],
  58736. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  58737. referencedClasses: [],
  58738. messageSends: ["log:"]
  58739. }),
  58740. $globals.FileServer);
  58741. $globals.FileServer.klass.iVarNames = ['mimeTypes'];
  58742. $core.addMethod(
  58743. $core.method({
  58744. selector: "commandLineSwitches",
  58745. protocol: 'accessing',
  58746. fn: function (){
  58747. var self=this;
  58748. var switches;
  58749. return $core.withContext(function($ctx1) {
  58750. switches=$recv(self._methodsInProtocol_("accessing"))._collect_((function(each){
  58751. return $core.withContext(function($ctx2) {
  58752. return $recv(each)._selector();
  58753. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58754. }));
  58755. $ctx1.sendIdx["collect:"]=1;
  58756. switches=$recv(switches)._select_((function(each){
  58757. return $core.withContext(function($ctx2) {
  58758. return $recv(each)._match_("^[^:]*:$");
  58759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  58760. }));
  58761. switches=$recv(switches)._collect_((function(each){
  58762. return $core.withContext(function($ctx2) {
  58763. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  58764. $ctx2.sendIdx["replace:with:"]=1;
  58765. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  58766. }));
  58767. return switches;
  58768. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.klass)});
  58769. },
  58770. args: [],
  58771. 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",
  58772. referencedClasses: [],
  58773. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  58774. }),
  58775. $globals.FileServer.klass);
  58776. $core.addMethod(
  58777. $core.method({
  58778. selector: "createServerWithArguments:",
  58779. protocol: 'initialization',
  58780. fn: function (options){
  58781. var self=this;
  58782. var server,popFront,front,optionName,optionValue,switches;
  58783. return $core.withContext(function($ctx1) {
  58784. var $1,$2,$3,$4,$5,$6,$7,$8;
  58785. var $early={};
  58786. try {
  58787. switches=self._commandLineSwitches();
  58788. server=self._new();
  58789. $recv(options)._ifEmpty_((function(){
  58790. throw $early=[server];
  58791. }));
  58792. $1=$recv($recv(options)._size())._even();
  58793. if(!$core.assert($1)){
  58794. $recv(console)._log_("Using default parameters.");
  58795. $ctx1.sendIdx["log:"]=1;
  58796. $2=console;
  58797. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  58798. $ctx1.sendIdx[","]=1;
  58799. $recv($2)._log_($3);
  58800. $ctx1.sendIdx["log:"]=2;
  58801. $4=console;
  58802. $5="Use any of the following ones: ".__comma(switches);
  58803. $ctx1.sendIdx[","]=2;
  58804. $recv($4)._log_($5);
  58805. $ctx1.sendIdx["log:"]=3;
  58806. return server;
  58807. };
  58808. popFront=(function(args){
  58809. return $core.withContext(function($ctx2) {
  58810. front=$recv(args)._first();
  58811. front;
  58812. $recv(args)._remove_(front);
  58813. return front;
  58814. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  58815. });
  58816. $recv((function(){
  58817. return $core.withContext(function($ctx2) {
  58818. return $recv(options)._notEmpty();
  58819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58820. }))._whileTrue_((function(){
  58821. return $core.withContext(function($ctx2) {
  58822. optionName=$recv(popFront)._value_(options);
  58823. $ctx2.sendIdx["value:"]=1;
  58824. optionName;
  58825. optionValue=$recv(popFront)._value_(options);
  58826. optionValue;
  58827. $6=$recv(switches)._includes_(optionName);
  58828. if($core.assert($6)){
  58829. optionName=self._selectorForCommandLineSwitch_(optionName);
  58830. optionName;
  58831. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  58832. } else {
  58833. $7=console;
  58834. $8=$recv(optionName).__comma(" is not a valid commandline option");
  58835. $ctx2.sendIdx[","]=3;
  58836. $recv($7)._log_($8);
  58837. $ctx2.sendIdx["log:"]=4;
  58838. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  58839. };
  58840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58841. }));
  58842. return server;
  58843. }
  58844. catch(e) {if(e===$early)return e[0]; throw e}
  58845. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.klass)});
  58846. },
  58847. args: ["options"],
  58848. 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.",
  58849. referencedClasses: ["Array"],
  58850. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  58851. }),
  58852. $globals.FileServer.klass);
  58853. $core.addMethod(
  58854. $core.method({
  58855. selector: "defaultBasePath",
  58856. protocol: 'accessing',
  58857. fn: function (){
  58858. var self=this;
  58859. return "./";
  58860. },
  58861. args: [],
  58862. source: "defaultBasePath\x0a\x09^ './'",
  58863. referencedClasses: [],
  58864. messageSends: []
  58865. }),
  58866. $globals.FileServer.klass);
  58867. $core.addMethod(
  58868. $core.method({
  58869. selector: "defaultHost",
  58870. protocol: 'accessing',
  58871. fn: function (){
  58872. var self=this;
  58873. return "127.0.0.1";
  58874. },
  58875. args: [],
  58876. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  58877. referencedClasses: [],
  58878. messageSends: []
  58879. }),
  58880. $globals.FileServer.klass);
  58881. $core.addMethod(
  58882. $core.method({
  58883. selector: "defaultMimeTypes",
  58884. protocol: 'accessing',
  58885. fn: function (){
  58886. var self=this;
  58887. 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"]);
  58888. },
  58889. args: [],
  58890. 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}",
  58891. referencedClasses: [],
  58892. messageSends: []
  58893. }),
  58894. $globals.FileServer.klass);
  58895. $core.addMethod(
  58896. $core.method({
  58897. selector: "defaultPort",
  58898. protocol: 'accessing',
  58899. fn: function (){
  58900. var self=this;
  58901. return (4000);
  58902. },
  58903. args: [],
  58904. source: "defaultPort\x0a\x09^ 4000",
  58905. referencedClasses: [],
  58906. messageSends: []
  58907. }),
  58908. $globals.FileServer.klass);
  58909. $core.addMethod(
  58910. $core.method({
  58911. selector: "main",
  58912. protocol: 'initialization',
  58913. fn: function (){
  58914. var self=this;
  58915. var fileServer,args;
  58916. return $core.withContext(function($ctx1) {
  58917. var $1;
  58918. var $early={};
  58919. try {
  58920. args=$recv(process)._argv();
  58921. $recv(args)._removeFrom_to_((1),(3));
  58922. $recv(args)._detect_ifNone_((function(each){
  58923. return $core.withContext(function($ctx2) {
  58924. $1=$recv(each).__eq("--help");
  58925. if($core.assert($1)){
  58926. return $recv($globals.FileServer)._printHelp();
  58927. };
  58928. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58929. }),(function(){
  58930. return $core.withContext(function($ctx2) {
  58931. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  58932. fileServer;
  58933. throw $early=[$recv(fileServer)._start()];
  58934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58935. }));
  58936. return self;
  58937. }
  58938. catch(e) {if(e===$early)return e[0]; throw e}
  58939. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.klass)});
  58940. },
  58941. args: [],
  58942. 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]",
  58943. referencedClasses: ["FileServer"],
  58944. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  58945. }),
  58946. $globals.FileServer.klass);
  58947. $core.addMethod(
  58948. $core.method({
  58949. selector: "mimeTypeFor:",
  58950. protocol: 'accessing',
  58951. fn: function (aString){
  58952. var self=this;
  58953. return $core.withContext(function($ctx1) {
  58954. return $recv(self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  58955. return "text/plain";
  58956. }));
  58957. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.klass)});
  58958. },
  58959. args: ["aString"],
  58960. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  58961. referencedClasses: [],
  58962. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  58963. }),
  58964. $globals.FileServer.klass);
  58965. $core.addMethod(
  58966. $core.method({
  58967. selector: "mimeTypes",
  58968. protocol: 'accessing',
  58969. fn: function (){
  58970. var self=this;
  58971. return $core.withContext(function($ctx1) {
  58972. var $1,$receiver;
  58973. $1=self["@mimeTypes"];
  58974. if(($receiver = $1) == null || $receiver.isNil){
  58975. self["@mimeTypes"]=self._defaultMimeTypes();
  58976. return self["@mimeTypes"];
  58977. } else {
  58978. return $1;
  58979. };
  58980. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.klass)});
  58981. },
  58982. args: [],
  58983. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  58984. referencedClasses: [],
  58985. messageSends: ["ifNil:", "defaultMimeTypes"]
  58986. }),
  58987. $globals.FileServer.klass);
  58988. $core.addMethod(
  58989. $core.method({
  58990. selector: "printHelp",
  58991. protocol: 'accessing',
  58992. fn: function (){
  58993. var self=this;
  58994. return $core.withContext(function($ctx1) {
  58995. $recv(console)._log_("Available commandline options are:");
  58996. $ctx1.sendIdx["log:"]=1;
  58997. $recv(console)._log_("--help");
  58998. $ctx1.sendIdx["log:"]=2;
  58999. $recv(self._commandLineSwitches())._do_((function(each){
  59000. return $core.withContext(function($ctx2) {
  59001. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  59002. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59003. }));
  59004. return self;
  59005. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.klass)});
  59006. },
  59007. args: [],
  59008. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  59009. referencedClasses: [],
  59010. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  59011. }),
  59012. $globals.FileServer.klass);
  59013. $core.addMethod(
  59014. $core.method({
  59015. selector: "selectorForCommandLineSwitch:",
  59016. protocol: 'accessing',
  59017. fn: function (aSwitch){
  59018. var self=this;
  59019. return $core.withContext(function($ctx1) {
  59020. var $1;
  59021. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  59022. return $core.withContext(function($ctx2) {
  59023. return $recv($recv(each)._second())._asUppercase();
  59024. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59025. }));
  59026. $ctx1.sendIdx["replace:with:"]=1;
  59027. return $recv($1).__comma(":");
  59028. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.klass)});
  59029. },
  59030. args: ["aSwitch"],
  59031. 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 ]), ':'",
  59032. referencedClasses: [],
  59033. messageSends: [",", "replace:with:", "asUppercase", "second"]
  59034. }),
  59035. $globals.FileServer.klass);
  59036. $core.addClass('Initer', $globals.BaseFileManipulator, ['childProcess', 'nmPath'], 'AmberCli');
  59037. $core.addMethod(
  59038. $core.method({
  59039. selector: "bowerInstallThenDo:",
  59040. protocol: 'action',
  59041. fn: function (aBlock){
  59042. var self=this;
  59043. var child;
  59044. return $core.withContext(function($ctx1) {
  59045. var $1,$3,$2;
  59046. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]);
  59047. $1=child;
  59048. $recv($1)._on_do_("error",aBlock);
  59049. $ctx1.sendIdx["on:do:"]=1;
  59050. $recv($1)._on_do_("close",(function(code){
  59051. return $core.withContext(function($ctx2) {
  59052. $3=$recv(code).__eq((0));
  59053. if($core.assert($3)){
  59054. $2=nil;
  59055. } else {
  59056. $2=code;
  59057. };
  59058. return $recv(aBlock)._value_($2);
  59059. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  59060. }));
  59061. return self;
  59062. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  59063. },
  59064. args: ["aBlock"],
  59065. 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 ]) ]",
  59066. referencedClasses: [],
  59067. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  59068. }),
  59069. $globals.Initer);
  59070. $core.addMethod(
  59071. $core.method({
  59072. selector: "finishMessage",
  59073. protocol: 'action',
  59074. fn: function (){
  59075. var self=this;
  59076. return $core.withContext(function($ctx1) {
  59077. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  59078. $recv((function(){
  59079. }))._valueWithTimeout_((600));
  59080. return self;
  59081. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  59082. },
  59083. args: [],
  59084. 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",
  59085. referencedClasses: ["String"],
  59086. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  59087. }),
  59088. $globals.Initer);
  59089. $core.addMethod(
  59090. $core.method({
  59091. selector: "gruntInitThenDo:",
  59092. protocol: 'action',
  59093. fn: function (aBlock){
  59094. var self=this;
  59095. var child,sanitizedTemplatePath;
  59096. return $core.withContext(function($ctx1) {
  59097. var $1,$3,$2;
  59098. sanitizedTemplatePath=$recv($recv($recv(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  59099. $ctx1.sendIdx["replace:with:"]=1;
  59100. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  59101. $1=child;
  59102. $recv($1)._on_do_("error",aBlock);
  59103. $ctx1.sendIdx["on:do:"]=1;
  59104. $recv($1)._on_do_("close",(function(code){
  59105. return $core.withContext(function($ctx2) {
  59106. $3=$recv(code).__eq((0));
  59107. if($core.assert($3)){
  59108. $2=nil;
  59109. } else {
  59110. $2=code;
  59111. };
  59112. return $recv(aBlock)._value_($2);
  59113. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  59114. }));
  59115. return self;
  59116. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  59117. },
  59118. args: ["aBlock"],
  59119. 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 ]) ]",
  59120. referencedClasses: [],
  59121. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  59122. }),
  59123. $globals.Initer);
  59124. $core.addMethod(
  59125. $core.method({
  59126. selector: "gruntThenDo:",
  59127. protocol: 'action',
  59128. fn: function (aBlock){
  59129. var self=this;
  59130. var child;
  59131. return $core.withContext(function($ctx1) {
  59132. var $1,$3,$2;
  59133. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  59134. $1=child;
  59135. $recv($1)._on_do_("error",aBlock);
  59136. $ctx1.sendIdx["on:do:"]=1;
  59137. $recv($1)._on_do_("close",(function(code){
  59138. return $core.withContext(function($ctx2) {
  59139. $3=$recv(code).__eq((0));
  59140. if($core.assert($3)){
  59141. $2=nil;
  59142. } else {
  59143. $2=code;
  59144. };
  59145. return $recv(aBlock)._value_($2);
  59146. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  59147. }));
  59148. return self;
  59149. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  59150. },
  59151. args: ["aBlock"],
  59152. 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 ]) ]",
  59153. referencedClasses: [],
  59154. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  59155. }),
  59156. $globals.Initer);
  59157. $core.addMethod(
  59158. $core.method({
  59159. selector: "initialize",
  59160. protocol: 'initialization',
  59161. fn: function (){
  59162. var self=this;
  59163. return $core.withContext(function($ctx1) {
  59164. (
  59165. $ctx1.supercall = true,
  59166. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  59167. $ctx1.supercall = false;
  59168. self["@childProcess"]=$recv(require)._value_("child_process");
  59169. self["@nmPath"]=$recv(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  59170. return self;
  59171. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  59172. },
  59173. args: [],
  59174. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  59175. referencedClasses: [],
  59176. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  59177. }),
  59178. $globals.Initer);
  59179. $core.addMethod(
  59180. $core.method({
  59181. selector: "npmInstallThenDo:",
  59182. protocol: 'action',
  59183. fn: function (aBlock){
  59184. var self=this;
  59185. var child;
  59186. return $core.withContext(function($ctx1) {
  59187. var $1;
  59188. child=$recv(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  59189. $1=$recv(child)._stdout();
  59190. $ctx1.sendIdx["stdout"]=1;
  59191. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  59192. return self;
  59193. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  59194. },
  59195. args: ["aBlock"],
  59196. 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 }",
  59197. referencedClasses: [],
  59198. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  59199. }),
  59200. $globals.Initer);
  59201. $core.addMethod(
  59202. $core.method({
  59203. selector: "npmScriptForModule:named:",
  59204. protocol: 'npm',
  59205. fn: function (aString,anotherString){
  59206. var self=this;
  59207. var modulePath,packageJson,binSection,scriptPath;
  59208. return $core.withContext(function($ctx1) {
  59209. var $1,$3,$4,$2,$5;
  59210. $1=self["@path"];
  59211. $3=$recv($globals.JSObjectProxy)._on_(require);
  59212. $4=$recv(aString).__comma("/package.json");
  59213. $ctx1.sendIdx[","]=1;
  59214. $2=$recv($3)._resolve_($4);
  59215. modulePath=$recv($1)._dirname_($2);
  59216. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  59217. binSection=$recv(packageJson)._at_("bin");
  59218. $ctx1.sendIdx["at:"]=1;
  59219. $5=$recv(binSection)._isString();
  59220. if($core.assert($5)){
  59221. scriptPath=binSection;
  59222. } else {
  59223. scriptPath=$recv(binSection)._at_(anotherString);
  59224. };
  59225. return $recv(self["@path"])._join_with_(modulePath,scriptPath);
  59226. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  59227. },
  59228. args: ["aString", "anotherString"],
  59229. 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",
  59230. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  59231. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  59232. }),
  59233. $globals.Initer);
  59234. $core.addMethod(
  59235. $core.method({
  59236. selector: "start",
  59237. protocol: 'action',
  59238. fn: function (){
  59239. var self=this;
  59240. return $core.withContext(function($ctx1) {
  59241. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  59242. self._gruntInitThenDo_((function(error){
  59243. return $core.withContext(function($ctx2) {
  59244. if(($receiver = error) == null || $receiver.isNil){
  59245. return self._bowerInstallThenDo_((function(error2){
  59246. return $core.withContext(function($ctx3) {
  59247. if(($receiver = error2) == null || $receiver.isNil){
  59248. return self._npmInstallThenDo_((function(error3){
  59249. return $core.withContext(function($ctx4) {
  59250. if(($receiver = error3) == null || $receiver.isNil){
  59251. return self._gruntThenDo_((function(error4){
  59252. return $core.withContext(function($ctx5) {
  59253. if(($receiver = error4) == null || $receiver.isNil){
  59254. self._finishMessage();
  59255. return $recv(process)._exit();
  59256. } else {
  59257. $7=console;
  59258. $recv($7)._log_("grunt exec error:");
  59259. $ctx5.sendIdx["log:"]=7;
  59260. $recv($7)._log_(error4);
  59261. return $recv(process)._exit_((104));
  59262. };
  59263. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  59264. }));
  59265. } else {
  59266. $5=console;
  59267. $recv($5)._log_("npm install exec error:");
  59268. $ctx4.sendIdx["log:"]=5;
  59269. $6=$recv($5)._log_(error3);
  59270. $ctx4.sendIdx["log:"]=6;
  59271. $6;
  59272. return $recv(process)._exit_((103));
  59273. $ctx4.sendIdx["exit:"]=3;
  59274. };
  59275. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  59276. }));
  59277. } else {
  59278. $3=console;
  59279. $recv($3)._log_("bower install exec error:");
  59280. $ctx3.sendIdx["log:"]=3;
  59281. $4=$recv($3)._log_(error2);
  59282. $ctx3.sendIdx["log:"]=4;
  59283. $4;
  59284. return $recv(process)._exit_((102));
  59285. $ctx3.sendIdx["exit:"]=2;
  59286. };
  59287. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  59288. }));
  59289. } else {
  59290. $1=console;
  59291. $recv($1)._log_("grunt-init exec error:");
  59292. $ctx2.sendIdx["log:"]=1;
  59293. $2=$recv($1)._log_(error);
  59294. $ctx2.sendIdx["log:"]=2;
  59295. $2;
  59296. return $recv(process)._exit_((101));
  59297. $ctx2.sendIdx["exit:"]=1;
  59298. };
  59299. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  59300. }));
  59301. return self;
  59302. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  59303. },
  59304. args: [],
  59305. 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 ]]]]]]]]",
  59306. referencedClasses: [],
  59307. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  59308. }),
  59309. $globals.Initer);
  59310. $core.addClass('Repl', $globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  59311. $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.";
  59312. $core.addMethod(
  59313. $core.method({
  59314. selector: "addVariableNamed:to:",
  59315. protocol: 'private',
  59316. fn: function (aString,anObject){
  59317. var self=this;
  59318. var newClass,newObject;
  59319. return $core.withContext(function($ctx1) {
  59320. newClass=self._subclass_withVariable_($recv(anObject)._class(),aString);
  59321. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  59322. newObject=$recv(newClass)._new();
  59323. self._setPreviousVariablesFor_from_(newObject,anObject);
  59324. return newObject;
  59325. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  59326. },
  59327. args: ["aString", "anObject"],
  59328. 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",
  59329. referencedClasses: [],
  59330. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  59331. }),
  59332. $globals.Repl);
  59333. $core.addMethod(
  59334. $core.method({
  59335. selector: "assignNewVariable:do:",
  59336. protocol: 'private',
  59337. fn: function (buffer,aBlock){
  59338. var self=this;
  59339. return $core.withContext(function($ctx1) {
  59340. var $2,$3,$1,$receiver;
  59341. return self._parseAssignment_do_(buffer,(function(name,expr){
  59342. var varName,value;
  59343. return $core.withContext(function($ctx2) {
  59344. if(($receiver = name) == null || $receiver.isNil){
  59345. varName=self._nextResultName();
  59346. } else {
  59347. varName=name;
  59348. };
  59349. varName;
  59350. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  59351. self["@session"];
  59352. $recv((function(){
  59353. return $core.withContext(function($ctx3) {
  59354. $2=$recv(varName).__comma(" := ");
  59355. if(($receiver = expr) == null || $receiver.isNil){
  59356. $3=buffer;
  59357. } else {
  59358. $3=expr;
  59359. };
  59360. $1=$recv($2).__comma($3);
  59361. $ctx3.sendIdx[","]=1;
  59362. value=self._eval_on_($1,self["@session"]);
  59363. return value;
  59364. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  59365. }))._on_do_($globals.Error,(function(e){
  59366. return $core.withContext(function($ctx3) {
  59367. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  59368. value=nil;
  59369. return value;
  59370. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  59371. }));
  59372. return $recv(aBlock)._value_value_(varName,value);
  59373. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  59374. }));
  59375. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  59376. },
  59377. args: ["buffer", "aBlock"],
  59378. 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]",
  59379. referencedClasses: ["Error", "ConsoleErrorHandler"],
  59380. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  59381. }),
  59382. $globals.Repl);
  59383. $core.addMethod(
  59384. $core.method({
  59385. selector: "clearScreen",
  59386. protocol: 'actions',
  59387. fn: function (){
  59388. var self=this;
  59389. var esc,cls;
  59390. return $core.withContext(function($ctx1) {
  59391. var $1;
  59392. esc=$recv($globals.String)._fromCharCode_((27));
  59393. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  59394. $ctx1.sendIdx[","]=2;
  59395. cls=$recv($1).__comma("[0;0f");
  59396. $ctx1.sendIdx[","]=1;
  59397. $recv($recv(process)._stdout())._write_(cls);
  59398. $recv(self["@interface"])._prompt();
  59399. return self;
  59400. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  59401. },
  59402. args: [],
  59403. 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",
  59404. referencedClasses: ["String"],
  59405. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  59406. }),
  59407. $globals.Repl);
  59408. $core.addMethod(
  59409. $core.method({
  59410. selector: "close",
  59411. protocol: 'actions',
  59412. fn: function (){
  59413. var self=this;
  59414. return $core.withContext(function($ctx1) {
  59415. $recv($recv(process)._stdin())._destroy();
  59416. return self;
  59417. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  59418. },
  59419. args: [],
  59420. source: "close\x0a\x09process stdin destroy",
  59421. referencedClasses: [],
  59422. messageSends: ["destroy", "stdin"]
  59423. }),
  59424. $globals.Repl);
  59425. $core.addMethod(
  59426. $core.method({
  59427. selector: "commands",
  59428. protocol: 'accessing',
  59429. fn: function (){
  59430. var self=this;
  59431. return self["@commands"];
  59432. },
  59433. args: [],
  59434. source: "commands\x0a\x09^ commands",
  59435. referencedClasses: [],
  59436. messageSends: []
  59437. }),
  59438. $globals.Repl);
  59439. $core.addMethod(
  59440. $core.method({
  59441. selector: "createInterface",
  59442. protocol: 'actions',
  59443. fn: function (){
  59444. var self=this;
  59445. return $core.withContext(function($ctx1) {
  59446. self["@interface"]=$recv(self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  59447. $recv(self["@interface"])._on_do_("line",(function(buffer){
  59448. return $core.withContext(function($ctx2) {
  59449. return self._processLine_(buffer);
  59450. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  59451. }));
  59452. $ctx1.sendIdx["on:do:"]=1;
  59453. $recv(self["@interface"])._on_do_("close",(function(){
  59454. return $core.withContext(function($ctx2) {
  59455. return self._close();
  59456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59457. }));
  59458. self._printWelcome();
  59459. self._setupHotkeys();
  59460. self._setPrompt();
  59461. $recv(self["@interface"])._prompt();
  59462. return self;
  59463. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  59464. },
  59465. args: [],
  59466. 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",
  59467. referencedClasses: [],
  59468. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  59469. }),
  59470. $globals.Repl);
  59471. $core.addMethod(
  59472. $core.method({
  59473. selector: "encapsulateVariable:withValue:in:",
  59474. protocol: 'private',
  59475. fn: function (aString,anObject,aClass){
  59476. var self=this;
  59477. var compiler;
  59478. return $core.withContext(function($ctx1) {
  59479. var $1,$4,$3,$2,$5,$6;
  59480. compiler=$recv($globals.Compiler)._new();
  59481. $1=compiler;
  59482. $4=$recv(aString).__comma(": anObject ^ ");
  59483. $ctx1.sendIdx[","]=3;
  59484. $3=$recv($4).__comma(aString);
  59485. $ctx1.sendIdx[","]=2;
  59486. $2=$recv($3).__comma(" := anObject");
  59487. $ctx1.sendIdx[","]=1;
  59488. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  59489. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  59490. $5=compiler;
  59491. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  59492. $ctx1.sendIdx[","]=4;
  59493. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  59494. return self;
  59495. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  59496. },
  59497. args: ["aString", "anObject", "aClass"],
  59498. 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'.",
  59499. referencedClasses: ["Compiler"],
  59500. messageSends: ["new", "install:forClass:protocol:", ","]
  59501. }),
  59502. $globals.Repl);
  59503. $core.addMethod(
  59504. $core.method({
  59505. selector: "eval:",
  59506. protocol: 'actions',
  59507. fn: function (buffer){
  59508. var self=this;
  59509. return $core.withContext(function($ctx1) {
  59510. return self._eval_on_(buffer,$recv($globals.DoIt)._new());
  59511. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  59512. },
  59513. args: ["buffer"],
  59514. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  59515. referencedClasses: ["DoIt"],
  59516. messageSends: ["eval:on:", "new"]
  59517. }),
  59518. $globals.Repl);
  59519. $core.addMethod(
  59520. $core.method({
  59521. selector: "eval:on:",
  59522. protocol: 'actions',
  59523. fn: function (buffer,anObject){
  59524. var self=this;
  59525. var result;
  59526. return $core.withContext(function($ctx1) {
  59527. var $1;
  59528. $recv(buffer)._ifNotEmpty_((function(){
  59529. return $core.withContext(function($ctx2) {
  59530. return $recv((function(){
  59531. return $core.withContext(function($ctx3) {
  59532. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  59533. return result;
  59534. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  59535. }))._tryCatch_((function(e){
  59536. return $core.withContext(function($ctx3) {
  59537. $1=$recv(e)._isSmalltalkError();
  59538. if($core.assert($1)){
  59539. return $recv(e)._resignal();
  59540. } else {
  59541. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  59542. };
  59543. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  59544. }));
  59545. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59546. }));
  59547. return result;
  59548. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  59549. },
  59550. args: ["buffer", "anObject"],
  59551. 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",
  59552. referencedClasses: ["Compiler"],
  59553. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  59554. }),
  59555. $globals.Repl);
  59556. $core.addMethod(
  59557. $core.method({
  59558. selector: "executeCommand:",
  59559. protocol: 'private',
  59560. fn: function (aString){
  59561. var self=this;
  59562. return $core.withContext(function($ctx1) {
  59563. var $1;
  59564. var $early={};
  59565. try {
  59566. $recv(self._commands())._keysAndValuesDo_((function(names,cmd){
  59567. return $core.withContext(function($ctx2) {
  59568. $1=$recv(names)._includes_(aString);
  59569. if($core.assert($1)){
  59570. $recv(cmd)._value();
  59571. throw $early=[true];
  59572. };
  59573. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  59574. }));
  59575. return false;
  59576. }
  59577. catch(e) {if(e===$early)return e[0]; throw e}
  59578. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  59579. },
  59580. args: ["aString"],
  59581. 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",
  59582. referencedClasses: [],
  59583. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  59584. }),
  59585. $globals.Repl);
  59586. $core.addMethod(
  59587. $core.method({
  59588. selector: "initialize",
  59589. protocol: 'initialization',
  59590. fn: function (){
  59591. var self=this;
  59592. return $core.withContext(function($ctx1) {
  59593. (
  59594. $ctx1.supercall = true,
  59595. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  59596. $ctx1.supercall = false;
  59597. self["@session"]=$recv($globals.DoIt)._new();
  59598. self["@readline"]=$recv(require)._value_("readline");
  59599. $ctx1.sendIdx["value:"]=1;
  59600. self["@util"]=$recv(require)._value_("util");
  59601. self._setupCommands();
  59602. return self;
  59603. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  59604. },
  59605. args: [],
  59606. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  59607. referencedClasses: ["DoIt"],
  59608. messageSends: ["initialize", "new", "value:", "setupCommands"]
  59609. }),
  59610. $globals.Repl);
  59611. $core.addMethod(
  59612. $core.method({
  59613. selector: "instanceVariableNamesFor:",
  59614. protocol: 'private',
  59615. fn: function (aClass){
  59616. var self=this;
  59617. return $core.withContext(function($ctx1) {
  59618. var $1,$2,$receiver;
  59619. $1=$recv(aClass)._superclass();
  59620. $ctx1.sendIdx["superclass"]=1;
  59621. if(($receiver = $1) == null || $receiver.isNil){
  59622. return $recv(aClass)._instanceVariableNames();
  59623. } else {
  59624. $2=$recv(aClass)._instanceVariableNames();
  59625. $ctx1.sendIdx["instanceVariableNames"]=1;
  59626. return $recv($2)._copyWithAll_(self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  59627. };
  59628. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  59629. },
  59630. args: ["aClass"],
  59631. 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]",
  59632. referencedClasses: [],
  59633. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  59634. }),
  59635. $globals.Repl);
  59636. $core.addMethod(
  59637. $core.method({
  59638. selector: "isIdentifier:",
  59639. protocol: 'private',
  59640. fn: function (aString){
  59641. var self=this;
  59642. return $core.withContext(function($ctx1) {
  59643. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  59644. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  59645. },
  59646. args: ["aString"],
  59647. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  59648. referencedClasses: [],
  59649. messageSends: ["match:", "asRegexp"]
  59650. }),
  59651. $globals.Repl);
  59652. $core.addMethod(
  59653. $core.method({
  59654. selector: "isVariableDefined:",
  59655. protocol: 'private',
  59656. fn: function (aString){
  59657. var self=this;
  59658. return $core.withContext(function($ctx1) {
  59659. return $recv(self._instanceVariableNamesFor_($recv(self["@session"])._class()))._includes_(aString);
  59660. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  59661. },
  59662. args: ["aString"],
  59663. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  59664. referencedClasses: [],
  59665. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  59666. }),
  59667. $globals.Repl);
  59668. $core.addMethod(
  59669. $core.method({
  59670. selector: "nextResultName",
  59671. protocol: 'private',
  59672. fn: function (){
  59673. var self=this;
  59674. return $core.withContext(function($ctx1) {
  59675. var $1,$receiver;
  59676. $1=self["@resultCount"];
  59677. if(($receiver = $1) == null || $receiver.isNil){
  59678. self["@resultCount"]=(1);
  59679. } else {
  59680. self["@resultCount"]=$recv(self["@resultCount"]).__plus((1));
  59681. };
  59682. return "res".__comma($recv(self["@resultCount"])._asString());
  59683. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  59684. },
  59685. args: [],
  59686. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  59687. referencedClasses: [],
  59688. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  59689. }),
  59690. $globals.Repl);
  59691. $core.addMethod(
  59692. $core.method({
  59693. selector: "onKeyPress:",
  59694. protocol: 'private',
  59695. fn: function (key){
  59696. var self=this;
  59697. return $core.withContext(function($ctx1) {
  59698. var $1;
  59699. $1=$recv($recv(key)._ctrl())._and_((function(){
  59700. return $core.withContext(function($ctx2) {
  59701. return $recv($recv(key)._name()).__eq("l");
  59702. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59703. }));
  59704. if($core.assert($1)){
  59705. self._clearScreen();
  59706. };
  59707. return self;
  59708. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  59709. },
  59710. args: ["key"],
  59711. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  59712. referencedClasses: [],
  59713. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  59714. }),
  59715. $globals.Repl);
  59716. $core.addMethod(
  59717. $core.method({
  59718. selector: "parseAssignment:do:",
  59719. protocol: 'private',
  59720. fn: function (aString,aBlock){
  59721. var self=this;
  59722. var assignment;
  59723. return $core.withContext(function($ctx1) {
  59724. var $2,$1;
  59725. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  59726. return $core.withContext(function($ctx2) {
  59727. return $recv(s)._trimBoth();
  59728. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  59729. }));
  59730. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  59731. return $core.withContext(function($ctx2) {
  59732. $2=$recv(assignment)._first();
  59733. $ctx2.sendIdx["first"]=1;
  59734. return self._isIdentifier_($2);
  59735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59736. }));
  59737. if($core.assert($1)){
  59738. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  59739. $ctx1.sendIdx["value:value:"]=1;
  59740. } else {
  59741. return $recv(aBlock)._value_value_(nil,nil);
  59742. };
  59743. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  59744. },
  59745. args: ["aString", "aBlock"],
  59746. 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 ]",
  59747. referencedClasses: [],
  59748. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  59749. }),
  59750. $globals.Repl);
  59751. $core.addMethod(
  59752. $core.method({
  59753. selector: "presentResultNamed:withValue:",
  59754. protocol: 'private',
  59755. fn: function (varName,value){
  59756. var self=this;
  59757. return $core.withContext(function($ctx1) {
  59758. var $3,$2,$1;
  59759. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  59760. $ctx1.sendIdx[","]=3;
  59761. $2=$recv($3).__comma(" = ");
  59762. $ctx1.sendIdx[","]=2;
  59763. $1=$recv($2).__comma($recv(value)._asString());
  59764. $ctx1.sendIdx[","]=1;
  59765. $recv($globals.Transcript)._show_($1);
  59766. $recv($globals.Transcript)._cr();
  59767. $recv(self["@interface"])._prompt();
  59768. return self;
  59769. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  59770. },
  59771. args: ["varName", "value"],
  59772. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  59773. referencedClasses: ["Transcript"],
  59774. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  59775. }),
  59776. $globals.Repl);
  59777. $core.addMethod(
  59778. $core.method({
  59779. selector: "printWelcome",
  59780. protocol: 'actions',
  59781. fn: function (){
  59782. var self=this;
  59783. return $core.withContext(function($ctx1) {
  59784. $recv($globals.Transcript)._show_("Type :q to exit.");
  59785. $recv($globals.Transcript)._cr();
  59786. return self;
  59787. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  59788. },
  59789. args: [],
  59790. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  59791. referencedClasses: ["Transcript"],
  59792. messageSends: ["show:", "cr"]
  59793. }),
  59794. $globals.Repl);
  59795. $core.addMethod(
  59796. $core.method({
  59797. selector: "processLine:",
  59798. protocol: 'private',
  59799. fn: function (buffer){
  59800. var self=this;
  59801. var show;
  59802. return $core.withContext(function($ctx1) {
  59803. var $1,$2;
  59804. show=(function(varName,value){
  59805. return $core.withContext(function($ctx2) {
  59806. return self._presentResultNamed_withValue_(varName,value);
  59807. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  59808. });
  59809. $1=self._executeCommand_(buffer);
  59810. if(!$core.assert($1)){
  59811. $2=self._isVariableDefined_(buffer);
  59812. if($core.assert($2)){
  59813. $recv(show)._value_value_(buffer,$recv(self["@session"])._perform_(buffer));
  59814. } else {
  59815. self._assignNewVariable_do_(buffer,show);
  59816. };
  59817. };
  59818. return self;
  59819. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  59820. },
  59821. args: ["buffer"],
  59822. 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]]",
  59823. referencedClasses: [],
  59824. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  59825. }),
  59826. $globals.Repl);
  59827. $core.addMethod(
  59828. $core.method({
  59829. selector: "prompt",
  59830. protocol: 'accessing',
  59831. fn: function (){
  59832. var self=this;
  59833. return "amber >> ";
  59834. },
  59835. args: [],
  59836. source: "prompt\x0a\x09^ 'amber >> '",
  59837. referencedClasses: [],
  59838. messageSends: []
  59839. }),
  59840. $globals.Repl);
  59841. $core.addMethod(
  59842. $core.method({
  59843. selector: "setPreviousVariablesFor:from:",
  59844. protocol: 'private',
  59845. fn: function (newObject,oldObject){
  59846. var self=this;
  59847. return $core.withContext(function($ctx1) {
  59848. $recv(self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  59849. return $core.withContext(function($ctx2) {
  59850. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  59851. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59852. }));
  59853. return self;
  59854. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  59855. },
  59856. args: ["newObject", "oldObject"],
  59857. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  59858. referencedClasses: [],
  59859. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  59860. }),
  59861. $globals.Repl);
  59862. $core.addMethod(
  59863. $core.method({
  59864. selector: "setPrompt",
  59865. protocol: 'actions',
  59866. fn: function (){
  59867. var self=this;
  59868. return $core.withContext(function($ctx1) {
  59869. $recv(self["@interface"])._setPrompt_(self._prompt());
  59870. return self;
  59871. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  59872. },
  59873. args: [],
  59874. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  59875. referencedClasses: [],
  59876. messageSends: ["setPrompt:", "prompt"]
  59877. }),
  59878. $globals.Repl);
  59879. $core.addMethod(
  59880. $core.method({
  59881. selector: "setupCommands",
  59882. protocol: 'initialization',
  59883. fn: function (){
  59884. var self=this;
  59885. return $core.withContext(function($ctx1) {
  59886. var $2,$1;
  59887. $2=$recv([":q"]).__minus_gt((function(){
  59888. return $core.withContext(function($ctx2) {
  59889. return $recv(process)._exit();
  59890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59891. }));
  59892. $ctx1.sendIdx["->"]=1;
  59893. $1=[$2,$recv([""]).__minus_gt((function(){
  59894. return $core.withContext(function($ctx2) {
  59895. return $recv(self["@interface"])._prompt();
  59896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59897. }))];
  59898. self["@commands"]=$recv($globals.Dictionary)._from_($1);
  59899. return self;
  59900. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  59901. },
  59902. args: [],
  59903. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  59904. referencedClasses: ["Dictionary"],
  59905. messageSends: ["from:", "->", "exit", "prompt"]
  59906. }),
  59907. $globals.Repl);
  59908. $core.addMethod(
  59909. $core.method({
  59910. selector: "setupHotkeys",
  59911. protocol: 'initialization',
  59912. fn: function (){
  59913. var self=this;
  59914. return $core.withContext(function($ctx1) {
  59915. var $receiver;
  59916. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  59917. return $core.withContext(function($ctx2) {
  59918. if(($receiver = key) == null || $receiver.isNil){
  59919. return key;
  59920. } else {
  59921. return self._onKeyPress_(key);
  59922. };
  59923. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  59924. }));
  59925. return self;
  59926. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  59927. },
  59928. args: [],
  59929. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  59930. referencedClasses: [],
  59931. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  59932. }),
  59933. $globals.Repl);
  59934. $core.addMethod(
  59935. $core.method({
  59936. selector: "subclass:withVariable:",
  59937. protocol: 'private',
  59938. fn: function (aClass,varName){
  59939. var self=this;
  59940. return $core.withContext(function($ctx1) {
  59941. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  59942. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  59943. },
  59944. args: ["aClass", "varName"],
  59945. 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'",
  59946. referencedClasses: ["ClassBuilder"],
  59947. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  59948. }),
  59949. $globals.Repl);
  59950. $core.addMethod(
  59951. $core.method({
  59952. selector: "subclassNameFor:",
  59953. protocol: 'private',
  59954. fn: function (aClass){
  59955. var self=this;
  59956. return $core.withContext(function($ctx1) {
  59957. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  59958. $2=$recv(aClass)._name();
  59959. $ctx1.sendIdx["name"]=1;
  59960. $1=$recv($2)._matchesOf_("\x5cd+$");
  59961. $ctx1.sendIdx["matchesOf:"]=1;
  59962. if(($receiver = $1) == null || $receiver.isNil){
  59963. return $recv($recv(aClass)._name()).__comma("2");
  59964. } else {
  59965. var counter;
  59966. $6=$recv(aClass)._name();
  59967. $ctx1.sendIdx["name"]=2;
  59968. $5=$recv($6)._matchesOf_("\x5cd+$");
  59969. $4=$recv($5)._first();
  59970. $3=$recv($4)._asNumber();
  59971. counter=$recv($3).__plus((1));
  59972. counter;
  59973. $7=$recv(aClass)._name();
  59974. $ctx1.sendIdx["name"]=3;
  59975. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  59976. };
  59977. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  59978. },
  59979. args: ["aClass"],
  59980. 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'].",
  59981. referencedClasses: [],
  59982. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  59983. }),
  59984. $globals.Repl);
  59985. $core.addMethod(
  59986. $core.method({
  59987. selector: "main",
  59988. protocol: 'initialization',
  59989. fn: function (){
  59990. var self=this;
  59991. return $core.withContext(function($ctx1) {
  59992. $recv(self._new())._createInterface();
  59993. return self;
  59994. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.klass)});
  59995. },
  59996. args: [],
  59997. source: "main\x0a\x09self new createInterface",
  59998. referencedClasses: [],
  59999. messageSends: ["createInterface", "new"]
  60000. }),
  60001. $globals.Repl.klass);
  60002. });
  60003. (function () {
  60004. define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) {
  60005. amber.initialize().then(function () {
  60006. amber.globals.AmberCli._main();
  60007. });
  60008. });
  60009. }());
  60010. //jshint eqnull:true
  60011. define('amber/kernel-runtime',[],function () {
  60012. "use strict";
  60013. DNUBrik.deps = ["selectors", "messageSend", "manipulation", "root"];
  60014. function DNUBrik(brikz, st) {
  60015. var selectorsBrik = brikz.selectors;
  60016. var messageNotUnderstood = brikz.messageSend.messageNotUnderstood;
  60017. var installJSMethod = brikz.manipulation.installJSMethod;
  60018. var nilAsClass = brikz.root.nilAsClass;
  60019. /* Method not implemented handlers */
  60020. function makeDnuHandler(pair, targetClasses) {
  60021. var jsSelector = pair.js;
  60022. var fn = createHandler(pair.st);
  60023. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  60024. targetClasses.forEach(function (target) {
  60025. installJSMethod(target.fn.prototype, jsSelector, fn);
  60026. });
  60027. }
  60028. this.makeDnuHandler = makeDnuHandler;
  60029. /* Dnu handler method */
  60030. function createHandler(stSelector) {
  60031. return function () {
  60032. return messageNotUnderstood(this, stSelector, arguments);
  60033. };
  60034. }
  60035. selectorsBrik.selectorPairs.forEach(function (pair) {
  60036. makeDnuHandler(pair, []);
  60037. });
  60038. }
  60039. function ManipulationBrik(brikz, st) {
  60040. function installJSMethod(obj, jsSelector, fn) {
  60041. Object.defineProperty(obj, jsSelector, {
  60042. value: fn,
  60043. enumerable: false, configurable: true, writable: true
  60044. });
  60045. }
  60046. function installMethod(method, klass) {
  60047. installJSMethod(klass.fn.prototype, method.jsSelector, method.fn);
  60048. }
  60049. this.installMethod = installMethod;
  60050. this.installJSMethod = installJSMethod;
  60051. }
  60052. RuntimeClassesBrik.deps = ["selectors", "dnu", "classes", "manipulation"];
  60053. function RuntimeClassesBrik(brikz, st) {
  60054. var selectors = brikz.selectors;
  60055. var classes = brikz.classes.classes;
  60056. var wireKlass = brikz.classes.wireKlass;
  60057. var installMethod = brikz.manipulation.installMethod;
  60058. var installJSMethod = brikz.manipulation.installJSMethod;
  60059. /* Initialize a class in its class hierarchy. Handle both classes and
  60060. metaclasses. */
  60061. var detachedRootClasses = [];
  60062. function markClassDetachedRoot(klass) {
  60063. detachedRootClasses.addElement(klass);
  60064. klass.detachedRoot = true;
  60065. }
  60066. this.detachedRootClasses = function () {
  60067. return detachedRootClasses;
  60068. };
  60069. function initClassAndMetaclass(klass) {
  60070. initClass(klass);
  60071. if (klass.klass && !klass.meta) {
  60072. initClass(klass.klass);
  60073. }
  60074. }
  60075. classes().forEach(initClassAndMetaclass);
  60076. st._classAdded = initClassAndMetaclass;
  60077. function initClass(klass) {
  60078. wireKlass(klass);
  60079. if (klass.detachedRoot) {
  60080. copySuperclass(klass);
  60081. }
  60082. installMethods(klass);
  60083. }
  60084. function copySuperclass(klass) {
  60085. var myproto = klass.fn.prototype,
  60086. superproto = klass.superclass.fn.prototype;
  60087. selectors.selectorPairs.forEach(function (selectorPair) {
  60088. var jsSelector = selectorPair.js;
  60089. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  60090. });
  60091. }
  60092. function installMethods(klass) {
  60093. var methods = klass.methods;
  60094. Object.keys(methods).forEach(function (selector) {
  60095. installMethod(methods[selector], klass);
  60096. });
  60097. }
  60098. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  60099. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  60100. markClassDetachedRoot(klass);
  60101. klass.fn = constructor;
  60102. initClass(klass);
  60103. };
  60104. }
  60105. FrameBindingBrik.deps=["globals", "runtimeClasses"];
  60106. function FrameBindingBrik(brikz, st) {
  60107. var globals = brikz.smalltalkGlobals.globals;
  60108. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  60109. setClassConstructor(globals.Number, Number);
  60110. setClassConstructor(globals.BlockClosure, Function);
  60111. setClassConstructor(globals.Boolean, Boolean);
  60112. setClassConstructor(globals.Date, Date);
  60113. setClassConstructor(globals.String, String);
  60114. setClassConstructor(globals.Array, Array);
  60115. setClassConstructor(globals.RegularExpression, RegExp);
  60116. setClassConstructor(globals.Error, Error);
  60117. setClassConstructor(globals.Promise, Promise);
  60118. }
  60119. RuntimeMethodsBrik.deps = ["manipulation", "dnu", "runtimeClasses"];
  60120. function RuntimeMethodsBrik(brikz, st) {
  60121. var installMethod = brikz.manipulation.installMethod;
  60122. var installJSMethod = brikz.manipulation.installJSMethod;
  60123. var makeDnuHandler = brikz.dnu.makeDnuHandler;
  60124. var detachedRootClasses = brikz.runtimeClasses.detachedRootClasses;
  60125. st._methodAdded = function (method, klass) {
  60126. installMethod(method, klass);
  60127. propagateMethodChange(klass, method, klass);
  60128. };
  60129. st._selectorsAdded = function (newSelectors) {
  60130. var targetClasses = detachedRootClasses();
  60131. newSelectors.forEach(function (pair) {
  60132. makeDnuHandler(pair, targetClasses);
  60133. });
  60134. };
  60135. st._methodRemoved = function (method, klass) {
  60136. delete klass.fn.prototype[method.jsSelector];
  60137. propagateMethodChange(klass, method, null);
  60138. };
  60139. function propagateMethodChange(klass, method, exclude) {
  60140. var selector = method.selector;
  60141. var jsSelector = method.jsSelector;
  60142. st.traverseClassTree(klass, function (subclass) {
  60143. if (subclass != exclude) {
  60144. initMethodInClass(subclass, selector, jsSelector);
  60145. }
  60146. });
  60147. }
  60148. function initMethodInClass(klass, selector, jsSelector) {
  60149. if (klass.detachedRoot && !klass.methods[selector]) {
  60150. installJSMethod(klass.fn.prototype, jsSelector, klass.superclass.fn.prototype[jsSelector]);
  60151. }
  60152. }
  60153. }
  60154. PrimitivesBrik.deps = ["smalltalkGlobals"];
  60155. function PrimitivesBrik(brikz, st) {
  60156. var globals = brikz.smalltalkGlobals.globals;
  60157. var oid = 0;
  60158. /* Unique ID number generator */
  60159. st.nextId = function () {
  60160. oid += 1;
  60161. return oid;
  60162. };
  60163. /* Converts a JavaScript object to valid Smalltalk Object */
  60164. st.readJSObject = function (js) {
  60165. if (js == null)
  60166. return null;
  60167. var readObject = js.constructor === Object;
  60168. var readArray = js.constructor === Array;
  60169. var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
  60170. for (var i in js) {
  60171. if (readObject) {
  60172. object._at_put_(i, st.readJSObject(js[i]));
  60173. }
  60174. if (readArray) {
  60175. object[i] = st.readJSObject(js[i]);
  60176. }
  60177. }
  60178. return object;
  60179. };
  60180. /* Boolean assertion */
  60181. st.assert = function (shouldBeBoolean) {
  60182. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  60183. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  60184. shouldBeBoolean = shouldBeBoolean.valueOf();
  60185. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  60186. }
  60187. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  60188. };
  60189. /* List of all reserved words in JavaScript. They may not be used as variables
  60190. in Smalltalk. */
  60191. // list of reserved JavaScript keywords as of
  60192. // http://es5.github.com/#x7.6.1.1
  60193. // and
  60194. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  60195. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  60196. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  60197. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  60198. 'try', 'typeof', 'var', 'void', 'while', 'with',
  60199. // Amber protected words: these should not be compiled as-is when in code
  60200. 'arguments',
  60201. // ES5: future use: http://es5.github.com/#x7.6.1.2
  60202. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  60203. // ES5: future use in strict mode
  60204. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  60205. 'public', 'static', 'yield'];
  60206. st.globalJsVariables = ['window', 'document', 'process', 'global'];
  60207. }
  60208. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  60209. function RuntimeBrik(brikz, st) {
  60210. var globals = brikz.smalltalkGlobals.globals;
  60211. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  60212. function SmalltalkMethodContext(home, setup) {
  60213. this.sendIdx = {};
  60214. this.homeContext = home;
  60215. this.setup = setup || function () {
  60216. };
  60217. this.supercall = false;
  60218. }
  60219. // Fallbacks
  60220. SmalltalkMethodContext.prototype.locals = {};
  60221. SmalltalkMethodContext.prototype.receiver = null;
  60222. SmalltalkMethodContext.prototype.selector = null;
  60223. SmalltalkMethodContext.prototype.lookupClass = null;
  60224. SmalltalkMethodContext.prototype.fill = function (receiver, selector, locals, lookupClass) {
  60225. this.receiver = receiver;
  60226. this.selector = selector;
  60227. this.locals = locals || {};
  60228. this.lookupClass = lookupClass;
  60229. if (this.homeContext) {
  60230. this.homeContext.evaluatedSelector = selector;
  60231. }
  60232. };
  60233. SmalltalkMethodContext.prototype.fillBlock = function (locals, ctx, index) {
  60234. this.locals = locals || {};
  60235. this.outerContext = ctx;
  60236. this.index = index || 0;
  60237. };
  60238. SmalltalkMethodContext.prototype.init = function () {
  60239. var home = this.homeContext;
  60240. if (home) {
  60241. home.init();
  60242. }
  60243. this.setup(this);
  60244. };
  60245. SmalltalkMethodContext.prototype.method = function () {
  60246. var method;
  60247. var lookup = this.lookupClass || this.receiver.klass;
  60248. while (!method && lookup) {
  60249. method = lookup.methods[st.js2st(this.selector)];
  60250. lookup = lookup.superclass;
  60251. }
  60252. return method;
  60253. };
  60254. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  60255. /* This is the current call context object. While it is publicly available,
  60256. Use smalltalk.getThisContext() instead which will answer a safe copy of
  60257. the current context */
  60258. var thisContext = null;
  60259. st.withContext = function (worker, setup) {
  60260. if (thisContext) {
  60261. return inContext(worker, setup);
  60262. } else {
  60263. return inContextWithErrorHandling(worker, setup);
  60264. }
  60265. };
  60266. /*
  60267. Runs worker function so that error handler is not set up
  60268. if there isn't one. This is accomplished by unconditional
  60269. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  60270. which then stops error handler setup (see st.withContext above).
  60271. The effect is, $core.seamless(fn)'s exceptions are not
  60272. handed into ST error handler and caller should process them.
  60273. */
  60274. st.seamless = function (worker) {
  60275. return inContext(worker, function (ctx) {
  60276. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  60277. });
  60278. };
  60279. function inContextWithErrorHandling(worker, setup) {
  60280. try {
  60281. return inContext(worker, setup);
  60282. } catch (error) {
  60283. handleError(error);
  60284. thisContext = null;
  60285. // Rethrow the error in any case.
  60286. error.amberHandled = true;
  60287. throw error;
  60288. }
  60289. }
  60290. function inContext(worker, setup) {
  60291. var oldContext = thisContext;
  60292. thisContext = new SmalltalkMethodContext(thisContext, setup);
  60293. var result = worker(thisContext);
  60294. thisContext = oldContext;
  60295. return result;
  60296. }
  60297. /* Wrap a JavaScript exception in a Smalltalk Exception.
  60298. In case of a RangeError, stub the stack after 100 contexts to
  60299. avoid another RangeError later when the stack is manipulated. */
  60300. function wrappedError(error) {
  60301. var errorWrapper = globals.JavaScriptException._on_(error);
  60302. // Add the error to the context, so it is visible in the stack
  60303. try {
  60304. errorWrapper._signal();
  60305. } catch (ex) {
  60306. }
  60307. var context = st.getThisContext();
  60308. if (isRangeError(error)) {
  60309. stubContextStack(context);
  60310. }
  60311. errorWrapper._context_(context);
  60312. return errorWrapper;
  60313. }
  60314. /* Stub the context stack after 100 contexts */
  60315. function stubContextStack(context) {
  60316. var currentContext = context;
  60317. var contexts = 0;
  60318. while (contexts < 100) {
  60319. if (currentContext) {
  60320. currentContext = currentContext.homeContext;
  60321. }
  60322. contexts++;
  60323. }
  60324. if (currentContext) {
  60325. currentContext.homeContext = undefined;
  60326. }
  60327. }
  60328. function isRangeError(error) {
  60329. return error instanceof RangeError;
  60330. }
  60331. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  60332. (See the Smalltalk class ErrorHandler and its subclasses */
  60333. function handleError(error) {
  60334. if (!error.smalltalkError) {
  60335. error = wrappedError(error);
  60336. }
  60337. globals.ErrorHandler._handleError_(error);
  60338. }
  60339. /* Handle thisContext pseudo variable */
  60340. st.getThisContext = function () {
  60341. if (thisContext) {
  60342. thisContext.init();
  60343. return thisContext;
  60344. } else {
  60345. return null;
  60346. }
  60347. };
  60348. }
  60349. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  60350. function MessageSendBrik(brikz, st) {
  60351. var globals = brikz.smalltalkGlobals.globals;
  60352. var nilAsReceiver = brikz.root.nilAsReceiver;
  60353. /* Handles unhandled errors during message sends */
  60354. // simply send the message and handle #dnu:
  60355. st.send2 = function (receiver, selector, args, klass) {
  60356. var method, jsSelector = st.st2js(selector);
  60357. if (receiver == null) {
  60358. receiver = nilAsReceiver;
  60359. }
  60360. method = klass ? klass.fn.prototype[jsSelector] : receiver.klass && receiver[jsSelector];
  60361. if (method) {
  60362. return method.apply(receiver, args || []);
  60363. } else {
  60364. return messageNotUnderstood(receiver, selector, args);
  60365. }
  60366. };
  60367. function invokeDnuMethod(receiver, stSelector, args) {
  60368. return receiver._doesNotUnderstand_(
  60369. globals.Message._new()
  60370. ._selector_(stSelector)
  60371. ._arguments_([].slice.call(args))
  60372. );
  60373. }
  60374. /* Handles #dnu: *and* JavaScript method calls.
  60375. if the receiver has no klass, we consider it a JS object (outside of the
  60376. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  60377. function messageNotUnderstood(receiver, stSelector, args) {
  60378. if (receiver.klass != null && !receiver.allowJavaScriptCalls) {
  60379. return invokeDnuMethod(receiver, stSelector, args);
  60380. }
  60381. /* Call a method of a JS object, or answer a property if it exists.
  60382. Else try wrapping a JSObjectProxy around the receiver. */
  60383. var propertyName = st.st2prop(stSelector);
  60384. if (!(propertyName in receiver)) {
  60385. return invokeDnuMethod(globals.JSObjectProxy._on_(receiver), stSelector, args);
  60386. }
  60387. return accessJavaScript(receiver, propertyName, args);
  60388. }
  60389. /* If the object property is a function, then call it, except if it starts with
  60390. an uppercase character (we probably want to answer the function itself in this
  60391. case and send it #new from Amber).
  60392. Converts keyword-based selectors by using the first
  60393. keyword only, but keeping all message arguments.
  60394. Example:
  60395. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  60396. function accessJavaScript(receiver, propertyName, args) {
  60397. var propertyValue = receiver[propertyName];
  60398. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  60399. return propertyValue.apply(receiver, args || []);
  60400. } else if (args.length > 0) {
  60401. receiver[propertyName] = args[0];
  60402. return receiver;
  60403. } else {
  60404. return propertyValue;
  60405. }
  60406. }
  60407. st.accessJavaScript = accessJavaScript;
  60408. this.messageNotUnderstood = messageNotUnderstood;
  60409. }
  60410. /* Making smalltalk that can run */
  60411. function configureWithRuntime(brikz) {
  60412. brikz.dnu = DNUBrik;
  60413. brikz.manipulation = ManipulationBrik;
  60414. brikz.runtimeClasses = RuntimeClassesBrik;
  60415. brikz.frameBinding = FrameBindingBrik;
  60416. brikz.runtimeMethods = RuntimeMethodsBrik;
  60417. brikz.messageSend = MessageSendBrik;
  60418. brikz.runtime = RuntimeBrik;
  60419. brikz.primitives = PrimitivesBrik;
  60420. brikz.rebuild();
  60421. }
  60422. return configureWithRuntime;
  60423. });
  60424. // Depend on each module that is loaded lazily.
  60425. // Add to packager tasks as dependency,
  60426. // so the lazy-loaded modules are included.
  60427. define('amber/lazypack',['./kernel-runtime'], {});
  60428. require(["app"]);
  60429. });
  60430. define.require('__wrap__');
  60431. }((function amdefine(module, requireFn) {
  60432. 'use strict';
  60433. var defineCache = {},
  60434. loaderCache = {},
  60435. alreadyCalled = false,
  60436. path = require('path'),
  60437. makeRequire, stringRequire;
  60438. /**
  60439. * Trims the . and .. from an array of path segments.
  60440. * It will keep a leading path segment if a .. will become
  60441. * the first path segment, to help with module name lookups,
  60442. * which act like paths, but can be remapped. But the end result,
  60443. * all paths that use this function should look normalized.
  60444. * NOTE: this method MODIFIES the input array.
  60445. * @param {Array} ary the array of path segments.
  60446. */
  60447. function trimDots(ary) {
  60448. var i, part;
  60449. for (i = 0; ary[i]; i+= 1) {
  60450. part = ary[i];
  60451. if (part === '.') {
  60452. ary.splice(i, 1);
  60453. i -= 1;
  60454. } else if (part === '..') {
  60455. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  60456. //End of the line. Keep at least one non-dot
  60457. //path segment at the front so it can be mapped
  60458. //correctly to disk. Otherwise, there is likely
  60459. //no path mapping for a path starting with '..'.
  60460. //This can still fail, but catches the most reasonable
  60461. //uses of ..
  60462. break;
  60463. } else if (i > 0) {
  60464. ary.splice(i - 1, 2);
  60465. i -= 2;
  60466. }
  60467. }
  60468. }
  60469. }
  60470. function normalize(name, baseName) {
  60471. var baseParts;
  60472. //Adjust any relative paths.
  60473. if (name && name.charAt(0) === '.') {
  60474. //If have a base name, try to normalize against it,
  60475. //otherwise, assume it is a top-level require that will
  60476. //be relative to baseUrl in the end.
  60477. if (baseName) {
  60478. baseParts = baseName.split('/');
  60479. baseParts = baseParts.slice(0, baseParts.length - 1);
  60480. baseParts = baseParts.concat(name.split('/'));
  60481. trimDots(baseParts);
  60482. name = baseParts.join('/');
  60483. }
  60484. }
  60485. return name;
  60486. }
  60487. /**
  60488. * Create the normalize() function passed to a loader plugin's
  60489. * normalize method.
  60490. */
  60491. function makeNormalize(relName) {
  60492. return function (name) {
  60493. return normalize(name, relName);
  60494. };
  60495. }
  60496. function makeLoad(id) {
  60497. function load(value) {
  60498. loaderCache[id] = value;
  60499. }
  60500. load.fromText = function (id, text) {
  60501. //This one is difficult because the text can/probably uses
  60502. //define, and any relative paths and requires should be relative
  60503. //to that id was it would be found on disk. But this would require
  60504. //bootstrapping a module/require fairly deeply from node core.
  60505. //Not sure how best to go about that yet.
  60506. throw new Error('amdefine does not implement load.fromText');
  60507. };
  60508. return load;
  60509. }
  60510. makeRequire = function (systemRequire, exports, module, relId) {
  60511. function amdRequire(deps, callback) {
  60512. if (typeof deps === 'string') {
  60513. //Synchronous, single module require('')
  60514. return stringRequire(systemRequire, exports, module, deps, relId);
  60515. } else {
  60516. //Array of dependencies with a callback.
  60517. //Convert the dependencies to modules.
  60518. deps = deps.map(function (depName) {
  60519. return stringRequire(systemRequire, exports, module, depName, relId);
  60520. });
  60521. //Wait for next tick to call back the require call.
  60522. if (callback) {
  60523. process.nextTick(function () {
  60524. callback.apply(null, deps);
  60525. });
  60526. }
  60527. }
  60528. }
  60529. amdRequire.toUrl = function (filePath) {
  60530. if (filePath.indexOf('.') === 0) {
  60531. return normalize(filePath, path.dirname(module.filename));
  60532. } else {
  60533. return filePath;
  60534. }
  60535. };
  60536. return amdRequire;
  60537. };
  60538. //Favor explicit value, passed in if the module wants to support Node 0.4.
  60539. requireFn = requireFn || function req() {
  60540. return module.require.apply(module, arguments);
  60541. };
  60542. function runFactory(id, deps, factory) {
  60543. var r, e, m, result;
  60544. if (id) {
  60545. e = loaderCache[id] = {};
  60546. m = {
  60547. id: id,
  60548. uri: __filename,
  60549. exports: e
  60550. };
  60551. r = makeRequire(requireFn, e, m, id);
  60552. } else {
  60553. //Only support one define call per file
  60554. if (alreadyCalled) {
  60555. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  60556. }
  60557. alreadyCalled = true;
  60558. //Use the real variables from node
  60559. //Use module.exports for exports, since
  60560. //the exports in here is amdefine exports.
  60561. e = module.exports;
  60562. m = module;
  60563. r = makeRequire(requireFn, e, m, module.id);
  60564. }
  60565. //If there are dependencies, they are strings, so need
  60566. //to convert them to dependency values.
  60567. if (deps) {
  60568. deps = deps.map(function (depName) {
  60569. return r(depName);
  60570. });
  60571. }
  60572. //Call the factory with the right dependencies.
  60573. if (typeof factory === 'function') {
  60574. result = factory.apply(m.exports, deps);
  60575. } else {
  60576. result = factory;
  60577. }
  60578. if (result !== undefined) {
  60579. m.exports = result;
  60580. if (id) {
  60581. loaderCache[id] = m.exports;
  60582. }
  60583. }
  60584. }
  60585. stringRequire = function (systemRequire, exports, module, id, relId) {
  60586. //Split the ID by a ! so that
  60587. var index = id.indexOf('!'),
  60588. originalId = id,
  60589. prefix, plugin;
  60590. if (index === -1) {
  60591. id = normalize(id, relId);
  60592. //Straight module lookup. If it is one of the special dependencies,
  60593. //deal with it, otherwise, delegate to node.
  60594. if (id === 'require') {
  60595. return makeRequire(systemRequire, exports, module, relId);
  60596. } else if (id === 'exports') {
  60597. return exports;
  60598. } else if (id === 'module') {
  60599. return module;
  60600. } else if (loaderCache.hasOwnProperty(id)) {
  60601. return loaderCache[id];
  60602. } else if (defineCache[id]) {
  60603. runFactory.apply(null, defineCache[id]);
  60604. return loaderCache[id];
  60605. } else {
  60606. if(systemRequire) {
  60607. return systemRequire(originalId);
  60608. } else {
  60609. throw new Error('No module with ID: ' + id);
  60610. }
  60611. }
  60612. } else {
  60613. //There is a plugin in play.
  60614. prefix = id.substring(0, index);
  60615. id = id.substring(index + 1, id.length);
  60616. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  60617. if (plugin.normalize) {
  60618. id = plugin.normalize(id, makeNormalize(relId));
  60619. } else {
  60620. //Normalize the ID normally.
  60621. id = normalize(id, relId);
  60622. }
  60623. if (loaderCache[id]) {
  60624. return loaderCache[id];
  60625. } else {
  60626. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  60627. return loaderCache[id];
  60628. }
  60629. }
  60630. };
  60631. //Create a define function specific to the module asking for amdefine.
  60632. function define(id, deps, factory) {
  60633. if (Array.isArray(id)) {
  60634. factory = deps;
  60635. deps = id;
  60636. id = undefined;
  60637. } else if (typeof id !== 'string') {
  60638. factory = id;
  60639. id = deps = undefined;
  60640. }
  60641. if (deps && !Array.isArray(deps)) {
  60642. factory = deps;
  60643. deps = undefined;
  60644. }
  60645. if (!deps) {
  60646. deps = ['require', 'exports', 'module'];
  60647. }
  60648. //Set up properties for this module. If an ID, then use
  60649. //internal cache. If no ID, then use the external variables
  60650. //for this node module.
  60651. if (id) {
  60652. //Put the module in deep freeze until there is a
  60653. //require call for it.
  60654. defineCache[id] = [id, deps, factory];
  60655. } else {
  60656. runFactory(id, deps, factory);
  60657. }
  60658. }
  60659. //define.require, which has access to all the values in the
  60660. //cache. Useful for AMD modules that all have IDs in the file,
  60661. //but need to finally export a value to node based on one of those
  60662. //IDs.
  60663. define.require = function (id) {
  60664. if (loaderCache[id]) {
  60665. return loaderCache[id];
  60666. }
  60667. if (defineCache[id]) {
  60668. runFactory.apply(null, defineCache[id]);
  60669. return loaderCache[id];
  60670. }
  60671. };
  60672. define.amd = {};
  60673. return define;
  60674. }(module)), require));