amber-cli.js 2.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636
  1. #!/usr/bin/env node
  2. (function(define, require){
  3. define('__wrap__', function (requirejs) {
  4. requirejs.resolve = require.resolve;
  5. require = requirejs;
  6. // This file is used to make additional changes
  7. // when building an app to run in node.js.
  8. // Free to edit. You can break tests (cli test runner uses
  9. // this to build itself - it is a node executable).
  10. define("amber/Platform", ["amber_core/Platform-Node"], {});
  11. define("amber/compatibility", ["amber/node-compatibility"], {});
  12. define("jquery", {});
  13. define("config-node", function(){});
  14. /*!
  15. * @overview es6-promise - a tiny implementation of Promises/A+.
  16. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  17. * @license Licensed under MIT license
  18. * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
  19. * @version 3.0.2
  20. */
  21. (function() {
  22. "use strict";
  23. function lib$es6$promise$utils$$objectOrFunction(x) {
  24. return typeof x === 'function' || (typeof x === 'object' && x !== null);
  25. }
  26. function lib$es6$promise$utils$$isFunction(x) {
  27. return typeof x === 'function';
  28. }
  29. function lib$es6$promise$utils$$isMaybeThenable(x) {
  30. return typeof x === 'object' && x !== null;
  31. }
  32. var lib$es6$promise$utils$$_isArray;
  33. if (!Array.isArray) {
  34. lib$es6$promise$utils$$_isArray = function (x) {
  35. return Object.prototype.toString.call(x) === '[object Array]';
  36. };
  37. } else {
  38. lib$es6$promise$utils$$_isArray = Array.isArray;
  39. }
  40. var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray;
  41. var lib$es6$promise$asap$$len = 0;
  42. var lib$es6$promise$asap$$toString = {}.toString;
  43. var lib$es6$promise$asap$$vertxNext;
  44. var lib$es6$promise$asap$$customSchedulerFn;
  45. var lib$es6$promise$asap$$asap = function asap(callback, arg) {
  46. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback;
  47. lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg;
  48. lib$es6$promise$asap$$len += 2;
  49. if (lib$es6$promise$asap$$len === 2) {
  50. // If len is 2, that means that we need to schedule an async flush.
  51. // If additional callbacks are queued before the queue is flushed, they
  52. // will be processed by this flush that we are scheduling.
  53. if (lib$es6$promise$asap$$customSchedulerFn) {
  54. lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush);
  55. } else {
  56. lib$es6$promise$asap$$scheduleFlush();
  57. }
  58. }
  59. }
  60. function lib$es6$promise$asap$$setScheduler(scheduleFn) {
  61. lib$es6$promise$asap$$customSchedulerFn = scheduleFn;
  62. }
  63. function lib$es6$promise$asap$$setAsap(asapFn) {
  64. lib$es6$promise$asap$$asap = asapFn;
  65. }
  66. var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;
  67. var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {};
  68. var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;
  69. var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
  70. // test for web worker but not in IE10
  71. var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&
  72. typeof importScripts !== 'undefined' &&
  73. typeof MessageChannel !== 'undefined';
  74. // node
  75. function lib$es6$promise$asap$$useNextTick() {
  76. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  77. // see https://github.com/cujojs/when/issues/410 for details
  78. return function() {
  79. process.nextTick(lib$es6$promise$asap$$flush);
  80. };
  81. }
  82. // vertx
  83. function lib$es6$promise$asap$$useVertxTimer() {
  84. return function() {
  85. lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush);
  86. };
  87. }
  88. function lib$es6$promise$asap$$useMutationObserver() {
  89. var iterations = 0;
  90. var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);
  91. var node = document.createTextNode('');
  92. observer.observe(node, { characterData: true });
  93. return function() {
  94. node.data = (iterations = ++iterations % 2);
  95. };
  96. }
  97. // web worker
  98. function lib$es6$promise$asap$$useMessageChannel() {
  99. var channel = new MessageChannel();
  100. channel.port1.onmessage = lib$es6$promise$asap$$flush;
  101. return function () {
  102. channel.port2.postMessage(0);
  103. };
  104. }
  105. function lib$es6$promise$asap$$useSetTimeout() {
  106. return function() {
  107. setTimeout(lib$es6$promise$asap$$flush, 1);
  108. };
  109. }
  110. var lib$es6$promise$asap$$queue = new Array(1000);
  111. function lib$es6$promise$asap$$flush() {
  112. for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) {
  113. var callback = lib$es6$promise$asap$$queue[i];
  114. var arg = lib$es6$promise$asap$$queue[i+1];
  115. callback(arg);
  116. lib$es6$promise$asap$$queue[i] = undefined;
  117. lib$es6$promise$asap$$queue[i+1] = undefined;
  118. }
  119. lib$es6$promise$asap$$len = 0;
  120. }
  121. function lib$es6$promise$asap$$attemptVertx() {
  122. try {
  123. var r = require;
  124. var vertx = r('vertx');
  125. lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext;
  126. return lib$es6$promise$asap$$useVertxTimer();
  127. } catch(e) {
  128. return lib$es6$promise$asap$$useSetTimeout();
  129. }
  130. }
  131. var lib$es6$promise$asap$$scheduleFlush;
  132. // Decide what async method to use to triggering processing of queued callbacks:
  133. if (lib$es6$promise$asap$$isNode) {
  134. lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick();
  135. } else if (lib$es6$promise$asap$$BrowserMutationObserver) {
  136. lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver();
  137. } else if (lib$es6$promise$asap$$isWorker) {
  138. lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel();
  139. } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') {
  140. lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertx();
  141. } else {
  142. lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout();
  143. }
  144. function lib$es6$promise$$internal$$noop() {}
  145. var lib$es6$promise$$internal$$PENDING = void 0;
  146. var lib$es6$promise$$internal$$FULFILLED = 1;
  147. var lib$es6$promise$$internal$$REJECTED = 2;
  148. var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject();
  149. function lib$es6$promise$$internal$$selfFulfillment() {
  150. return new TypeError("You cannot resolve a promise with itself");
  151. }
  152. function lib$es6$promise$$internal$$cannotReturnOwn() {
  153. return new TypeError('A promises callback cannot return that same promise.');
  154. }
  155. function lib$es6$promise$$internal$$getThen(promise) {
  156. try {
  157. return promise.then;
  158. } catch(error) {
  159. lib$es6$promise$$internal$$GET_THEN_ERROR.error = error;
  160. return lib$es6$promise$$internal$$GET_THEN_ERROR;
  161. }
  162. }
  163. function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  164. try {
  165. then.call(value, fulfillmentHandler, rejectionHandler);
  166. } catch(e) {
  167. return e;
  168. }
  169. }
  170. function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) {
  171. lib$es6$promise$asap$$asap(function(promise) {
  172. var sealed = false;
  173. var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) {
  174. if (sealed) { return; }
  175. sealed = true;
  176. if (thenable !== value) {
  177. lib$es6$promise$$internal$$resolve(promise, value);
  178. } else {
  179. lib$es6$promise$$internal$$fulfill(promise, value);
  180. }
  181. }, function(reason) {
  182. if (sealed) { return; }
  183. sealed = true;
  184. lib$es6$promise$$internal$$reject(promise, reason);
  185. }, 'Settle: ' + (promise._label || ' unknown promise'));
  186. if (!sealed && error) {
  187. sealed = true;
  188. lib$es6$promise$$internal$$reject(promise, error);
  189. }
  190. }, promise);
  191. }
  192. function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) {
  193. if (thenable._state === lib$es6$promise$$internal$$FULFILLED) {
  194. lib$es6$promise$$internal$$fulfill(promise, thenable._result);
  195. } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) {
  196. lib$es6$promise$$internal$$reject(promise, thenable._result);
  197. } else {
  198. lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) {
  199. lib$es6$promise$$internal$$resolve(promise, value);
  200. }, function(reason) {
  201. lib$es6$promise$$internal$$reject(promise, reason);
  202. });
  203. }
  204. }
  205. function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) {
  206. if (maybeThenable.constructor === promise.constructor) {
  207. lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable);
  208. } else {
  209. var then = lib$es6$promise$$internal$$getThen(maybeThenable);
  210. if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) {
  211. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error);
  212. } else if (then === undefined) {
  213. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  214. } else if (lib$es6$promise$utils$$isFunction(then)) {
  215. lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then);
  216. } else {
  217. lib$es6$promise$$internal$$fulfill(promise, maybeThenable);
  218. }
  219. }
  220. }
  221. function lib$es6$promise$$internal$$resolve(promise, value) {
  222. if (promise === value) {
  223. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFulfillment());
  224. } else if (lib$es6$promise$utils$$objectOrFunction(value)) {
  225. lib$es6$promise$$internal$$handleMaybeThenable(promise, value);
  226. } else {
  227. lib$es6$promise$$internal$$fulfill(promise, value);
  228. }
  229. }
  230. function lib$es6$promise$$internal$$publishRejection(promise) {
  231. if (promise._onerror) {
  232. promise._onerror(promise._result);
  233. }
  234. lib$es6$promise$$internal$$publish(promise);
  235. }
  236. function lib$es6$promise$$internal$$fulfill(promise, value) {
  237. if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
  238. promise._result = value;
  239. promise._state = lib$es6$promise$$internal$$FULFILLED;
  240. if (promise._subscribers.length !== 0) {
  241. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise);
  242. }
  243. }
  244. function lib$es6$promise$$internal$$reject(promise, reason) {
  245. if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; }
  246. promise._state = lib$es6$promise$$internal$$REJECTED;
  247. promise._result = reason;
  248. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise);
  249. }
  250. function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
  251. var subscribers = parent._subscribers;
  252. var length = subscribers.length;
  253. parent._onerror = null;
  254. subscribers[length] = child;
  255. subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment;
  256. subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection;
  257. if (length === 0 && parent._state) {
  258. lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent);
  259. }
  260. }
  261. function lib$es6$promise$$internal$$publish(promise) {
  262. var subscribers = promise._subscribers;
  263. var settled = promise._state;
  264. if (subscribers.length === 0) { return; }
  265. var child, callback, detail = promise._result;
  266. for (var i = 0; i < subscribers.length; i += 3) {
  267. child = subscribers[i];
  268. callback = subscribers[i + settled];
  269. if (child) {
  270. lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail);
  271. } else {
  272. callback(detail);
  273. }
  274. }
  275. promise._subscribers.length = 0;
  276. }
  277. function lib$es6$promise$$internal$$ErrorObject() {
  278. this.error = null;
  279. }
  280. var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject();
  281. function lib$es6$promise$$internal$$tryCatch(callback, detail) {
  282. try {
  283. return callback(detail);
  284. } catch(e) {
  285. lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e;
  286. return lib$es6$promise$$internal$$TRY_CATCH_ERROR;
  287. }
  288. }
  289. function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) {
  290. var hasCallback = lib$es6$promise$utils$$isFunction(callback),
  291. value, error, succeeded, failed;
  292. if (hasCallback) {
  293. value = lib$es6$promise$$internal$$tryCatch(callback, detail);
  294. if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) {
  295. failed = true;
  296. error = value.error;
  297. value = null;
  298. } else {
  299. succeeded = true;
  300. }
  301. if (promise === value) {
  302. lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn());
  303. return;
  304. }
  305. } else {
  306. value = detail;
  307. succeeded = true;
  308. }
  309. if (promise._state !== lib$es6$promise$$internal$$PENDING) {
  310. // noop
  311. } else if (hasCallback && succeeded) {
  312. lib$es6$promise$$internal$$resolve(promise, value);
  313. } else if (failed) {
  314. lib$es6$promise$$internal$$reject(promise, error);
  315. } else if (settled === lib$es6$promise$$internal$$FULFILLED) {
  316. lib$es6$promise$$internal$$fulfill(promise, value);
  317. } else if (settled === lib$es6$promise$$internal$$REJECTED) {
  318. lib$es6$promise$$internal$$reject(promise, value);
  319. }
  320. }
  321. function lib$es6$promise$$internal$$initializePromise(promise, resolver) {
  322. try {
  323. resolver(function resolvePromise(value){
  324. lib$es6$promise$$internal$$resolve(promise, value);
  325. }, function rejectPromise(reason) {
  326. lib$es6$promise$$internal$$reject(promise, reason);
  327. });
  328. } catch(e) {
  329. lib$es6$promise$$internal$$reject(promise, e);
  330. }
  331. }
  332. function lib$es6$promise$enumerator$$Enumerator(Constructor, input) {
  333. var enumerator = this;
  334. enumerator._instanceConstructor = Constructor;
  335. enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop);
  336. if (enumerator._validateInput(input)) {
  337. enumerator._input = input;
  338. enumerator.length = input.length;
  339. enumerator._remaining = input.length;
  340. enumerator._init();
  341. if (enumerator.length === 0) {
  342. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  343. } else {
  344. enumerator.length = enumerator.length || 0;
  345. enumerator._enumerate();
  346. if (enumerator._remaining === 0) {
  347. lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result);
  348. }
  349. }
  350. } else {
  351. lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError());
  352. }
  353. }
  354. lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) {
  355. return lib$es6$promise$utils$$isArray(input);
  356. };
  357. lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() {
  358. return new Error('Array Methods must be provided an Array');
  359. };
  360. lib$es6$promise$enumerator$$Enumerator.prototype._init = function() {
  361. this._result = new Array(this.length);
  362. };
  363. var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator;
  364. lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() {
  365. var enumerator = this;
  366. var length = enumerator.length;
  367. var promise = enumerator.promise;
  368. var input = enumerator._input;
  369. for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
  370. enumerator._eachEntry(input[i], i);
  371. }
  372. };
  373. lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {
  374. var enumerator = this;
  375. var c = enumerator._instanceConstructor;
  376. if (lib$es6$promise$utils$$isMaybeThenable(entry)) {
  377. if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) {
  378. entry._onerror = null;
  379. enumerator._settledAt(entry._state, i, entry._result);
  380. } else {
  381. enumerator._willSettleAt(c.resolve(entry), i);
  382. }
  383. } else {
  384. enumerator._remaining--;
  385. enumerator._result[i] = entry;
  386. }
  387. };
  388. lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {
  389. var enumerator = this;
  390. var promise = enumerator.promise;
  391. if (promise._state === lib$es6$promise$$internal$$PENDING) {
  392. enumerator._remaining--;
  393. if (state === lib$es6$promise$$internal$$REJECTED) {
  394. lib$es6$promise$$internal$$reject(promise, value);
  395. } else {
  396. enumerator._result[i] = value;
  397. }
  398. }
  399. if (enumerator._remaining === 0) {
  400. lib$es6$promise$$internal$$fulfill(promise, enumerator._result);
  401. }
  402. };
  403. lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {
  404. var enumerator = this;
  405. lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) {
  406. enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value);
  407. }, function(reason) {
  408. enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason);
  409. });
  410. };
  411. function lib$es6$promise$promise$all$$all(entries) {
  412. return new lib$es6$promise$enumerator$$default(this, entries).promise;
  413. }
  414. var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all;
  415. function lib$es6$promise$promise$race$$race(entries) {
  416. /*jshint validthis:true */
  417. var Constructor = this;
  418. var promise = new Constructor(lib$es6$promise$$internal$$noop);
  419. if (!lib$es6$promise$utils$$isArray(entries)) {
  420. lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
  421. return promise;
  422. }
  423. var length = entries.length;
  424. function onFulfillment(value) {
  425. lib$es6$promise$$internal$$resolve(promise, value);
  426. }
  427. function onRejection(reason) {
  428. lib$es6$promise$$internal$$reject(promise, reason);
  429. }
  430. for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) {
  431. lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
  432. }
  433. return promise;
  434. }
  435. var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race;
  436. function lib$es6$promise$promise$resolve$$resolve(object) {
  437. /*jshint validthis:true */
  438. var Constructor = this;
  439. if (object && typeof object === 'object' && object.constructor === Constructor) {
  440. return object;
  441. }
  442. var promise = new Constructor(lib$es6$promise$$internal$$noop);
  443. lib$es6$promise$$internal$$resolve(promise, object);
  444. return promise;
  445. }
  446. var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve;
  447. function lib$es6$promise$promise$reject$$reject(reason) {
  448. /*jshint validthis:true */
  449. var Constructor = this;
  450. var promise = new Constructor(lib$es6$promise$$internal$$noop);
  451. lib$es6$promise$$internal$$reject(promise, reason);
  452. return promise;
  453. }
  454. var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject;
  455. var lib$es6$promise$promise$$counter = 0;
  456. function lib$es6$promise$promise$$needsResolver() {
  457. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  458. }
  459. function lib$es6$promise$promise$$needsNew() {
  460. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  461. }
  462. var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise;
  463. /**
  464. Promise objects represent the eventual result of an asynchronous operation. The
  465. primary way of interacting with a promise is through its `then` method, which
  466. registers callbacks to receive either a promise's eventual value or the reason
  467. why the promise cannot be fulfilled.
  468. Terminology
  469. -----------
  470. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  471. - `thenable` is an object or function that defines a `then` method.
  472. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  473. - `exception` is a value that is thrown using the throw statement.
  474. - `reason` is a value that indicates why a promise was rejected.
  475. - `settled` the final resting state of a promise, fulfilled or rejected.
  476. A promise can be in one of three states: pending, fulfilled, or rejected.
  477. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  478. state. Promises that are rejected have a rejection reason and are in the
  479. rejected state. A fulfillment value is never a thenable.
  480. Promises can also be said to *resolve* a value. If this value is also a
  481. promise, then the original promise's settled state will match the value's
  482. settled state. So a promise that *resolves* a promise that rejects will
  483. itself reject, and a promise that *resolves* a promise that fulfills will
  484. itself fulfill.
  485. Basic Usage:
  486. ------------
  487. ```js
  488. var promise = new Promise(function(resolve, reject) {
  489. // on success
  490. resolve(value);
  491. // on failure
  492. reject(reason);
  493. });
  494. promise.then(function(value) {
  495. // on fulfillment
  496. }, function(reason) {
  497. // on rejection
  498. });
  499. ```
  500. Advanced Usage:
  501. ---------------
  502. Promises shine when abstracting away asynchronous interactions such as
  503. `XMLHttpRequest`s.
  504. ```js
  505. function getJSON(url) {
  506. return new Promise(function(resolve, reject){
  507. var xhr = new XMLHttpRequest();
  508. xhr.open('GET', url);
  509. xhr.onreadystatechange = handler;
  510. xhr.responseType = 'json';
  511. xhr.setRequestHeader('Accept', 'application/json');
  512. xhr.send();
  513. function handler() {
  514. if (this.readyState === this.DONE) {
  515. if (this.status === 200) {
  516. resolve(this.response);
  517. } else {
  518. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  519. }
  520. }
  521. };
  522. });
  523. }
  524. getJSON('/posts.json').then(function(json) {
  525. // on fulfillment
  526. }, function(reason) {
  527. // on rejection
  528. });
  529. ```
  530. Unlike callbacks, promises are great composable primitives.
  531. ```js
  532. Promise.all([
  533. getJSON('/posts'),
  534. getJSON('/comments')
  535. ]).then(function(values){
  536. values[0] // => postsJSON
  537. values[1] // => commentsJSON
  538. return values;
  539. });
  540. ```
  541. @class Promise
  542. @param {function} resolver
  543. Useful for tooling.
  544. @constructor
  545. */
  546. function lib$es6$promise$promise$$Promise(resolver) {
  547. this._id = lib$es6$promise$promise$$counter++;
  548. this._state = undefined;
  549. this._result = undefined;
  550. this._subscribers = [];
  551. if (lib$es6$promise$$internal$$noop !== resolver) {
  552. if (!lib$es6$promise$utils$$isFunction(resolver)) {
  553. lib$es6$promise$promise$$needsResolver();
  554. }
  555. if (!(this instanceof lib$es6$promise$promise$$Promise)) {
  556. lib$es6$promise$promise$$needsNew();
  557. }
  558. lib$es6$promise$$internal$$initializePromise(this, resolver);
  559. }
  560. }
  561. lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default;
  562. lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default;
  563. lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default;
  564. lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default;
  565. lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler;
  566. lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap;
  567. lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap;
  568. lib$es6$promise$promise$$Promise.prototype = {
  569. constructor: lib$es6$promise$promise$$Promise,
  570. /**
  571. The primary way of interacting with a promise is through its `then` method,
  572. which registers callbacks to receive either a promise's eventual value or the
  573. reason why the promise cannot be fulfilled.
  574. ```js
  575. findUser().then(function(user){
  576. // user is available
  577. }, function(reason){
  578. // user is unavailable, and you are given the reason why
  579. });
  580. ```
  581. Chaining
  582. --------
  583. The return value of `then` is itself a promise. This second, 'downstream'
  584. promise is resolved with the return value of the first promise's fulfillment
  585. or rejection handler, or rejected if the handler throws an exception.
  586. ```js
  587. findUser().then(function (user) {
  588. return user.name;
  589. }, function (reason) {
  590. return 'default name';
  591. }).then(function (userName) {
  592. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  593. // will be `'default name'`
  594. });
  595. findUser().then(function (user) {
  596. throw new Error('Found user, but still unhappy');
  597. }, function (reason) {
  598. throw new Error('`findUser` rejected and we're unhappy');
  599. }).then(function (value) {
  600. // never reached
  601. }, function (reason) {
  602. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  603. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  604. });
  605. ```
  606. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  607. ```js
  608. findUser().then(function (user) {
  609. throw new PedagogicalException('Upstream error');
  610. }).then(function (value) {
  611. // never reached
  612. }).then(function (value) {
  613. // never reached
  614. }, function (reason) {
  615. // The `PedgagocialException` is propagated all the way down to here
  616. });
  617. ```
  618. Assimilation
  619. ------------
  620. Sometimes the value you want to propagate to a downstream promise can only be
  621. retrieved asynchronously. This can be achieved by returning a promise in the
  622. fulfillment or rejection handler. The downstream promise will then be pending
  623. until the returned promise is settled. This is called *assimilation*.
  624. ```js
  625. findUser().then(function (user) {
  626. return findCommentsByAuthor(user);
  627. }).then(function (comments) {
  628. // The user's comments are now available
  629. });
  630. ```
  631. If the assimliated promise rejects, then the downstream promise will also reject.
  632. ```js
  633. findUser().then(function (user) {
  634. return findCommentsByAuthor(user);
  635. }).then(function (comments) {
  636. // If `findCommentsByAuthor` fulfills, we'll have the value here
  637. }, function (reason) {
  638. // If `findCommentsByAuthor` rejects, we'll have the reason here
  639. });
  640. ```
  641. Simple Example
  642. --------------
  643. Synchronous Example
  644. ```javascript
  645. var result;
  646. try {
  647. result = findResult();
  648. // success
  649. } catch(reason) {
  650. // failure
  651. }
  652. ```
  653. Errback Example
  654. ```js
  655. findResult(function(result, err){
  656. if (err) {
  657. // failure
  658. } else {
  659. // success
  660. }
  661. });
  662. ```
  663. Promise Example;
  664. ```javascript
  665. findResult().then(function(result){
  666. // success
  667. }, function(reason){
  668. // failure
  669. });
  670. ```
  671. Advanced Example
  672. --------------
  673. Synchronous Example
  674. ```javascript
  675. var author, books;
  676. try {
  677. author = findAuthor();
  678. books = findBooksByAuthor(author);
  679. // success
  680. } catch(reason) {
  681. // failure
  682. }
  683. ```
  684. Errback Example
  685. ```js
  686. function foundBooks(books) {
  687. }
  688. function failure(reason) {
  689. }
  690. findAuthor(function(author, err){
  691. if (err) {
  692. failure(err);
  693. // failure
  694. } else {
  695. try {
  696. findBoooksByAuthor(author, function(books, err) {
  697. if (err) {
  698. failure(err);
  699. } else {
  700. try {
  701. foundBooks(books);
  702. } catch(reason) {
  703. failure(reason);
  704. }
  705. }
  706. });
  707. } catch(error) {
  708. failure(err);
  709. }
  710. // success
  711. }
  712. });
  713. ```
  714. Promise Example;
  715. ```javascript
  716. findAuthor().
  717. then(findBooksByAuthor).
  718. then(function(books){
  719. // found books
  720. }).catch(function(reason){
  721. // something went wrong
  722. });
  723. ```
  724. @method then
  725. @param {Function} onFulfilled
  726. @param {Function} onRejected
  727. Useful for tooling.
  728. @return {Promise}
  729. */
  730. then: function(onFulfillment, onRejection) {
  731. var parent = this;
  732. var state = parent._state;
  733. if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) {
  734. return this;
  735. }
  736. var child = new this.constructor(lib$es6$promise$$internal$$noop);
  737. var result = parent._result;
  738. if (state) {
  739. var callback = arguments[state - 1];
  740. lib$es6$promise$asap$$asap(function(){
  741. lib$es6$promise$$internal$$invokeCallback(state, child, callback, result);
  742. });
  743. } else {
  744. lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection);
  745. }
  746. return child;
  747. },
  748. /**
  749. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  750. as the catch block of a try/catch statement.
  751. ```js
  752. function findAuthor(){
  753. throw new Error('couldn't find that author');
  754. }
  755. // synchronous
  756. try {
  757. findAuthor();
  758. } catch(reason) {
  759. // something went wrong
  760. }
  761. // async with promises
  762. findAuthor().catch(function(reason){
  763. // something went wrong
  764. });
  765. ```
  766. @method catch
  767. @param {Function} onRejection
  768. Useful for tooling.
  769. @return {Promise}
  770. */
  771. 'catch': function(onRejection) {
  772. return this.then(null, onRejection);
  773. }
  774. };
  775. function lib$es6$promise$polyfill$$polyfill() {
  776. var local;
  777. if (typeof global !== 'undefined') {
  778. local = global;
  779. } else if (typeof self !== 'undefined') {
  780. local = self;
  781. } else {
  782. try {
  783. local = Function('return this')();
  784. } catch (e) {
  785. throw new Error('polyfill failed because global object is unavailable in this environment');
  786. }
  787. }
  788. var P = local.Promise;
  789. if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) {
  790. return;
  791. }
  792. local.Promise = lib$es6$promise$promise$$default;
  793. }
  794. var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill;
  795. var lib$es6$promise$umd$$ES6Promise = {
  796. 'Promise': lib$es6$promise$promise$$default,
  797. 'polyfill': lib$es6$promise$polyfill$$default
  798. };
  799. /* global define:true module:true window: true */
  800. if (typeof define === 'function' && define['amd']) {
  801. define('amber/es6-promise',[],function() { return lib$es6$promise$umd$$ES6Promise; });
  802. } else if (typeof module !== 'undefined' && module['exports']) {
  803. module['exports'] = lib$es6$promise$umd$$ES6Promise;
  804. } else if (typeof this !== 'undefined') {
  805. this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise;
  806. }
  807. lib$es6$promise$polyfill$$default();
  808. }).call(this);
  809. define('amber/es2015-polyfills',['amber/es6-promise'], function (promiseLib) {
  810. promiseLib.polyfill();
  811. });
  812. // This file is injected dependencies by amber-compat-xxx modules.
  813. // Therefore it is important that it _does_not_have_ define call.
  814. ;
  815. define("amber/node-compatibility", ["./es2015-polyfills"], function(){});
  816. /* ====================================================================
  817. |
  818. | Amber Smalltalk
  819. | http://amber-lang.net
  820. |
  821. ======================================================================
  822. ======================================================================
  823. |
  824. | Copyright (c) 2010-2014
  825. | Nicolas Petton <petton.nicolas@gmail.com>
  826. |
  827. | Copyright (c) 2012-2014
  828. | The Amber team https://github.com/amber-smalltalk?tab=members
  829. | Amber contributors https://github.com/amber-smalltalk/amber/graphs/contributors
  830. |
  831. | Amber is released under the MIT license
  832. |
  833. | Permission is hereby granted, free of charge, to any person obtaining
  834. | a copy of this software and associated documentation files (the
  835. | 'Software'), to deal in the Software without restriction, including
  836. | without limitation the rights to use, copy, modify, merge, publish,
  837. | distribute, sublicense, and/or sell copies of the Software, and to
  838. | permit persons to whom the Software is furnished to do so, subject to
  839. | the following conditions:
  840. |
  841. | The above copyright notice and this permission notice shall be
  842. | included in all copies or substantial portions of the Software.
  843. |
  844. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  845. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  846. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  847. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  848. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  849. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  850. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  851. |
  852. ==================================================================== */
  853. //jshint eqnull:true
  854. define('amber/boot',['require', './compatibility'], function (require) {
  855. /* Reconfigurable micro composition system, https://github.com/amber-smalltalk/brikz */
  856. function Brikz(api, apiKey, initKey) {
  857. var brikz = this, backup = {};
  858. apiKey = apiKey || 'exports';
  859. initKey = initKey || '__init__';
  860. function mixin(src, target, what) {
  861. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  862. if (src == null) {
  863. target[keys[i]] = undefined;
  864. } else {
  865. var value = src[keys[i]];
  866. if (typeof value !== "undefined") {
  867. target[keys[i]] = value;
  868. }
  869. }
  870. }
  871. return target;
  872. }
  873. var d = {value: null, enumerable: false, configurable: true, writable: true};
  874. Object.defineProperties(this, {ensure: d, rebuild: d});
  875. var exclude = mixin(this, {});
  876. this.rebuild = function () {
  877. Object.keys(backup).forEach(function (key) {
  878. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  879. });
  880. var oapi = mixin(api, {}), order = [], chk = {};
  881. brikz.ensure = function (key) {
  882. if (key in exclude) {
  883. return null;
  884. }
  885. var b = brikz[key], bak = backup[key];
  886. mixin(null, api, api);
  887. while (typeof b === "function") {
  888. b = new b(brikz, api, bak);
  889. }
  890. if (b && !chk[key]) {
  891. chk[key] = true;
  892. order.push(b);
  893. }
  894. if (b && !b[apiKey]) {
  895. b[apiKey] = mixin(api, {});
  896. }
  897. brikz[key] = b;
  898. return b;
  899. };
  900. Object.keys(brikz).forEach(function (key) {
  901. brikz.ensure(key);
  902. });
  903. brikz.ensure = null;
  904. mixin(oapi, mixin(null, api, api));
  905. order.forEach(function (brik) {
  906. mixin(brik[apiKey] || {}, api);
  907. });
  908. order.forEach(function (brik) {
  909. if (brik[initKey]) brik[initKey]();
  910. });
  911. backup = mixin(brikz, {});
  912. };
  913. }
  914. /* Brikz end */
  915. function inherits(child, parent) {
  916. child.prototype = Object.create(parent.prototype, {
  917. constructor: {
  918. value: child,
  919. enumerable: false, configurable: true, writable: true
  920. }
  921. });
  922. return child;
  923. }
  924. var jsGlobals = new Function("return this")();
  925. var globals = Object.create(jsGlobals);
  926. globals.SmalltalkSettings = {};
  927. var api = {};
  928. var brikz = new Brikz(api);
  929. function RootBrik(brikz, st) {
  930. /* Smalltalk foundational objects */
  931. /* SmalltalkRoot is the hidden root of the Amber hierarchy.
  932. All objects including `Object` inherit from SmalltalkRoot */
  933. function SmalltalkRoot() {
  934. }
  935. function SmalltalkProtoObject() {
  936. }
  937. inherits(SmalltalkProtoObject, SmalltalkRoot);
  938. function SmalltalkObject() {
  939. }
  940. inherits(SmalltalkObject, SmalltalkProtoObject);
  941. function SmalltalkNil() {
  942. }
  943. inherits(SmalltalkNil, SmalltalkObject);
  944. this.Object = SmalltalkObject;
  945. this.nil = new SmalltalkNil();
  946. // Adds an `isNil` property to the `nil` object. When sending
  947. // nil objects from one environment to another, doing
  948. // `anObject == nil` (in JavaScript) does not always answer
  949. // true as the referenced nil object might come from the other
  950. // environment.
  951. Object.defineProperty(this.nil, 'isNil', {
  952. value: true,
  953. enumerable: false, configurable: false, writable: false
  954. });
  955. // Hidden root class of the system.
  956. this.rootAsClass = {fn: SmalltalkRoot};
  957. this.__init__ = function () {
  958. st.addPackage("Kernel-Objects");
  959. st.wrapClassName("ProtoObject", "Kernel-Objects", SmalltalkProtoObject, undefined, false);
  960. st.wrapClassName("Object", "Kernel-Objects", SmalltalkObject, globals.ProtoObject, false);
  961. st.wrapClassName("UndefinedObject", "Kernel-Objects", SmalltalkNil, globals.Object, false);
  962. };
  963. }
  964. function OrganizeBrik(brikz, st) {
  965. brikz.ensure("augments");
  966. var SmalltalkObject = brikz.ensure("root").Object;
  967. function SmalltalkOrganizer() {
  968. }
  969. function SmalltalkPackageOrganizer() {
  970. this.elements = [];
  971. }
  972. function SmalltalkClassOrganizer() {
  973. this.elements = [];
  974. }
  975. inherits(SmalltalkOrganizer, SmalltalkObject);
  976. inherits(SmalltalkPackageOrganizer, SmalltalkOrganizer);
  977. inherits(SmalltalkClassOrganizer, SmalltalkOrganizer);
  978. this.__init__ = function () {
  979. st.addPackage("Kernel-Infrastructure");
  980. st.wrapClassName("Organizer", "Kernel-Infrastructure", SmalltalkOrganizer, globals.Object, false);
  981. st.wrapClassName("PackageOrganizer", "Kernel-Infrastructure", SmalltalkPackageOrganizer, globals.Organizer, false);
  982. st.wrapClassName("ClassOrganizer", "Kernel-Infrastructure", SmalltalkClassOrganizer, globals.Organizer, false);
  983. };
  984. this.setupClassOrganization = function (klass) {
  985. klass.organization = new SmalltalkClassOrganizer();
  986. klass.organization.theClass = klass;
  987. };
  988. this.setupPackageOrganization = function (pkg) {
  989. pkg.organization = new SmalltalkPackageOrganizer();
  990. };
  991. this.addOrganizationElement = function (owner, element) {
  992. owner.organization.elements.addElement(element);
  993. };
  994. this.removeOrganizationElement = function (owner, element) {
  995. owner.organization.elements.removeElement(element);
  996. };
  997. }
  998. function DNUBrik(brikz, st) {
  999. brikz.ensure("selectorConversion");
  1000. brikz.ensure("messageSend");
  1001. var manip = brikz.ensure("manipulation");
  1002. var rootAsClass = brikz.ensure("root").rootAsClass;
  1003. /* Method not implemented handlers */
  1004. var methods = [], methodDict = Object.create(null);
  1005. this.selectors = [];
  1006. this.jsSelectors = [];
  1007. this.make = function (stSelector, targetClasses) {
  1008. var method = methodDict[stSelector];
  1009. if (method) return;
  1010. var jsSelector = st.st2js(stSelector);
  1011. this.selectors.push(stSelector);
  1012. this.jsSelectors.push(jsSelector);
  1013. method = {jsSelector: jsSelector, fn: createHandler(stSelector)};
  1014. methodDict[stSelector] = method;
  1015. methods.push(method);
  1016. manip.installMethod(method, rootAsClass);
  1017. targetClasses.forEach(function (target) {
  1018. manip.installMethod(method, target);
  1019. });
  1020. return method;
  1021. };
  1022. /* Dnu handler method */
  1023. function createHandler(stSelector) {
  1024. return function () {
  1025. return brikz.messageSend.messageNotUnderstood(this, stSelector, arguments);
  1026. };
  1027. }
  1028. }
  1029. function ClassInitBrik(brikz, st) {
  1030. var dnu = brikz.ensure("dnu");
  1031. var manip = brikz.ensure("manipulation");
  1032. /* Initialize a class in its class hierarchy. Handle both classes and
  1033. metaclasses. */
  1034. st.init = function (klass) {
  1035. initClass(klass);
  1036. if (klass.klass && !klass.meta) {
  1037. initClass(klass.klass);
  1038. }
  1039. };
  1040. function initClass(klass) {
  1041. if (klass.wrapped) {
  1042. copySuperclass(klass);
  1043. }
  1044. }
  1045. this.initClass = initClass;
  1046. function copySuperclass(klass) {
  1047. var superclass = klass.superclass,
  1048. localMethods = klass.methods,
  1049. localMethodsByJsSelector = {};
  1050. Object.keys(localMethods).forEach(function (each) {
  1051. var localMethod = localMethods[each];
  1052. localMethodsByJsSelector[localMethod.jsSelector] = localMethod;
  1053. });
  1054. var myproto = klass.fn.prototype,
  1055. superproto = superclass.fn.prototype;
  1056. dnu.jsSelectors.forEach(function (selector) {
  1057. if (!localMethodsByJsSelector[selector]) {
  1058. manip.installMethod({
  1059. jsSelector: selector,
  1060. fn: superproto[selector]
  1061. }, klass);
  1062. } else if (!myproto[selector]) {
  1063. manip.installMethod(localMethodsByJsSelector[selector], klass);
  1064. }
  1065. });
  1066. }
  1067. }
  1068. function ManipulationBrik(brikz, st) {
  1069. this.installMethod = function (method, klass) {
  1070. Object.defineProperty(klass.fn.prototype, method.jsSelector, {
  1071. value: method.fn,
  1072. enumerable: false, configurable: true, writable: true
  1073. });
  1074. };
  1075. }
  1076. function PackagesBrik(brikz, st) {
  1077. var org = brikz.ensure("organize");
  1078. var root = brikz.ensure("root");
  1079. var nil = root.nil;
  1080. var SmalltalkObject = root.Object;
  1081. function SmalltalkPackage() {
  1082. }
  1083. inherits(SmalltalkPackage, SmalltalkObject);
  1084. this.__init__ = function () {
  1085. st.addPackage("Kernel-Infrastructure");
  1086. st.wrapClassName("Package", "Kernel-Infrastructure", SmalltalkPackage, globals.Object, false);
  1087. };
  1088. st.packages = {};
  1089. /* Smalltalk package creation. To add a Package, use smalltalk.addPackage() */
  1090. function pkg(spec) {
  1091. var that = new SmalltalkPackage();
  1092. that.pkgName = spec.pkgName;
  1093. org.setupPackageOrganization(that);
  1094. that.properties = spec.properties || {};
  1095. return that;
  1096. }
  1097. /* Add a package to the smalltalk.packages object, creating a new one if needed.
  1098. If pkgName is null or empty we return nil, which is an allowed package for a class.
  1099. If package already exists we still update the properties of it. */
  1100. st.addPackage = function (pkgName, properties) {
  1101. if (!pkgName) {
  1102. return nil;
  1103. }
  1104. if (!(st.packages[pkgName])) {
  1105. st.packages[pkgName] = pkg({
  1106. pkgName: pkgName,
  1107. properties: properties
  1108. });
  1109. } else {
  1110. if (properties) {
  1111. st.packages[pkgName].properties = properties;
  1112. }
  1113. }
  1114. return st.packages[pkgName];
  1115. };
  1116. }
  1117. function ClassesBrik(brikz, st) {
  1118. var org = brikz.ensure("organize");
  1119. var root = brikz.ensure("root");
  1120. var classInit = brikz.ensure("classInit");
  1121. var nil = root.nil;
  1122. var rootAsClass = root.rootAsClass;
  1123. var SmalltalkObject = root.Object;
  1124. rootAsClass.klass = {fn: SmalltalkClass};
  1125. function SmalltalkBehavior() {
  1126. }
  1127. function SmalltalkClass() {
  1128. }
  1129. function SmalltalkMetaclass() {
  1130. }
  1131. inherits(SmalltalkBehavior, SmalltalkObject);
  1132. inherits(SmalltalkClass, SmalltalkBehavior);
  1133. inherits(SmalltalkMetaclass, SmalltalkBehavior);
  1134. SmalltalkMetaclass.prototype.meta = true;
  1135. this.__init__ = function () {
  1136. st.addPackage("Kernel-Classes");
  1137. st.wrapClassName("Behavior", "Kernel-Classes", SmalltalkBehavior, globals.Object, false);
  1138. st.wrapClassName("Metaclass", "Kernel-Classes", SmalltalkMetaclass, globals.Behavior, false);
  1139. st.wrapClassName("Class", "Kernel-Classes", SmalltalkClass, globals.Behavior, false);
  1140. // Manually bootstrap the metaclass hierarchy
  1141. globals.ProtoObject.klass.superclass = rootAsClass.klass = globals.Class;
  1142. addSubclass(globals.ProtoObject.klass);
  1143. };
  1144. /* Smalltalk classes */
  1145. var classes = [];
  1146. var wrappedClasses = [];
  1147. /* Smalltalk class creation. A class is an instance of an automatically
  1148. created metaclass object. Newly created classes (not their metaclass)
  1149. should be added to the smalltalk object, see smalltalk.addClass().
  1150. Superclass linking is *not* handled here, see smalltalk.init() */
  1151. function klass(spec) {
  1152. spec = spec || {};
  1153. var setSuperClass = spec.superclass;
  1154. if (!spec.superclass) {
  1155. spec.superclass = rootAsClass;
  1156. }
  1157. var meta = metaclass(spec);
  1158. var that = meta.instanceClass;
  1159. that.superclass = setSuperClass;
  1160. that.fn = spec.fn || inherits(function () {
  1161. }, spec.superclass.fn);
  1162. that.subclasses = [];
  1163. setupClass(that, spec);
  1164. that.className = spec.className;
  1165. that.wrapped = spec.wrapped || false;
  1166. meta.className = spec.className + ' class';
  1167. meta.superclass = spec.superclass.klass;
  1168. return that;
  1169. }
  1170. function metaclass(spec) {
  1171. spec = spec || {};
  1172. var that = new SmalltalkMetaclass();
  1173. that.fn = inherits(function () {
  1174. }, spec.superclass.klass.fn);
  1175. that.instanceClass = new that.fn();
  1176. setupClass(that);
  1177. return that;
  1178. }
  1179. SmalltalkBehavior.prototype.toString = function () {
  1180. return 'Smalltalk ' + this.className;
  1181. };
  1182. function wireKlass(klass) {
  1183. Object.defineProperty(klass.fn.prototype, "klass", {
  1184. value: klass,
  1185. enumerable: false, configurable: true, writable: true
  1186. });
  1187. }
  1188. function setupClass(klass, spec) {
  1189. spec = spec || {};
  1190. klass.iVarNames = spec.iVarNames || [];
  1191. klass.pkg = spec.pkg;
  1192. org.setupClassOrganization(klass);
  1193. Object.defineProperty(klass, "methods", {
  1194. value: Object.create(null),
  1195. enumerable: false, configurable: true, writable: true
  1196. });
  1197. wireKlass(klass);
  1198. }
  1199. /* Add a class to the smalltalk object, creating a new one if needed.
  1200. A Package is lazily created if it does not exist with given name. */
  1201. st.addClass = function (className, superclass, iVarNames, pkgName) {
  1202. // While subclassing nil is allowed, it might be an error, so
  1203. // warn about it.
  1204. if (typeof superclass == 'undefined' || superclass == nil) {
  1205. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  1206. }
  1207. rawAddClass(pkgName, className, superclass, iVarNames, false, null);
  1208. };
  1209. function rawAddClass(pkgName, className, superclass, iVarNames, wrapped, fn) {
  1210. var pkg = st.packages[pkgName];
  1211. if (!pkg) {
  1212. throw new Error("Missing package " + pkgName);
  1213. }
  1214. if (!superclass || superclass == nil) {
  1215. superclass = null;
  1216. }
  1217. var theClass = globals.hasOwnProperty(className) && globals[className];
  1218. if (theClass && theClass.superclass == superclass) {
  1219. // theClass.superclass = superclass;
  1220. theClass.iVarNames = iVarNames || [];
  1221. if (pkg) theClass.pkg = pkg;
  1222. if (fn) {
  1223. fn.prototype = theClass.fn.prototype;
  1224. theClass.fn = fn;
  1225. fn.prototype.constructor = fn;
  1226. }
  1227. } else {
  1228. if (theClass) {
  1229. st.removeClass(theClass);
  1230. }
  1231. theClass = globals[className] = klass({
  1232. className: className,
  1233. superclass: superclass,
  1234. pkg: pkg,
  1235. iVarNames: iVarNames,
  1236. fn: fn,
  1237. wrapped: wrapped
  1238. });
  1239. addSubclass(theClass);
  1240. }
  1241. classes.addElement(theClass);
  1242. org.addOrganizationElement(pkg, theClass);
  1243. }
  1244. st.removeClass = function (klass) {
  1245. org.removeOrganizationElement(klass.pkg, klass);
  1246. classes.removeElement(klass);
  1247. removeSubclass(klass);
  1248. delete globals[klass.className];
  1249. };
  1250. function addSubclass(klass) {
  1251. if (klass.superclass) {
  1252. klass.superclass.subclasses.addElement(klass);
  1253. }
  1254. }
  1255. function removeSubclass(klass) {
  1256. if (klass.superclass) {
  1257. klass.superclass.subclasses.removeElement(klass);
  1258. }
  1259. }
  1260. /* Create a new class wrapping a JavaScript constructor, and add it to the
  1261. global smalltalk object. Package is lazily created if it does not exist with given name. */
  1262. st.wrapClassName = function (className, pkgName, fn, superclass, wrapped) {
  1263. wrapped = wrapped !== false;
  1264. rawAddClass(pkgName, className, superclass, globals[className] && globals[className].iVarNames, wrapped, fn);
  1265. if (wrapped) {
  1266. wrappedClasses.addElement(globals[className]);
  1267. }
  1268. };
  1269. /* Manually set the constructor of an existing Smalltalk klass, making it a wrapped class. */
  1270. st.setClassConstructor = function (klass, constructor) {
  1271. wrappedClasses.addElement(klass);
  1272. klass.wrapped = true;
  1273. klass.fn = constructor;
  1274. // The fn property changed. We need to add back the klass property to the prototype
  1275. wireKlass(klass);
  1276. classInit.initClass(klass);
  1277. };
  1278. /* Create an alias for an existing class */
  1279. st.alias = function (klass, alias) {
  1280. globals[alias] = klass;
  1281. };
  1282. /* Answer all registered Smalltalk classes */
  1283. //TODO: remove the function and make smalltalk.classes an array
  1284. st.classes = function () {
  1285. return classes;
  1286. };
  1287. st.wrappedClasses = function () {
  1288. return wrappedClasses;
  1289. };
  1290. // Still used, but could go away now that subclasses are stored
  1291. // into classes directly.
  1292. st.allSubclasses = function (klass) {
  1293. return klass._allSubclasses();
  1294. };
  1295. }
  1296. function MethodsBrik(brikz, st) {
  1297. var manip = brikz.ensure("manipulation");
  1298. var org = brikz.ensure("organize");
  1299. var stInit = brikz.ensure("stInit");
  1300. var dnu = brikz.ensure("dnu");
  1301. var SmalltalkObject = brikz.ensure("root").Object;
  1302. brikz.ensure("selectorConversion");
  1303. brikz.ensure("classes");
  1304. function SmalltalkMethod() {
  1305. }
  1306. inherits(SmalltalkMethod, SmalltalkObject);
  1307. this.__init__ = function () {
  1308. st.addPackage("Kernel-Methods");
  1309. st.wrapClassName("CompiledMethod", "Kernel-Methods", SmalltalkMethod, globals.Object, false);
  1310. };
  1311. /* Smalltalk method object. To add a method to a class,
  1312. use smalltalk.addMethod() */
  1313. st.method = function (spec) {
  1314. var that = new SmalltalkMethod();
  1315. that.selector = spec.selector;
  1316. that.jsSelector = spec.jsSelector;
  1317. that.args = spec.args || {};
  1318. that.protocol = spec.protocol;
  1319. that.source = spec.source;
  1320. that.messageSends = spec.messageSends || [];
  1321. that.referencedClasses = spec.referencedClasses || [];
  1322. that.fn = spec.fn;
  1323. return that;
  1324. };
  1325. function ensureJsSelector(method) {
  1326. if (!(method.jsSelector)) {
  1327. method.jsSelector = st.st2js(method.selector);
  1328. }
  1329. }
  1330. /* Add/remove a method to/from a class */
  1331. st.addMethod = function (method, klass) {
  1332. ensureJsSelector(method);
  1333. manip.installMethod(method, klass);
  1334. klass.methods[method.selector] = method;
  1335. method.methodClass = klass;
  1336. // During the bootstrap, #addCompiledMethod is not used.
  1337. // Therefore we populate the organizer here too
  1338. org.addOrganizationElement(klass, method.protocol);
  1339. propagateMethodChange(klass, method);
  1340. var usedSelectors = method.messageSends,
  1341. targetClasses = stInit.initialized() ? st.wrappedClasses() : [];
  1342. dnu.make(method.selector, targetClasses);
  1343. for (var i = 0; i < usedSelectors.length; i++) {
  1344. dnu.make(usedSelectors[i], targetClasses);
  1345. }
  1346. };
  1347. function propagateMethodChange(klass, method) {
  1348. // If already initialized (else it will be done later anyway),
  1349. // re-initialize all subclasses to ensure the method change
  1350. // propagation (for wrapped classes, not using the prototype
  1351. // chain).
  1352. if (stInit.initialized()) {
  1353. st.allSubclasses(klass).forEach(function (subclass) {
  1354. initMethodInClass(subclass, method);
  1355. });
  1356. }
  1357. }
  1358. function initMethodInClass(klass, method) {
  1359. if (klass.wrapped && !klass.methods[method.selector]) {
  1360. var jsSelector = method.jsSelector;
  1361. manip.installMethod({
  1362. jsSelector: jsSelector,
  1363. fn: klass.superclass.fn.prototype[jsSelector]
  1364. }, klass);
  1365. }
  1366. }
  1367. st.removeMethod = function (method, klass) {
  1368. if (klass !== method.methodClass) {
  1369. throw new Error(
  1370. "Refusing to remove method " +
  1371. method.methodClass.className + ">>" + method.selector +
  1372. " from different class " +
  1373. klass.className);
  1374. }
  1375. ensureJsSelector(method);
  1376. delete klass.fn.prototype[method.jsSelector];
  1377. delete klass.methods[method.selector];
  1378. initMethodInClass(klass, method);
  1379. propagateMethodChange(klass, method);
  1380. // Do *not* delete protocols from here.
  1381. // This is handled by #removeCompiledMethod
  1382. };
  1383. /* Answer all method selectors based on dnu handlers */
  1384. st.allSelectors = function () {
  1385. return dnu.selectors;
  1386. };
  1387. }
  1388. function AugmentsBrik(brikz, st) {
  1389. /* Array extensions */
  1390. Array.prototype.addElement = function (el) {
  1391. if (typeof el === 'undefined') {
  1392. return;
  1393. }
  1394. if (this.indexOf(el) == -1) {
  1395. this.push(el);
  1396. }
  1397. };
  1398. Array.prototype.removeElement = function (el) {
  1399. var i = this.indexOf(el);
  1400. if (i !== -1) {
  1401. this.splice(i, 1);
  1402. }
  1403. };
  1404. }
  1405. function SmalltalkInitBrik(brikz, st) {
  1406. brikz.ensure("classInit");
  1407. brikz.ensure("classes");
  1408. var initialized = false;
  1409. /* Smalltalk initialization. Called on page load */
  1410. st.initialize = function () {
  1411. if (initialized) {
  1412. return;
  1413. }
  1414. st.classes().forEach(function (klass) {
  1415. st.init(klass);
  1416. });
  1417. runnable();
  1418. st.classes().forEach(function (klass) {
  1419. klass._initialize();
  1420. });
  1421. initialized = true;
  1422. };
  1423. this.initialized = function () {
  1424. return initialized;
  1425. };
  1426. this.__init__ = function () {
  1427. st.addPackage("Kernel-Methods");
  1428. st.wrapClassName("Number", "Kernel-Objects", Number, globals.Object);
  1429. st.wrapClassName("BlockClosure", "Kernel-Methods", Function, globals.Object);
  1430. st.wrapClassName("Boolean", "Kernel-Objects", Boolean, globals.Object);
  1431. st.wrapClassName("Date", "Kernel-Objects", Date, globals.Object);
  1432. st.addPackage("Kernel-Collections");
  1433. st.addClass("Collection", globals.Object, null, "Kernel-Collections");
  1434. st.addClass("IndexableCollection", globals.Collection, null, "Kernel-Collections");
  1435. st.addClass("SequenceableCollection", globals.IndexableCollection, null, "Kernel-Collections");
  1436. st.addClass("CharacterArray", globals.SequenceableCollection, null, "Kernel-Collections");
  1437. st.wrapClassName("String", "Kernel-Collections", String, globals.CharacterArray);
  1438. st.wrapClassName("Array", "Kernel-Collections", Array, globals.SequenceableCollection);
  1439. st.wrapClassName("RegularExpression", "Kernel-Collections", RegExp, globals.Object);
  1440. st.addPackage("Kernel-Exceptions");
  1441. st.wrapClassName("Error", "Kernel-Exceptions", Error, globals.Object);
  1442. /* Alias definitions */
  1443. st.alias(globals.Array, "OrderedCollection");
  1444. st.alias(globals.Date, "Time");
  1445. };
  1446. }
  1447. function PrimitivesBrik(brikz, st) {
  1448. /* Unique ID number generator */
  1449. var oid = 0;
  1450. st.nextId = function () {
  1451. oid += 1;
  1452. return oid;
  1453. };
  1454. /* Converts a JavaScript object to valid Smalltalk Object */
  1455. st.readJSObject = function (js) {
  1456. if (js == null)
  1457. return null;
  1458. var readObject = js.constructor === Object;
  1459. var readArray = js.constructor === Array;
  1460. var object = readObject ? globals.Dictionary._new() : readArray ? [] : js;
  1461. for (var i in js) {
  1462. if (readObject) {
  1463. object._at_put_(i, st.readJSObject(js[i]));
  1464. }
  1465. if (readArray) {
  1466. object[i] = st.readJSObject(js[i]);
  1467. }
  1468. }
  1469. return object;
  1470. };
  1471. /* Boolean assertion */
  1472. st.assert = function (shouldBeBoolean) {
  1473. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1474. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  1475. shouldBeBoolean = shouldBeBoolean.valueOf();
  1476. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1477. }
  1478. globals.NonBooleanReceiver._new()._object_(shouldBeBoolean)._signal();
  1479. };
  1480. /* List of all reserved words in JavaScript. They may not be used as variables
  1481. in Smalltalk. */
  1482. // list of reserved JavaScript keywords as of
  1483. // http://es5.github.com/#x7.6.1.1
  1484. // and
  1485. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.6.1
  1486. st.reservedWords = ['break', 'case', 'catch', 'continue', 'debugger',
  1487. 'default', 'delete', 'do', 'else', 'finally', 'for', 'function',
  1488. 'if', 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw',
  1489. 'try', 'typeof', 'var', 'void', 'while', 'with',
  1490. // Amber protected words: these should not be compiled as-is when in code
  1491. 'arguments',
  1492. // ES5: future use: http://es5.github.com/#x7.6.1.2
  1493. 'class', 'const', 'enum', 'export', 'extends', 'import', 'super',
  1494. // ES5: future use in strict mode
  1495. 'implements', 'interface', 'let', 'package', 'private', 'protected',
  1496. 'public', 'static', 'yield'];
  1497. st.globalJsVariables = ['window', 'document', 'process', 'global'];
  1498. }
  1499. function RuntimeBrik(brikz, st) {
  1500. brikz.ensure("selectorConversion");
  1501. var root = brikz.ensure("root");
  1502. var nil = root.nil;
  1503. var SmalltalkObject = root.Object;
  1504. function SmalltalkMethodContext(home, setup) {
  1505. this.sendIdx = {};
  1506. this.homeContext = home;
  1507. this.setup = setup || function () {
  1508. };
  1509. this.supercall = false;
  1510. }
  1511. inherits(SmalltalkMethodContext, SmalltalkObject);
  1512. this.__init__ = function () {
  1513. st.addPackage("Kernel-Methods");
  1514. st.wrapClassName("MethodContext", "Kernel-Methods", SmalltalkMethodContext, globals.Object, false);
  1515. // Fallbacks
  1516. SmalltalkMethodContext.prototype.locals = {};
  1517. SmalltalkMethodContext.prototype.receiver = null;
  1518. SmalltalkMethodContext.prototype.selector = null;
  1519. SmalltalkMethodContext.prototype.lookupClass = null;
  1520. SmalltalkMethodContext.prototype.fill = function (receiver, selector, locals, lookupClass) {
  1521. this.receiver = receiver;
  1522. this.selector = selector;
  1523. this.locals = locals || {};
  1524. this.lookupClass = lookupClass;
  1525. if (this.homeContext) {
  1526. this.homeContext.evaluatedSelector = selector;
  1527. }
  1528. };
  1529. SmalltalkMethodContext.prototype.fillBlock = function (locals, ctx, index) {
  1530. this.locals = locals || {};
  1531. this.outerContext = ctx;
  1532. this.index = index || 0;
  1533. };
  1534. SmalltalkMethodContext.prototype.init = function () {
  1535. var home = this.homeContext;
  1536. if (home) {
  1537. home.init();
  1538. }
  1539. this.setup(this);
  1540. };
  1541. SmalltalkMethodContext.prototype.method = function () {
  1542. var method;
  1543. var lookup = this.lookupClass || this.receiver.klass;
  1544. while (!method && lookup) {
  1545. method = lookup.methods[st.js2st(this.selector)];
  1546. lookup = lookup.superclass;
  1547. }
  1548. return method;
  1549. };
  1550. };
  1551. /* This is the current call context object. While it is publicly available,
  1552. Use smalltalk.getThisContext() instead which will answer a safe copy of
  1553. the current context */
  1554. var thisContext = null;
  1555. st.withContext = function (worker, setup) {
  1556. if (thisContext) {
  1557. return inContext(worker, setup);
  1558. } else {
  1559. return inContextWithErrorHandling(worker, setup);
  1560. }
  1561. };
  1562. function inContextWithErrorHandling(worker, setup) {
  1563. try {
  1564. return inContext(worker, setup);
  1565. } catch (error) {
  1566. handleError(error);
  1567. thisContext = null;
  1568. // Rethrow the error in any case.
  1569. error.amberHandled = true;
  1570. throw error;
  1571. }
  1572. }
  1573. function inContext(worker, setup) {
  1574. var oldContext = thisContext;
  1575. thisContext = new SmalltalkMethodContext(thisContext, setup);
  1576. var result = worker(thisContext);
  1577. thisContext = oldContext;
  1578. return result;
  1579. }
  1580. /* Wrap a JavaScript exception in a Smalltalk Exception.
  1581. In case of a RangeError, stub the stack after 100 contexts to
  1582. avoid another RangeError later when the stack is manipulated. */
  1583. function wrappedError(error) {
  1584. var errorWrapper = globals.JavaScriptException._on_(error);
  1585. // Add the error to the context, so it is visible in the stack
  1586. try {
  1587. errorWrapper._signal();
  1588. } catch (ex) {
  1589. }
  1590. var context = st.getThisContext();
  1591. if (isRangeError(error)) {
  1592. stubContextStack(context);
  1593. }
  1594. errorWrapper._context_(context);
  1595. return errorWrapper;
  1596. }
  1597. /* Stub the context stack after 100 contexts */
  1598. function stubContextStack(context) {
  1599. var currentContext = context;
  1600. var contexts = 0;
  1601. while (contexts < 100) {
  1602. if (currentContext) {
  1603. currentContext = currentContext.homeContext;
  1604. }
  1605. contexts++;
  1606. }
  1607. if (currentContext) {
  1608. currentContext.homeContext = undefined;
  1609. }
  1610. }
  1611. function isRangeError(error) {
  1612. return error instanceof RangeError;
  1613. }
  1614. /* Handles Smalltalk errors. Triggers the registered ErrorHandler
  1615. (See the Smalltalk class ErrorHandler and its subclasses */
  1616. function handleError(error) {
  1617. if (!error.smalltalkError) {
  1618. error = wrappedError(error);
  1619. }
  1620. globals.ErrorHandler._handleError_(error);
  1621. }
  1622. /* Handle thisContext pseudo variable */
  1623. st.getThisContext = function () {
  1624. if (thisContext) {
  1625. thisContext.init();
  1626. return thisContext;
  1627. } else {
  1628. return nil;
  1629. }
  1630. };
  1631. }
  1632. function MessageSendBrik(brikz, st) {
  1633. brikz.ensure("selectorConversion");
  1634. var nil = brikz.ensure("root").nil;
  1635. /* Handles unhandled errors during message sends */
  1636. // simply send the message and handle #dnu:
  1637. st.send = function (receiver, jsSelector, args, klass) {
  1638. var method;
  1639. if (receiver == null) {
  1640. receiver = nil;
  1641. }
  1642. method = klass ? klass.fn.prototype[jsSelector] : receiver.klass && receiver[jsSelector];
  1643. if (method) {
  1644. return method.apply(receiver, args || []);
  1645. } else {
  1646. return messageNotUnderstood(receiver, st.js2st(jsSelector), args);
  1647. }
  1648. };
  1649. function invokeDnuMethod(receiver, stSelector, args) {
  1650. return receiver._doesNotUnderstand_(
  1651. globals.Message._new()
  1652. ._selector_(stSelector)
  1653. ._arguments_([].slice.call(args))
  1654. );
  1655. }
  1656. /* Handles #dnu: *and* JavaScript method calls.
  1657. if the receiver has no klass, we consider it a JS object (outside of the
  1658. Amber system). Else assume that the receiver understands #doesNotUnderstand: */
  1659. function messageNotUnderstood(receiver, stSelector, args) {
  1660. if (receiver.klass != null && !receiver.allowJavaScriptCalls) {
  1661. return invokeDnuMethod(receiver, stSelector, args);
  1662. }
  1663. /* Call a method of a JS object, or answer a property if it exists.
  1664. Else try wrapping a JSObjectProxy around the receiver. */
  1665. var propertyName = st.st2prop(stSelector);
  1666. if (!(propertyName in receiver)) {
  1667. return invokeDnuMethod(globals.JSObjectProxy._on_(receiver), stSelector, args);
  1668. }
  1669. return accessJavaScript(receiver, propertyName, args);
  1670. }
  1671. /* If the object property is a function, then call it, except if it starts with
  1672. an uppercase character (we probably want to answer the function itself in this
  1673. case and send it #new from Amber).
  1674. Converts keyword-based selectors by using the first
  1675. keyword only, but keeping all message arguments.
  1676. Example:
  1677. "self do: aBlock with: anObject" -> "self.do(aBlock, anObject)" */
  1678. function accessJavaScript(receiver, propertyName, args) {
  1679. var propertyValue = receiver[propertyName];
  1680. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  1681. return propertyValue.apply(receiver, args || []);
  1682. } else if (args.length > 0) {
  1683. receiver[propertyName] = args[0];
  1684. return nil;
  1685. } else {
  1686. return propertyValue;
  1687. }
  1688. }
  1689. st.accessJavaScript = accessJavaScript;
  1690. this.messageNotUnderstood = messageNotUnderstood;
  1691. }
  1692. function SelectorConversionBrik(brikz, st) {
  1693. /* Convert a Smalltalk selector into a JS selector */
  1694. st.st2js = function (string) {
  1695. var selector = '_' + string;
  1696. selector = selector.replace(/:/g, '_');
  1697. selector = selector.replace(/[\&]/g, '_and');
  1698. selector = selector.replace(/[\|]/g, '_or');
  1699. selector = selector.replace(/[+]/g, '_plus');
  1700. selector = selector.replace(/-/g, '_minus');
  1701. selector = selector.replace(/[*]/g, '_star');
  1702. selector = selector.replace(/[\/]/g, '_slash');
  1703. selector = selector.replace(/[\\]/g, '_backslash');
  1704. selector = selector.replace(/[\~]/g, '_tild');
  1705. selector = selector.replace(/>/g, '_gt');
  1706. selector = selector.replace(/</g, '_lt');
  1707. selector = selector.replace(/=/g, '_eq');
  1708. selector = selector.replace(/,/g, '_comma');
  1709. selector = selector.replace(/[@]/g, '_at');
  1710. return selector;
  1711. };
  1712. /* Convert a string to a valid smalltalk selector.
  1713. if you modify the following functions, also change st2js
  1714. accordingly */
  1715. st.js2st = function (selector) {
  1716. if (selector.match(/^__/)) {
  1717. return binaryJsToSt(selector);
  1718. } else {
  1719. return keywordJsToSt(selector);
  1720. }
  1721. };
  1722. function keywordJsToSt(selector) {
  1723. return selector.replace(/^_/, '').replace(/_/g, ':');
  1724. }
  1725. function binaryJsToSt(selector) {
  1726. return selector
  1727. .replace(/^_/, '')
  1728. .replace(/_and/g, '&')
  1729. .replace(/_or/g, '|')
  1730. .replace(/_plus/g, '+')
  1731. .replace(/_minus/g, '-')
  1732. .replace(/_star/g, '*')
  1733. .replace(/_slash/g, '/')
  1734. .replace(/_backslash/g, '\\')
  1735. .replace(/_tild/g, '~')
  1736. .replace(/_gt/g, '>')
  1737. .replace(/_lt/g, '<')
  1738. .replace(/_eq/g, '=')
  1739. .replace(/_comma/g, ',')
  1740. .replace(/_at/g, '@');
  1741. }
  1742. st.st2prop = function (stSelector) {
  1743. var colonPosition = stSelector.indexOf(':');
  1744. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1745. };
  1746. }
  1747. /* Adds AMD and requirejs related methods to the smalltalk object */
  1748. function AMDBrik(brikz, st) {
  1749. this.__init__ = function () {
  1750. st.amdRequire = require;
  1751. st.defaultTransportType = st.defaultTransportType || "amd";
  1752. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  1753. };
  1754. }
  1755. /* Defines asReceiver to be present at load time */
  1756. /* (logically it belongs more to PrimitiveBrik) */
  1757. function AsReceiverBrik(brikz, st) {
  1758. var nil = brikz.ensure("root").nil;
  1759. /**
  1760. * This function is used all over the compiled amber code.
  1761. * It takes any value (JavaScript or Smalltalk)
  1762. * and returns a proper Amber Smalltalk receiver.
  1763. *
  1764. * null or undefined -> nil,
  1765. * plain JS object -> wrapped JS object,
  1766. * otherwise unchanged
  1767. */
  1768. this.asReceiver = function (o) {
  1769. if (o == null) return nil;
  1770. if (typeof o === "object" || typeof o === "function") {
  1771. return o.klass != null ? o : globals.JSObjectProxy._on_(o);
  1772. }
  1773. // IMPORTANT: This optimization (return o if typeof !== "object")
  1774. // assumes all primitive types are wrapped by some Smalltalk class
  1775. // so they can be returned as-is, without boxing and looking for .klass.
  1776. // KEEP THE primitives-are-wrapped INVARIANT!
  1777. return o;
  1778. };
  1779. }
  1780. /* Making smalltalk that can load */
  1781. brikz.root = RootBrik;
  1782. brikz.dnu = DNUBrik;
  1783. brikz.organize = OrganizeBrik;
  1784. brikz.selectorConversion = SelectorConversionBrik;
  1785. brikz.classInit = ClassInitBrik;
  1786. brikz.manipulation = ManipulationBrik;
  1787. brikz.packages = PackagesBrik;
  1788. brikz.classes = ClassesBrik;
  1789. brikz.methods = MethodsBrik;
  1790. brikz.stInit = SmalltalkInitBrik;
  1791. brikz.augments = AugmentsBrik;
  1792. brikz.asReceiver = AsReceiverBrik;
  1793. brikz.amd = AMDBrik;
  1794. brikz.rebuild();
  1795. /* Making smalltalk that can run */
  1796. function runnable() {
  1797. brikz.messageSend = MessageSendBrik;
  1798. brikz.runtime = RuntimeBrik;
  1799. brikz.primitives = PrimitivesBrik;
  1800. brikz.rebuild();
  1801. }
  1802. return {
  1803. api: api,
  1804. nil: brikz.root.nil,
  1805. dnu: brikz.root.rootAsClass,
  1806. globals: globals,
  1807. asReceiver: brikz.asReceiver.asReceiver
  1808. };
  1809. });
  1810. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  1811. var globals = boot.globals,
  1812. exports = {},
  1813. api = boot.api,
  1814. nil = boot.nil;
  1815. // API
  1816. exports.popupHelios = function () {
  1817. require(['helios/index'], function (helios) {
  1818. helios.popup();
  1819. }, function (err) {
  1820. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  1821. });
  1822. };
  1823. Object.defineProperty(exports, "api", {
  1824. value: api,
  1825. enumerable: true, configurable: true, writable: false
  1826. });
  1827. Object.defineProperty(exports, "globals", {
  1828. value: globals,
  1829. enumerable: true, configurable: true, writable: false
  1830. });
  1831. Object.defineProperty(exports, "nil", {
  1832. value: nil,
  1833. enumerable: true, configurable: true, writable: false
  1834. });
  1835. function mixinToSettings(source) {
  1836. var settings = globals.SmalltalkSettings;
  1837. Object.keys(source).forEach(function (key) {
  1838. settings[key] = source[key];
  1839. });
  1840. }
  1841. function settingsInLocalStorage() {
  1842. //jshint evil:true
  1843. var global = new Function('return this')(),
  1844. storage = 'localStorage' in global && global.localStorage;
  1845. if (storage) {
  1846. var fromStorage;
  1847. try {
  1848. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  1849. } catch (ex) {
  1850. // pass
  1851. }
  1852. mixinToSettings(fromStorage || {});
  1853. if (typeof window !== "undefined") {
  1854. requirejs(['jquery'], function ($) {
  1855. $(window).on('beforeunload', function () {
  1856. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  1857. });
  1858. });
  1859. }
  1860. }
  1861. }
  1862. exports.initialize = function (options) {
  1863. return Promise.resolve()
  1864. .then(function () {
  1865. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  1866. })
  1867. .then(settingsInLocalStorage)
  1868. .then(function () {
  1869. return options || {};
  1870. })
  1871. .then(mixinToSettings)
  1872. .then(function () {
  1873. return api.initialize();
  1874. })
  1875. };
  1876. // Exports
  1877. return exports;
  1878. });
  1879. define("amber_core/Kernel-Objects", ["amber/boot"], function($boot){"use strict";
  1880. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  1881. $core.addPackage('Kernel-Objects');
  1882. $core.packages["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  1883. $core.packages["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  1884. $core.addClass('ProtoObject', null, [], 'Kernel-Objects');
  1885. $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.";
  1886. $core.addMethod(
  1887. $core.method({
  1888. selector: "=",
  1889. protocol: 'comparing',
  1890. fn: function (anObject){
  1891. var self=this;
  1892. return $core.withContext(function($ctx1) {
  1893. return self.__eq_eq(anObject);
  1894. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  1895. },
  1896. args: ["anObject"],
  1897. source: "= anObject\x0a\x09^ self == anObject",
  1898. referencedClasses: [],
  1899. messageSends: ["=="]
  1900. }),
  1901. $globals.ProtoObject);
  1902. $core.addMethod(
  1903. $core.method({
  1904. selector: "==",
  1905. protocol: 'comparing',
  1906. fn: function (anObject){
  1907. var self=this;
  1908. return $core.withContext(function($ctx1) {
  1909. return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject);
  1910. return self;
  1911. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  1912. },
  1913. args: ["anObject"],
  1914. source: "== anObject\x0a<return self._class() === $recv(anObject)._class() && self._isSameInstanceAs_(anObject)>",
  1915. referencedClasses: [],
  1916. messageSends: []
  1917. }),
  1918. $globals.ProtoObject);
  1919. $core.addMethod(
  1920. $core.method({
  1921. selector: "asString",
  1922. protocol: 'converting',
  1923. fn: function (){
  1924. var self=this;
  1925. return $core.withContext(function($ctx1) {
  1926. return self._printString();
  1927. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  1928. },
  1929. args: [],
  1930. source: "asString\x0a\x09^ self printString",
  1931. referencedClasses: [],
  1932. messageSends: ["printString"]
  1933. }),
  1934. $globals.ProtoObject);
  1935. $core.addMethod(
  1936. $core.method({
  1937. selector: "class",
  1938. protocol: 'accessing',
  1939. fn: function (){
  1940. var self=this;
  1941. return $core.withContext(function($ctx1) {
  1942. return self.klass;
  1943. return self;
  1944. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  1945. },
  1946. args: [],
  1947. source: "class\x0a\x09<return self.klass>",
  1948. referencedClasses: [],
  1949. messageSends: []
  1950. }),
  1951. $globals.ProtoObject);
  1952. $core.addMethod(
  1953. $core.method({
  1954. selector: "doesNotUnderstand:",
  1955. protocol: 'error handling',
  1956. fn: function (aMessage){
  1957. var self=this;
  1958. return $core.withContext(function($ctx1) {
  1959. var $1;
  1960. $1=$recv($globals.MessageNotUnderstood)._new();
  1961. $recv($1)._receiver_(self);
  1962. $recv($1)._message_(aMessage);
  1963. $recv($1)._signal();
  1964. return self;
  1965. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  1966. },
  1967. args: ["aMessage"],
  1968. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  1969. referencedClasses: ["MessageNotUnderstood"],
  1970. messageSends: ["receiver:", "new", "message:", "signal"]
  1971. }),
  1972. $globals.ProtoObject);
  1973. $core.addMethod(
  1974. $core.method({
  1975. selector: "evaluate:on:",
  1976. protocol: 'evaluating',
  1977. fn: function (aString,anEvaluator){
  1978. var self=this;
  1979. return $core.withContext(function($ctx1) {
  1980. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  1981. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  1982. },
  1983. args: ["aString", "anEvaluator"],
  1984. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  1985. referencedClasses: [],
  1986. messageSends: ["evaluate:receiver:"]
  1987. }),
  1988. $globals.ProtoObject);
  1989. $core.addMethod(
  1990. $core.method({
  1991. selector: "identityHash",
  1992. protocol: 'accessing',
  1993. fn: function (){
  1994. var self=this;
  1995. return $core.withContext(function($ctx1) {
  1996. var hash=self.identityHash;
  1997. if (hash) return hash;
  1998. hash=$core.nextId();
  1999. Object.defineProperty(self, 'identityHash', {value:hash});
  2000. return hash;
  2001. ;
  2002. return self;
  2003. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  2004. },
  2005. args: [],
  2006. 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>",
  2007. referencedClasses: [],
  2008. messageSends: []
  2009. }),
  2010. $globals.ProtoObject);
  2011. $core.addMethod(
  2012. $core.method({
  2013. selector: "ifNil:",
  2014. protocol: 'testing',
  2015. fn: function (aBlock){
  2016. var self=this;
  2017. return self;
  2018. },
  2019. args: ["aBlock"],
  2020. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2021. referencedClasses: [],
  2022. messageSends: []
  2023. }),
  2024. $globals.ProtoObject);
  2025. $core.addMethod(
  2026. $core.method({
  2027. selector: "ifNil:ifNotNil:",
  2028. protocol: 'testing',
  2029. fn: function (aBlock,anotherBlock){
  2030. var self=this;
  2031. return $core.withContext(function($ctx1) {
  2032. return $recv(anotherBlock)._value_(self);
  2033. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2034. },
  2035. args: ["aBlock", "anotherBlock"],
  2036. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2037. referencedClasses: [],
  2038. messageSends: ["value:"]
  2039. }),
  2040. $globals.ProtoObject);
  2041. $core.addMethod(
  2042. $core.method({
  2043. selector: "ifNotNil:",
  2044. protocol: 'testing',
  2045. fn: function (aBlock){
  2046. var self=this;
  2047. return $core.withContext(function($ctx1) {
  2048. return $recv(aBlock)._value_(self);
  2049. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  2050. },
  2051. args: ["aBlock"],
  2052. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2053. referencedClasses: [],
  2054. messageSends: ["value:"]
  2055. }),
  2056. $globals.ProtoObject);
  2057. $core.addMethod(
  2058. $core.method({
  2059. selector: "ifNotNil:ifNil:",
  2060. protocol: 'testing',
  2061. fn: function (aBlock,anotherBlock){
  2062. var self=this;
  2063. return $core.withContext(function($ctx1) {
  2064. return $recv(aBlock)._value_(self);
  2065. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2066. },
  2067. args: ["aBlock", "anotherBlock"],
  2068. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2069. referencedClasses: [],
  2070. messageSends: ["value:"]
  2071. }),
  2072. $globals.ProtoObject);
  2073. $core.addMethod(
  2074. $core.method({
  2075. selector: "initialize",
  2076. protocol: 'initialization',
  2077. fn: function (){
  2078. var self=this;
  2079. return self;
  2080. },
  2081. args: [],
  2082. source: "initialize",
  2083. referencedClasses: [],
  2084. messageSends: []
  2085. }),
  2086. $globals.ProtoObject);
  2087. $core.addMethod(
  2088. $core.method({
  2089. selector: "inspect",
  2090. protocol: 'inspecting',
  2091. fn: function (){
  2092. var self=this;
  2093. return $core.withContext(function($ctx1) {
  2094. $recv($globals.Inspector)._inspect_(self);
  2095. return self;
  2096. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  2097. },
  2098. args: [],
  2099. source: "inspect\x0a\x09Inspector inspect: self",
  2100. referencedClasses: ["Inspector"],
  2101. messageSends: ["inspect:"]
  2102. }),
  2103. $globals.ProtoObject);
  2104. $core.addMethod(
  2105. $core.method({
  2106. selector: "inspectOn:",
  2107. protocol: 'inspecting',
  2108. fn: function (anInspector){
  2109. var self=this;
  2110. return self;
  2111. },
  2112. args: ["anInspector"],
  2113. source: "inspectOn: anInspector",
  2114. referencedClasses: [],
  2115. messageSends: []
  2116. }),
  2117. $globals.ProtoObject);
  2118. $core.addMethod(
  2119. $core.method({
  2120. selector: "instVarAt:",
  2121. protocol: 'accessing',
  2122. fn: function (aString){
  2123. var self=this;
  2124. return $core.withContext(function($ctx1) {
  2125. return self['@'+aString] ;
  2126. return self;
  2127. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  2128. },
  2129. args: ["aString"],
  2130. source: "instVarAt: aString\x0a\x09< return self['@'+aString] >",
  2131. referencedClasses: [],
  2132. messageSends: []
  2133. }),
  2134. $globals.ProtoObject);
  2135. $core.addMethod(
  2136. $core.method({
  2137. selector: "instVarAt:put:",
  2138. protocol: 'accessing',
  2139. fn: function (aString,anObject){
  2140. var self=this;
  2141. return $core.withContext(function($ctx1) {
  2142. self['@' + aString] = anObject ;
  2143. return self;
  2144. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  2145. },
  2146. args: ["aString", "anObject"],
  2147. source: "instVarAt: aString put: anObject\x0a\x09< self['@' + aString] = anObject >",
  2148. referencedClasses: [],
  2149. messageSends: []
  2150. }),
  2151. $globals.ProtoObject);
  2152. $core.addMethod(
  2153. $core.method({
  2154. selector: "isKindOf:",
  2155. protocol: 'testing',
  2156. fn: function (aClass){
  2157. var self=this;
  2158. return $core.withContext(function($ctx1) {
  2159. var $1;
  2160. $1=self._isMemberOf_(aClass);
  2161. if($core.assert($1)){
  2162. return true;
  2163. } else {
  2164. return $recv(self._class())._inheritsFrom_(aClass);
  2165. };
  2166. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  2167. },
  2168. args: ["aClass"],
  2169. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  2170. referencedClasses: [],
  2171. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  2172. }),
  2173. $globals.ProtoObject);
  2174. $core.addMethod(
  2175. $core.method({
  2176. selector: "isNil",
  2177. protocol: 'testing',
  2178. fn: function (){
  2179. var self=this;
  2180. return false;
  2181. },
  2182. args: [],
  2183. source: "isNil\x0a\x09^ false",
  2184. referencedClasses: [],
  2185. messageSends: []
  2186. }),
  2187. $globals.ProtoObject);
  2188. $core.addMethod(
  2189. $core.method({
  2190. selector: "isSameInstanceAs:",
  2191. protocol: 'comparing',
  2192. fn: function (anObject){
  2193. var self=this;
  2194. return $core.withContext(function($ctx1) {
  2195. var $1;
  2196. $1=self._identityHash();
  2197. $ctx1.sendIdx["identityHash"]=1;
  2198. return $recv($1).__eq($recv(anObject)._identityHash());
  2199. }, function($ctx1) {$ctx1.fill(self,"isSameInstanceAs:",{anObject:anObject},$globals.ProtoObject)});
  2200. },
  2201. args: ["anObject"],
  2202. source: "isSameInstanceAs: anObject\x0a\x09^ self identityHash = anObject identityHash",
  2203. referencedClasses: [],
  2204. messageSends: ["=", "identityHash"]
  2205. }),
  2206. $globals.ProtoObject);
  2207. $core.addMethod(
  2208. $core.method({
  2209. selector: "notNil",
  2210. protocol: 'testing',
  2211. fn: function (){
  2212. var self=this;
  2213. return $core.withContext(function($ctx1) {
  2214. return $recv(self._isNil())._not();
  2215. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2216. },
  2217. args: [],
  2218. source: "notNil\x0a\x09^ self isNil not",
  2219. referencedClasses: [],
  2220. messageSends: ["not", "isNil"]
  2221. }),
  2222. $globals.ProtoObject);
  2223. $core.addMethod(
  2224. $core.method({
  2225. selector: "perform:",
  2226. protocol: 'message handling',
  2227. fn: function (aString){
  2228. var self=this;
  2229. return $core.withContext(function($ctx1) {
  2230. return self._perform_withArguments_(aString,[]);
  2231. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2232. },
  2233. args: ["aString"],
  2234. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2235. referencedClasses: [],
  2236. messageSends: ["perform:withArguments:"]
  2237. }),
  2238. $globals.ProtoObject);
  2239. $core.addMethod(
  2240. $core.method({
  2241. selector: "perform:withArguments:",
  2242. protocol: 'message handling',
  2243. fn: function (aString,aCollection){
  2244. var self=this;
  2245. return $core.withContext(function($ctx1) {
  2246. return $core.send(self, aString._asJavaScriptMethodName(), aCollection);
  2247. return self;
  2248. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2249. },
  2250. args: ["aString", "aCollection"],
  2251. source: "perform: aString withArguments: aCollection\x0a\x09<return $core.send(self, aString._asJavaScriptMethodName(), aCollection)>",
  2252. referencedClasses: [],
  2253. messageSends: []
  2254. }),
  2255. $globals.ProtoObject);
  2256. $core.addMethod(
  2257. $core.method({
  2258. selector: "printOn:",
  2259. protocol: 'printing',
  2260. fn: function (aStream){
  2261. var self=this;
  2262. return $core.withContext(function($ctx1) {
  2263. var $5,$4,$3,$2,$1;
  2264. $5=self._class();
  2265. $ctx1.sendIdx["class"]=1;
  2266. $4=$recv($5)._name();
  2267. $ctx1.sendIdx["name"]=1;
  2268. $3=$recv($4)._first();
  2269. $2=$recv($3)._isVowel();
  2270. if($core.assert($2)){
  2271. $1="an ";
  2272. } else {
  2273. $1="a ";
  2274. };
  2275. $recv(aStream)._nextPutAll_($1);
  2276. $ctx1.sendIdx["nextPutAll:"]=1;
  2277. $recv(aStream)._nextPutAll_($recv(self._class())._name());
  2278. return self;
  2279. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  2280. },
  2281. args: ["aStream"],
  2282. 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",
  2283. referencedClasses: [],
  2284. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  2285. }),
  2286. $globals.ProtoObject);
  2287. $core.addMethod(
  2288. $core.method({
  2289. selector: "printString",
  2290. protocol: 'printing',
  2291. fn: function (){
  2292. var self=this;
  2293. return $core.withContext(function($ctx1) {
  2294. return $recv($globals.String)._streamContents_((function(str){
  2295. return $core.withContext(function($ctx2) {
  2296. return self._printOn_(str);
  2297. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  2298. }));
  2299. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  2300. },
  2301. args: [],
  2302. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  2303. referencedClasses: ["String"],
  2304. messageSends: ["streamContents:", "printOn:"]
  2305. }),
  2306. $globals.ProtoObject);
  2307. $core.addMethod(
  2308. $core.method({
  2309. selector: "yourself",
  2310. protocol: 'accessing',
  2311. fn: function (){
  2312. var self=this;
  2313. return self;
  2314. },
  2315. args: [],
  2316. source: "yourself\x0a\x09^ self",
  2317. referencedClasses: [],
  2318. messageSends: []
  2319. }),
  2320. $globals.ProtoObject);
  2321. $core.addMethod(
  2322. $core.method({
  2323. selector: "~=",
  2324. protocol: 'comparing',
  2325. fn: function (anObject){
  2326. var self=this;
  2327. return $core.withContext(function($ctx1) {
  2328. var $1;
  2329. $1=$recv(self.__eq(anObject)).__eq(false);
  2330. $ctx1.sendIdx["="]=1;
  2331. return $1;
  2332. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  2333. },
  2334. args: ["anObject"],
  2335. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  2336. referencedClasses: [],
  2337. messageSends: ["="]
  2338. }),
  2339. $globals.ProtoObject);
  2340. $core.addMethod(
  2341. $core.method({
  2342. selector: "~~",
  2343. protocol: 'comparing',
  2344. fn: function (anObject){
  2345. var self=this;
  2346. return $core.withContext(function($ctx1) {
  2347. return $recv(self.__eq_eq(anObject)).__eq(false);
  2348. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  2349. },
  2350. args: ["anObject"],
  2351. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  2352. referencedClasses: [],
  2353. messageSends: ["=", "=="]
  2354. }),
  2355. $globals.ProtoObject);
  2356. $core.addMethod(
  2357. $core.method({
  2358. selector: "initialize",
  2359. protocol: 'initialization',
  2360. fn: function (){
  2361. var self=this;
  2362. return self;
  2363. },
  2364. args: [],
  2365. source: "initialize",
  2366. referencedClasses: [],
  2367. messageSends: []
  2368. }),
  2369. $globals.ProtoObject.klass);
  2370. $core.addClass('Object', $globals.ProtoObject, [], 'Kernel-Objects');
  2371. $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.";
  2372. $core.addMethod(
  2373. $core.method({
  2374. selector: "->",
  2375. protocol: 'converting',
  2376. fn: function (anObject){
  2377. var self=this;
  2378. return $core.withContext(function($ctx1) {
  2379. return $recv($globals.Association)._key_value_(self,anObject);
  2380. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  2381. },
  2382. args: ["anObject"],
  2383. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  2384. referencedClasses: ["Association"],
  2385. messageSends: ["key:value:"]
  2386. }),
  2387. $globals.Object);
  2388. $core.addMethod(
  2389. $core.method({
  2390. selector: "asJSON",
  2391. protocol: 'converting',
  2392. fn: function (){
  2393. var self=this;
  2394. var variables;
  2395. return $core.withContext(function($ctx1) {
  2396. variables=$recv($globals.HashedCollection)._new();
  2397. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  2398. return $core.withContext(function($ctx2) {
  2399. return $recv(variables)._at_put_(each,$recv(self._instVarAt_(each))._asJSON());
  2400. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2401. }));
  2402. return variables;
  2403. }, function($ctx1) {$ctx1.fill(self,"asJSON",{variables:variables},$globals.Object)});
  2404. },
  2405. args: [],
  2406. 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",
  2407. referencedClasses: ["HashedCollection"],
  2408. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJSON", "instVarAt:"]
  2409. }),
  2410. $globals.Object);
  2411. $core.addMethod(
  2412. $core.method({
  2413. selector: "asJSONString",
  2414. protocol: 'converting',
  2415. fn: function (){
  2416. var self=this;
  2417. return $core.withContext(function($ctx1) {
  2418. return $recv($globals.JSON)._stringify_(self._asJSON());
  2419. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  2420. },
  2421. args: [],
  2422. source: "asJSONString\x0a\x09^ JSON stringify: self asJSON",
  2423. referencedClasses: ["JSON"],
  2424. messageSends: ["stringify:", "asJSON"]
  2425. }),
  2426. $globals.Object);
  2427. $core.addMethod(
  2428. $core.method({
  2429. selector: "asJavascript",
  2430. protocol: 'converting',
  2431. fn: function (){
  2432. var self=this;
  2433. return $core.withContext(function($ctx1) {
  2434. return self._asString();
  2435. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Object)});
  2436. },
  2437. args: [],
  2438. source: "asJavascript\x0a\x09^ self asString",
  2439. referencedClasses: [],
  2440. messageSends: ["asString"]
  2441. }),
  2442. $globals.Object);
  2443. $core.addMethod(
  2444. $core.method({
  2445. selector: "basicAt:",
  2446. protocol: 'accessing',
  2447. fn: function (aString){
  2448. var self=this;
  2449. return $core.withContext(function($ctx1) {
  2450. return self[aString];
  2451. return self;
  2452. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  2453. },
  2454. args: ["aString"],
  2455. source: "basicAt: aString\x0a\x09<return self[aString]>",
  2456. referencedClasses: [],
  2457. messageSends: []
  2458. }),
  2459. $globals.Object);
  2460. $core.addMethod(
  2461. $core.method({
  2462. selector: "basicAt:put:",
  2463. protocol: 'accessing',
  2464. fn: function (aString,anObject){
  2465. var self=this;
  2466. return $core.withContext(function($ctx1) {
  2467. return self[aString] = anObject;
  2468. return self;
  2469. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  2470. },
  2471. args: ["aString", "anObject"],
  2472. source: "basicAt: aString put: anObject\x0a\x09<return self[aString] = anObject>",
  2473. referencedClasses: [],
  2474. messageSends: []
  2475. }),
  2476. $globals.Object);
  2477. $core.addMethod(
  2478. $core.method({
  2479. selector: "basicDelete:",
  2480. protocol: 'accessing',
  2481. fn: function (aString){
  2482. var self=this;
  2483. return $core.withContext(function($ctx1) {
  2484. delete self[aString]; return aString;
  2485. return self;
  2486. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  2487. },
  2488. args: ["aString"],
  2489. source: "basicDelete: aString\x0a\x09<delete self[aString]; return aString>",
  2490. referencedClasses: [],
  2491. messageSends: []
  2492. }),
  2493. $globals.Object);
  2494. $core.addMethod(
  2495. $core.method({
  2496. selector: "basicPerform:",
  2497. protocol: 'message handling',
  2498. fn: function (aString){
  2499. var self=this;
  2500. return $core.withContext(function($ctx1) {
  2501. return self._basicPerform_withArguments_(aString,[]);
  2502. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  2503. },
  2504. args: ["aString"],
  2505. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  2506. referencedClasses: [],
  2507. messageSends: ["basicPerform:withArguments:"]
  2508. }),
  2509. $globals.Object);
  2510. $core.addMethod(
  2511. $core.method({
  2512. selector: "basicPerform:withArguments:",
  2513. protocol: 'message handling',
  2514. fn: function (aString,aCollection){
  2515. var self=this;
  2516. return $core.withContext(function($ctx1) {
  2517. return self[aString].apply(self, aCollection);;
  2518. return self;
  2519. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  2520. },
  2521. args: ["aString", "aCollection"],
  2522. source: "basicPerform: aString withArguments: aCollection\x0a\x09<return self[aString].apply(self, aCollection);>",
  2523. referencedClasses: [],
  2524. messageSends: []
  2525. }),
  2526. $globals.Object);
  2527. $core.addMethod(
  2528. $core.method({
  2529. selector: "browse",
  2530. protocol: 'browsing',
  2531. fn: function (){
  2532. var self=this;
  2533. return $core.withContext(function($ctx1) {
  2534. $recv($globals.Finder)._findClass_(self._class());
  2535. return self;
  2536. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  2537. },
  2538. args: [],
  2539. source: "browse\x0a\x09Finder findClass: self class",
  2540. referencedClasses: ["Finder"],
  2541. messageSends: ["findClass:", "class"]
  2542. }),
  2543. $globals.Object);
  2544. $core.addMethod(
  2545. $core.method({
  2546. selector: "copy",
  2547. protocol: 'copying',
  2548. fn: function (){
  2549. var self=this;
  2550. return $core.withContext(function($ctx1) {
  2551. return $recv(self._shallowCopy())._postCopy();
  2552. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  2553. },
  2554. args: [],
  2555. source: "copy\x0a\x09^ self shallowCopy postCopy",
  2556. referencedClasses: [],
  2557. messageSends: ["postCopy", "shallowCopy"]
  2558. }),
  2559. $globals.Object);
  2560. $core.addMethod(
  2561. $core.method({
  2562. selector: "deepCopy",
  2563. protocol: 'copying',
  2564. fn: function (){
  2565. var self=this;
  2566. return $core.withContext(function($ctx1) {
  2567. var copy = self.klass._new();
  2568. Object.keys(self).forEach(function (i) {
  2569. if(/^@.+/.test(i)) {
  2570. copy[i] = self[i]._deepCopy();
  2571. }
  2572. });
  2573. return copy;
  2574. ;
  2575. return self;
  2576. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  2577. },
  2578. args: [],
  2579. 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>",
  2580. referencedClasses: [],
  2581. messageSends: []
  2582. }),
  2583. $globals.Object);
  2584. $core.addMethod(
  2585. $core.method({
  2586. selector: "deprecatedAPI",
  2587. protocol: 'error handling',
  2588. fn: function (){
  2589. var self=this;
  2590. return $core.withContext(function($ctx1) {
  2591. var $1,$6,$5,$4,$8,$7,$3,$2;
  2592. $1=console;
  2593. $6=$core.getThisContext()._home();
  2594. $ctx1.sendIdx["home"]=1;
  2595. $5=$recv($6)._asString();
  2596. $ctx1.sendIdx["asString"]=1;
  2597. $4=$recv($5).__comma(" is deprecated! (in ");
  2598. $8=$recv($core.getThisContext()._home())._home();
  2599. $ctx1.sendIdx["home"]=2;
  2600. $7=$recv($8)._asString();
  2601. $3=$recv($4).__comma($7);
  2602. $ctx1.sendIdx[","]=2;
  2603. $2=$recv($3).__comma(")");
  2604. $ctx1.sendIdx[","]=1;
  2605. $recv($1)._warn_($2);
  2606. return self;
  2607. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  2608. },
  2609. args: [],
  2610. 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, ')'.",
  2611. referencedClasses: [],
  2612. messageSends: ["warn:", ",", "asString", "home"]
  2613. }),
  2614. $globals.Object);
  2615. $core.addMethod(
  2616. $core.method({
  2617. selector: "deprecatedAPI:",
  2618. protocol: 'error handling',
  2619. fn: function (aString){
  2620. var self=this;
  2621. return $core.withContext(function($ctx1) {
  2622. var $1,$6,$5,$4,$8,$7,$3,$2;
  2623. $1=console;
  2624. $6=$core.getThisContext()._home();
  2625. $ctx1.sendIdx["home"]=1;
  2626. $5=$recv($6)._asString();
  2627. $ctx1.sendIdx["asString"]=1;
  2628. $4=$recv($5).__comma(" is deprecated! (in ");
  2629. $8=$recv($core.getThisContext()._home())._home();
  2630. $ctx1.sendIdx["home"]=2;
  2631. $7=$recv($8)._asString();
  2632. $3=$recv($4).__comma($7);
  2633. $ctx1.sendIdx[","]=2;
  2634. $2=$recv($3).__comma(")");
  2635. $ctx1.sendIdx[","]=1;
  2636. $recv($1)._warn_($2);
  2637. $ctx1.sendIdx["warn:"]=1;
  2638. $recv(console)._warn_(aString);
  2639. return self;
  2640. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  2641. },
  2642. args: ["aString"],
  2643. 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",
  2644. referencedClasses: [],
  2645. messageSends: ["warn:", ",", "asString", "home"]
  2646. }),
  2647. $globals.Object);
  2648. $core.addMethod(
  2649. $core.method({
  2650. selector: "error:",
  2651. protocol: 'error handling',
  2652. fn: function (aString){
  2653. var self=this;
  2654. return $core.withContext(function($ctx1) {
  2655. $recv($globals.Error)._signal_(aString);
  2656. return self;
  2657. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  2658. },
  2659. args: ["aString"],
  2660. source: "error: aString\x0a\x09Error signal: aString",
  2661. referencedClasses: ["Error"],
  2662. messageSends: ["signal:"]
  2663. }),
  2664. $globals.Object);
  2665. $core.addMethod(
  2666. $core.method({
  2667. selector: "halt",
  2668. protocol: 'error handling',
  2669. fn: function (){
  2670. var self=this;
  2671. return $core.withContext(function($ctx1) {
  2672. $recv($globals.Halt)._signal();
  2673. return self;
  2674. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  2675. },
  2676. args: [],
  2677. source: "halt\x0a\x09Halt signal",
  2678. referencedClasses: ["Halt"],
  2679. messageSends: ["signal"]
  2680. }),
  2681. $globals.Object);
  2682. $core.addMethod(
  2683. $core.method({
  2684. selector: "in:",
  2685. protocol: 'evaluating',
  2686. fn: function (aValuable){
  2687. var self=this;
  2688. return $core.withContext(function($ctx1) {
  2689. return $recv(aValuable)._value_(self);
  2690. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  2691. },
  2692. args: ["aValuable"],
  2693. source: "in: aValuable\x0a\x09^ aValuable value: self",
  2694. referencedClasses: [],
  2695. messageSends: ["value:"]
  2696. }),
  2697. $globals.Object);
  2698. $core.addMethod(
  2699. $core.method({
  2700. selector: "isBehavior",
  2701. protocol: 'testing',
  2702. fn: function (){
  2703. var self=this;
  2704. return false;
  2705. },
  2706. args: [],
  2707. source: "isBehavior\x0a\x09^ false",
  2708. referencedClasses: [],
  2709. messageSends: []
  2710. }),
  2711. $globals.Object);
  2712. $core.addMethod(
  2713. $core.method({
  2714. selector: "isBoolean",
  2715. protocol: 'testing',
  2716. fn: function (){
  2717. var self=this;
  2718. return false;
  2719. },
  2720. args: [],
  2721. source: "isBoolean\x0a\x09^ false",
  2722. referencedClasses: [],
  2723. messageSends: []
  2724. }),
  2725. $globals.Object);
  2726. $core.addMethod(
  2727. $core.method({
  2728. selector: "isClass",
  2729. protocol: 'testing',
  2730. fn: function (){
  2731. var self=this;
  2732. return false;
  2733. },
  2734. args: [],
  2735. source: "isClass\x0a\x09^ false",
  2736. referencedClasses: [],
  2737. messageSends: []
  2738. }),
  2739. $globals.Object);
  2740. $core.addMethod(
  2741. $core.method({
  2742. selector: "isCompiledMethod",
  2743. protocol: 'testing',
  2744. fn: function (){
  2745. var self=this;
  2746. return false;
  2747. },
  2748. args: [],
  2749. source: "isCompiledMethod\x0a\x09^ false",
  2750. referencedClasses: [],
  2751. messageSends: []
  2752. }),
  2753. $globals.Object);
  2754. $core.addMethod(
  2755. $core.method({
  2756. selector: "isImmutable",
  2757. protocol: 'testing',
  2758. fn: function (){
  2759. var self=this;
  2760. return false;
  2761. },
  2762. args: [],
  2763. source: "isImmutable\x0a\x09^ false",
  2764. referencedClasses: [],
  2765. messageSends: []
  2766. }),
  2767. $globals.Object);
  2768. $core.addMethod(
  2769. $core.method({
  2770. selector: "isMemberOf:",
  2771. protocol: 'testing',
  2772. fn: function (aClass){
  2773. var self=this;
  2774. return $core.withContext(function($ctx1) {
  2775. return $recv(self._class()).__eq(aClass);
  2776. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  2777. },
  2778. args: ["aClass"],
  2779. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  2780. referencedClasses: [],
  2781. messageSends: ["=", "class"]
  2782. }),
  2783. $globals.Object);
  2784. $core.addMethod(
  2785. $core.method({
  2786. selector: "isMetaclass",
  2787. protocol: 'testing',
  2788. fn: function (){
  2789. var self=this;
  2790. return false;
  2791. },
  2792. args: [],
  2793. source: "isMetaclass\x0a\x09^ false",
  2794. referencedClasses: [],
  2795. messageSends: []
  2796. }),
  2797. $globals.Object);
  2798. $core.addMethod(
  2799. $core.method({
  2800. selector: "isNumber",
  2801. protocol: 'testing',
  2802. fn: function (){
  2803. var self=this;
  2804. return false;
  2805. },
  2806. args: [],
  2807. source: "isNumber\x0a\x09^ false",
  2808. referencedClasses: [],
  2809. messageSends: []
  2810. }),
  2811. $globals.Object);
  2812. $core.addMethod(
  2813. $core.method({
  2814. selector: "isPackage",
  2815. protocol: 'testing',
  2816. fn: function (){
  2817. var self=this;
  2818. return false;
  2819. },
  2820. args: [],
  2821. source: "isPackage\x0a\x09^ false",
  2822. referencedClasses: [],
  2823. messageSends: []
  2824. }),
  2825. $globals.Object);
  2826. $core.addMethod(
  2827. $core.method({
  2828. selector: "isParseFailure",
  2829. protocol: 'testing',
  2830. fn: function (){
  2831. var self=this;
  2832. return false;
  2833. },
  2834. args: [],
  2835. source: "isParseFailure\x0a\x09^ false",
  2836. referencedClasses: [],
  2837. messageSends: []
  2838. }),
  2839. $globals.Object);
  2840. $core.addMethod(
  2841. $core.method({
  2842. selector: "isString",
  2843. protocol: 'testing',
  2844. fn: function (){
  2845. var self=this;
  2846. return false;
  2847. },
  2848. args: [],
  2849. source: "isString\x0a\x09^ false",
  2850. referencedClasses: [],
  2851. messageSends: []
  2852. }),
  2853. $globals.Object);
  2854. $core.addMethod(
  2855. $core.method({
  2856. selector: "isSymbol",
  2857. protocol: 'testing',
  2858. fn: function (){
  2859. var self=this;
  2860. return false;
  2861. },
  2862. args: [],
  2863. source: "isSymbol\x0a\x09^ false",
  2864. referencedClasses: [],
  2865. messageSends: []
  2866. }),
  2867. $globals.Object);
  2868. $core.addMethod(
  2869. $core.method({
  2870. selector: "postCopy",
  2871. protocol: 'copying',
  2872. fn: function (){
  2873. var self=this;
  2874. return self;
  2875. },
  2876. args: [],
  2877. source: "postCopy",
  2878. referencedClasses: [],
  2879. messageSends: []
  2880. }),
  2881. $globals.Object);
  2882. $core.addMethod(
  2883. $core.method({
  2884. selector: "putOn:",
  2885. protocol: 'streaming',
  2886. fn: function (aStream){
  2887. var self=this;
  2888. return $core.withContext(function($ctx1) {
  2889. $recv(aStream)._nextPut_(self);
  2890. return self;
  2891. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  2892. },
  2893. args: ["aStream"],
  2894. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  2895. referencedClasses: [],
  2896. messageSends: ["nextPut:"]
  2897. }),
  2898. $globals.Object);
  2899. $core.addMethod(
  2900. $core.method({
  2901. selector: "respondsTo:",
  2902. protocol: 'testing',
  2903. fn: function (aSelector){
  2904. var self=this;
  2905. return $core.withContext(function($ctx1) {
  2906. return $recv(self._class())._canUnderstand_(aSelector);
  2907. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  2908. },
  2909. args: ["aSelector"],
  2910. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  2911. referencedClasses: [],
  2912. messageSends: ["canUnderstand:", "class"]
  2913. }),
  2914. $globals.Object);
  2915. $core.addMethod(
  2916. $core.method({
  2917. selector: "shallowCopy",
  2918. protocol: 'copying',
  2919. fn: function (){
  2920. var self=this;
  2921. return $core.withContext(function($ctx1) {
  2922. var copy = self.klass._new();
  2923. Object.keys(self).forEach(function(i) {
  2924. if(/^@.+/.test(i)) {
  2925. copy[i] = self[i];
  2926. }
  2927. });
  2928. return copy;
  2929. ;
  2930. return self;
  2931. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  2932. },
  2933. args: [],
  2934. 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>",
  2935. referencedClasses: [],
  2936. messageSends: []
  2937. }),
  2938. $globals.Object);
  2939. $core.addMethod(
  2940. $core.method({
  2941. selector: "shouldNotImplement",
  2942. protocol: 'error handling',
  2943. fn: function (){
  2944. var self=this;
  2945. return $core.withContext(function($ctx1) {
  2946. self._error_("This method should not be implemented in ".__comma($recv(self._class())._name()));
  2947. return self;
  2948. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  2949. },
  2950. args: [],
  2951. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  2952. referencedClasses: [],
  2953. messageSends: ["error:", ",", "name", "class"]
  2954. }),
  2955. $globals.Object);
  2956. $core.addMethod(
  2957. $core.method({
  2958. selector: "size",
  2959. protocol: 'accessing',
  2960. fn: function (){
  2961. var self=this;
  2962. return $core.withContext(function($ctx1) {
  2963. self._error_("Object not indexable");
  2964. return self;
  2965. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  2966. },
  2967. args: [],
  2968. source: "size\x0a\x09self error: 'Object not indexable'",
  2969. referencedClasses: [],
  2970. messageSends: ["error:"]
  2971. }),
  2972. $globals.Object);
  2973. $core.addMethod(
  2974. $core.method({
  2975. selector: "subclassResponsibility",
  2976. protocol: 'error handling',
  2977. fn: function (){
  2978. var self=this;
  2979. return $core.withContext(function($ctx1) {
  2980. self._error_("This method is a responsibility of a subclass");
  2981. return self;
  2982. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  2983. },
  2984. args: [],
  2985. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  2986. referencedClasses: [],
  2987. messageSends: ["error:"]
  2988. }),
  2989. $globals.Object);
  2990. $core.addMethod(
  2991. $core.method({
  2992. selector: "throw:",
  2993. protocol: 'error handling',
  2994. fn: function (anObject){
  2995. var self=this;
  2996. return $core.withContext(function($ctx1) {
  2997. throw anObject ;
  2998. return self;
  2999. }, function($ctx1) {$ctx1.fill(self,"throw:",{anObject:anObject},$globals.Object)});
  3000. },
  3001. args: ["anObject"],
  3002. source: "throw: anObject\x0a\x09< throw anObject >",
  3003. referencedClasses: [],
  3004. messageSends: []
  3005. }),
  3006. $globals.Object);
  3007. $core.addMethod(
  3008. $core.method({
  3009. selector: "value",
  3010. protocol: 'evaluating',
  3011. fn: function (){
  3012. var self=this;
  3013. return $core.withContext(function($ctx1) {
  3014. return self.valueOf();
  3015. return self;
  3016. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  3017. },
  3018. args: [],
  3019. source: "value\x0a\x09<return self.valueOf()>",
  3020. referencedClasses: [],
  3021. messageSends: []
  3022. }),
  3023. $globals.Object);
  3024. $core.addMethod(
  3025. $core.method({
  3026. selector: "accessorProtocolWith:",
  3027. protocol: 'helios',
  3028. fn: function (aGenerator){
  3029. var self=this;
  3030. return $core.withContext(function($ctx1) {
  3031. $recv(aGenerator)._accessorProtocolForObject();
  3032. return self;
  3033. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  3034. },
  3035. args: ["aGenerator"],
  3036. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3037. referencedClasses: [],
  3038. messageSends: ["accessorProtocolForObject"]
  3039. }),
  3040. $globals.Object.klass);
  3041. $core.addMethod(
  3042. $core.method({
  3043. selector: "accessorsSourceCodesWith:",
  3044. protocol: 'helios',
  3045. fn: function (aGenerator){
  3046. var self=this;
  3047. return $core.withContext(function($ctx1) {
  3048. $recv(aGenerator)._accessorsForObject();
  3049. return self;
  3050. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  3051. },
  3052. args: ["aGenerator"],
  3053. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3054. referencedClasses: [],
  3055. messageSends: ["accessorsForObject"]
  3056. }),
  3057. $globals.Object.klass);
  3058. $core.addMethod(
  3059. $core.method({
  3060. selector: "initialize",
  3061. protocol: 'initialization',
  3062. fn: function (){
  3063. var self=this;
  3064. return self;
  3065. },
  3066. args: [],
  3067. source: "initialize\x0a\x09\x22no op\x22",
  3068. referencedClasses: [],
  3069. messageSends: []
  3070. }),
  3071. $globals.Object.klass);
  3072. $core.addMethod(
  3073. $core.method({
  3074. selector: "initializeProtocolWith:",
  3075. protocol: 'helios',
  3076. fn: function (aGenerator){
  3077. var self=this;
  3078. return $core.withContext(function($ctx1) {
  3079. $recv(aGenerator)._initializeProtocolForObject();
  3080. return self;
  3081. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  3082. },
  3083. args: ["aGenerator"],
  3084. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3085. referencedClasses: [],
  3086. messageSends: ["initializeProtocolForObject"]
  3087. }),
  3088. $globals.Object.klass);
  3089. $core.addMethod(
  3090. $core.method({
  3091. selector: "initializeSourceCodesWith:",
  3092. protocol: 'helios',
  3093. fn: function (aGenerator){
  3094. var self=this;
  3095. return $core.withContext(function($ctx1) {
  3096. $recv(aGenerator)._initializeForObject();
  3097. return self;
  3098. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.klass)});
  3099. },
  3100. args: ["aGenerator"],
  3101. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3102. referencedClasses: [],
  3103. messageSends: ["initializeForObject"]
  3104. }),
  3105. $globals.Object.klass);
  3106. $core.addClass('Boolean', $globals.Object, [], 'Kernel-Objects');
  3107. $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: [ ... ]";
  3108. $core.addMethod(
  3109. $core.method({
  3110. selector: "&",
  3111. protocol: 'controlling',
  3112. fn: function (aBoolean){
  3113. var self=this;
  3114. return $core.withContext(function($ctx1) {
  3115. if(self == true) {
  3116. return aBoolean;
  3117. } else {
  3118. return false;
  3119. }
  3120. ;
  3121. return self;
  3122. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  3123. },
  3124. args: ["aBoolean"],
  3125. 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>",
  3126. referencedClasses: [],
  3127. messageSends: []
  3128. }),
  3129. $globals.Boolean);
  3130. $core.addMethod(
  3131. $core.method({
  3132. selector: "==",
  3133. protocol: 'comparing',
  3134. fn: function (aBoolean){
  3135. var self=this;
  3136. return $core.withContext(function($ctx1) {
  3137. if (typeof aBoolean === "boolean") return self.valueOf() === aBoolean;
  3138. else if (aBoolean != null && typeof aBoolean === "object") return self.valueOf() === aBoolean.valueOf();
  3139. else return false;;
  3140. return self;
  3141. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  3142. },
  3143. args: ["aBoolean"],
  3144. 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>",
  3145. referencedClasses: [],
  3146. messageSends: []
  3147. }),
  3148. $globals.Boolean);
  3149. $core.addMethod(
  3150. $core.method({
  3151. selector: "and:",
  3152. protocol: 'controlling',
  3153. fn: function (aBlock){
  3154. var self=this;
  3155. return $core.withContext(function($ctx1) {
  3156. var $1;
  3157. $1=self.__eq(true);
  3158. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  3159. return false;
  3160. }));
  3161. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  3162. },
  3163. args: ["aBlock"],
  3164. source: "and: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ false ]",
  3165. referencedClasses: [],
  3166. messageSends: ["ifTrue:ifFalse:", "="]
  3167. }),
  3168. $globals.Boolean);
  3169. $core.addMethod(
  3170. $core.method({
  3171. selector: "asBit",
  3172. protocol: 'converting',
  3173. fn: function (){
  3174. var self=this;
  3175. return $core.withContext(function($ctx1) {
  3176. if($core.assert(self)){
  3177. return (1);
  3178. } else {
  3179. return (0);
  3180. };
  3181. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  3182. },
  3183. args: [],
  3184. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3185. referencedClasses: [],
  3186. messageSends: ["ifTrue:ifFalse:"]
  3187. }),
  3188. $globals.Boolean);
  3189. $core.addMethod(
  3190. $core.method({
  3191. selector: "asJSON",
  3192. protocol: 'converting',
  3193. fn: function (){
  3194. var self=this;
  3195. return self;
  3196. },
  3197. args: [],
  3198. source: "asJSON\x0a\x09^ self",
  3199. referencedClasses: [],
  3200. messageSends: []
  3201. }),
  3202. $globals.Boolean);
  3203. $core.addMethod(
  3204. $core.method({
  3205. selector: "asString",
  3206. protocol: 'converting',
  3207. fn: function (){
  3208. var self=this;
  3209. return $core.withContext(function($ctx1) {
  3210. return self.toString() ;
  3211. return self;
  3212. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3213. },
  3214. args: [],
  3215. source: "asString\x0a\x09< return self.toString() >",
  3216. referencedClasses: [],
  3217. messageSends: []
  3218. }),
  3219. $globals.Boolean);
  3220. $core.addMethod(
  3221. $core.method({
  3222. selector: "deepCopy",
  3223. protocol: 'copying',
  3224. fn: function (){
  3225. var self=this;
  3226. return self;
  3227. },
  3228. args: [],
  3229. source: "deepCopy\x0a\x09^ self",
  3230. referencedClasses: [],
  3231. messageSends: []
  3232. }),
  3233. $globals.Boolean);
  3234. $core.addMethod(
  3235. $core.method({
  3236. selector: "ifFalse:",
  3237. protocol: 'controlling',
  3238. fn: function (aBlock){
  3239. var self=this;
  3240. return $core.withContext(function($ctx1) {
  3241. return self._ifTrue_ifFalse_((function(){
  3242. }),aBlock);
  3243. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3244. },
  3245. args: ["aBlock"],
  3246. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3247. referencedClasses: [],
  3248. messageSends: ["ifTrue:ifFalse:"]
  3249. }),
  3250. $globals.Boolean);
  3251. $core.addMethod(
  3252. $core.method({
  3253. selector: "ifFalse:ifTrue:",
  3254. protocol: 'controlling',
  3255. fn: function (aBlock,anotherBlock){
  3256. var self=this;
  3257. return $core.withContext(function($ctx1) {
  3258. return self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3259. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3260. },
  3261. args: ["aBlock", "anotherBlock"],
  3262. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3263. referencedClasses: [],
  3264. messageSends: ["ifTrue:ifFalse:"]
  3265. }),
  3266. $globals.Boolean);
  3267. $core.addMethod(
  3268. $core.method({
  3269. selector: "ifTrue:",
  3270. protocol: 'controlling',
  3271. fn: function (aBlock){
  3272. var self=this;
  3273. return $core.withContext(function($ctx1) {
  3274. return self._ifTrue_ifFalse_(aBlock,(function(){
  3275. }));
  3276. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3277. },
  3278. args: ["aBlock"],
  3279. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3280. referencedClasses: [],
  3281. messageSends: ["ifTrue:ifFalse:"]
  3282. }),
  3283. $globals.Boolean);
  3284. $core.addMethod(
  3285. $core.method({
  3286. selector: "ifTrue:ifFalse:",
  3287. protocol: 'controlling',
  3288. fn: function (aBlock,anotherBlock){
  3289. var self=this;
  3290. return $core.withContext(function($ctx1) {
  3291. if(self == true) {
  3292. return aBlock._value();
  3293. } else {
  3294. return anotherBlock._value();
  3295. }
  3296. ;
  3297. return self;
  3298. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3299. },
  3300. args: ["aBlock", "anotherBlock"],
  3301. 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>",
  3302. referencedClasses: [],
  3303. messageSends: []
  3304. }),
  3305. $globals.Boolean);
  3306. $core.addMethod(
  3307. $core.method({
  3308. selector: "isBoolean",
  3309. protocol: 'testing',
  3310. fn: function (){
  3311. var self=this;
  3312. return true;
  3313. },
  3314. args: [],
  3315. source: "isBoolean\x0a\x09^ true",
  3316. referencedClasses: [],
  3317. messageSends: []
  3318. }),
  3319. $globals.Boolean);
  3320. $core.addMethod(
  3321. $core.method({
  3322. selector: "isImmutable",
  3323. protocol: 'testing',
  3324. fn: function (){
  3325. var self=this;
  3326. return true;
  3327. },
  3328. args: [],
  3329. source: "isImmutable\x0a\x09^ true",
  3330. referencedClasses: [],
  3331. messageSends: []
  3332. }),
  3333. $globals.Boolean);
  3334. $core.addMethod(
  3335. $core.method({
  3336. selector: "not",
  3337. protocol: 'controlling',
  3338. fn: function (){
  3339. var self=this;
  3340. return $core.withContext(function($ctx1) {
  3341. return self.__eq(false);
  3342. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  3343. },
  3344. args: [],
  3345. source: "not\x0a\x09^ self = false",
  3346. referencedClasses: [],
  3347. messageSends: ["="]
  3348. }),
  3349. $globals.Boolean);
  3350. $core.addMethod(
  3351. $core.method({
  3352. selector: "or:",
  3353. protocol: 'controlling',
  3354. fn: function (aBlock){
  3355. var self=this;
  3356. return $core.withContext(function($ctx1) {
  3357. var $1;
  3358. $1=self.__eq(true);
  3359. return $recv($1)._ifTrue_ifFalse_((function(){
  3360. return true;
  3361. }),aBlock);
  3362. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  3363. },
  3364. args: ["aBlock"],
  3365. source: "or: aBlock\x0a\x09^ self = true\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: aBlock",
  3366. referencedClasses: [],
  3367. messageSends: ["ifTrue:ifFalse:", "="]
  3368. }),
  3369. $globals.Boolean);
  3370. $core.addMethod(
  3371. $core.method({
  3372. selector: "printOn:",
  3373. protocol: 'printing',
  3374. fn: function (aStream){
  3375. var self=this;
  3376. return $core.withContext(function($ctx1) {
  3377. $recv(aStream)._nextPutAll_(self._asString());
  3378. return self;
  3379. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  3380. },
  3381. args: ["aStream"],
  3382. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3383. referencedClasses: [],
  3384. messageSends: ["nextPutAll:", "asString"]
  3385. }),
  3386. $globals.Boolean);
  3387. $core.addMethod(
  3388. $core.method({
  3389. selector: "shallowCopy",
  3390. protocol: 'copying',
  3391. fn: function (){
  3392. var self=this;
  3393. return self;
  3394. },
  3395. args: [],
  3396. source: "shallowCopy\x0a\x09^ self",
  3397. referencedClasses: [],
  3398. messageSends: []
  3399. }),
  3400. $globals.Boolean);
  3401. $core.addMethod(
  3402. $core.method({
  3403. selector: "|",
  3404. protocol: 'controlling',
  3405. fn: function (aBoolean){
  3406. var self=this;
  3407. return $core.withContext(function($ctx1) {
  3408. if(self == true) {
  3409. return true;
  3410. } else {
  3411. return aBoolean;
  3412. }
  3413. ;
  3414. return self;
  3415. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  3416. },
  3417. args: ["aBoolean"],
  3418. 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>",
  3419. referencedClasses: [],
  3420. messageSends: []
  3421. }),
  3422. $globals.Boolean);
  3423. $core.addClass('Date', $globals.Object, [], 'Kernel-Objects');
  3424. $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.).";
  3425. $core.addMethod(
  3426. $core.method({
  3427. selector: "+",
  3428. protocol: 'arithmetic',
  3429. fn: function (aDate){
  3430. var self=this;
  3431. return $core.withContext(function($ctx1) {
  3432. return self + aDate;
  3433. return self;
  3434. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  3435. },
  3436. args: ["aDate"],
  3437. source: "+ aDate\x0a\x09<return self + aDate>",
  3438. referencedClasses: [],
  3439. messageSends: []
  3440. }),
  3441. $globals.Date);
  3442. $core.addMethod(
  3443. $core.method({
  3444. selector: "-",
  3445. protocol: 'arithmetic',
  3446. fn: function (aDate){
  3447. var self=this;
  3448. return $core.withContext(function($ctx1) {
  3449. return self - aDate;
  3450. return self;
  3451. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  3452. },
  3453. args: ["aDate"],
  3454. source: "- aDate\x0a\x09<return self - aDate>",
  3455. referencedClasses: [],
  3456. messageSends: []
  3457. }),
  3458. $globals.Date);
  3459. $core.addMethod(
  3460. $core.method({
  3461. selector: "<",
  3462. protocol: 'comparing',
  3463. fn: function (aDate){
  3464. var self=this;
  3465. return $core.withContext(function($ctx1) {
  3466. return self < aDate;
  3467. return self;
  3468. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  3469. },
  3470. args: ["aDate"],
  3471. source: "< aDate\x0a\x09<return self < aDate>",
  3472. referencedClasses: [],
  3473. messageSends: []
  3474. }),
  3475. $globals.Date);
  3476. $core.addMethod(
  3477. $core.method({
  3478. selector: "<=",
  3479. protocol: 'comparing',
  3480. fn: function (aDate){
  3481. var self=this;
  3482. return $core.withContext(function($ctx1) {
  3483. return self <= aDate;
  3484. return self;
  3485. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  3486. },
  3487. args: ["aDate"],
  3488. source: "<= aDate\x0a\x09<return self <= aDate>",
  3489. referencedClasses: [],
  3490. messageSends: []
  3491. }),
  3492. $globals.Date);
  3493. $core.addMethod(
  3494. $core.method({
  3495. selector: "=",
  3496. protocol: 'comparing',
  3497. fn: function (aDate){
  3498. var self=this;
  3499. return $core.withContext(function($ctx1) {
  3500. var $2,$1,$3;
  3501. $2=$recv(aDate)._class();
  3502. $ctx1.sendIdx["class"]=1;
  3503. $1=$recv($2).__eq_eq(self._class());
  3504. $ctx1.sendIdx["=="]=1;
  3505. return $recv($1)._and_((function(){
  3506. return $core.withContext(function($ctx2) {
  3507. $3=self._asMilliseconds();
  3508. $ctx2.sendIdx["asMilliseconds"]=1;
  3509. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  3510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3511. }));
  3512. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  3513. },
  3514. args: ["aDate"],
  3515. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  3516. referencedClasses: [],
  3517. messageSends: ["and:", "==", "class", "asMilliseconds"]
  3518. }),
  3519. $globals.Date);
  3520. $core.addMethod(
  3521. $core.method({
  3522. selector: ">",
  3523. protocol: 'comparing',
  3524. fn: function (aDate){
  3525. var self=this;
  3526. return $core.withContext(function($ctx1) {
  3527. return self > aDate;
  3528. return self;
  3529. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  3530. },
  3531. args: ["aDate"],
  3532. source: "> aDate\x0a\x09<return self >> aDate>",
  3533. referencedClasses: [],
  3534. messageSends: []
  3535. }),
  3536. $globals.Date);
  3537. $core.addMethod(
  3538. $core.method({
  3539. selector: ">=",
  3540. protocol: 'comparing',
  3541. fn: function (aDate){
  3542. var self=this;
  3543. return $core.withContext(function($ctx1) {
  3544. return self >= aDate;
  3545. return self;
  3546. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  3547. },
  3548. args: ["aDate"],
  3549. source: ">= aDate\x0a\x09<return self >>= aDate>",
  3550. referencedClasses: [],
  3551. messageSends: []
  3552. }),
  3553. $globals.Date);
  3554. $core.addMethod(
  3555. $core.method({
  3556. selector: "asDateString",
  3557. protocol: 'converting',
  3558. fn: function (){
  3559. var self=this;
  3560. return $core.withContext(function($ctx1) {
  3561. return self.toDateString();
  3562. return self;
  3563. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  3564. },
  3565. args: [],
  3566. source: "asDateString\x0a\x09<return self.toDateString()>",
  3567. referencedClasses: [],
  3568. messageSends: []
  3569. }),
  3570. $globals.Date);
  3571. $core.addMethod(
  3572. $core.method({
  3573. selector: "asLocaleString",
  3574. protocol: 'converting',
  3575. fn: function (){
  3576. var self=this;
  3577. return $core.withContext(function($ctx1) {
  3578. return self.toLocaleString();
  3579. return self;
  3580. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  3581. },
  3582. args: [],
  3583. source: "asLocaleString\x0a\x09<return self.toLocaleString()>",
  3584. referencedClasses: [],
  3585. messageSends: []
  3586. }),
  3587. $globals.Date);
  3588. $core.addMethod(
  3589. $core.method({
  3590. selector: "asMilliseconds",
  3591. protocol: 'converting',
  3592. fn: function (){
  3593. var self=this;
  3594. return $core.withContext(function($ctx1) {
  3595. return self._time();
  3596. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  3597. },
  3598. args: [],
  3599. source: "asMilliseconds\x0a\x09^ self time",
  3600. referencedClasses: [],
  3601. messageSends: ["time"]
  3602. }),
  3603. $globals.Date);
  3604. $core.addMethod(
  3605. $core.method({
  3606. selector: "asNumber",
  3607. protocol: 'converting',
  3608. fn: function (){
  3609. var self=this;
  3610. return $core.withContext(function($ctx1) {
  3611. return self._asMilliseconds();
  3612. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  3613. },
  3614. args: [],
  3615. source: "asNumber\x0a\x09^ self asMilliseconds",
  3616. referencedClasses: [],
  3617. messageSends: ["asMilliseconds"]
  3618. }),
  3619. $globals.Date);
  3620. $core.addMethod(
  3621. $core.method({
  3622. selector: "asString",
  3623. protocol: 'converting',
  3624. fn: function (){
  3625. var self=this;
  3626. return $core.withContext(function($ctx1) {
  3627. return self.toString();
  3628. return self;
  3629. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  3630. },
  3631. args: [],
  3632. source: "asString\x0a\x09<return self.toString()>",
  3633. referencedClasses: [],
  3634. messageSends: []
  3635. }),
  3636. $globals.Date);
  3637. $core.addMethod(
  3638. $core.method({
  3639. selector: "asTimeString",
  3640. protocol: 'converting',
  3641. fn: function (){
  3642. var self=this;
  3643. return $core.withContext(function($ctx1) {
  3644. return self.toTimeString();
  3645. return self;
  3646. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  3647. },
  3648. args: [],
  3649. source: "asTimeString\x0a\x09<return self.toTimeString()>",
  3650. referencedClasses: [],
  3651. messageSends: []
  3652. }),
  3653. $globals.Date);
  3654. $core.addMethod(
  3655. $core.method({
  3656. selector: "day",
  3657. protocol: 'accessing',
  3658. fn: function (){
  3659. var self=this;
  3660. return $core.withContext(function($ctx1) {
  3661. return self._dayOfWeek();
  3662. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  3663. },
  3664. args: [],
  3665. source: "day\x0a\x09^ self dayOfWeek",
  3666. referencedClasses: [],
  3667. messageSends: ["dayOfWeek"]
  3668. }),
  3669. $globals.Date);
  3670. $core.addMethod(
  3671. $core.method({
  3672. selector: "day:",
  3673. protocol: 'accessing',
  3674. fn: function (aNumber){
  3675. var self=this;
  3676. return $core.withContext(function($ctx1) {
  3677. self._dayOfWeek_(aNumber);
  3678. return self;
  3679. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  3680. },
  3681. args: ["aNumber"],
  3682. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  3683. referencedClasses: [],
  3684. messageSends: ["dayOfWeek:"]
  3685. }),
  3686. $globals.Date);
  3687. $core.addMethod(
  3688. $core.method({
  3689. selector: "dayOfMonth",
  3690. protocol: 'accessing',
  3691. fn: function (){
  3692. var self=this;
  3693. return $core.withContext(function($ctx1) {
  3694. return self.getDate();
  3695. return self;
  3696. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  3697. },
  3698. args: [],
  3699. source: "dayOfMonth\x0a\x09<return self.getDate()>",
  3700. referencedClasses: [],
  3701. messageSends: []
  3702. }),
  3703. $globals.Date);
  3704. $core.addMethod(
  3705. $core.method({
  3706. selector: "dayOfMonth:",
  3707. protocol: 'accessing',
  3708. fn: function (aNumber){
  3709. var self=this;
  3710. return $core.withContext(function($ctx1) {
  3711. self.setDate(aNumber);
  3712. return self;
  3713. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  3714. },
  3715. args: ["aNumber"],
  3716. source: "dayOfMonth: aNumber\x0a\x09<self.setDate(aNumber)>",
  3717. referencedClasses: [],
  3718. messageSends: []
  3719. }),
  3720. $globals.Date);
  3721. $core.addMethod(
  3722. $core.method({
  3723. selector: "dayOfWeek",
  3724. protocol: 'accessing',
  3725. fn: function (){
  3726. var self=this;
  3727. return $core.withContext(function($ctx1) {
  3728. return self.getDay() + 1;
  3729. return self;
  3730. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  3731. },
  3732. args: [],
  3733. source: "dayOfWeek\x0a\x09<return self.getDay() + 1>",
  3734. referencedClasses: [],
  3735. messageSends: []
  3736. }),
  3737. $globals.Date);
  3738. $core.addMethod(
  3739. $core.method({
  3740. selector: "dayOfWeek:",
  3741. protocol: 'accessing',
  3742. fn: function (aNumber){
  3743. var self=this;
  3744. return $core.withContext(function($ctx1) {
  3745. return self.setDay(aNumber - 1);
  3746. return self;
  3747. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  3748. },
  3749. args: ["aNumber"],
  3750. source: "dayOfWeek: aNumber\x0a\x09<return self.setDay(aNumber - 1)>",
  3751. referencedClasses: [],
  3752. messageSends: []
  3753. }),
  3754. $globals.Date);
  3755. $core.addMethod(
  3756. $core.method({
  3757. selector: "hours",
  3758. protocol: 'accessing',
  3759. fn: function (){
  3760. var self=this;
  3761. return $core.withContext(function($ctx1) {
  3762. return self.getHours();
  3763. return self;
  3764. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  3765. },
  3766. args: [],
  3767. source: "hours\x0a\x09<return self.getHours()>",
  3768. referencedClasses: [],
  3769. messageSends: []
  3770. }),
  3771. $globals.Date);
  3772. $core.addMethod(
  3773. $core.method({
  3774. selector: "hours:",
  3775. protocol: 'accessing',
  3776. fn: function (aNumber){
  3777. var self=this;
  3778. return $core.withContext(function($ctx1) {
  3779. self.setHours(aNumber);
  3780. return self;
  3781. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  3782. },
  3783. args: ["aNumber"],
  3784. source: "hours: aNumber\x0a\x09<self.setHours(aNumber)>",
  3785. referencedClasses: [],
  3786. messageSends: []
  3787. }),
  3788. $globals.Date);
  3789. $core.addMethod(
  3790. $core.method({
  3791. selector: "milliseconds",
  3792. protocol: 'accessing',
  3793. fn: function (){
  3794. var self=this;
  3795. return $core.withContext(function($ctx1) {
  3796. return self.getMilliseconds();
  3797. return self;
  3798. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  3799. },
  3800. args: [],
  3801. source: "milliseconds\x0a\x09<return self.getMilliseconds()>",
  3802. referencedClasses: [],
  3803. messageSends: []
  3804. }),
  3805. $globals.Date);
  3806. $core.addMethod(
  3807. $core.method({
  3808. selector: "milliseconds:",
  3809. protocol: 'accessing',
  3810. fn: function (aNumber){
  3811. var self=this;
  3812. return $core.withContext(function($ctx1) {
  3813. self.setMilliseconds(aNumber);
  3814. return self;
  3815. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  3816. },
  3817. args: ["aNumber"],
  3818. source: "milliseconds: aNumber\x0a\x09<self.setMilliseconds(aNumber)>",
  3819. referencedClasses: [],
  3820. messageSends: []
  3821. }),
  3822. $globals.Date);
  3823. $core.addMethod(
  3824. $core.method({
  3825. selector: "minutes",
  3826. protocol: 'accessing',
  3827. fn: function (){
  3828. var self=this;
  3829. return $core.withContext(function($ctx1) {
  3830. return self.getMinutes();
  3831. return self;
  3832. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  3833. },
  3834. args: [],
  3835. source: "minutes\x0a\x09<return self.getMinutes()>",
  3836. referencedClasses: [],
  3837. messageSends: []
  3838. }),
  3839. $globals.Date);
  3840. $core.addMethod(
  3841. $core.method({
  3842. selector: "minutes:",
  3843. protocol: 'accessing',
  3844. fn: function (aNumber){
  3845. var self=this;
  3846. return $core.withContext(function($ctx1) {
  3847. self.setMinutes(aNumber);
  3848. return self;
  3849. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  3850. },
  3851. args: ["aNumber"],
  3852. source: "minutes: aNumber\x0a\x09<self.setMinutes(aNumber)>",
  3853. referencedClasses: [],
  3854. messageSends: []
  3855. }),
  3856. $globals.Date);
  3857. $core.addMethod(
  3858. $core.method({
  3859. selector: "month",
  3860. protocol: 'accessing',
  3861. fn: function (){
  3862. var self=this;
  3863. return $core.withContext(function($ctx1) {
  3864. return self.getMonth() + 1;
  3865. return self;
  3866. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  3867. },
  3868. args: [],
  3869. source: "month\x0a\x09<return self.getMonth() + 1>",
  3870. referencedClasses: [],
  3871. messageSends: []
  3872. }),
  3873. $globals.Date);
  3874. $core.addMethod(
  3875. $core.method({
  3876. selector: "month:",
  3877. protocol: 'accessing',
  3878. fn: function (aNumber){
  3879. var self=this;
  3880. return $core.withContext(function($ctx1) {
  3881. self.setMonth(aNumber - 1);
  3882. return self;
  3883. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  3884. },
  3885. args: ["aNumber"],
  3886. source: "month: aNumber\x0a\x09<self.setMonth(aNumber - 1)>",
  3887. referencedClasses: [],
  3888. messageSends: []
  3889. }),
  3890. $globals.Date);
  3891. $core.addMethod(
  3892. $core.method({
  3893. selector: "printOn:",
  3894. protocol: 'printing',
  3895. fn: function (aStream){
  3896. var self=this;
  3897. return $core.withContext(function($ctx1) {
  3898. $recv(aStream)._nextPutAll_(self._asString());
  3899. return self;
  3900. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  3901. },
  3902. args: ["aStream"],
  3903. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  3904. referencedClasses: [],
  3905. messageSends: ["nextPutAll:", "asString"]
  3906. }),
  3907. $globals.Date);
  3908. $core.addMethod(
  3909. $core.method({
  3910. selector: "seconds",
  3911. protocol: 'accessing',
  3912. fn: function (){
  3913. var self=this;
  3914. return $core.withContext(function($ctx1) {
  3915. return self.getSeconds();
  3916. return self;
  3917. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  3918. },
  3919. args: [],
  3920. source: "seconds\x0a\x09<return self.getSeconds()>",
  3921. referencedClasses: [],
  3922. messageSends: []
  3923. }),
  3924. $globals.Date);
  3925. $core.addMethod(
  3926. $core.method({
  3927. selector: "seconds:",
  3928. protocol: 'accessing',
  3929. fn: function (aNumber){
  3930. var self=this;
  3931. return $core.withContext(function($ctx1) {
  3932. self.setSeconds(aNumber);
  3933. return self;
  3934. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  3935. },
  3936. args: ["aNumber"],
  3937. source: "seconds: aNumber\x0a\x09<self.setSeconds(aNumber)>",
  3938. referencedClasses: [],
  3939. messageSends: []
  3940. }),
  3941. $globals.Date);
  3942. $core.addMethod(
  3943. $core.method({
  3944. selector: "time",
  3945. protocol: 'accessing',
  3946. fn: function (){
  3947. var self=this;
  3948. return $core.withContext(function($ctx1) {
  3949. return self.getTime();
  3950. return self;
  3951. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  3952. },
  3953. args: [],
  3954. source: "time\x0a\x09<return self.getTime()>",
  3955. referencedClasses: [],
  3956. messageSends: []
  3957. }),
  3958. $globals.Date);
  3959. $core.addMethod(
  3960. $core.method({
  3961. selector: "time:",
  3962. protocol: 'accessing',
  3963. fn: function (aNumber){
  3964. var self=this;
  3965. return $core.withContext(function($ctx1) {
  3966. self.setTime(aNumber);
  3967. return self;
  3968. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  3969. },
  3970. args: ["aNumber"],
  3971. source: "time: aNumber\x0a\x09<self.setTime(aNumber)>",
  3972. referencedClasses: [],
  3973. messageSends: []
  3974. }),
  3975. $globals.Date);
  3976. $core.addMethod(
  3977. $core.method({
  3978. selector: "year",
  3979. protocol: 'accessing',
  3980. fn: function (){
  3981. var self=this;
  3982. return $core.withContext(function($ctx1) {
  3983. return self.getFullYear();
  3984. return self;
  3985. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  3986. },
  3987. args: [],
  3988. source: "year\x0a\x09<return self.getFullYear()>",
  3989. referencedClasses: [],
  3990. messageSends: []
  3991. }),
  3992. $globals.Date);
  3993. $core.addMethod(
  3994. $core.method({
  3995. selector: "year:",
  3996. protocol: 'accessing',
  3997. fn: function (aNumber){
  3998. var self=this;
  3999. return $core.withContext(function($ctx1) {
  4000. self.setFullYear(aNumber);
  4001. return self;
  4002. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  4003. },
  4004. args: ["aNumber"],
  4005. source: "year: aNumber\x0a\x09<self.setFullYear(aNumber)>",
  4006. referencedClasses: [],
  4007. messageSends: []
  4008. }),
  4009. $globals.Date);
  4010. $core.addMethod(
  4011. $core.method({
  4012. selector: "classTag",
  4013. protocol: 'accessing',
  4014. fn: function (){
  4015. var self=this;
  4016. return "magnitude";
  4017. },
  4018. args: [],
  4019. 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'",
  4020. referencedClasses: [],
  4021. messageSends: []
  4022. }),
  4023. $globals.Date.klass);
  4024. $core.addMethod(
  4025. $core.method({
  4026. selector: "fromMilliseconds:",
  4027. protocol: 'instance creation',
  4028. fn: function (aNumber){
  4029. var self=this;
  4030. return $core.withContext(function($ctx1) {
  4031. return self._new_(aNumber);
  4032. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.klass)});
  4033. },
  4034. args: ["aNumber"],
  4035. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4036. referencedClasses: [],
  4037. messageSends: ["new:"]
  4038. }),
  4039. $globals.Date.klass);
  4040. $core.addMethod(
  4041. $core.method({
  4042. selector: "fromSeconds:",
  4043. protocol: 'instance creation',
  4044. fn: function (aNumber){
  4045. var self=this;
  4046. return $core.withContext(function($ctx1) {
  4047. return self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4048. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.klass)});
  4049. },
  4050. args: ["aNumber"],
  4051. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4052. referencedClasses: [],
  4053. messageSends: ["fromMilliseconds:", "*"]
  4054. }),
  4055. $globals.Date.klass);
  4056. $core.addMethod(
  4057. $core.method({
  4058. selector: "fromString:",
  4059. protocol: 'instance creation',
  4060. fn: function (aString){
  4061. var self=this;
  4062. return $core.withContext(function($ctx1) {
  4063. return self._new_(aString);
  4064. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.klass)});
  4065. },
  4066. args: ["aString"],
  4067. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4068. referencedClasses: [],
  4069. messageSends: ["new:"]
  4070. }),
  4071. $globals.Date.klass);
  4072. $core.addMethod(
  4073. $core.method({
  4074. selector: "millisecondsToRun:",
  4075. protocol: 'instance creation',
  4076. fn: function (aBlock){
  4077. var self=this;
  4078. var t;
  4079. return $core.withContext(function($ctx1) {
  4080. t=$recv($globals.Date)._now();
  4081. $ctx1.sendIdx["now"]=1;
  4082. $recv(aBlock)._value();
  4083. return $recv($recv($globals.Date)._now()).__minus(t);
  4084. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.klass)});
  4085. },
  4086. args: ["aBlock"],
  4087. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4088. referencedClasses: ["Date"],
  4089. messageSends: ["now", "value", "-"]
  4090. }),
  4091. $globals.Date.klass);
  4092. $core.addMethod(
  4093. $core.method({
  4094. selector: "new:",
  4095. protocol: 'instance creation',
  4096. fn: function (anObject){
  4097. var self=this;
  4098. return $core.withContext(function($ctx1) {
  4099. return new Date(anObject);
  4100. return self;
  4101. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.klass)});
  4102. },
  4103. args: ["anObject"],
  4104. source: "new: anObject\x0a\x09<return new Date(anObject)>",
  4105. referencedClasses: [],
  4106. messageSends: []
  4107. }),
  4108. $globals.Date.klass);
  4109. $core.addMethod(
  4110. $core.method({
  4111. selector: "now",
  4112. protocol: 'instance creation',
  4113. fn: function (){
  4114. var self=this;
  4115. return $core.withContext(function($ctx1) {
  4116. return self._today();
  4117. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.klass)});
  4118. },
  4119. args: [],
  4120. source: "now\x0a\x09^ self today",
  4121. referencedClasses: [],
  4122. messageSends: ["today"]
  4123. }),
  4124. $globals.Date.klass);
  4125. $core.addMethod(
  4126. $core.method({
  4127. selector: "today",
  4128. protocol: 'instance creation',
  4129. fn: function (){
  4130. var self=this;
  4131. return $core.withContext(function($ctx1) {
  4132. return self._new();
  4133. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.klass)});
  4134. },
  4135. args: [],
  4136. source: "today\x0a\x09^ self new",
  4137. referencedClasses: [],
  4138. messageSends: ["new"]
  4139. }),
  4140. $globals.Date.klass);
  4141. $core.addClass('Number', $globals.Object, [], 'Kernel-Objects');
  4142. $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 ].";
  4143. $core.addMethod(
  4144. $core.method({
  4145. selector: "&",
  4146. protocol: 'converting',
  4147. fn: function (aNumber){
  4148. var self=this;
  4149. return $core.withContext(function($ctx1) {
  4150. return self & aNumber;
  4151. return self;
  4152. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  4153. },
  4154. args: ["aNumber"],
  4155. source: "& aNumber\x0a\x09<return self & aNumber>",
  4156. referencedClasses: [],
  4157. messageSends: []
  4158. }),
  4159. $globals.Number);
  4160. $core.addMethod(
  4161. $core.method({
  4162. selector: "*",
  4163. protocol: 'arithmetic',
  4164. fn: function (aNumber){
  4165. var self=this;
  4166. return $core.withContext(function($ctx1) {
  4167. return self * aNumber;
  4168. return self;
  4169. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  4170. },
  4171. args: ["aNumber"],
  4172. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self * aNumber>",
  4173. referencedClasses: [],
  4174. messageSends: []
  4175. }),
  4176. $globals.Number);
  4177. $core.addMethod(
  4178. $core.method({
  4179. selector: "**",
  4180. protocol: 'mathematical functions',
  4181. fn: function (exponent){
  4182. var self=this;
  4183. return $core.withContext(function($ctx1) {
  4184. return self._raisedTo_(exponent);
  4185. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4186. },
  4187. args: ["exponent"],
  4188. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4189. referencedClasses: [],
  4190. messageSends: ["raisedTo:"]
  4191. }),
  4192. $globals.Number);
  4193. $core.addMethod(
  4194. $core.method({
  4195. selector: "+",
  4196. protocol: 'arithmetic',
  4197. fn: function (aNumber){
  4198. var self=this;
  4199. return $core.withContext(function($ctx1) {
  4200. return self + aNumber;
  4201. return self;
  4202. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4203. },
  4204. args: ["aNumber"],
  4205. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self + aNumber>",
  4206. referencedClasses: [],
  4207. messageSends: []
  4208. }),
  4209. $globals.Number);
  4210. $core.addMethod(
  4211. $core.method({
  4212. selector: "-",
  4213. protocol: 'arithmetic',
  4214. fn: function (aNumber){
  4215. var self=this;
  4216. return $core.withContext(function($ctx1) {
  4217. return self - aNumber;
  4218. return self;
  4219. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4220. },
  4221. args: ["aNumber"],
  4222. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self - aNumber>",
  4223. referencedClasses: [],
  4224. messageSends: []
  4225. }),
  4226. $globals.Number);
  4227. $core.addMethod(
  4228. $core.method({
  4229. selector: "/",
  4230. protocol: 'arithmetic',
  4231. fn: function (aNumber){
  4232. var self=this;
  4233. return $core.withContext(function($ctx1) {
  4234. return self / aNumber;
  4235. return self;
  4236. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4237. },
  4238. args: ["aNumber"],
  4239. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self / aNumber>",
  4240. referencedClasses: [],
  4241. messageSends: []
  4242. }),
  4243. $globals.Number);
  4244. $core.addMethod(
  4245. $core.method({
  4246. selector: "//",
  4247. protocol: 'arithmetic',
  4248. fn: function (aNumber){
  4249. var self=this;
  4250. return $core.withContext(function($ctx1) {
  4251. return $recv(self.__slash(aNumber))._floor();
  4252. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4253. },
  4254. args: ["aNumber"],
  4255. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4256. referencedClasses: [],
  4257. messageSends: ["floor", "/"]
  4258. }),
  4259. $globals.Number);
  4260. $core.addMethod(
  4261. $core.method({
  4262. selector: "<",
  4263. protocol: 'comparing',
  4264. fn: function (aNumber){
  4265. var self=this;
  4266. return $core.withContext(function($ctx1) {
  4267. return self < aNumber;
  4268. return self;
  4269. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4270. },
  4271. args: ["aNumber"],
  4272. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self < aNumber>",
  4273. referencedClasses: [],
  4274. messageSends: []
  4275. }),
  4276. $globals.Number);
  4277. $core.addMethod(
  4278. $core.method({
  4279. selector: "<=",
  4280. protocol: 'comparing',
  4281. fn: function (aNumber){
  4282. var self=this;
  4283. return $core.withContext(function($ctx1) {
  4284. return self <= aNumber;
  4285. return self;
  4286. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  4287. },
  4288. args: ["aNumber"],
  4289. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self <= aNumber>",
  4290. referencedClasses: [],
  4291. messageSends: []
  4292. }),
  4293. $globals.Number);
  4294. $core.addMethod(
  4295. $core.method({
  4296. selector: "==",
  4297. protocol: 'comparing',
  4298. fn: function (aNumber){
  4299. var self=this;
  4300. return $core.withContext(function($ctx1) {
  4301. if (typeof aNumber === "number") return Number(self) === aNumber;
  4302. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  4303. else return false;;
  4304. return self;
  4305. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  4306. },
  4307. args: ["aNumber"],
  4308. 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>",
  4309. referencedClasses: [],
  4310. messageSends: []
  4311. }),
  4312. $globals.Number);
  4313. $core.addMethod(
  4314. $core.method({
  4315. selector: ">",
  4316. protocol: 'comparing',
  4317. fn: function (aNumber){
  4318. var self=this;
  4319. return $core.withContext(function($ctx1) {
  4320. return self > aNumber;
  4321. return self;
  4322. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  4323. },
  4324. args: ["aNumber"],
  4325. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >> aNumber>",
  4326. referencedClasses: [],
  4327. messageSends: []
  4328. }),
  4329. $globals.Number);
  4330. $core.addMethod(
  4331. $core.method({
  4332. selector: ">=",
  4333. protocol: 'comparing',
  4334. fn: function (aNumber){
  4335. var self=this;
  4336. return $core.withContext(function($ctx1) {
  4337. return self >= aNumber;
  4338. return self;
  4339. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  4340. },
  4341. args: ["aNumber"],
  4342. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<return self >>= aNumber>",
  4343. referencedClasses: [],
  4344. messageSends: []
  4345. }),
  4346. $globals.Number);
  4347. $core.addMethod(
  4348. $core.method({
  4349. selector: "@",
  4350. protocol: 'converting',
  4351. fn: function (aNumber){
  4352. var self=this;
  4353. return $core.withContext(function($ctx1) {
  4354. return $recv($globals.Point)._x_y_(self,aNumber);
  4355. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  4356. },
  4357. args: ["aNumber"],
  4358. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  4359. referencedClasses: ["Point"],
  4360. messageSends: ["x:y:"]
  4361. }),
  4362. $globals.Number);
  4363. $core.addMethod(
  4364. $core.method({
  4365. selector: "\x5c\x5c",
  4366. protocol: 'arithmetic',
  4367. fn: function (aNumber){
  4368. var self=this;
  4369. return $core.withContext(function($ctx1) {
  4370. return self % aNumber;
  4371. return self;
  4372. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  4373. },
  4374. args: ["aNumber"],
  4375. source: "\x5c\x5c aNumber\x0a\x09<return self % aNumber>",
  4376. referencedClasses: [],
  4377. messageSends: []
  4378. }),
  4379. $globals.Number);
  4380. $core.addMethod(
  4381. $core.method({
  4382. selector: "abs",
  4383. protocol: 'arithmetic',
  4384. fn: function (){
  4385. var self=this;
  4386. return $core.withContext(function($ctx1) {
  4387. return Math.abs(self);;
  4388. return self;
  4389. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  4390. },
  4391. args: [],
  4392. source: "abs\x0a\x09<return Math.abs(self);>",
  4393. referencedClasses: [],
  4394. messageSends: []
  4395. }),
  4396. $globals.Number);
  4397. $core.addMethod(
  4398. $core.method({
  4399. selector: "arcCos",
  4400. protocol: 'mathematical functions',
  4401. fn: function (){
  4402. var self=this;
  4403. return $core.withContext(function($ctx1) {
  4404. return Math.acos(self);;
  4405. return self;
  4406. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  4407. },
  4408. args: [],
  4409. source: "arcCos\x0a\x09<return Math.acos(self);>",
  4410. referencedClasses: [],
  4411. messageSends: []
  4412. }),
  4413. $globals.Number);
  4414. $core.addMethod(
  4415. $core.method({
  4416. selector: "arcSin",
  4417. protocol: 'mathematical functions',
  4418. fn: function (){
  4419. var self=this;
  4420. return $core.withContext(function($ctx1) {
  4421. return Math.asin(self);;
  4422. return self;
  4423. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  4424. },
  4425. args: [],
  4426. source: "arcSin\x0a\x09<return Math.asin(self);>",
  4427. referencedClasses: [],
  4428. messageSends: []
  4429. }),
  4430. $globals.Number);
  4431. $core.addMethod(
  4432. $core.method({
  4433. selector: "arcTan",
  4434. protocol: 'mathematical functions',
  4435. fn: function (){
  4436. var self=this;
  4437. return $core.withContext(function($ctx1) {
  4438. return Math.atan(self);;
  4439. return self;
  4440. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  4441. },
  4442. args: [],
  4443. source: "arcTan\x0a\x09<return Math.atan(self);>",
  4444. referencedClasses: [],
  4445. messageSends: []
  4446. }),
  4447. $globals.Number);
  4448. $core.addMethod(
  4449. $core.method({
  4450. selector: "asJSON",
  4451. protocol: 'converting',
  4452. fn: function (){
  4453. var self=this;
  4454. return self;
  4455. },
  4456. args: [],
  4457. source: "asJSON\x0a\x09^ self",
  4458. referencedClasses: [],
  4459. messageSends: []
  4460. }),
  4461. $globals.Number);
  4462. $core.addMethod(
  4463. $core.method({
  4464. selector: "asJavascript",
  4465. protocol: 'converting',
  4466. fn: function (){
  4467. var self=this;
  4468. return $core.withContext(function($ctx1) {
  4469. var $1;
  4470. $1=$recv("(".__comma(self._printString())).__comma(")");
  4471. $ctx1.sendIdx[","]=1;
  4472. return $1;
  4473. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Number)});
  4474. },
  4475. args: [],
  4476. source: "asJavascript\x0a\x09^ '(', self printString, ')'",
  4477. referencedClasses: [],
  4478. messageSends: [",", "printString"]
  4479. }),
  4480. $globals.Number);
  4481. $core.addMethod(
  4482. $core.method({
  4483. selector: "asNumber",
  4484. protocol: 'converting',
  4485. fn: function (){
  4486. var self=this;
  4487. return self;
  4488. },
  4489. args: [],
  4490. source: "asNumber\x0a\x09^ self",
  4491. referencedClasses: [],
  4492. messageSends: []
  4493. }),
  4494. $globals.Number);
  4495. $core.addMethod(
  4496. $core.method({
  4497. selector: "asPoint",
  4498. protocol: 'converting',
  4499. fn: function (){
  4500. var self=this;
  4501. return $core.withContext(function($ctx1) {
  4502. return $recv($globals.Point)._x_y_(self,self);
  4503. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  4504. },
  4505. args: [],
  4506. source: "asPoint\x0a\x09^ Point x: self y: self",
  4507. referencedClasses: ["Point"],
  4508. messageSends: ["x:y:"]
  4509. }),
  4510. $globals.Number);
  4511. $core.addMethod(
  4512. $core.method({
  4513. selector: "asString",
  4514. protocol: 'converting',
  4515. fn: function (){
  4516. var self=this;
  4517. return $core.withContext(function($ctx1) {
  4518. return String(self) ;
  4519. return self;
  4520. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  4521. },
  4522. args: [],
  4523. source: "asString\x0a\x09< return String(self) >",
  4524. referencedClasses: [],
  4525. messageSends: []
  4526. }),
  4527. $globals.Number);
  4528. $core.addMethod(
  4529. $core.method({
  4530. selector: "atRandom",
  4531. protocol: 'converting',
  4532. fn: function (){
  4533. var self=this;
  4534. return $core.withContext(function($ctx1) {
  4535. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  4536. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  4537. },
  4538. args: [],
  4539. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  4540. referencedClasses: ["Random"],
  4541. messageSends: ["+", "truncated", "*", "next", "new"]
  4542. }),
  4543. $globals.Number);
  4544. $core.addMethod(
  4545. $core.method({
  4546. selector: "ceiling",
  4547. protocol: 'converting',
  4548. fn: function (){
  4549. var self=this;
  4550. return $core.withContext(function($ctx1) {
  4551. return Math.ceil(self);;
  4552. return self;
  4553. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  4554. },
  4555. args: [],
  4556. source: "ceiling\x0a\x09<return Math.ceil(self);>",
  4557. referencedClasses: [],
  4558. messageSends: []
  4559. }),
  4560. $globals.Number);
  4561. $core.addMethod(
  4562. $core.method({
  4563. selector: "copy",
  4564. protocol: 'copying',
  4565. fn: function (){
  4566. var self=this;
  4567. return self;
  4568. },
  4569. args: [],
  4570. source: "copy\x0a\x09^ self",
  4571. referencedClasses: [],
  4572. messageSends: []
  4573. }),
  4574. $globals.Number);
  4575. $core.addMethod(
  4576. $core.method({
  4577. selector: "cos",
  4578. protocol: 'mathematical functions',
  4579. fn: function (){
  4580. var self=this;
  4581. return $core.withContext(function($ctx1) {
  4582. return Math.cos(self);;
  4583. return self;
  4584. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  4585. },
  4586. args: [],
  4587. source: "cos\x0a\x09<return Math.cos(self);>",
  4588. referencedClasses: [],
  4589. messageSends: []
  4590. }),
  4591. $globals.Number);
  4592. $core.addMethod(
  4593. $core.method({
  4594. selector: "deepCopy",
  4595. protocol: 'copying',
  4596. fn: function (){
  4597. var self=this;
  4598. return $core.withContext(function($ctx1) {
  4599. return self._copy();
  4600. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  4601. },
  4602. args: [],
  4603. source: "deepCopy\x0a\x09^ self copy",
  4604. referencedClasses: [],
  4605. messageSends: ["copy"]
  4606. }),
  4607. $globals.Number);
  4608. $core.addMethod(
  4609. $core.method({
  4610. selector: "even",
  4611. protocol: 'testing',
  4612. fn: function (){
  4613. var self=this;
  4614. return $core.withContext(function($ctx1) {
  4615. return (0).__eq(self.__backslash_backslash((2)));
  4616. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  4617. },
  4618. args: [],
  4619. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  4620. referencedClasses: [],
  4621. messageSends: ["=", "\x5c\x5c"]
  4622. }),
  4623. $globals.Number);
  4624. $core.addMethod(
  4625. $core.method({
  4626. selector: "floor",
  4627. protocol: 'converting',
  4628. fn: function (){
  4629. var self=this;
  4630. return $core.withContext(function($ctx1) {
  4631. return Math.floor(self);;
  4632. return self;
  4633. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  4634. },
  4635. args: [],
  4636. source: "floor\x0a\x09<return Math.floor(self);>",
  4637. referencedClasses: [],
  4638. messageSends: []
  4639. }),
  4640. $globals.Number);
  4641. $core.addMethod(
  4642. $core.method({
  4643. selector: "isImmutable",
  4644. protocol: 'testing',
  4645. fn: function (){
  4646. var self=this;
  4647. return true;
  4648. },
  4649. args: [],
  4650. source: "isImmutable\x0a\x09^ true",
  4651. referencedClasses: [],
  4652. messageSends: []
  4653. }),
  4654. $globals.Number);
  4655. $core.addMethod(
  4656. $core.method({
  4657. selector: "isNumber",
  4658. protocol: 'testing',
  4659. fn: function (){
  4660. var self=this;
  4661. return true;
  4662. },
  4663. args: [],
  4664. source: "isNumber\x0a\x09^ true",
  4665. referencedClasses: [],
  4666. messageSends: []
  4667. }),
  4668. $globals.Number);
  4669. $core.addMethod(
  4670. $core.method({
  4671. selector: "isZero",
  4672. protocol: 'testing',
  4673. fn: function (){
  4674. var self=this;
  4675. return $core.withContext(function($ctx1) {
  4676. return self.__eq((0));
  4677. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  4678. },
  4679. args: [],
  4680. source: "isZero\x0a\x09^ self = 0",
  4681. referencedClasses: [],
  4682. messageSends: ["="]
  4683. }),
  4684. $globals.Number);
  4685. $core.addMethod(
  4686. $core.method({
  4687. selector: "ln",
  4688. protocol: 'mathematical functions',
  4689. fn: function (){
  4690. var self=this;
  4691. return $core.withContext(function($ctx1) {
  4692. return Math.log(self);;
  4693. return self;
  4694. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  4695. },
  4696. args: [],
  4697. source: "ln\x0a\x09<return Math.log(self);>",
  4698. referencedClasses: [],
  4699. messageSends: []
  4700. }),
  4701. $globals.Number);
  4702. $core.addMethod(
  4703. $core.method({
  4704. selector: "log",
  4705. protocol: 'mathematical functions',
  4706. fn: function (){
  4707. var self=this;
  4708. return $core.withContext(function($ctx1) {
  4709. return Math.log(self) / Math.LN10;;
  4710. return self;
  4711. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  4712. },
  4713. args: [],
  4714. source: "log\x0a\x09<return Math.log(self) / Math.LN10;>",
  4715. referencedClasses: [],
  4716. messageSends: []
  4717. }),
  4718. $globals.Number);
  4719. $core.addMethod(
  4720. $core.method({
  4721. selector: "log:",
  4722. protocol: 'mathematical functions',
  4723. fn: function (aNumber){
  4724. var self=this;
  4725. return $core.withContext(function($ctx1) {
  4726. return Math.log(self) / Math.log(aNumber);;
  4727. return self;
  4728. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  4729. },
  4730. args: ["aNumber"],
  4731. source: "log: aNumber\x0a\x09<return Math.log(self) / Math.log(aNumber);>",
  4732. referencedClasses: [],
  4733. messageSends: []
  4734. }),
  4735. $globals.Number);
  4736. $core.addMethod(
  4737. $core.method({
  4738. selector: "max:",
  4739. protocol: 'arithmetic',
  4740. fn: function (aNumber){
  4741. var self=this;
  4742. return $core.withContext(function($ctx1) {
  4743. return Math.max(self, aNumber);;
  4744. return self;
  4745. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  4746. },
  4747. args: ["aNumber"],
  4748. source: "max: aNumber\x0a\x09<return Math.max(self, aNumber);>",
  4749. referencedClasses: [],
  4750. messageSends: []
  4751. }),
  4752. $globals.Number);
  4753. $core.addMethod(
  4754. $core.method({
  4755. selector: "min:",
  4756. protocol: 'arithmetic',
  4757. fn: function (aNumber){
  4758. var self=this;
  4759. return $core.withContext(function($ctx1) {
  4760. return Math.min(self, aNumber);;
  4761. return self;
  4762. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  4763. },
  4764. args: ["aNumber"],
  4765. source: "min: aNumber\x0a\x09<return Math.min(self, aNumber);>",
  4766. referencedClasses: [],
  4767. messageSends: []
  4768. }),
  4769. $globals.Number);
  4770. $core.addMethod(
  4771. $core.method({
  4772. selector: "negated",
  4773. protocol: 'arithmetic',
  4774. fn: function (){
  4775. var self=this;
  4776. return $core.withContext(function($ctx1) {
  4777. return (0).__minus(self);
  4778. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  4779. },
  4780. args: [],
  4781. source: "negated\x0a\x09^ 0 - self",
  4782. referencedClasses: [],
  4783. messageSends: ["-"]
  4784. }),
  4785. $globals.Number);
  4786. $core.addMethod(
  4787. $core.method({
  4788. selector: "negative",
  4789. protocol: 'testing',
  4790. fn: function (){
  4791. var self=this;
  4792. return $core.withContext(function($ctx1) {
  4793. return self.__lt((0));
  4794. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  4795. },
  4796. args: [],
  4797. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  4798. referencedClasses: [],
  4799. messageSends: ["<"]
  4800. }),
  4801. $globals.Number);
  4802. $core.addMethod(
  4803. $core.method({
  4804. selector: "odd",
  4805. protocol: 'testing',
  4806. fn: function (){
  4807. var self=this;
  4808. return $core.withContext(function($ctx1) {
  4809. return $recv(self._even())._not();
  4810. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  4811. },
  4812. args: [],
  4813. source: "odd\x0a\x09^ self even not",
  4814. referencedClasses: [],
  4815. messageSends: ["not", "even"]
  4816. }),
  4817. $globals.Number);
  4818. $core.addMethod(
  4819. $core.method({
  4820. selector: "positive",
  4821. protocol: 'testing',
  4822. fn: function (){
  4823. var self=this;
  4824. return $core.withContext(function($ctx1) {
  4825. return self.__gt_eq((0));
  4826. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  4827. },
  4828. args: [],
  4829. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  4830. referencedClasses: [],
  4831. messageSends: [">="]
  4832. }),
  4833. $globals.Number);
  4834. $core.addMethod(
  4835. $core.method({
  4836. selector: "printOn:",
  4837. protocol: 'printing',
  4838. fn: function (aStream){
  4839. var self=this;
  4840. return $core.withContext(function($ctx1) {
  4841. $recv(aStream)._nextPutAll_(self._asString());
  4842. return self;
  4843. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  4844. },
  4845. args: ["aStream"],
  4846. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4847. referencedClasses: [],
  4848. messageSends: ["nextPutAll:", "asString"]
  4849. }),
  4850. $globals.Number);
  4851. $core.addMethod(
  4852. $core.method({
  4853. selector: "printShowingDecimalPlaces:",
  4854. protocol: 'printing',
  4855. fn: function (placesDesired){
  4856. var self=this;
  4857. return $core.withContext(function($ctx1) {
  4858. return self.toFixed(placesDesired);
  4859. return self;
  4860. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  4861. },
  4862. args: ["placesDesired"],
  4863. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<return self.toFixed(placesDesired)>",
  4864. referencedClasses: [],
  4865. messageSends: []
  4866. }),
  4867. $globals.Number);
  4868. $core.addMethod(
  4869. $core.method({
  4870. selector: "raisedTo:",
  4871. protocol: 'mathematical functions',
  4872. fn: function (exponent){
  4873. var self=this;
  4874. return $core.withContext(function($ctx1) {
  4875. return Math.pow(self, exponent);;
  4876. return self;
  4877. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  4878. },
  4879. args: ["exponent"],
  4880. source: "raisedTo: exponent\x0a\x09<return Math.pow(self, exponent);>",
  4881. referencedClasses: [],
  4882. messageSends: []
  4883. }),
  4884. $globals.Number);
  4885. $core.addMethod(
  4886. $core.method({
  4887. selector: "rounded",
  4888. protocol: 'converting',
  4889. fn: function (){
  4890. var self=this;
  4891. return $core.withContext(function($ctx1) {
  4892. return Math.round(self);;
  4893. return self;
  4894. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  4895. },
  4896. args: [],
  4897. source: "rounded\x0a\x09<return Math.round(self);>",
  4898. referencedClasses: [],
  4899. messageSends: []
  4900. }),
  4901. $globals.Number);
  4902. $core.addMethod(
  4903. $core.method({
  4904. selector: "sign",
  4905. protocol: 'mathematical functions',
  4906. fn: function (){
  4907. var self=this;
  4908. return $core.withContext(function($ctx1) {
  4909. var $1,$2;
  4910. $1=self._isZero();
  4911. if($core.assert($1)){
  4912. return (0);
  4913. };
  4914. $2=self._positive();
  4915. if($core.assert($2)){
  4916. return (1);
  4917. } else {
  4918. return (-1);
  4919. };
  4920. return self;
  4921. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  4922. },
  4923. args: [],
  4924. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  4925. referencedClasses: [],
  4926. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  4927. }),
  4928. $globals.Number);
  4929. $core.addMethod(
  4930. $core.method({
  4931. selector: "sin",
  4932. protocol: 'mathematical functions',
  4933. fn: function (){
  4934. var self=this;
  4935. return $core.withContext(function($ctx1) {
  4936. return Math.sin(self);;
  4937. return self;
  4938. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  4939. },
  4940. args: [],
  4941. source: "sin\x0a\x09<return Math.sin(self);>",
  4942. referencedClasses: [],
  4943. messageSends: []
  4944. }),
  4945. $globals.Number);
  4946. $core.addMethod(
  4947. $core.method({
  4948. selector: "sqrt",
  4949. protocol: 'mathematical functions',
  4950. fn: function (){
  4951. var self=this;
  4952. return $core.withContext(function($ctx1) {
  4953. return Math.sqrt(self);
  4954. return self;
  4955. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  4956. },
  4957. args: [],
  4958. source: "sqrt\x0a\x09<return Math.sqrt(self)>",
  4959. referencedClasses: [],
  4960. messageSends: []
  4961. }),
  4962. $globals.Number);
  4963. $core.addMethod(
  4964. $core.method({
  4965. selector: "squared",
  4966. protocol: 'mathematical functions',
  4967. fn: function (){
  4968. var self=this;
  4969. return $core.withContext(function($ctx1) {
  4970. return self.__star(self);
  4971. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  4972. },
  4973. args: [],
  4974. source: "squared\x0a\x09^ self * self",
  4975. referencedClasses: [],
  4976. messageSends: ["*"]
  4977. }),
  4978. $globals.Number);
  4979. $core.addMethod(
  4980. $core.method({
  4981. selector: "tan",
  4982. protocol: 'mathematical functions',
  4983. fn: function (){
  4984. var self=this;
  4985. return $core.withContext(function($ctx1) {
  4986. return Math.tan(self);;
  4987. return self;
  4988. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  4989. },
  4990. args: [],
  4991. source: "tan\x0a\x09<return Math.tan(self);>",
  4992. referencedClasses: [],
  4993. messageSends: []
  4994. }),
  4995. $globals.Number);
  4996. $core.addMethod(
  4997. $core.method({
  4998. selector: "timesRepeat:",
  4999. protocol: 'enumerating',
  5000. fn: function (aBlock){
  5001. var self=this;
  5002. var count;
  5003. return $core.withContext(function($ctx1) {
  5004. count=(1);
  5005. $recv((function(){
  5006. return $core.withContext(function($ctx2) {
  5007. return $recv(count).__gt(self);
  5008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5009. }))._whileFalse_((function(){
  5010. return $core.withContext(function($ctx2) {
  5011. $recv(aBlock)._value();
  5012. count=$recv(count).__plus((1));
  5013. return count;
  5014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5015. }));
  5016. return self;
  5017. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  5018. },
  5019. args: ["aBlock"],
  5020. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5021. referencedClasses: [],
  5022. messageSends: ["whileFalse:", ">", "value", "+"]
  5023. }),
  5024. $globals.Number);
  5025. $core.addMethod(
  5026. $core.method({
  5027. selector: "to:",
  5028. protocol: 'converting',
  5029. fn: function (aNumber){
  5030. var self=this;
  5031. var array,first,last,count;
  5032. return $core.withContext(function($ctx1) {
  5033. first=self._truncated();
  5034. $ctx1.sendIdx["truncated"]=1;
  5035. last=$recv($recv(aNumber)._truncated()).__plus((1));
  5036. $ctx1.sendIdx["+"]=1;
  5037. count=(1);
  5038. array=$recv($globals.Array)._new();
  5039. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  5040. return $core.withContext(function($ctx2) {
  5041. $recv(array)._at_put_(count,first);
  5042. count=$recv(count).__plus((1));
  5043. $ctx2.sendIdx["+"]=2;
  5044. count;
  5045. first=$recv(first).__plus((1));
  5046. return first;
  5047. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5048. }));
  5049. return array;
  5050. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  5051. },
  5052. args: ["aNumber"],
  5053. 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",
  5054. referencedClasses: ["Array"],
  5055. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5056. }),
  5057. $globals.Number);
  5058. $core.addMethod(
  5059. $core.method({
  5060. selector: "to:by:",
  5061. protocol: 'converting',
  5062. fn: function (stop,step){
  5063. var self=this;
  5064. var array,value,pos;
  5065. return $core.withContext(function($ctx1) {
  5066. var $1,$2;
  5067. value=self;
  5068. array=$recv($globals.Array)._new();
  5069. pos=(1);
  5070. $1=$recv(step).__eq((0));
  5071. if($core.assert($1)){
  5072. self._error_("step must be non-zero");
  5073. };
  5074. $2=$recv(step).__lt((0));
  5075. if($core.assert($2)){
  5076. $recv((function(){
  5077. return $core.withContext(function($ctx2) {
  5078. return $recv(value).__gt_eq(stop);
  5079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5080. }))._whileTrue_((function(){
  5081. return $core.withContext(function($ctx2) {
  5082. $recv(array)._at_put_(pos,value);
  5083. $ctx2.sendIdx["at:put:"]=1;
  5084. pos=$recv(pos).__plus((1));
  5085. $ctx2.sendIdx["+"]=1;
  5086. pos;
  5087. value=$recv(value).__plus(step);
  5088. $ctx2.sendIdx["+"]=2;
  5089. return value;
  5090. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5091. }));
  5092. $ctx1.sendIdx["whileTrue:"]=1;
  5093. } else {
  5094. $recv((function(){
  5095. return $core.withContext(function($ctx2) {
  5096. return $recv(value).__lt_eq(stop);
  5097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5098. }))._whileTrue_((function(){
  5099. return $core.withContext(function($ctx2) {
  5100. $recv(array)._at_put_(pos,value);
  5101. pos=$recv(pos).__plus((1));
  5102. $ctx2.sendIdx["+"]=3;
  5103. pos;
  5104. value=$recv(value).__plus(step);
  5105. return value;
  5106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5107. }));
  5108. };
  5109. return array;
  5110. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  5111. },
  5112. args: ["stop", "step"],
  5113. 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",
  5114. referencedClasses: ["Array"],
  5115. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  5116. }),
  5117. $globals.Number);
  5118. $core.addMethod(
  5119. $core.method({
  5120. selector: "to:by:do:",
  5121. protocol: 'enumerating',
  5122. fn: function (stop,step,aBlock){
  5123. var self=this;
  5124. var value;
  5125. return $core.withContext(function($ctx1) {
  5126. var $1,$2;
  5127. value=self;
  5128. $1=$recv(step).__eq((0));
  5129. if($core.assert($1)){
  5130. self._error_("step must be non-zero");
  5131. };
  5132. $2=$recv(step).__lt((0));
  5133. if($core.assert($2)){
  5134. $recv((function(){
  5135. return $core.withContext(function($ctx2) {
  5136. return $recv(value).__gt_eq(stop);
  5137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5138. }))._whileTrue_((function(){
  5139. return $core.withContext(function($ctx2) {
  5140. $recv(aBlock)._value_(value);
  5141. $ctx2.sendIdx["value:"]=1;
  5142. value=$recv(value).__plus(step);
  5143. $ctx2.sendIdx["+"]=1;
  5144. return value;
  5145. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5146. }));
  5147. $ctx1.sendIdx["whileTrue:"]=1;
  5148. } else {
  5149. $recv((function(){
  5150. return $core.withContext(function($ctx2) {
  5151. return $recv(value).__lt_eq(stop);
  5152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5153. }))._whileTrue_((function(){
  5154. return $core.withContext(function($ctx2) {
  5155. $recv(aBlock)._value_(value);
  5156. value=$recv(value).__plus(step);
  5157. return value;
  5158. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5159. }));
  5160. };
  5161. return self;
  5162. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  5163. },
  5164. args: ["stop", "step", "aBlock"],
  5165. 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 ]]",
  5166. referencedClasses: [],
  5167. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  5168. }),
  5169. $globals.Number);
  5170. $core.addMethod(
  5171. $core.method({
  5172. selector: "to:do:",
  5173. protocol: 'enumerating',
  5174. fn: function (stop,aBlock){
  5175. var self=this;
  5176. var nextValue;
  5177. return $core.withContext(function($ctx1) {
  5178. nextValue=self;
  5179. $recv((function(){
  5180. return $core.withContext(function($ctx2) {
  5181. return $recv(nextValue).__lt_eq(stop);
  5182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5183. }))._whileTrue_((function(){
  5184. return $core.withContext(function($ctx2) {
  5185. $recv(aBlock)._value_(nextValue);
  5186. nextValue=$recv(nextValue).__plus((1));
  5187. return nextValue;
  5188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5189. }));
  5190. return self;
  5191. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  5192. },
  5193. args: ["stop", "aBlock"],
  5194. 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 ]",
  5195. referencedClasses: [],
  5196. messageSends: ["whileTrue:", "<=", "value:", "+"]
  5197. }),
  5198. $globals.Number);
  5199. $core.addMethod(
  5200. $core.method({
  5201. selector: "truncated",
  5202. protocol: 'converting',
  5203. fn: function (){
  5204. var self=this;
  5205. return $core.withContext(function($ctx1) {
  5206. if(self >= 0) {
  5207. return Math.floor(self);
  5208. } else {
  5209. return Math.floor(self * (-1)) * (-1);
  5210. };
  5211. ;
  5212. return self;
  5213. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  5214. },
  5215. args: [],
  5216. 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>",
  5217. referencedClasses: [],
  5218. messageSends: []
  5219. }),
  5220. $globals.Number);
  5221. $core.addMethod(
  5222. $core.method({
  5223. selector: "|",
  5224. protocol: 'converting',
  5225. fn: function (aNumber){
  5226. var self=this;
  5227. return $core.withContext(function($ctx1) {
  5228. return self | aNumber;
  5229. return self;
  5230. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  5231. },
  5232. args: ["aNumber"],
  5233. source: "| aNumber\x0a\x09<return self | aNumber>",
  5234. referencedClasses: [],
  5235. messageSends: []
  5236. }),
  5237. $globals.Number);
  5238. $core.addMethod(
  5239. $core.method({
  5240. selector: "classTag",
  5241. protocol: 'accessing',
  5242. fn: function (){
  5243. var self=this;
  5244. return "magnitude";
  5245. },
  5246. args: [],
  5247. 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'",
  5248. referencedClasses: [],
  5249. messageSends: []
  5250. }),
  5251. $globals.Number.klass);
  5252. $core.addMethod(
  5253. $core.method({
  5254. selector: "e",
  5255. protocol: 'instance creation',
  5256. fn: function (){
  5257. var self=this;
  5258. return $core.withContext(function($ctx1) {
  5259. return Math.E;;
  5260. return self;
  5261. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.klass)});
  5262. },
  5263. args: [],
  5264. source: "e\x0a\x09<return Math.E;>",
  5265. referencedClasses: [],
  5266. messageSends: []
  5267. }),
  5268. $globals.Number.klass);
  5269. $core.addMethod(
  5270. $core.method({
  5271. selector: "pi",
  5272. protocol: 'instance creation',
  5273. fn: function (){
  5274. var self=this;
  5275. return $core.withContext(function($ctx1) {
  5276. return Math.PI;
  5277. return self;
  5278. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.klass)});
  5279. },
  5280. args: [],
  5281. source: "pi\x0a\x09<return Math.PI>",
  5282. referencedClasses: [],
  5283. messageSends: []
  5284. }),
  5285. $globals.Number.klass);
  5286. $core.addClass('Point', $globals.Object, ['x', 'y'], 'Kernel-Objects');
  5287. $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";
  5288. $core.addMethod(
  5289. $core.method({
  5290. selector: "*",
  5291. protocol: 'arithmetic',
  5292. fn: function (aPoint){
  5293. var self=this;
  5294. return $core.withContext(function($ctx1) {
  5295. var $2,$4,$3,$1,$6,$5;
  5296. $2=self._x();
  5297. $ctx1.sendIdx["x"]=1;
  5298. $4=$recv(aPoint)._asPoint();
  5299. $ctx1.sendIdx["asPoint"]=1;
  5300. $3=$recv($4)._x();
  5301. $1=$recv($2).__star($3);
  5302. $ctx1.sendIdx["*"]=1;
  5303. $6=self._y();
  5304. $ctx1.sendIdx["y"]=1;
  5305. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  5306. return $recv($globals.Point)._x_y_($1,$5);
  5307. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  5308. },
  5309. args: ["aPoint"],
  5310. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  5311. referencedClasses: ["Point"],
  5312. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  5313. }),
  5314. $globals.Point);
  5315. $core.addMethod(
  5316. $core.method({
  5317. selector: "+",
  5318. protocol: 'arithmetic',
  5319. fn: function (aPoint){
  5320. var self=this;
  5321. return $core.withContext(function($ctx1) {
  5322. var $2,$4,$3,$1,$6,$5;
  5323. $2=self._x();
  5324. $ctx1.sendIdx["x"]=1;
  5325. $4=$recv(aPoint)._asPoint();
  5326. $ctx1.sendIdx["asPoint"]=1;
  5327. $3=$recv($4)._x();
  5328. $1=$recv($2).__plus($3);
  5329. $ctx1.sendIdx["+"]=1;
  5330. $6=self._y();
  5331. $ctx1.sendIdx["y"]=1;
  5332. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  5333. return $recv($globals.Point)._x_y_($1,$5);
  5334. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  5335. },
  5336. args: ["aPoint"],
  5337. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  5338. referencedClasses: ["Point"],
  5339. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  5340. }),
  5341. $globals.Point);
  5342. $core.addMethod(
  5343. $core.method({
  5344. selector: "-",
  5345. protocol: 'arithmetic',
  5346. fn: function (aPoint){
  5347. var self=this;
  5348. return $core.withContext(function($ctx1) {
  5349. var $2,$4,$3,$1,$6,$5;
  5350. $2=self._x();
  5351. $ctx1.sendIdx["x"]=1;
  5352. $4=$recv(aPoint)._asPoint();
  5353. $ctx1.sendIdx["asPoint"]=1;
  5354. $3=$recv($4)._x();
  5355. $1=$recv($2).__minus($3);
  5356. $ctx1.sendIdx["-"]=1;
  5357. $6=self._y();
  5358. $ctx1.sendIdx["y"]=1;
  5359. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  5360. return $recv($globals.Point)._x_y_($1,$5);
  5361. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  5362. },
  5363. args: ["aPoint"],
  5364. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  5365. referencedClasses: ["Point"],
  5366. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  5367. }),
  5368. $globals.Point);
  5369. $core.addMethod(
  5370. $core.method({
  5371. selector: "/",
  5372. protocol: 'arithmetic',
  5373. fn: function (aPoint){
  5374. var self=this;
  5375. return $core.withContext(function($ctx1) {
  5376. var $2,$4,$3,$1,$6,$5;
  5377. $2=self._x();
  5378. $ctx1.sendIdx["x"]=1;
  5379. $4=$recv(aPoint)._asPoint();
  5380. $ctx1.sendIdx["asPoint"]=1;
  5381. $3=$recv($4)._x();
  5382. $1=$recv($2).__slash($3);
  5383. $ctx1.sendIdx["/"]=1;
  5384. $6=self._y();
  5385. $ctx1.sendIdx["y"]=1;
  5386. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  5387. return $recv($globals.Point)._x_y_($1,$5);
  5388. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  5389. },
  5390. args: ["aPoint"],
  5391. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  5392. referencedClasses: ["Point"],
  5393. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  5394. }),
  5395. $globals.Point);
  5396. $core.addMethod(
  5397. $core.method({
  5398. selector: "<",
  5399. protocol: 'comparing',
  5400. fn: function (aPoint){
  5401. var self=this;
  5402. return $core.withContext(function($ctx1) {
  5403. var $2,$1,$3;
  5404. $2=self._x();
  5405. $ctx1.sendIdx["x"]=1;
  5406. $1=$recv($2).__lt($recv(aPoint)._x());
  5407. $ctx1.sendIdx["<"]=1;
  5408. return $recv($1)._and_((function(){
  5409. return $core.withContext(function($ctx2) {
  5410. $3=self._y();
  5411. $ctx2.sendIdx["y"]=1;
  5412. return $recv($3).__lt($recv(aPoint)._y());
  5413. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5414. }));
  5415. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  5416. },
  5417. args: ["aPoint"],
  5418. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  5419. referencedClasses: [],
  5420. messageSends: ["and:", "<", "x", "y"]
  5421. }),
  5422. $globals.Point);
  5423. $core.addMethod(
  5424. $core.method({
  5425. selector: "<=",
  5426. protocol: 'comparing',
  5427. fn: function (aPoint){
  5428. var self=this;
  5429. return $core.withContext(function($ctx1) {
  5430. var $2,$1,$3;
  5431. $2=self._x();
  5432. $ctx1.sendIdx["x"]=1;
  5433. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  5434. $ctx1.sendIdx["<="]=1;
  5435. return $recv($1)._and_((function(){
  5436. return $core.withContext(function($ctx2) {
  5437. $3=self._y();
  5438. $ctx2.sendIdx["y"]=1;
  5439. return $recv($3).__lt_eq($recv(aPoint)._y());
  5440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5441. }));
  5442. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  5443. },
  5444. args: ["aPoint"],
  5445. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  5446. referencedClasses: [],
  5447. messageSends: ["and:", "<=", "x", "y"]
  5448. }),
  5449. $globals.Point);
  5450. $core.addMethod(
  5451. $core.method({
  5452. selector: "=",
  5453. protocol: 'comparing',
  5454. fn: function (aPoint){
  5455. var self=this;
  5456. return $core.withContext(function($ctx1) {
  5457. var $2,$1,$4,$3,$6,$5;
  5458. $2=$recv(aPoint)._class();
  5459. $ctx1.sendIdx["class"]=1;
  5460. $1=$recv($2).__eq(self._class());
  5461. $ctx1.sendIdx["="]=1;
  5462. return $recv($1)._and_((function(){
  5463. return $core.withContext(function($ctx2) {
  5464. $4=$recv(aPoint)._x();
  5465. $ctx2.sendIdx["x"]=1;
  5466. $3=$recv($4).__eq(self._x());
  5467. $ctx2.sendIdx["="]=2;
  5468. $6=$recv(aPoint)._y();
  5469. $ctx2.sendIdx["y"]=1;
  5470. $5=$recv($6).__eq(self._y());
  5471. return $recv($3).__and($5);
  5472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5473. }));
  5474. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  5475. },
  5476. args: ["aPoint"],
  5477. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  5478. referencedClasses: [],
  5479. messageSends: ["and:", "=", "class", "&", "x", "y"]
  5480. }),
  5481. $globals.Point);
  5482. $core.addMethod(
  5483. $core.method({
  5484. selector: ">",
  5485. protocol: 'comparing',
  5486. fn: function (aPoint){
  5487. var self=this;
  5488. return $core.withContext(function($ctx1) {
  5489. var $2,$1,$3;
  5490. $2=self._x();
  5491. $ctx1.sendIdx["x"]=1;
  5492. $1=$recv($2).__gt($recv(aPoint)._x());
  5493. $ctx1.sendIdx[">"]=1;
  5494. return $recv($1)._and_((function(){
  5495. return $core.withContext(function($ctx2) {
  5496. $3=self._y();
  5497. $ctx2.sendIdx["y"]=1;
  5498. return $recv($3).__gt($recv(aPoint)._y());
  5499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5500. }));
  5501. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  5502. },
  5503. args: ["aPoint"],
  5504. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  5505. referencedClasses: [],
  5506. messageSends: ["and:", ">", "x", "y"]
  5507. }),
  5508. $globals.Point);
  5509. $core.addMethod(
  5510. $core.method({
  5511. selector: ">=",
  5512. protocol: 'comparing',
  5513. fn: function (aPoint){
  5514. var self=this;
  5515. return $core.withContext(function($ctx1) {
  5516. var $2,$1,$3;
  5517. $2=self._x();
  5518. $ctx1.sendIdx["x"]=1;
  5519. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  5520. $ctx1.sendIdx[">="]=1;
  5521. return $recv($1)._and_((function(){
  5522. return $core.withContext(function($ctx2) {
  5523. $3=self._y();
  5524. $ctx2.sendIdx["y"]=1;
  5525. return $recv($3).__gt_eq($recv(aPoint)._y());
  5526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5527. }));
  5528. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  5529. },
  5530. args: ["aPoint"],
  5531. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  5532. referencedClasses: [],
  5533. messageSends: ["and:", ">=", "x", "y"]
  5534. }),
  5535. $globals.Point);
  5536. $core.addMethod(
  5537. $core.method({
  5538. selector: "asPoint",
  5539. protocol: 'converting',
  5540. fn: function (){
  5541. var self=this;
  5542. return self;
  5543. },
  5544. args: [],
  5545. source: "asPoint\x0a\x09^ self",
  5546. referencedClasses: [],
  5547. messageSends: []
  5548. }),
  5549. $globals.Point);
  5550. $core.addMethod(
  5551. $core.method({
  5552. selector: "dist:",
  5553. protocol: 'transforming',
  5554. fn: function (aPoint){
  5555. var self=this;
  5556. var dx,dy;
  5557. return $core.withContext(function($ctx1) {
  5558. var $2,$1;
  5559. dx=$recv($recv(aPoint)._x()).__minus(self["@x"]);
  5560. $ctx1.sendIdx["-"]=1;
  5561. dy=$recv($recv(aPoint)._y()).__minus(self["@y"]);
  5562. $2=$recv(dx).__star(dx);
  5563. $ctx1.sendIdx["*"]=1;
  5564. $1=$recv($2).__plus($recv(dy).__star(dy));
  5565. return $recv($1)._sqrt();
  5566. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  5567. },
  5568. args: ["aPoint"],
  5569. 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",
  5570. referencedClasses: [],
  5571. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  5572. }),
  5573. $globals.Point);
  5574. $core.addMethod(
  5575. $core.method({
  5576. selector: "printOn:",
  5577. protocol: 'printing',
  5578. fn: function (aStream){
  5579. var self=this;
  5580. return $core.withContext(function($ctx1) {
  5581. var $1;
  5582. $recv(self["@x"])._printOn_(aStream);
  5583. $ctx1.sendIdx["printOn:"]=1;
  5584. $recv(aStream)._nextPutAll_("@");
  5585. $1=$recv($recv(self["@y"])._notNil())._and_((function(){
  5586. return $core.withContext(function($ctx2) {
  5587. return $recv(self["@y"])._negative();
  5588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5589. }));
  5590. if($core.assert($1)){
  5591. $recv(aStream)._space();
  5592. };
  5593. $recv(self["@y"])._printOn_(aStream);
  5594. return self;
  5595. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  5596. },
  5597. args: ["aStream"],
  5598. 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",
  5599. referencedClasses: [],
  5600. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  5601. }),
  5602. $globals.Point);
  5603. $core.addMethod(
  5604. $core.method({
  5605. selector: "translateBy:",
  5606. protocol: 'transforming',
  5607. fn: function (delta){
  5608. var self=this;
  5609. return $core.withContext(function($ctx1) {
  5610. var $1;
  5611. $1=$recv($recv(delta)._x()).__plus(self["@x"]);
  5612. $ctx1.sendIdx["+"]=1;
  5613. return $recv($1).__at($recv($recv(delta)._y()).__plus(self["@y"]));
  5614. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  5615. },
  5616. args: ["delta"],
  5617. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  5618. referencedClasses: [],
  5619. messageSends: ["@", "+", "x", "y"]
  5620. }),
  5621. $globals.Point);
  5622. $core.addMethod(
  5623. $core.method({
  5624. selector: "x",
  5625. protocol: 'accessing',
  5626. fn: function (){
  5627. var self=this;
  5628. return self["@x"];
  5629. },
  5630. args: [],
  5631. source: "x\x0a\x09^ x",
  5632. referencedClasses: [],
  5633. messageSends: []
  5634. }),
  5635. $globals.Point);
  5636. $core.addMethod(
  5637. $core.method({
  5638. selector: "x:",
  5639. protocol: 'accessing',
  5640. fn: function (aNumber){
  5641. var self=this;
  5642. self["@x"]=aNumber;
  5643. return self;
  5644. },
  5645. args: ["aNumber"],
  5646. source: "x: aNumber\x0a\x09x := aNumber",
  5647. referencedClasses: [],
  5648. messageSends: []
  5649. }),
  5650. $globals.Point);
  5651. $core.addMethod(
  5652. $core.method({
  5653. selector: "y",
  5654. protocol: 'accessing',
  5655. fn: function (){
  5656. var self=this;
  5657. return self["@y"];
  5658. },
  5659. args: [],
  5660. source: "y\x0a\x09^ y",
  5661. referencedClasses: [],
  5662. messageSends: []
  5663. }),
  5664. $globals.Point);
  5665. $core.addMethod(
  5666. $core.method({
  5667. selector: "y:",
  5668. protocol: 'accessing',
  5669. fn: function (aNumber){
  5670. var self=this;
  5671. self["@y"]=aNumber;
  5672. return self;
  5673. },
  5674. args: ["aNumber"],
  5675. source: "y: aNumber\x0a\x09y := aNumber",
  5676. referencedClasses: [],
  5677. messageSends: []
  5678. }),
  5679. $globals.Point);
  5680. $core.addMethod(
  5681. $core.method({
  5682. selector: "classTag",
  5683. protocol: 'accessing',
  5684. fn: function (){
  5685. var self=this;
  5686. return "magnitude";
  5687. },
  5688. args: [],
  5689. 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'",
  5690. referencedClasses: [],
  5691. messageSends: []
  5692. }),
  5693. $globals.Point.klass);
  5694. $core.addMethod(
  5695. $core.method({
  5696. selector: "x:y:",
  5697. protocol: 'instance creation',
  5698. fn: function (aNumber,anotherNumber){
  5699. var self=this;
  5700. return $core.withContext(function($ctx1) {
  5701. var $1;
  5702. $1=self._new();
  5703. $recv($1)._x_(aNumber);
  5704. $recv($1)._y_(anotherNumber);
  5705. return $recv($1)._yourself();
  5706. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.klass)});
  5707. },
  5708. args: ["aNumber", "anotherNumber"],
  5709. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  5710. referencedClasses: [],
  5711. messageSends: ["x:", "new", "y:", "yourself"]
  5712. }),
  5713. $globals.Point.klass);
  5714. $core.addClass('Random', $globals.Object, [], 'Kernel-Objects');
  5715. $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'`.";
  5716. $core.addMethod(
  5717. $core.method({
  5718. selector: "next",
  5719. protocol: 'accessing',
  5720. fn: function (){
  5721. var self=this;
  5722. return $core.withContext(function($ctx1) {
  5723. return Math.random();
  5724. return self;
  5725. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  5726. },
  5727. args: [],
  5728. source: "next\x0a\x09<return Math.random()>",
  5729. referencedClasses: [],
  5730. messageSends: []
  5731. }),
  5732. $globals.Random);
  5733. $core.addMethod(
  5734. $core.method({
  5735. selector: "next:",
  5736. protocol: 'accessing',
  5737. fn: function (anInteger){
  5738. var self=this;
  5739. return $core.withContext(function($ctx1) {
  5740. return $recv((1)._to_(anInteger))._collect_((function(each){
  5741. return $core.withContext(function($ctx2) {
  5742. return self._next();
  5743. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5744. }));
  5745. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  5746. },
  5747. args: ["anInteger"],
  5748. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  5749. referencedClasses: [],
  5750. messageSends: ["collect:", "to:", "next"]
  5751. }),
  5752. $globals.Random);
  5753. $core.addClass('UndefinedObject', $globals.Object, [], 'Kernel-Objects');
  5754. $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`.";
  5755. $core.addMethod(
  5756. $core.method({
  5757. selector: "asJSON",
  5758. protocol: 'converting',
  5759. fn: function (){
  5760. var self=this;
  5761. return null;
  5762. },
  5763. args: [],
  5764. source: "asJSON\x0a\x09^ null",
  5765. referencedClasses: [],
  5766. messageSends: []
  5767. }),
  5768. $globals.UndefinedObject);
  5769. $core.addMethod(
  5770. $core.method({
  5771. selector: "deepCopy",
  5772. protocol: 'copying',
  5773. fn: function (){
  5774. var self=this;
  5775. return self;
  5776. },
  5777. args: [],
  5778. source: "deepCopy\x0a\x09^ self",
  5779. referencedClasses: [],
  5780. messageSends: []
  5781. }),
  5782. $globals.UndefinedObject);
  5783. $core.addMethod(
  5784. $core.method({
  5785. selector: "ifNil:",
  5786. protocol: 'testing',
  5787. fn: function (aBlock){
  5788. var self=this;
  5789. return $core.withContext(function($ctx1) {
  5790. return self._ifNil_ifNotNil_(aBlock,(function(){
  5791. }));
  5792. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  5793. },
  5794. args: ["aBlock"],
  5795. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  5796. referencedClasses: [],
  5797. messageSends: ["ifNil:ifNotNil:"]
  5798. }),
  5799. $globals.UndefinedObject);
  5800. $core.addMethod(
  5801. $core.method({
  5802. selector: "ifNil:ifNotNil:",
  5803. protocol: 'testing',
  5804. fn: function (aBlock,anotherBlock){
  5805. var self=this;
  5806. return $core.withContext(function($ctx1) {
  5807. return $recv(aBlock)._value();
  5808. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5809. },
  5810. args: ["aBlock", "anotherBlock"],
  5811. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  5812. referencedClasses: [],
  5813. messageSends: ["value"]
  5814. }),
  5815. $globals.UndefinedObject);
  5816. $core.addMethod(
  5817. $core.method({
  5818. selector: "ifNotNil:",
  5819. protocol: 'testing',
  5820. fn: function (aBlock){
  5821. var self=this;
  5822. return self;
  5823. },
  5824. args: ["aBlock"],
  5825. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  5826. referencedClasses: [],
  5827. messageSends: []
  5828. }),
  5829. $globals.UndefinedObject);
  5830. $core.addMethod(
  5831. $core.method({
  5832. selector: "ifNotNil:ifNil:",
  5833. protocol: 'testing',
  5834. fn: function (aBlock,anotherBlock){
  5835. var self=this;
  5836. return $core.withContext(function($ctx1) {
  5837. return $recv(anotherBlock)._value();
  5838. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  5839. },
  5840. args: ["aBlock", "anotherBlock"],
  5841. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  5842. referencedClasses: [],
  5843. messageSends: ["value"]
  5844. }),
  5845. $globals.UndefinedObject);
  5846. $core.addMethod(
  5847. $core.method({
  5848. selector: "isImmutable",
  5849. protocol: 'testing',
  5850. fn: function (){
  5851. var self=this;
  5852. return true;
  5853. },
  5854. args: [],
  5855. source: "isImmutable\x0a\x09^ true",
  5856. referencedClasses: [],
  5857. messageSends: []
  5858. }),
  5859. $globals.UndefinedObject);
  5860. $core.addMethod(
  5861. $core.method({
  5862. selector: "isNil",
  5863. protocol: 'testing',
  5864. fn: function (){
  5865. var self=this;
  5866. return true;
  5867. },
  5868. args: [],
  5869. source: "isNil\x0a\x09^ true",
  5870. referencedClasses: [],
  5871. messageSends: []
  5872. }),
  5873. $globals.UndefinedObject);
  5874. $core.addMethod(
  5875. $core.method({
  5876. selector: "notNil",
  5877. protocol: 'testing',
  5878. fn: function (){
  5879. var self=this;
  5880. return false;
  5881. },
  5882. args: [],
  5883. source: "notNil\x0a\x09^ false",
  5884. referencedClasses: [],
  5885. messageSends: []
  5886. }),
  5887. $globals.UndefinedObject);
  5888. $core.addMethod(
  5889. $core.method({
  5890. selector: "printOn:",
  5891. protocol: 'printing',
  5892. fn: function (aStream){
  5893. var self=this;
  5894. return $core.withContext(function($ctx1) {
  5895. $recv(aStream)._nextPutAll_("nil");
  5896. return self;
  5897. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  5898. },
  5899. args: ["aStream"],
  5900. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  5901. referencedClasses: [],
  5902. messageSends: ["nextPutAll:"]
  5903. }),
  5904. $globals.UndefinedObject);
  5905. $core.addMethod(
  5906. $core.method({
  5907. selector: "shallowCopy",
  5908. protocol: 'copying',
  5909. fn: function (){
  5910. var self=this;
  5911. return self;
  5912. },
  5913. args: [],
  5914. source: "shallowCopy\x0a\x09^ self",
  5915. referencedClasses: [],
  5916. messageSends: []
  5917. }),
  5918. $globals.UndefinedObject);
  5919. $core.addMethod(
  5920. $core.method({
  5921. selector: "subclass:instanceVariableNames:",
  5922. protocol: 'class creation',
  5923. fn: function (aString,anotherString){
  5924. var self=this;
  5925. return $core.withContext(function($ctx1) {
  5926. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  5927. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.UndefinedObject)});
  5928. },
  5929. args: ["aString", "anotherString"],
  5930. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  5931. referencedClasses: [],
  5932. messageSends: ["subclass:instanceVariableNames:package:"]
  5933. }),
  5934. $globals.UndefinedObject);
  5935. $core.addMethod(
  5936. $core.method({
  5937. selector: "subclass:instanceVariableNames:category:",
  5938. protocol: 'class creation',
  5939. fn: function (aString,aString2,aString3){
  5940. var self=this;
  5941. return $core.withContext(function($ctx1) {
  5942. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5943. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5944. },
  5945. args: ["aString", "aString2", "aString3"],
  5946. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  5947. referencedClasses: [],
  5948. messageSends: ["subclass:instanceVariableNames:package:"]
  5949. }),
  5950. $globals.UndefinedObject);
  5951. $core.addMethod(
  5952. $core.method({
  5953. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  5954. protocol: 'class creation',
  5955. fn: function (aString,aString2,classVars,pools,aString3){
  5956. var self=this;
  5957. return $core.withContext(function($ctx1) {
  5958. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  5959. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.UndefinedObject)});
  5960. },
  5961. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  5962. 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",
  5963. referencedClasses: [],
  5964. messageSends: ["subclass:instanceVariableNames:package:"]
  5965. }),
  5966. $globals.UndefinedObject);
  5967. $core.addMethod(
  5968. $core.method({
  5969. selector: "subclass:instanceVariableNames:package:",
  5970. protocol: 'class creation',
  5971. fn: function (aString,aString2,aString3){
  5972. var self=this;
  5973. return $core.withContext(function($ctx1) {
  5974. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  5975. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.UndefinedObject)});
  5976. },
  5977. args: ["aString", "aString2", "aString3"],
  5978. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  5979. referencedClasses: ["ClassBuilder"],
  5980. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  5981. }),
  5982. $globals.UndefinedObject);
  5983. $core.addMethod(
  5984. $core.method({
  5985. selector: "new",
  5986. protocol: 'instance creation',
  5987. fn: function (){
  5988. var self=this;
  5989. return $core.withContext(function($ctx1) {
  5990. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  5991. return self;
  5992. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.klass)});
  5993. },
  5994. args: [],
  5995. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  5996. referencedClasses: [],
  5997. messageSends: ["error:"]
  5998. }),
  5999. $globals.UndefinedObject.klass);
  6000. });
  6001. define("amber_core/Kernel-Classes", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  6002. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  6003. $core.addPackage('Kernel-Classes');
  6004. $core.packages["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  6005. $core.packages["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  6006. $core.addClass('Behavior', $globals.Object, [], 'Kernel-Classes');
  6007. $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.";
  6008. $core.addMethod(
  6009. $core.method({
  6010. selector: ">>",
  6011. protocol: 'accessing',
  6012. fn: function (aString){
  6013. var self=this;
  6014. return $core.withContext(function($ctx1) {
  6015. return self._methodAt_(aString);
  6016. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.Behavior)});
  6017. },
  6018. args: ["aString"],
  6019. source: ">> aString\x0a\x09^ self methodAt: aString",
  6020. referencedClasses: [],
  6021. messageSends: ["methodAt:"]
  6022. }),
  6023. $globals.Behavior);
  6024. $core.addMethod(
  6025. $core.method({
  6026. selector: "addCompiledMethod:",
  6027. protocol: 'compiling',
  6028. fn: function (aMethod){
  6029. var self=this;
  6030. var oldMethod,announcement;
  6031. return $core.withContext(function($ctx1) {
  6032. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$receiver;
  6033. oldMethod=$recv(self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  6034. return nil;
  6035. }));
  6036. $2=self._protocols();
  6037. $3=$recv(aMethod)._protocol();
  6038. $ctx1.sendIdx["protocol"]=1;
  6039. $1=$recv($2)._includes_($3);
  6040. if(!$core.assert($1)){
  6041. $4=self._organization();
  6042. $5=$recv(aMethod)._protocol();
  6043. $ctx1.sendIdx["protocol"]=2;
  6044. $recv($4)._addElement_($5);
  6045. };
  6046. self._basicAddCompiledMethod_(aMethod);
  6047. $6=oldMethod;
  6048. if(($receiver = $6) == null || $receiver.isNil){
  6049. $6;
  6050. } else {
  6051. self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  6052. };
  6053. $7=oldMethod;
  6054. if(($receiver = $7) == null || $receiver.isNil){
  6055. $8=$recv($globals.MethodAdded)._new();
  6056. $ctx1.sendIdx["new"]=1;
  6057. $recv($8)._method_(aMethod);
  6058. $ctx1.sendIdx["method:"]=1;
  6059. $9=$recv($8)._yourself();
  6060. $ctx1.sendIdx["yourself"]=1;
  6061. announcement=$9;
  6062. } else {
  6063. $10=$recv($globals.MethodModified)._new();
  6064. $recv($10)._oldMethod_(oldMethod);
  6065. $recv($10)._method_(aMethod);
  6066. announcement=$recv($10)._yourself();
  6067. };
  6068. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  6069. return self;
  6070. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.Behavior)});
  6071. },
  6072. args: ["aMethod"],
  6073. 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",
  6074. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  6075. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "ifFalse:", "includes:", "protocols", "protocol", "addElement:", "organization", "basicAddCompiledMethod:", "ifNotNil:", "removeProtocolIfEmpty:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  6076. }),
  6077. $globals.Behavior);
  6078. $core.addMethod(
  6079. $core.method({
  6080. selector: "allInstanceVariableNames",
  6081. protocol: 'accessing',
  6082. fn: function (){
  6083. var self=this;
  6084. var result;
  6085. return $core.withContext(function($ctx1) {
  6086. var $1,$receiver;
  6087. result=$recv(self._instanceVariableNames())._copy();
  6088. $1=self._superclass();
  6089. $ctx1.sendIdx["superclass"]=1;
  6090. if(($receiver = $1) == null || $receiver.isNil){
  6091. $1;
  6092. } else {
  6093. $recv(result)._addAll_($recv(self._superclass())._allInstanceVariableNames());
  6094. };
  6095. return result;
  6096. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  6097. },
  6098. args: [],
  6099. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  6100. referencedClasses: [],
  6101. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  6102. }),
  6103. $globals.Behavior);
  6104. $core.addMethod(
  6105. $core.method({
  6106. selector: "allSelectors",
  6107. protocol: 'accessing',
  6108. fn: function (){
  6109. var self=this;
  6110. return $core.withContext(function($ctx1) {
  6111. var $1,$2;
  6112. $1=self._allSuperclasses();
  6113. $2=self._selectors();
  6114. $ctx1.sendIdx["selectors"]=1;
  6115. return $recv($1)._inject_into_($2,(function(acc,each){
  6116. return $core.withContext(function($ctx2) {
  6117. $recv(acc)._addAll_($recv(each)._selectors());
  6118. return $recv(acc)._yourself();
  6119. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  6120. }));
  6121. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  6122. },
  6123. args: [],
  6124. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  6125. referencedClasses: [],
  6126. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  6127. }),
  6128. $globals.Behavior);
  6129. $core.addMethod(
  6130. $core.method({
  6131. selector: "allSubclasses",
  6132. protocol: 'accessing',
  6133. fn: function (){
  6134. var self=this;
  6135. var subclasses,index;
  6136. return $core.withContext(function($ctx1) {
  6137. subclasses=self._subclasses();
  6138. $ctx1.sendIdx["subclasses"]=1;
  6139. index=(1);
  6140. $recv((function(){
  6141. return $core.withContext(function($ctx2) {
  6142. return $recv(index).__gt($recv(subclasses)._size());
  6143. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6144. }))._whileFalse_((function(){
  6145. return $core.withContext(function($ctx2) {
  6146. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  6147. index=$recv(index).__plus((1));
  6148. return index;
  6149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6150. }));
  6151. return subclasses;
  6152. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{subclasses:subclasses,index:index},$globals.Behavior)});
  6153. },
  6154. args: [],
  6155. source: "allSubclasses\x0a\x09\x22Answer an collection of the receiver's and the receiver's descendent's subclasses. \x22\x0a\x0a\x09| subclasses index |\x0a\x09\x0a\x09subclasses := self 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\x09^ subclasses",
  6156. referencedClasses: [],
  6157. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+"]
  6158. }),
  6159. $globals.Behavior);
  6160. $core.addMethod(
  6161. $core.method({
  6162. selector: "allSubclassesDo:",
  6163. protocol: 'enumerating',
  6164. fn: function (aBlock){
  6165. var self=this;
  6166. return $core.withContext(function($ctx1) {
  6167. $recv(self._allSubclasses())._do_((function(each){
  6168. return $core.withContext(function($ctx2) {
  6169. return $recv(aBlock)._value_(each);
  6170. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6171. }));
  6172. return self;
  6173. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  6174. },
  6175. args: ["aBlock"],
  6176. source: "allSubclassesDo: aBlock\x0a\x09\x22Evaluate the argument, aBlock, for each of the receiver's subclasses.\x22\x0a\x0a\x09self allSubclasses do: [ :each |\x0a \x09aBlock value: each ]",
  6177. referencedClasses: [],
  6178. messageSends: ["do:", "allSubclasses", "value:"]
  6179. }),
  6180. $globals.Behavior);
  6181. $core.addMethod(
  6182. $core.method({
  6183. selector: "allSuperclasses",
  6184. protocol: 'accessing',
  6185. fn: function (){
  6186. var self=this;
  6187. return $core.withContext(function($ctx1) {
  6188. var $1,$3,$2,$receiver;
  6189. $1=self._superclass();
  6190. $ctx1.sendIdx["superclass"]=1;
  6191. if(($receiver = $1) == null || $receiver.isNil){
  6192. return [];
  6193. } else {
  6194. $1;
  6195. };
  6196. $3=self._superclass();
  6197. $ctx1.sendIdx["superclass"]=2;
  6198. $2=$recv($globals.OrderedCollection)._with_($3);
  6199. $recv($2)._addAll_($recv(self._superclass())._allSuperclasses());
  6200. return $recv($2)._yourself();
  6201. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  6202. },
  6203. args: [],
  6204. 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",
  6205. referencedClasses: ["OrderedCollection"],
  6206. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  6207. }),
  6208. $globals.Behavior);
  6209. $core.addMethod(
  6210. $core.method({
  6211. selector: "basicAddCompiledMethod:",
  6212. protocol: 'private',
  6213. fn: function (aMethod){
  6214. var self=this;
  6215. return $core.withContext(function($ctx1) {
  6216. $core.addMethod(aMethod, self);
  6217. return self;
  6218. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6219. },
  6220. args: ["aMethod"],
  6221. source: "basicAddCompiledMethod: aMethod\x0a\x09<$core.addMethod(aMethod, self)>",
  6222. referencedClasses: [],
  6223. messageSends: []
  6224. }),
  6225. $globals.Behavior);
  6226. $core.addMethod(
  6227. $core.method({
  6228. selector: "basicNew",
  6229. protocol: 'instance creation',
  6230. fn: function (){
  6231. var self=this;
  6232. return $core.withContext(function($ctx1) {
  6233. return new self.fn();
  6234. return self;
  6235. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  6236. },
  6237. args: [],
  6238. source: "basicNew\x0a\x09<return new self.fn()>",
  6239. referencedClasses: [],
  6240. messageSends: []
  6241. }),
  6242. $globals.Behavior);
  6243. $core.addMethod(
  6244. $core.method({
  6245. selector: "basicRemoveCompiledMethod:",
  6246. protocol: 'private',
  6247. fn: function (aMethod){
  6248. var self=this;
  6249. return $core.withContext(function($ctx1) {
  6250. $core.removeMethod(aMethod,self);
  6251. return self;
  6252. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6253. },
  6254. args: ["aMethod"],
  6255. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<$core.removeMethod(aMethod,self)>",
  6256. referencedClasses: [],
  6257. messageSends: []
  6258. }),
  6259. $globals.Behavior);
  6260. $core.addMethod(
  6261. $core.method({
  6262. selector: "canUnderstand:",
  6263. protocol: 'testing',
  6264. fn: function (aSelector){
  6265. var self=this;
  6266. return $core.withContext(function($ctx1) {
  6267. var $2,$1;
  6268. return $recv(self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  6269. return $core.withContext(function($ctx2) {
  6270. $2=self._superclass();
  6271. $ctx2.sendIdx["superclass"]=1;
  6272. $1=$recv($2)._notNil();
  6273. return $recv($1)._and_((function(){
  6274. return $core.withContext(function($ctx3) {
  6275. return $recv(self._superclass())._canUnderstand_(aSelector);
  6276. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6277. }));
  6278. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6279. }));
  6280. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  6281. },
  6282. args: ["aSelector"],
  6283. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  6284. referencedClasses: [],
  6285. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  6286. }),
  6287. $globals.Behavior);
  6288. $core.addMethod(
  6289. $core.method({
  6290. selector: "comment",
  6291. protocol: 'accessing',
  6292. fn: function (){
  6293. var self=this;
  6294. return $core.withContext(function($ctx1) {
  6295. var $1,$receiver;
  6296. $1=self._basicAt_("comment");
  6297. if(($receiver = $1) == null || $receiver.isNil){
  6298. return "";
  6299. } else {
  6300. return $1;
  6301. };
  6302. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.Behavior)});
  6303. },
  6304. args: [],
  6305. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  6306. referencedClasses: [],
  6307. messageSends: ["ifNil:", "basicAt:"]
  6308. }),
  6309. $globals.Behavior);
  6310. $core.addMethod(
  6311. $core.method({
  6312. selector: "comment:",
  6313. protocol: 'accessing',
  6314. fn: function (aString){
  6315. var self=this;
  6316. return $core.withContext(function($ctx1) {
  6317. var $1,$3,$2;
  6318. self._basicAt_put_("comment",aString);
  6319. $1=$recv($globals.SystemAnnouncer)._current();
  6320. $3=$recv($globals.ClassCommentChanged)._new();
  6321. $recv($3)._theClass_(self);
  6322. $2=$recv($3)._yourself();
  6323. $recv($1)._announce_($2);
  6324. return self;
  6325. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.Behavior)});
  6326. },
  6327. args: ["aString"],
  6328. 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)",
  6329. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  6330. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  6331. }),
  6332. $globals.Behavior);
  6333. $core.addMethod(
  6334. $core.method({
  6335. selector: "compile:protocol:",
  6336. protocol: 'compiling',
  6337. fn: function (aString,anotherString){
  6338. var self=this;
  6339. return $core.withContext(function($ctx1) {
  6340. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  6341. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.Behavior)});
  6342. },
  6343. args: ["aString", "anotherString"],
  6344. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  6345. referencedClasses: ["Compiler"],
  6346. messageSends: ["install:forClass:protocol:", "new"]
  6347. }),
  6348. $globals.Behavior);
  6349. $core.addMethod(
  6350. $core.method({
  6351. selector: "definition",
  6352. protocol: 'accessing',
  6353. fn: function (){
  6354. var self=this;
  6355. return "";
  6356. },
  6357. args: [],
  6358. source: "definition\x0a\x09^ ''",
  6359. referencedClasses: [],
  6360. messageSends: []
  6361. }),
  6362. $globals.Behavior);
  6363. $core.addMethod(
  6364. $core.method({
  6365. selector: "includesBehavior:",
  6366. protocol: 'testing',
  6367. fn: function (aClass){
  6368. var self=this;
  6369. return $core.withContext(function($ctx1) {
  6370. return $recv(self.__eq_eq(aClass))._or_((function(){
  6371. return $core.withContext(function($ctx2) {
  6372. return self._inheritsFrom_(aClass);
  6373. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6374. }));
  6375. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  6376. },
  6377. args: ["aClass"],
  6378. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  6379. referencedClasses: [],
  6380. messageSends: ["or:", "==", "inheritsFrom:"]
  6381. }),
  6382. $globals.Behavior);
  6383. $core.addMethod(
  6384. $core.method({
  6385. selector: "includesSelector:",
  6386. protocol: 'testing',
  6387. fn: function (aString){
  6388. var self=this;
  6389. return $core.withContext(function($ctx1) {
  6390. return $recv(self._methodDictionary())._includesKey_(aString);
  6391. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.Behavior)});
  6392. },
  6393. args: ["aString"],
  6394. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  6395. referencedClasses: [],
  6396. messageSends: ["includesKey:", "methodDictionary"]
  6397. }),
  6398. $globals.Behavior);
  6399. $core.addMethod(
  6400. $core.method({
  6401. selector: "inheritsFrom:",
  6402. protocol: 'testing',
  6403. fn: function (aClass){
  6404. var self=this;
  6405. return $core.withContext(function($ctx1) {
  6406. var $1,$3,$2,$receiver;
  6407. $1=self._superclass();
  6408. $ctx1.sendIdx["superclass"]=1;
  6409. if(($receiver = $1) == null || $receiver.isNil){
  6410. return false;
  6411. } else {
  6412. $1;
  6413. };
  6414. $3=self._superclass();
  6415. $ctx1.sendIdx["superclass"]=2;
  6416. $2=$recv(aClass).__eq_eq($3);
  6417. return $recv($2)._or_((function(){
  6418. return $core.withContext(function($ctx2) {
  6419. return $recv(self._superclass())._inheritsFrom_(aClass);
  6420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6421. }));
  6422. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  6423. },
  6424. args: ["aClass"],
  6425. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  6426. referencedClasses: [],
  6427. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  6428. }),
  6429. $globals.Behavior);
  6430. $core.addMethod(
  6431. $core.method({
  6432. selector: "instanceVariableNames",
  6433. protocol: 'accessing',
  6434. fn: function (){
  6435. var self=this;
  6436. return $core.withContext(function($ctx1) {
  6437. return self.iVarNames;
  6438. return self;
  6439. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  6440. },
  6441. args: [],
  6442. source: "instanceVariableNames\x0a\x09<return self.iVarNames>",
  6443. referencedClasses: [],
  6444. messageSends: []
  6445. }),
  6446. $globals.Behavior);
  6447. $core.addMethod(
  6448. $core.method({
  6449. selector: "isBehavior",
  6450. protocol: 'testing',
  6451. fn: function (){
  6452. var self=this;
  6453. return true;
  6454. },
  6455. args: [],
  6456. source: "isBehavior\x0a\x09^ true",
  6457. referencedClasses: [],
  6458. messageSends: []
  6459. }),
  6460. $globals.Behavior);
  6461. $core.addMethod(
  6462. $core.method({
  6463. selector: "javascriptConstructor",
  6464. protocol: 'accessing',
  6465. fn: function (){
  6466. var self=this;
  6467. return $core.withContext(function($ctx1) {
  6468. return self.fn;
  6469. return self;
  6470. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  6471. },
  6472. args: [],
  6473. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<return self.fn>",
  6474. referencedClasses: [],
  6475. messageSends: []
  6476. }),
  6477. $globals.Behavior);
  6478. $core.addMethod(
  6479. $core.method({
  6480. selector: "javascriptConstructor:",
  6481. protocol: 'accessing',
  6482. fn: function (aJavaScriptFunction){
  6483. var self=this;
  6484. return $core.withContext(function($ctx1) {
  6485. $core.setClassConstructor(self, aJavaScriptFunction);;
  6486. return self;
  6487. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  6488. },
  6489. args: ["aJavaScriptFunction"],
  6490. 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);>",
  6491. referencedClasses: [],
  6492. messageSends: []
  6493. }),
  6494. $globals.Behavior);
  6495. $core.addMethod(
  6496. $core.method({
  6497. selector: "lookupSelector:",
  6498. protocol: 'accessing',
  6499. fn: function (selector){
  6500. var self=this;
  6501. var lookupClass;
  6502. return $core.withContext(function($ctx1) {
  6503. var $1;
  6504. var $early={};
  6505. try {
  6506. lookupClass=self;
  6507. $recv((function(){
  6508. return $core.withContext(function($ctx2) {
  6509. return $recv(lookupClass).__eq(nil);
  6510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6511. }))._whileFalse_((function(){
  6512. return $core.withContext(function($ctx2) {
  6513. $1=$recv(lookupClass)._includesSelector_(selector);
  6514. if($core.assert($1)){
  6515. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  6516. };
  6517. lookupClass=$recv(lookupClass)._superclass();
  6518. return lookupClass;
  6519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6520. }));
  6521. return nil;
  6522. }
  6523. catch(e) {if(e===$early)return e[0]; throw e}
  6524. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  6525. },
  6526. args: ["selector"],
  6527. 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",
  6528. referencedClasses: [],
  6529. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  6530. }),
  6531. $globals.Behavior);
  6532. $core.addMethod(
  6533. $core.method({
  6534. selector: "methodAt:",
  6535. protocol: 'accessing',
  6536. fn: function (aString){
  6537. var self=this;
  6538. return $core.withContext(function($ctx1) {
  6539. return $recv(self._methodDictionary())._at_(aString);
  6540. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.Behavior)});
  6541. },
  6542. args: ["aString"],
  6543. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  6544. referencedClasses: [],
  6545. messageSends: ["at:", "methodDictionary"]
  6546. }),
  6547. $globals.Behavior);
  6548. $core.addMethod(
  6549. $core.method({
  6550. selector: "methodDictionary",
  6551. protocol: 'accessing',
  6552. fn: function (){
  6553. var self=this;
  6554. return $core.withContext(function($ctx1) {
  6555. var dict = $globals.HashedCollection._new();
  6556. var methods = self.methods;
  6557. Object.keys(methods).forEach(function(i) {
  6558. if(methods[i].selector) {
  6559. dict._at_put_(methods[i].selector, methods[i]);
  6560. }
  6561. });
  6562. return dict;
  6563. return self;
  6564. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.Behavior)});
  6565. },
  6566. args: [],
  6567. 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>",
  6568. referencedClasses: [],
  6569. messageSends: []
  6570. }),
  6571. $globals.Behavior);
  6572. $core.addMethod(
  6573. $core.method({
  6574. selector: "methodTemplate",
  6575. protocol: 'accessing',
  6576. fn: function (){
  6577. var self=this;
  6578. return $core.withContext(function($ctx1) {
  6579. var $2,$3,$1,$6,$7,$5,$8,$4;
  6580. return $recv($globals.String)._streamContents_((function(stream){
  6581. return $core.withContext(function($ctx2) {
  6582. $recv(stream)._nextPutAll_("messageSelectorAndArgumentNames");
  6583. $ctx2.sendIdx["nextPutAll:"]=1;
  6584. $2=$recv($globals.String)._lf();
  6585. $ctx2.sendIdx["lf"]=1;
  6586. $3=$recv($globals.String)._tab();
  6587. $ctx2.sendIdx["tab"]=1;
  6588. $1=$recv($2).__comma($3);
  6589. $ctx2.sendIdx[","]=1;
  6590. $recv(stream)._nextPutAll_($1);
  6591. $ctx2.sendIdx["nextPutAll:"]=2;
  6592. $recv(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
  6593. $ctx2.sendIdx["nextPutAll:"]=3;
  6594. $6=$recv($globals.String)._lf();
  6595. $ctx2.sendIdx["lf"]=2;
  6596. $7=$recv($globals.String)._lf();
  6597. $ctx2.sendIdx["lf"]=3;
  6598. $5=$recv($6).__comma($7);
  6599. $ctx2.sendIdx[","]=3;
  6600. $8=$recv($globals.String)._tab();
  6601. $ctx2.sendIdx["tab"]=2;
  6602. $4=$recv($5).__comma($8);
  6603. $ctx2.sendIdx[","]=2;
  6604. $recv(stream)._nextPutAll_($4);
  6605. $ctx2.sendIdx["nextPutAll:"]=4;
  6606. $recv(stream)._nextPutAll_("| temporary variable names |");
  6607. $ctx2.sendIdx["nextPutAll:"]=5;
  6608. $recv(stream)._nextPutAll_($recv($recv($globals.String)._lf()).__comma($recv($globals.String)._tab()));
  6609. $ctx2.sendIdx["nextPutAll:"]=6;
  6610. return $recv(stream)._nextPutAll_("statements");
  6611. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6612. }));
  6613. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.Behavior)});
  6614. },
  6615. args: [],
  6616. 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' ]",
  6617. referencedClasses: ["String"],
  6618. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"]
  6619. }),
  6620. $globals.Behavior);
  6621. $core.addMethod(
  6622. $core.method({
  6623. selector: "methods",
  6624. protocol: 'accessing',
  6625. fn: function (){
  6626. var self=this;
  6627. return $core.withContext(function($ctx1) {
  6628. return $recv(self._methodDictionary())._values();
  6629. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.Behavior)});
  6630. },
  6631. args: [],
  6632. source: "methods\x0a\x09^ self methodDictionary values",
  6633. referencedClasses: [],
  6634. messageSends: ["values", "methodDictionary"]
  6635. }),
  6636. $globals.Behavior);
  6637. $core.addMethod(
  6638. $core.method({
  6639. selector: "methodsInProtocol:",
  6640. protocol: 'accessing',
  6641. fn: function (aString){
  6642. var self=this;
  6643. return $core.withContext(function($ctx1) {
  6644. return $recv(self._methods())._select_((function(each){
  6645. return $core.withContext(function($ctx2) {
  6646. return $recv($recv(each)._protocol()).__eq(aString);
  6647. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6648. }));
  6649. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.Behavior)});
  6650. },
  6651. args: ["aString"],
  6652. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  6653. referencedClasses: [],
  6654. messageSends: ["select:", "methods", "=", "protocol"]
  6655. }),
  6656. $globals.Behavior);
  6657. $core.addMethod(
  6658. $core.method({
  6659. selector: "name",
  6660. protocol: 'accessing',
  6661. fn: function (){
  6662. var self=this;
  6663. return $core.withContext(function($ctx1) {
  6664. return self.className || nil;
  6665. return self;
  6666. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Behavior)});
  6667. },
  6668. args: [],
  6669. source: "name\x0a\x09<return self.className || nil>",
  6670. referencedClasses: [],
  6671. messageSends: []
  6672. }),
  6673. $globals.Behavior);
  6674. $core.addMethod(
  6675. $core.method({
  6676. selector: "new",
  6677. protocol: 'instance creation',
  6678. fn: function (){
  6679. var self=this;
  6680. return $core.withContext(function($ctx1) {
  6681. return $recv(self._basicNew())._initialize();
  6682. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  6683. },
  6684. args: [],
  6685. source: "new\x0a\x09^ self basicNew initialize",
  6686. referencedClasses: [],
  6687. messageSends: ["initialize", "basicNew"]
  6688. }),
  6689. $globals.Behavior);
  6690. $core.addMethod(
  6691. $core.method({
  6692. selector: "organization",
  6693. protocol: 'accessing',
  6694. fn: function (){
  6695. var self=this;
  6696. return $core.withContext(function($ctx1) {
  6697. return self._basicAt_("organization");
  6698. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Behavior)});
  6699. },
  6700. args: [],
  6701. source: "organization\x0a\x09^ self basicAt: 'organization'",
  6702. referencedClasses: [],
  6703. messageSends: ["basicAt:"]
  6704. }),
  6705. $globals.Behavior);
  6706. $core.addMethod(
  6707. $core.method({
  6708. selector: "ownMethods",
  6709. protocol: 'accessing',
  6710. fn: function (){
  6711. var self=this;
  6712. return $core.withContext(function($ctx1) {
  6713. var $1;
  6714. return $recv($recv(self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  6715. return $core.withContext(function($ctx2) {
  6716. return $recv(acc).__comma(self._methodsInProtocol_(each));
  6717. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  6718. })))._sorted_((function(a,b){
  6719. return $core.withContext(function($ctx2) {
  6720. $1=$recv(a)._selector();
  6721. $ctx2.sendIdx["selector"]=1;
  6722. return $recv($1).__lt_eq($recv(b)._selector());
  6723. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  6724. }));
  6725. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.Behavior)});
  6726. },
  6727. args: [],
  6728. 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 ]",
  6729. referencedClasses: ["OrderedCollection"],
  6730. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "methodsInProtocol:", "<=", "selector"]
  6731. }),
  6732. $globals.Behavior);
  6733. $core.addMethod(
  6734. $core.method({
  6735. selector: "ownProtocols",
  6736. protocol: 'accessing',
  6737. fn: function (){
  6738. var self=this;
  6739. return $core.withContext(function($ctx1) {
  6740. return $recv(self._protocols())._reject_((function(each){
  6741. return $core.withContext(function($ctx2) {
  6742. return $recv(each)._match_("^\x5c*");
  6743. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6744. }));
  6745. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.Behavior)});
  6746. },
  6747. args: [],
  6748. 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*' ]",
  6749. referencedClasses: [],
  6750. messageSends: ["reject:", "protocols", "match:"]
  6751. }),
  6752. $globals.Behavior);
  6753. $core.addMethod(
  6754. $core.method({
  6755. selector: "packageOfProtocol:",
  6756. protocol: 'accessing',
  6757. fn: function (aString){
  6758. var self=this;
  6759. return $core.withContext(function($ctx1) {
  6760. var $1;
  6761. $1=$recv(aString)._beginsWith_("*");
  6762. if(!$core.assert($1)){
  6763. return self._package();
  6764. };
  6765. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  6766. return nil;
  6767. }));
  6768. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.Behavior)});
  6769. },
  6770. args: ["aString"],
  6771. 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 ]",
  6772. referencedClasses: ["Package"],
  6773. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  6774. }),
  6775. $globals.Behavior);
  6776. $core.addMethod(
  6777. $core.method({
  6778. selector: "protocols",
  6779. protocol: 'accessing',
  6780. fn: function (){
  6781. var self=this;
  6782. return $core.withContext(function($ctx1) {
  6783. return $recv($recv(self._organization())._elements())._sorted();
  6784. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.Behavior)});
  6785. },
  6786. args: [],
  6787. source: "protocols\x0a\x09^ self organization elements sorted",
  6788. referencedClasses: [],
  6789. messageSends: ["sorted", "elements", "organization"]
  6790. }),
  6791. $globals.Behavior);
  6792. $core.addMethod(
  6793. $core.method({
  6794. selector: "protocolsDo:",
  6795. protocol: 'enumerating',
  6796. fn: function (aBlock){
  6797. var self=this;
  6798. var methodsByProtocol;
  6799. return $core.withContext(function($ctx1) {
  6800. methodsByProtocol=$recv($globals.HashedCollection)._new();
  6801. $ctx1.sendIdx["new"]=1;
  6802. $recv(self._methodDictionary())._valuesDo_((function(m){
  6803. return $core.withContext(function($ctx2) {
  6804. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  6805. return $core.withContext(function($ctx3) {
  6806. return $recv($globals.Array)._new();
  6807. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  6808. })))._add_(m);
  6809. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  6810. }));
  6811. $recv(self._protocols())._do_((function(protocol){
  6812. return $core.withContext(function($ctx2) {
  6813. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  6814. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  6815. }));
  6816. return self;
  6817. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.Behavior)});
  6818. },
  6819. args: ["aBlock"],
  6820. 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) ]",
  6821. referencedClasses: ["HashedCollection", "Array"],
  6822. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  6823. }),
  6824. $globals.Behavior);
  6825. $core.addMethod(
  6826. $core.method({
  6827. selector: "prototype",
  6828. protocol: 'accessing',
  6829. fn: function (){
  6830. var self=this;
  6831. return $core.withContext(function($ctx1) {
  6832. return self.fn.prototype;
  6833. return self;
  6834. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  6835. },
  6836. args: [],
  6837. source: "prototype\x0a\x09<return self.fn.prototype>",
  6838. referencedClasses: [],
  6839. messageSends: []
  6840. }),
  6841. $globals.Behavior);
  6842. $core.addMethod(
  6843. $core.method({
  6844. selector: "recompile",
  6845. protocol: 'compiling',
  6846. fn: function (){
  6847. var self=this;
  6848. return $core.withContext(function($ctx1) {
  6849. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  6850. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.Behavior)});
  6851. },
  6852. args: [],
  6853. source: "recompile\x0a\x09^ Compiler new recompile: self",
  6854. referencedClasses: ["Compiler"],
  6855. messageSends: ["recompile:", "new"]
  6856. }),
  6857. $globals.Behavior);
  6858. $core.addMethod(
  6859. $core.method({
  6860. selector: "removeCompiledMethod:",
  6861. protocol: 'compiling',
  6862. fn: function (aMethod){
  6863. var self=this;
  6864. return $core.withContext(function($ctx1) {
  6865. var $1,$3,$2;
  6866. self._basicRemoveCompiledMethod_(aMethod);
  6867. self._removeProtocolIfEmpty_($recv(aMethod)._protocol());
  6868. $1=$recv($globals.SystemAnnouncer)._current();
  6869. $3=$recv($globals.MethodRemoved)._new();
  6870. $recv($3)._method_(aMethod);
  6871. $2=$recv($3)._yourself();
  6872. $recv($1)._announce_($2);
  6873. return self;
  6874. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.Behavior)});
  6875. },
  6876. args: ["aMethod"],
  6877. 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)",
  6878. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  6879. messageSends: ["basicRemoveCompiledMethod:", "removeProtocolIfEmpty:", "protocol", "announce:", "current", "method:", "new", "yourself"]
  6880. }),
  6881. $globals.Behavior);
  6882. $core.addMethod(
  6883. $core.method({
  6884. selector: "removeProtocolIfEmpty:",
  6885. protocol: 'accessing',
  6886. fn: function (aString){
  6887. var self=this;
  6888. return $core.withContext(function($ctx1) {
  6889. $recv(self._methods())._detect_ifNone_((function(each){
  6890. return $core.withContext(function($ctx2) {
  6891. return $recv($recv(each)._protocol()).__eq(aString);
  6892. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6893. }),(function(){
  6894. return $core.withContext(function($ctx2) {
  6895. return $recv(self._organization())._removeElement_(aString);
  6896. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6897. }));
  6898. return self;
  6899. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.Behavior)});
  6900. },
  6901. args: ["aString"],
  6902. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  6903. referencedClasses: [],
  6904. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  6905. }),
  6906. $globals.Behavior);
  6907. $core.addMethod(
  6908. $core.method({
  6909. selector: "selectors",
  6910. protocol: 'accessing',
  6911. fn: function (){
  6912. var self=this;
  6913. return $core.withContext(function($ctx1) {
  6914. return $recv(self._methodDictionary())._keys();
  6915. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.Behavior)});
  6916. },
  6917. args: [],
  6918. source: "selectors\x0a\x09^ self methodDictionary keys",
  6919. referencedClasses: [],
  6920. messageSends: ["keys", "methodDictionary"]
  6921. }),
  6922. $globals.Behavior);
  6923. $core.addMethod(
  6924. $core.method({
  6925. selector: "subclasses",
  6926. protocol: 'accessing',
  6927. fn: function (){
  6928. var self=this;
  6929. return $core.withContext(function($ctx1) {
  6930. self._subclassResponsibility();
  6931. return self;
  6932. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  6933. },
  6934. args: [],
  6935. source: "subclasses\x0a\x09self subclassResponsibility",
  6936. referencedClasses: [],
  6937. messageSends: ["subclassResponsibility"]
  6938. }),
  6939. $globals.Behavior);
  6940. $core.addMethod(
  6941. $core.method({
  6942. selector: "superclass",
  6943. protocol: 'accessing',
  6944. fn: function (){
  6945. var self=this;
  6946. return $core.withContext(function($ctx1) {
  6947. return self.superclass;
  6948. return self;
  6949. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  6950. },
  6951. args: [],
  6952. source: "superclass\x0a\x09<return self.superclass>",
  6953. referencedClasses: [],
  6954. messageSends: []
  6955. }),
  6956. $globals.Behavior);
  6957. $core.addMethod(
  6958. $core.method({
  6959. selector: "theMetaClass",
  6960. protocol: 'accessing',
  6961. fn: function (){
  6962. var self=this;
  6963. return $core.withContext(function($ctx1) {
  6964. self._subclassResponsibility();
  6965. return self;
  6966. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  6967. },
  6968. args: [],
  6969. source: "theMetaClass\x0a\x09self subclassResponsibility",
  6970. referencedClasses: [],
  6971. messageSends: ["subclassResponsibility"]
  6972. }),
  6973. $globals.Behavior);
  6974. $core.addMethod(
  6975. $core.method({
  6976. selector: "theNonMetaClass",
  6977. protocol: 'accessing',
  6978. fn: function (){
  6979. var self=this;
  6980. return $core.withContext(function($ctx1) {
  6981. self._subclassResponsibility();
  6982. return self;
  6983. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  6984. },
  6985. args: [],
  6986. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  6987. referencedClasses: [],
  6988. messageSends: ["subclassResponsibility"]
  6989. }),
  6990. $globals.Behavior);
  6991. $core.addMethod(
  6992. $core.method({
  6993. selector: "withAllSubclasses",
  6994. protocol: 'accessing',
  6995. fn: function (){
  6996. var self=this;
  6997. return $core.withContext(function($ctx1) {
  6998. var $1;
  6999. $1=$recv($globals.Array)._with_(self);
  7000. $recv($1)._addAll_(self._allSubclasses());
  7001. return $recv($1)._yourself();
  7002. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  7003. },
  7004. args: [],
  7005. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  7006. referencedClasses: ["Array"],
  7007. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  7008. }),
  7009. $globals.Behavior);
  7010. $core.addClass('Class', $globals.Behavior, [], 'Kernel-Classes');
  7011. $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.";
  7012. $core.addMethod(
  7013. $core.method({
  7014. selector: "asJavascript",
  7015. protocol: 'converting',
  7016. fn: function (){
  7017. var self=this;
  7018. return $core.withContext(function($ctx1) {
  7019. return "$globals.".__comma(self._name());
  7020. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Class)});
  7021. },
  7022. args: [],
  7023. source: "asJavascript\x0a\x09^ '$globals.', self name",
  7024. referencedClasses: [],
  7025. messageSends: [",", "name"]
  7026. }),
  7027. $globals.Class);
  7028. $core.addMethod(
  7029. $core.method({
  7030. selector: "browse",
  7031. protocol: 'browsing',
  7032. fn: function (){
  7033. var self=this;
  7034. return $core.withContext(function($ctx1) {
  7035. $recv($globals.Finder)._findClass_(self);
  7036. return self;
  7037. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Class)});
  7038. },
  7039. args: [],
  7040. source: "browse\x0a\x09Finder findClass: self",
  7041. referencedClasses: ["Finder"],
  7042. messageSends: ["findClass:"]
  7043. }),
  7044. $globals.Class);
  7045. $core.addMethod(
  7046. $core.method({
  7047. selector: "category",
  7048. protocol: 'accessing',
  7049. fn: function (){
  7050. var self=this;
  7051. return $core.withContext(function($ctx1) {
  7052. var $1,$receiver;
  7053. $1=self._package();
  7054. $ctx1.sendIdx["package"]=1;
  7055. if(($receiver = $1) == null || $receiver.isNil){
  7056. return "Unclassified";
  7057. } else {
  7058. return $recv(self._package())._name();
  7059. };
  7060. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.Class)});
  7061. },
  7062. args: [],
  7063. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  7064. referencedClasses: [],
  7065. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  7066. }),
  7067. $globals.Class);
  7068. $core.addMethod(
  7069. $core.method({
  7070. selector: "classTag",
  7071. protocol: 'accessing',
  7072. fn: function (){
  7073. var self=this;
  7074. return "class";
  7075. },
  7076. args: [],
  7077. 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'",
  7078. referencedClasses: [],
  7079. messageSends: []
  7080. }),
  7081. $globals.Class);
  7082. $core.addMethod(
  7083. $core.method({
  7084. selector: "definition",
  7085. protocol: 'accessing',
  7086. fn: function (){
  7087. var self=this;
  7088. return $core.withContext(function($ctx1) {
  7089. var $2,$3,$1,$4,$5;
  7090. return $recv($globals.String)._streamContents_((function(stream){
  7091. return $core.withContext(function($ctx2) {
  7092. $recv(stream)._nextPutAll_($recv(self._superclass())._asString());
  7093. $ctx2.sendIdx["nextPutAll:"]=1;
  7094. $recv(stream)._nextPutAll_(" subclass: #");
  7095. $ctx2.sendIdx["nextPutAll:"]=2;
  7096. $recv(stream)._nextPutAll_(self._name());
  7097. $ctx2.sendIdx["nextPutAll:"]=3;
  7098. $2=$recv($globals.String)._lf();
  7099. $ctx2.sendIdx["lf"]=1;
  7100. $3=$recv($globals.String)._tab();
  7101. $ctx2.sendIdx["tab"]=1;
  7102. $1=$recv($2).__comma($3);
  7103. $ctx2.sendIdx[","]=1;
  7104. $recv(stream)._nextPutAll_($1);
  7105. $ctx2.sendIdx["nextPutAll:"]=4;
  7106. $4=$recv(stream)._nextPutAll_("instanceVariableNames: '");
  7107. $ctx2.sendIdx["nextPutAll:"]=5;
  7108. $4;
  7109. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  7110. return $core.withContext(function($ctx3) {
  7111. return $recv(stream)._nextPutAll_(each);
  7112. $ctx3.sendIdx["nextPutAll:"]=6;
  7113. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  7114. }),(function(){
  7115. return $core.withContext(function($ctx3) {
  7116. return $recv(stream)._nextPutAll_(" ");
  7117. $ctx3.sendIdx["nextPutAll:"]=7;
  7118. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  7119. }));
  7120. $5=$recv("'".__comma($recv($globals.String)._lf())).__comma($recv($globals.String)._tab());
  7121. $ctx2.sendIdx[","]=2;
  7122. $recv(stream)._nextPutAll_($5);
  7123. $ctx2.sendIdx["nextPutAll:"]=8;
  7124. $recv(stream)._nextPutAll_("package: '");
  7125. $ctx2.sendIdx["nextPutAll:"]=9;
  7126. $recv(stream)._nextPutAll_(self._category());
  7127. $ctx2.sendIdx["nextPutAll:"]=10;
  7128. return $recv(stream)._nextPutAll_("'");
  7129. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  7130. }));
  7131. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  7132. },
  7133. args: [],
  7134. 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: '''' ]",
  7135. referencedClasses: ["String"],
  7136. messageSends: ["streamContents:", "nextPutAll:", "asString", "superclass", "name", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category"]
  7137. }),
  7138. $globals.Class);
  7139. $core.addMethod(
  7140. $core.method({
  7141. selector: "isClass",
  7142. protocol: 'testing',
  7143. fn: function (){
  7144. var self=this;
  7145. return true;
  7146. },
  7147. args: [],
  7148. source: "isClass\x0a\x09^ true",
  7149. referencedClasses: [],
  7150. messageSends: []
  7151. }),
  7152. $globals.Class);
  7153. $core.addMethod(
  7154. $core.method({
  7155. selector: "package",
  7156. protocol: 'accessing',
  7157. fn: function (){
  7158. var self=this;
  7159. return $core.withContext(function($ctx1) {
  7160. return self._basicAt_("pkg");
  7161. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Class)});
  7162. },
  7163. args: [],
  7164. source: "package\x0a\x09^ self basicAt: 'pkg'",
  7165. referencedClasses: [],
  7166. messageSends: ["basicAt:"]
  7167. }),
  7168. $globals.Class);
  7169. $core.addMethod(
  7170. $core.method({
  7171. selector: "package:",
  7172. protocol: 'accessing',
  7173. fn: function (aPackage){
  7174. var self=this;
  7175. var oldPackage;
  7176. return $core.withContext(function($ctx1) {
  7177. var $2,$1,$3,$4,$6,$5;
  7178. $2=self._package();
  7179. $ctx1.sendIdx["package"]=1;
  7180. $1=$recv($2).__eq(aPackage);
  7181. if($core.assert($1)){
  7182. return self;
  7183. };
  7184. oldPackage=self._package();
  7185. self._basicAt_put_("pkg",aPackage);
  7186. $3=$recv(oldPackage)._organization();
  7187. $ctx1.sendIdx["organization"]=1;
  7188. $recv($3)._removeElement_(self);
  7189. $recv($recv(aPackage)._organization())._addElement_(self);
  7190. $4=$recv($globals.SystemAnnouncer)._current();
  7191. $6=$recv($globals.ClassMoved)._new();
  7192. $recv($6)._theClass_(self);
  7193. $recv($6)._oldPackage_(oldPackage);
  7194. $5=$recv($6)._yourself();
  7195. $recv($4)._announce_($5);
  7196. return self;
  7197. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.Class)});
  7198. },
  7199. args: ["aPackage"],
  7200. 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)",
  7201. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  7202. messageSends: ["ifTrue:", "=", "package", "basicAt:put:", "removeElement:", "organization", "addElement:", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  7203. }),
  7204. $globals.Class);
  7205. $core.addMethod(
  7206. $core.method({
  7207. selector: "printOn:",
  7208. protocol: 'printing',
  7209. fn: function (aStream){
  7210. var self=this;
  7211. return $core.withContext(function($ctx1) {
  7212. $recv(aStream)._nextPutAll_(self._name());
  7213. return self;
  7214. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Class)});
  7215. },
  7216. args: ["aStream"],
  7217. source: "printOn: aStream\x0a\x09aStream nextPutAll: self name",
  7218. referencedClasses: [],
  7219. messageSends: ["nextPutAll:", "name"]
  7220. }),
  7221. $globals.Class);
  7222. $core.addMethod(
  7223. $core.method({
  7224. selector: "rename:",
  7225. protocol: 'accessing',
  7226. fn: function (aString){
  7227. var self=this;
  7228. return $core.withContext(function($ctx1) {
  7229. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  7230. return self;
  7231. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  7232. },
  7233. args: ["aString"],
  7234. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  7235. referencedClasses: ["ClassBuilder"],
  7236. messageSends: ["renameClass:to:", "new"]
  7237. }),
  7238. $globals.Class);
  7239. $core.addMethod(
  7240. $core.method({
  7241. selector: "subclass:instanceVariableNames:",
  7242. protocol: 'class creation',
  7243. fn: function (aString,anotherString){
  7244. var self=this;
  7245. return $core.withContext(function($ctx1) {
  7246. return self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  7247. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.Class)});
  7248. },
  7249. args: ["aString", "anotherString"],
  7250. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  7251. referencedClasses: [],
  7252. messageSends: ["subclass:instanceVariableNames:package:"]
  7253. }),
  7254. $globals.Class);
  7255. $core.addMethod(
  7256. $core.method({
  7257. selector: "subclass:instanceVariableNames:category:",
  7258. protocol: 'class creation',
  7259. fn: function (aString,aString2,aString3){
  7260. var self=this;
  7261. return $core.withContext(function($ctx1) {
  7262. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  7263. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  7264. },
  7265. args: ["aString", "aString2", "aString3"],
  7266. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  7267. referencedClasses: [],
  7268. messageSends: ["subclass:instanceVariableNames:package:"]
  7269. }),
  7270. $globals.Class);
  7271. $core.addMethod(
  7272. $core.method({
  7273. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  7274. protocol: 'class creation',
  7275. fn: function (aString,aString2,classVars,pools,aString3){
  7276. var self=this;
  7277. return $core.withContext(function($ctx1) {
  7278. return self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  7279. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.Class)});
  7280. },
  7281. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  7282. 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",
  7283. referencedClasses: [],
  7284. messageSends: ["subclass:instanceVariableNames:package:"]
  7285. }),
  7286. $globals.Class);
  7287. $core.addMethod(
  7288. $core.method({
  7289. selector: "subclass:instanceVariableNames:package:",
  7290. protocol: 'class creation',
  7291. fn: function (aString,aString2,aString3){
  7292. var self=this;
  7293. return $core.withContext(function($ctx1) {
  7294. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  7295. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.Class)});
  7296. },
  7297. args: ["aString", "aString2", "aString3"],
  7298. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  7299. referencedClasses: ["ClassBuilder"],
  7300. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  7301. }),
  7302. $globals.Class);
  7303. $core.addMethod(
  7304. $core.method({
  7305. selector: "subclasses",
  7306. protocol: 'accessing',
  7307. fn: function (){
  7308. var self=this;
  7309. return $core.withContext(function($ctx1) {
  7310. return self.subclasses._copy();
  7311. return self;
  7312. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  7313. },
  7314. args: [],
  7315. source: "subclasses\x0a\x09<return self.subclasses._copy()>",
  7316. referencedClasses: [],
  7317. messageSends: []
  7318. }),
  7319. $globals.Class);
  7320. $core.addMethod(
  7321. $core.method({
  7322. selector: "theMetaClass",
  7323. protocol: 'accessing',
  7324. fn: function (){
  7325. var self=this;
  7326. return $core.withContext(function($ctx1) {
  7327. return self._class();
  7328. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  7329. },
  7330. args: [],
  7331. source: "theMetaClass\x0a\x09^ self class",
  7332. referencedClasses: [],
  7333. messageSends: ["class"]
  7334. }),
  7335. $globals.Class);
  7336. $core.addMethod(
  7337. $core.method({
  7338. selector: "theNonMetaClass",
  7339. protocol: 'accessing',
  7340. fn: function (){
  7341. var self=this;
  7342. return self;
  7343. },
  7344. args: [],
  7345. source: "theNonMetaClass\x0a\x09^ self",
  7346. referencedClasses: [],
  7347. messageSends: []
  7348. }),
  7349. $globals.Class);
  7350. $core.addClass('Metaclass', $globals.Behavior, [], 'Kernel-Classes');
  7351. $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.";
  7352. $core.addMethod(
  7353. $core.method({
  7354. selector: "asJavascript",
  7355. protocol: 'converting',
  7356. fn: function (){
  7357. var self=this;
  7358. return $core.withContext(function($ctx1) {
  7359. var $1;
  7360. $1=$recv("$globals.".__comma($recv(self._instanceClass())._name())).__comma(".klass");
  7361. $ctx1.sendIdx[","]=1;
  7362. return $1;
  7363. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Metaclass)});
  7364. },
  7365. args: [],
  7366. source: "asJavascript\x0a\x09^ '$globals.', self instanceClass name, '.klass'",
  7367. referencedClasses: [],
  7368. messageSends: [",", "name", "instanceClass"]
  7369. }),
  7370. $globals.Metaclass);
  7371. $core.addMethod(
  7372. $core.method({
  7373. selector: "definition",
  7374. protocol: 'accessing',
  7375. fn: function (){
  7376. var self=this;
  7377. return $core.withContext(function($ctx1) {
  7378. var $1;
  7379. return $recv($globals.String)._streamContents_((function(stream){
  7380. return $core.withContext(function($ctx2) {
  7381. $recv(stream)._nextPutAll_(self._asString());
  7382. $ctx2.sendIdx["nextPutAll:"]=1;
  7383. $1=$recv(stream)._nextPutAll_(" instanceVariableNames: '");
  7384. $ctx2.sendIdx["nextPutAll:"]=2;
  7385. $1;
  7386. $recv(self._instanceVariableNames())._do_separatedBy_((function(each){
  7387. return $core.withContext(function($ctx3) {
  7388. return $recv(stream)._nextPutAll_(each);
  7389. $ctx3.sendIdx["nextPutAll:"]=3;
  7390. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  7391. }),(function(){
  7392. return $core.withContext(function($ctx3) {
  7393. return $recv(stream)._nextPutAll_(" ");
  7394. $ctx3.sendIdx["nextPutAll:"]=4;
  7395. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  7396. }));
  7397. return $recv(stream)._nextPutAll_("'");
  7398. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  7399. }));
  7400. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  7401. },
  7402. args: [],
  7403. 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: '''' ]",
  7404. referencedClasses: ["String"],
  7405. messageSends: ["streamContents:", "nextPutAll:", "asString", "do:separatedBy:", "instanceVariableNames"]
  7406. }),
  7407. $globals.Metaclass);
  7408. $core.addMethod(
  7409. $core.method({
  7410. selector: "instanceClass",
  7411. protocol: 'accessing',
  7412. fn: function (){
  7413. var self=this;
  7414. return $core.withContext(function($ctx1) {
  7415. return self.instanceClass;
  7416. return self;
  7417. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  7418. },
  7419. args: [],
  7420. source: "instanceClass\x0a\x09<return self.instanceClass>",
  7421. referencedClasses: [],
  7422. messageSends: []
  7423. }),
  7424. $globals.Metaclass);
  7425. $core.addMethod(
  7426. $core.method({
  7427. selector: "instanceVariableNames:",
  7428. protocol: 'accessing',
  7429. fn: function (aCollection){
  7430. var self=this;
  7431. return $core.withContext(function($ctx1) {
  7432. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  7433. return self;
  7434. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  7435. },
  7436. args: ["aCollection"],
  7437. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection",
  7438. referencedClasses: ["ClassBuilder"],
  7439. messageSends: ["class:instanceVariableNames:", "new"]
  7440. }),
  7441. $globals.Metaclass);
  7442. $core.addMethod(
  7443. $core.method({
  7444. selector: "isMetaclass",
  7445. protocol: 'testing',
  7446. fn: function (){
  7447. var self=this;
  7448. return true;
  7449. },
  7450. args: [],
  7451. source: "isMetaclass\x0a\x09^ true",
  7452. referencedClasses: [],
  7453. messageSends: []
  7454. }),
  7455. $globals.Metaclass);
  7456. $core.addMethod(
  7457. $core.method({
  7458. selector: "package",
  7459. protocol: 'accessing',
  7460. fn: function (){
  7461. var self=this;
  7462. return $core.withContext(function($ctx1) {
  7463. return $recv(self._instanceClass())._package();
  7464. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  7465. },
  7466. args: [],
  7467. source: "package\x0a\x09^ self instanceClass package",
  7468. referencedClasses: [],
  7469. messageSends: ["package", "instanceClass"]
  7470. }),
  7471. $globals.Metaclass);
  7472. $core.addMethod(
  7473. $core.method({
  7474. selector: "printOn:",
  7475. protocol: 'printing',
  7476. fn: function (aStream){
  7477. var self=this;
  7478. return $core.withContext(function($ctx1) {
  7479. $recv(aStream)._nextPutAll_($recv(self._instanceClass())._name());
  7480. $ctx1.sendIdx["nextPutAll:"]=1;
  7481. $recv(aStream)._nextPutAll_(" class");
  7482. return self;
  7483. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Metaclass)});
  7484. },
  7485. args: ["aStream"],
  7486. source: "printOn: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: self instanceClass name;\x0a\x09\x09nextPutAll: ' class'",
  7487. referencedClasses: [],
  7488. messageSends: ["nextPutAll:", "name", "instanceClass"]
  7489. }),
  7490. $globals.Metaclass);
  7491. $core.addMethod(
  7492. $core.method({
  7493. selector: "subclasses",
  7494. protocol: 'accessing',
  7495. fn: function (){
  7496. var self=this;
  7497. return $core.withContext(function($ctx1) {
  7498. return $recv($recv($recv(self._instanceClass())._subclasses())._select_((function(each){
  7499. return $core.withContext(function($ctx2) {
  7500. return $recv($recv(each)._isMetaclass())._not();
  7501. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7502. })))._collect_((function(each){
  7503. return $core.withContext(function($ctx2) {
  7504. return $recv(each)._theMetaClass();
  7505. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7506. }));
  7507. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  7508. },
  7509. args: [],
  7510. source: "subclasses\x0a\x09^ (self instanceClass subclasses \x0a\x09\x09select: [ :each | each isMetaclass not ])\x0a\x09\x09collect: [ :each | each theMetaClass ]",
  7511. referencedClasses: [],
  7512. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "not", "isMetaclass", "theMetaClass"]
  7513. }),
  7514. $globals.Metaclass);
  7515. $core.addMethod(
  7516. $core.method({
  7517. selector: "theMetaClass",
  7518. protocol: 'accessing',
  7519. fn: function (){
  7520. var self=this;
  7521. return self;
  7522. },
  7523. args: [],
  7524. source: "theMetaClass\x0a\x09^ self",
  7525. referencedClasses: [],
  7526. messageSends: []
  7527. }),
  7528. $globals.Metaclass);
  7529. $core.addMethod(
  7530. $core.method({
  7531. selector: "theNonMetaClass",
  7532. protocol: 'accessing',
  7533. fn: function (){
  7534. var self=this;
  7535. return $core.withContext(function($ctx1) {
  7536. return self._instanceClass();
  7537. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  7538. },
  7539. args: [],
  7540. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  7541. referencedClasses: [],
  7542. messageSends: ["instanceClass"]
  7543. }),
  7544. $globals.Metaclass);
  7545. $core.addClass('ClassBuilder', $globals.Object, [], 'Kernel-Classes');
  7546. $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:`.";
  7547. $core.addMethod(
  7548. $core.method({
  7549. selector: "addSubclassOf:named:instanceVariableNames:package:",
  7550. protocol: 'class definition',
  7551. fn: function (aClass,className,aCollection,packageName){
  7552. var self=this;
  7553. var theClass,thePackage;
  7554. return $core.withContext(function($ctx1) {
  7555. var $1,$2,$receiver;
  7556. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  7557. thePackage=$recv($globals.Package)._named_(packageName);
  7558. $1=theClass;
  7559. if(($receiver = $1) == null || $receiver.isNil){
  7560. $1;
  7561. } else {
  7562. $recv(theClass)._package_(thePackage);
  7563. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  7564. if(!$core.assert($2)){
  7565. return self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  7566. };
  7567. };
  7568. return self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  7569. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  7570. },
  7571. args: ["aClass", "className", "aCollection", "packageName"],
  7572. 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",
  7573. referencedClasses: ["Smalltalk", "Package"],
  7574. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "basicAddSubclassOf:named:instanceVariableNames:package:"]
  7575. }),
  7576. $globals.ClassBuilder);
  7577. $core.addMethod(
  7578. $core.method({
  7579. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  7580. protocol: 'private',
  7581. fn: function (aClass,aString,aCollection,packageName){
  7582. var self=this;
  7583. return $core.withContext(function($ctx1) {
  7584. $core.addClass(aString, aClass, aCollection, packageName);
  7585. return $globals[aString]
  7586. ;
  7587. return self;
  7588. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  7589. },
  7590. args: ["aClass", "aString", "aCollection", "packageName"],
  7591. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<\x0a\x09\x09$core.addClass(aString, aClass, aCollection, packageName);\x0a\x09\x09return $globals[aString]\x0a\x09>",
  7592. referencedClasses: [],
  7593. messageSends: []
  7594. }),
  7595. $globals.ClassBuilder);
  7596. $core.addMethod(
  7597. $core.method({
  7598. selector: "basicClass:instanceVariableNames:",
  7599. protocol: 'private',
  7600. fn: function (aClass,aString){
  7601. var self=this;
  7602. return $core.withContext(function($ctx1) {
  7603. self._basicClass_instanceVariables_(aClass,self._instanceVariableNamesFor_(aString));
  7604. return self;
  7605. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariableNames:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7606. },
  7607. args: ["aClass", "aString"],
  7608. source: "basicClass: aClass instanceVariableNames: aString\x0a\x09self basicClass: aClass instanceVariables: (self instanceVariableNamesFor: aString)",
  7609. referencedClasses: [],
  7610. messageSends: ["basicClass:instanceVariables:", "instanceVariableNamesFor:"]
  7611. }),
  7612. $globals.ClassBuilder);
  7613. $core.addMethod(
  7614. $core.method({
  7615. selector: "basicClass:instanceVariables:",
  7616. protocol: 'private',
  7617. fn: function (aClass,aCollection){
  7618. var self=this;
  7619. return $core.withContext(function($ctx1) {
  7620. var $1;
  7621. $1=$recv(aClass)._isMetaclass();
  7622. if(!$core.assert($1)){
  7623. self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  7624. };
  7625. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  7626. return self;
  7627. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  7628. },
  7629. args: ["aClass", "aCollection"],
  7630. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  7631. referencedClasses: [],
  7632. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  7633. }),
  7634. $globals.ClassBuilder);
  7635. $core.addMethod(
  7636. $core.method({
  7637. selector: "basicRemoveClass:",
  7638. protocol: 'private',
  7639. fn: function (aClass){
  7640. var self=this;
  7641. return $core.withContext(function($ctx1) {
  7642. $core.removeClass(aClass);
  7643. return self;
  7644. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  7645. },
  7646. args: ["aClass"],
  7647. source: "basicRemoveClass: aClass\x0a\x09<$core.removeClass(aClass)>",
  7648. referencedClasses: [],
  7649. messageSends: []
  7650. }),
  7651. $globals.ClassBuilder);
  7652. $core.addMethod(
  7653. $core.method({
  7654. selector: "basicRenameClass:to:",
  7655. protocol: 'private',
  7656. fn: function (aClass,aString){
  7657. var self=this;
  7658. return $core.withContext(function($ctx1) {
  7659. $globals[aString] = aClass;
  7660. delete $globals[aClass.className];
  7661. aClass.className = aString;
  7662. ;
  7663. return self;
  7664. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7665. },
  7666. args: ["aClass", "aString"],
  7667. 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>",
  7668. referencedClasses: [],
  7669. messageSends: []
  7670. }),
  7671. $globals.ClassBuilder);
  7672. $core.addMethod(
  7673. $core.method({
  7674. selector: "basicSwapClassNames:with:",
  7675. protocol: 'private',
  7676. fn: function (aClass,anotherClass){
  7677. var self=this;
  7678. return $core.withContext(function($ctx1) {
  7679. var tmp = aClass.className;
  7680. aClass.className = anotherClass.className;
  7681. anotherClass.className = tmp;
  7682. ;
  7683. return self;
  7684. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7685. },
  7686. args: ["aClass", "anotherClass"],
  7687. 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>",
  7688. referencedClasses: [],
  7689. messageSends: []
  7690. }),
  7691. $globals.ClassBuilder);
  7692. $core.addMethod(
  7693. $core.method({
  7694. selector: "class:instanceVariableNames:",
  7695. protocol: 'class definition',
  7696. fn: function (aClass,ivarNames){
  7697. var self=this;
  7698. return $core.withContext(function($ctx1) {
  7699. var $1,$3,$2;
  7700. self._basicClass_instanceVariableNames_(aClass,ivarNames);
  7701. self._setupClass_(aClass);
  7702. $1=$recv($globals.SystemAnnouncer)._current();
  7703. $3=$recv($globals.ClassDefinitionChanged)._new();
  7704. $recv($3)._theClass_(aClass);
  7705. $2=$recv($3)._yourself();
  7706. $recv($1)._announce_($2);
  7707. return self;
  7708. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  7709. },
  7710. args: ["aClass", "ivarNames"],
  7711. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self basicClass: aClass instanceVariableNames: ivarNames.\x0a\x09self setupClass: aClass.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  7712. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  7713. messageSends: ["basicClass:instanceVariableNames:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  7714. }),
  7715. $globals.ClassBuilder);
  7716. $core.addMethod(
  7717. $core.method({
  7718. selector: "copyClass:named:",
  7719. protocol: 'copying',
  7720. fn: function (aClass,className){
  7721. var self=this;
  7722. var newClass;
  7723. return $core.withContext(function($ctx1) {
  7724. var $1,$3,$2;
  7725. newClass=self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7726. self._copyClass_to_(aClass,newClass);
  7727. $1=$recv($globals.SystemAnnouncer)._current();
  7728. $3=$recv($globals.ClassAdded)._new();
  7729. $recv($3)._theClass_(newClass);
  7730. $2=$recv($3)._yourself();
  7731. $recv($1)._announce_($2);
  7732. return newClass;
  7733. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  7734. },
  7735. args: ["aClass", "className"],
  7736. 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",
  7737. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  7738. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  7739. }),
  7740. $globals.ClassBuilder);
  7741. $core.addMethod(
  7742. $core.method({
  7743. selector: "copyClass:to:",
  7744. protocol: 'copying',
  7745. fn: function (aClass,anotherClass){
  7746. var self=this;
  7747. return $core.withContext(function($ctx1) {
  7748. var $1,$2,$3,$4,$5,$7,$6,$9,$8;
  7749. $recv(anotherClass)._comment_($recv(aClass)._comment());
  7750. $1=$recv(aClass)._methodDictionary();
  7751. $ctx1.sendIdx["methodDictionary"]=1;
  7752. $recv($1)._valuesDo_((function(each){
  7753. return $core.withContext(function($ctx2) {
  7754. $2=$recv($globals.Compiler)._new();
  7755. $ctx2.sendIdx["new"]=1;
  7756. $3=$recv(each)._source();
  7757. $ctx2.sendIdx["source"]=1;
  7758. $4=$recv(each)._protocol();
  7759. $ctx2.sendIdx["protocol"]=1;
  7760. return $recv($2)._install_forClass_protocol_($3,anotherClass,$4);
  7761. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  7762. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7763. }));
  7764. $ctx1.sendIdx["valuesDo:"]=1;
  7765. $5=$recv(anotherClass)._class();
  7766. $ctx1.sendIdx["class"]=1;
  7767. $7=$recv(aClass)._class();
  7768. $ctx1.sendIdx["class"]=2;
  7769. $6=$recv($7)._instanceVariableNames();
  7770. self._basicClass_instanceVariables_($5,$6);
  7771. $9=$recv(aClass)._class();
  7772. $ctx1.sendIdx["class"]=3;
  7773. $8=$recv($9)._methodDictionary();
  7774. $recv($8)._valuesDo_((function(each){
  7775. return $core.withContext(function($ctx2) {
  7776. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_($recv(each)._source(),$recv(anotherClass)._class(),$recv(each)._protocol());
  7777. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7778. }));
  7779. self._setupClass_(anotherClass);
  7780. return self;
  7781. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7782. },
  7783. args: ["aClass", "anotherClass"],
  7784. 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 ].\x0a\x0a\x09self setupClass: anotherClass",
  7785. referencedClasses: ["Compiler"],
  7786. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "install:forClass:protocol:", "new", "source", "protocol", "basicClass:instanceVariables:", "class", "instanceVariableNames", "setupClass:"]
  7787. }),
  7788. $globals.ClassBuilder);
  7789. $core.addMethod(
  7790. $core.method({
  7791. selector: "installMethod:forClass:protocol:",
  7792. protocol: 'method definition',
  7793. fn: function (aCompiledMethod,aBehavior,aString){
  7794. var self=this;
  7795. return $core.withContext(function($ctx1) {
  7796. $recv(aCompiledMethod)._protocol_(aString);
  7797. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  7798. return aCompiledMethod;
  7799. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  7800. },
  7801. args: ["aCompiledMethod", "aBehavior", "aString"],
  7802. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  7803. referencedClasses: [],
  7804. messageSends: ["protocol:", "addCompiledMethod:"]
  7805. }),
  7806. $globals.ClassBuilder);
  7807. $core.addMethod(
  7808. $core.method({
  7809. selector: "instanceVariableNamesFor:",
  7810. protocol: 'accessing',
  7811. fn: function (aString){
  7812. var self=this;
  7813. return $core.withContext(function($ctx1) {
  7814. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  7815. return $core.withContext(function($ctx2) {
  7816. return $recv(each)._isEmpty();
  7817. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7818. }));
  7819. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  7820. },
  7821. args: ["aString"],
  7822. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  7823. referencedClasses: [],
  7824. messageSends: ["reject:", "tokenize:", "isEmpty"]
  7825. }),
  7826. $globals.ClassBuilder);
  7827. $core.addMethod(
  7828. $core.method({
  7829. selector: "migrateClass:superclass:",
  7830. protocol: 'class migration',
  7831. fn: function (aClass,anotherClass){
  7832. var self=this;
  7833. return $core.withContext(function($ctx1) {
  7834. var $1;
  7835. $1=$recv(aClass)._name();
  7836. $ctx1.sendIdx["name"]=1;
  7837. return self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  7838. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  7839. },
  7840. args: ["aClass", "anotherClass"],
  7841. 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",
  7842. referencedClasses: [],
  7843. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  7844. }),
  7845. $globals.ClassBuilder);
  7846. $core.addMethod(
  7847. $core.method({
  7848. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  7849. protocol: 'class migration',
  7850. fn: function (className,aClass,aCollection,packageName){
  7851. var self=this;
  7852. var oldClass,newClass,tmp;
  7853. return $core.withContext(function($ctx1) {
  7854. var $1,$2,$4,$3;
  7855. tmp="new*".__comma(className);
  7856. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  7857. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  7858. self._basicSwapClassNames_with_(oldClass,newClass);
  7859. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  7860. $recv((function(){
  7861. return $core.withContext(function($ctx2) {
  7862. return self._copyClass_to_(oldClass,newClass);
  7863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7864. }))._on_do_($globals.Error,(function(exception){
  7865. return $core.withContext(function($ctx2) {
  7866. self._basicSwapClassNames_with_(oldClass,newClass);
  7867. $1=self._basicRemoveClass_(newClass);
  7868. $ctx2.sendIdx["basicRemoveClass:"]=1;
  7869. $1;
  7870. return $recv(exception)._resignal();
  7871. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  7872. }));
  7873. self._rawRenameClass_to_(oldClass,tmp);
  7874. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  7875. self._rawRenameClass_to_(newClass,className);
  7876. $recv($recv(oldClass)._subclasses())._do_((function(each){
  7877. return $core.withContext(function($ctx2) {
  7878. return self._migrateClass_superclass_(each,newClass);
  7879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7880. }));
  7881. self._basicRemoveClass_(oldClass);
  7882. $2=$recv($globals.SystemAnnouncer)._current();
  7883. $4=$recv($globals.ClassMigrated)._new();
  7884. $recv($4)._theClass_(newClass);
  7885. $recv($4)._oldClass_(oldClass);
  7886. $3=$recv($4)._yourself();
  7887. $recv($2)._announce_($3);
  7888. return newClass;
  7889. }, 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)});
  7890. },
  7891. args: ["className", "aClass", "aCollection", "packageName"],
  7892. 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",
  7893. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  7894. 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"]
  7895. }),
  7896. $globals.ClassBuilder);
  7897. $core.addMethod(
  7898. $core.method({
  7899. selector: "rawRenameClass:to:",
  7900. protocol: 'private',
  7901. fn: function (aClass,aString){
  7902. var self=this;
  7903. return $core.withContext(function($ctx1) {
  7904. $globals[aString] = aClass;
  7905. ;
  7906. return self;
  7907. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  7908. },
  7909. args: ["aClass", "aString"],
  7910. source: "rawRenameClass: aClass to: aString\x0a\x09<\x0a\x09\x09$globals[aString] = aClass;\x0a\x09>",
  7911. referencedClasses: [],
  7912. messageSends: []
  7913. }),
  7914. $globals.ClassBuilder);
  7915. $core.addMethod(
  7916. $core.method({
  7917. selector: "renameClass:to:",
  7918. protocol: 'class migration',
  7919. fn: function (aClass,className){
  7920. var self=this;
  7921. return $core.withContext(function($ctx1) {
  7922. var $1,$3,$2;
  7923. self._basicRenameClass_to_(aClass,className);
  7924. $recv(aClass)._recompile();
  7925. $1=$recv($globals.SystemAnnouncer)._current();
  7926. $3=$recv($globals.ClassRenamed)._new();
  7927. $recv($3)._theClass_(aClass);
  7928. $2=$recv($3)._yourself();
  7929. $recv($1)._announce_($2);
  7930. return self;
  7931. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7932. },
  7933. args: ["aClass", "className"],
  7934. 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)",
  7935. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  7936. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  7937. }),
  7938. $globals.ClassBuilder);
  7939. $core.addMethod(
  7940. $core.method({
  7941. selector: "setupClass:",
  7942. protocol: 'public',
  7943. fn: function (aClass){
  7944. var self=this;
  7945. return $core.withContext(function($ctx1) {
  7946. $core.init(aClass);;
  7947. return self;
  7948. }, function($ctx1) {$ctx1.fill(self,"setupClass:",{aClass:aClass},$globals.ClassBuilder)});
  7949. },
  7950. args: ["aClass"],
  7951. source: "setupClass: aClass\x0a\x09<$core.init(aClass);>",
  7952. referencedClasses: [],
  7953. messageSends: []
  7954. }),
  7955. $globals.ClassBuilder);
  7956. $core.addMethod(
  7957. $core.method({
  7958. selector: "superclass:subclass:",
  7959. protocol: 'class definition',
  7960. fn: function (aClass,className){
  7961. var self=this;
  7962. return $core.withContext(function($ctx1) {
  7963. return self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  7964. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  7965. },
  7966. args: ["aClass", "className"],
  7967. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  7968. referencedClasses: [],
  7969. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  7970. }),
  7971. $globals.ClassBuilder);
  7972. $core.addMethod(
  7973. $core.method({
  7974. selector: "superclass:subclass:instanceVariableNames:package:",
  7975. protocol: 'class definition',
  7976. fn: function (aClass,className,ivarNames,packageName){
  7977. var self=this;
  7978. var newClass;
  7979. return $core.withContext(function($ctx1) {
  7980. var $1,$2,$3,$5,$4,$receiver;
  7981. $1=self._instanceVariableNamesFor_(ivarNames);
  7982. if(($receiver = packageName) == null || $receiver.isNil){
  7983. $2="unclassified";
  7984. } else {
  7985. $2=packageName;
  7986. };
  7987. newClass=self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  7988. self._setupClass_(newClass);
  7989. $3=$recv($globals.SystemAnnouncer)._current();
  7990. $5=$recv($globals.ClassAdded)._new();
  7991. $recv($5)._theClass_(newClass);
  7992. $4=$recv($5)._yourself();
  7993. $recv($3)._announce_($4);
  7994. return newClass;
  7995. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  7996. },
  7997. args: ["aClass", "className", "ivarNames", "packageName"],
  7998. 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\x09self setupClass: 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",
  7999. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  8000. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "setupClass:", "announce:", "current", "theClass:", "new", "yourself"]
  8001. }),
  8002. $globals.ClassBuilder);
  8003. $core.addClass('ClassSorterNode', $globals.Object, ['theClass', 'level', 'nodes'], 'Kernel-Classes');
  8004. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://github.com/amber-smalltalk/amber/issues/143) on GitHub.";
  8005. $core.addMethod(
  8006. $core.method({
  8007. selector: "getNodesFrom:",
  8008. protocol: 'accessing',
  8009. fn: function (aCollection){
  8010. var self=this;
  8011. var children,others;
  8012. return $core.withContext(function($ctx1) {
  8013. var $1;
  8014. children=[];
  8015. others=[];
  8016. $recv(aCollection)._do_((function(each){
  8017. return $core.withContext(function($ctx2) {
  8018. $1=$recv($recv(each)._superclass()).__eq(self._theClass());
  8019. if($core.assert($1)){
  8020. return $recv(children)._add_(each);
  8021. $ctx2.sendIdx["add:"]=1;
  8022. } else {
  8023. return $recv(others)._add_(each);
  8024. };
  8025. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8026. }));
  8027. self["@nodes"]=$recv(children)._collect_((function(each){
  8028. return $core.withContext(function($ctx2) {
  8029. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv(self._level()).__plus((1)));
  8030. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  8031. }));
  8032. return self;
  8033. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  8034. },
  8035. args: ["aCollection"],
  8036. 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 ]",
  8037. referencedClasses: ["ClassSorterNode"],
  8038. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  8039. }),
  8040. $globals.ClassSorterNode);
  8041. $core.addMethod(
  8042. $core.method({
  8043. selector: "level",
  8044. protocol: 'accessing',
  8045. fn: function (){
  8046. var self=this;
  8047. return self["@level"];
  8048. },
  8049. args: [],
  8050. source: "level\x0a\x09^ level",
  8051. referencedClasses: [],
  8052. messageSends: []
  8053. }),
  8054. $globals.ClassSorterNode);
  8055. $core.addMethod(
  8056. $core.method({
  8057. selector: "level:",
  8058. protocol: 'accessing',
  8059. fn: function (anInteger){
  8060. var self=this;
  8061. self["@level"]=anInteger;
  8062. return self;
  8063. },
  8064. args: ["anInteger"],
  8065. source: "level: anInteger\x0a\x09level := anInteger",
  8066. referencedClasses: [],
  8067. messageSends: []
  8068. }),
  8069. $globals.ClassSorterNode);
  8070. $core.addMethod(
  8071. $core.method({
  8072. selector: "nodes",
  8073. protocol: 'accessing',
  8074. fn: function (){
  8075. var self=this;
  8076. return self["@nodes"];
  8077. },
  8078. args: [],
  8079. source: "nodes\x0a\x09^ nodes",
  8080. referencedClasses: [],
  8081. messageSends: []
  8082. }),
  8083. $globals.ClassSorterNode);
  8084. $core.addMethod(
  8085. $core.method({
  8086. selector: "theClass",
  8087. protocol: 'accessing',
  8088. fn: function (){
  8089. var self=this;
  8090. return self["@theClass"];
  8091. },
  8092. args: [],
  8093. source: "theClass\x0a\x09^ theClass",
  8094. referencedClasses: [],
  8095. messageSends: []
  8096. }),
  8097. $globals.ClassSorterNode);
  8098. $core.addMethod(
  8099. $core.method({
  8100. selector: "theClass:",
  8101. protocol: 'accessing',
  8102. fn: function (aClass){
  8103. var self=this;
  8104. self["@theClass"]=aClass;
  8105. return self;
  8106. },
  8107. args: ["aClass"],
  8108. source: "theClass: aClass\x0a\x09theClass := aClass",
  8109. referencedClasses: [],
  8110. messageSends: []
  8111. }),
  8112. $globals.ClassSorterNode);
  8113. $core.addMethod(
  8114. $core.method({
  8115. selector: "traverseClassesWith:",
  8116. protocol: 'visiting',
  8117. fn: function (aCollection){
  8118. var self=this;
  8119. return $core.withContext(function($ctx1) {
  8120. var $1,$3,$2;
  8121. $1=self._theClass();
  8122. $ctx1.sendIdx["theClass"]=1;
  8123. $recv(aCollection)._add_($1);
  8124. $recv($recv(self._nodes())._sorted_((function(a,b){
  8125. return $core.withContext(function($ctx2) {
  8126. $3=$recv(a)._theClass();
  8127. $ctx2.sendIdx["theClass"]=2;
  8128. $2=$recv($3)._name();
  8129. $ctx2.sendIdx["name"]=1;
  8130. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  8131. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  8132. })))._do_((function(aNode){
  8133. return $core.withContext(function($ctx2) {
  8134. return $recv(aNode)._traverseClassesWith_(aCollection);
  8135. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  8136. }));
  8137. return self;
  8138. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  8139. },
  8140. args: ["aCollection"],
  8141. 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 ].",
  8142. referencedClasses: [],
  8143. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  8144. }),
  8145. $globals.ClassSorterNode);
  8146. $core.addMethod(
  8147. $core.method({
  8148. selector: "on:classes:level:",
  8149. protocol: 'instance creation',
  8150. fn: function (aClass,aCollection,anInteger){
  8151. var self=this;
  8152. return $core.withContext(function($ctx1) {
  8153. var $1;
  8154. $1=self._new();
  8155. $recv($1)._theClass_(aClass);
  8156. $recv($1)._level_(anInteger);
  8157. $recv($1)._getNodesFrom_(aCollection);
  8158. return $recv($1)._yourself();
  8159. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.klass)});
  8160. },
  8161. args: ["aClass", "aCollection", "anInteger"],
  8162. 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",
  8163. referencedClasses: [],
  8164. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  8165. }),
  8166. $globals.ClassSorterNode.klass);
  8167. });
  8168. define("amber_core/Kernel-Methods", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  8169. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  8170. $core.addPackage('Kernel-Methods');
  8171. $core.packages["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  8172. $core.packages["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  8173. $core.addClass('BlockClosure', $globals.Object, [], 'Kernel-Methods');
  8174. $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 | ... ] `";
  8175. $core.addMethod(
  8176. $core.method({
  8177. selector: "applyTo:arguments:",
  8178. protocol: 'evaluating',
  8179. fn: function (anObject,aCollection){
  8180. var self=this;
  8181. return $core.withContext(function($ctx1) {
  8182. return self.apply(anObject, aCollection);
  8183. return self;
  8184. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  8185. },
  8186. args: ["anObject", "aCollection"],
  8187. source: "applyTo: anObject arguments: aCollection\x0a\x09<return self.apply(anObject, aCollection)>",
  8188. referencedClasses: [],
  8189. messageSends: []
  8190. }),
  8191. $globals.BlockClosure);
  8192. $core.addMethod(
  8193. $core.method({
  8194. selector: "asCompiledMethod:",
  8195. protocol: 'converting',
  8196. fn: function (aString){
  8197. var self=this;
  8198. return $core.withContext(function($ctx1) {
  8199. return $core.method({selector:aString, fn:self});;
  8200. return self;
  8201. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  8202. },
  8203. args: ["aString"],
  8204. source: "asCompiledMethod: aString\x0a\x09<return $core.method({selector:aString, fn:self});>",
  8205. referencedClasses: [],
  8206. messageSends: []
  8207. }),
  8208. $globals.BlockClosure);
  8209. $core.addMethod(
  8210. $core.method({
  8211. selector: "compiledSource",
  8212. protocol: 'accessing',
  8213. fn: function (){
  8214. var self=this;
  8215. return $core.withContext(function($ctx1) {
  8216. return self.toString();
  8217. return self;
  8218. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  8219. },
  8220. args: [],
  8221. source: "compiledSource\x0a\x09<return self.toString()>",
  8222. referencedClasses: [],
  8223. messageSends: []
  8224. }),
  8225. $globals.BlockClosure);
  8226. $core.addMethod(
  8227. $core.method({
  8228. selector: "currySelf",
  8229. protocol: 'converting',
  8230. fn: function (){
  8231. var self=this;
  8232. return $core.withContext(function($ctx1) {
  8233. return function () {
  8234. var args = [ this ];
  8235. args.push.apply(args, arguments);
  8236. return self.apply(null, args);
  8237. }
  8238. ;
  8239. return self;
  8240. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  8241. },
  8242. args: [],
  8243. 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>",
  8244. referencedClasses: [],
  8245. messageSends: []
  8246. }),
  8247. $globals.BlockClosure);
  8248. $core.addMethod(
  8249. $core.method({
  8250. selector: "ensure:",
  8251. protocol: 'evaluating',
  8252. fn: function (aBlock){
  8253. var self=this;
  8254. return $core.withContext(function($ctx1) {
  8255. try{return self._value()}finally{aBlock._value()};
  8256. return self;
  8257. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  8258. },
  8259. args: ["aBlock"],
  8260. source: "ensure: aBlock\x0a\x09<try{return self._value()}finally{aBlock._value()}>",
  8261. referencedClasses: [],
  8262. messageSends: []
  8263. }),
  8264. $globals.BlockClosure);
  8265. $core.addMethod(
  8266. $core.method({
  8267. selector: "fork",
  8268. protocol: 'timeout/interval',
  8269. fn: function (){
  8270. var self=this;
  8271. return $core.withContext(function($ctx1) {
  8272. $recv($recv($globals.ForkPool)._default())._fork_(self);
  8273. return self;
  8274. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  8275. },
  8276. args: [],
  8277. source: "fork\x0a\x09ForkPool default fork: self",
  8278. referencedClasses: ["ForkPool"],
  8279. messageSends: ["fork:", "default"]
  8280. }),
  8281. $globals.BlockClosure);
  8282. $core.addMethod(
  8283. $core.method({
  8284. selector: "new",
  8285. protocol: 'evaluating',
  8286. fn: function (){
  8287. var self=this;
  8288. return $core.withContext(function($ctx1) {
  8289. return new self();
  8290. return self;
  8291. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  8292. },
  8293. args: [],
  8294. 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()>",
  8295. referencedClasses: [],
  8296. messageSends: []
  8297. }),
  8298. $globals.BlockClosure);
  8299. $core.addMethod(
  8300. $core.method({
  8301. selector: "newValue:",
  8302. protocol: 'evaluating',
  8303. fn: function (anObject){
  8304. var self=this;
  8305. return $core.withContext(function($ctx1) {
  8306. return self._newWithValues_([anObject]);
  8307. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  8308. },
  8309. args: ["anObject"],
  8310. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  8311. referencedClasses: [],
  8312. messageSends: ["newWithValues:"]
  8313. }),
  8314. $globals.BlockClosure);
  8315. $core.addMethod(
  8316. $core.method({
  8317. selector: "newValue:value:",
  8318. protocol: 'evaluating',
  8319. fn: function (anObject,anObject2){
  8320. var self=this;
  8321. return $core.withContext(function($ctx1) {
  8322. return self._newWithValues_([anObject,anObject2]);
  8323. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  8324. },
  8325. args: ["anObject", "anObject2"],
  8326. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  8327. referencedClasses: [],
  8328. messageSends: ["newWithValues:"]
  8329. }),
  8330. $globals.BlockClosure);
  8331. $core.addMethod(
  8332. $core.method({
  8333. selector: "newValue:value:value:",
  8334. protocol: 'evaluating',
  8335. fn: function (anObject,anObject2,anObject3){
  8336. var self=this;
  8337. return $core.withContext(function($ctx1) {
  8338. return self._newWithValues_([anObject,anObject2,anObject3]);
  8339. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  8340. },
  8341. args: ["anObject", "anObject2", "anObject3"],
  8342. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  8343. referencedClasses: [],
  8344. messageSends: ["newWithValues:"]
  8345. }),
  8346. $globals.BlockClosure);
  8347. $core.addMethod(
  8348. $core.method({
  8349. selector: "newWithValues:",
  8350. protocol: 'evaluating',
  8351. fn: function (aCollection){
  8352. var self=this;
  8353. return $core.withContext(function($ctx1) {
  8354. var object = Object.create(self.prototype);
  8355. var result = self.apply(object, aCollection);
  8356. return typeof result === "object" ? result : object;
  8357. ;
  8358. return self;
  8359. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  8360. },
  8361. args: ["aCollection"],
  8362. 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>",
  8363. referencedClasses: [],
  8364. messageSends: []
  8365. }),
  8366. $globals.BlockClosure);
  8367. $core.addMethod(
  8368. $core.method({
  8369. selector: "numArgs",
  8370. protocol: 'accessing',
  8371. fn: function (){
  8372. var self=this;
  8373. return $core.withContext(function($ctx1) {
  8374. return self.length;
  8375. return self;
  8376. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  8377. },
  8378. args: [],
  8379. source: "numArgs\x0a\x09<return self.length>",
  8380. referencedClasses: [],
  8381. messageSends: []
  8382. }),
  8383. $globals.BlockClosure);
  8384. $core.addMethod(
  8385. $core.method({
  8386. selector: "on:do:",
  8387. protocol: 'error handling',
  8388. fn: function (anErrorClass,aBlock){
  8389. var self=this;
  8390. return $core.withContext(function($ctx1) {
  8391. var $1;
  8392. return self._tryCatch_((function(error){
  8393. var smalltalkError;
  8394. return $core.withContext(function($ctx2) {
  8395. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  8396. smalltalkError;
  8397. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  8398. if($core.assert($1)){
  8399. return $recv(aBlock)._value_(smalltalkError);
  8400. } else {
  8401. return $recv(smalltalkError)._resignal();
  8402. };
  8403. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  8404. }));
  8405. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  8406. },
  8407. args: ["anErrorClass", "aBlock"],
  8408. 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 ] ]",
  8409. referencedClasses: ["Smalltalk"],
  8410. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "resignal"]
  8411. }),
  8412. $globals.BlockClosure);
  8413. $core.addMethod(
  8414. $core.method({
  8415. selector: "receiver",
  8416. protocol: 'accessing',
  8417. fn: function (){
  8418. var self=this;
  8419. return nil;
  8420. },
  8421. args: [],
  8422. source: "receiver\x0a\x09^ nil",
  8423. referencedClasses: [],
  8424. messageSends: []
  8425. }),
  8426. $globals.BlockClosure);
  8427. $core.addMethod(
  8428. $core.method({
  8429. selector: "timeToRun",
  8430. protocol: 'evaluating',
  8431. fn: function (){
  8432. var self=this;
  8433. return $core.withContext(function($ctx1) {
  8434. return $recv($globals.Date)._millisecondsToRun_(self);
  8435. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  8436. },
  8437. args: [],
  8438. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  8439. referencedClasses: ["Date"],
  8440. messageSends: ["millisecondsToRun:"]
  8441. }),
  8442. $globals.BlockClosure);
  8443. $core.addMethod(
  8444. $core.method({
  8445. selector: "tryCatch:",
  8446. protocol: 'error handling',
  8447. fn: function (aBlock){
  8448. var self=this;
  8449. return $core.withContext(function($ctx1) {
  8450. try {
  8451. return self._value();
  8452. } catch(error) {
  8453. // pass non-local returns undetected
  8454. if (Array.isArray(error) && error.length === 1) throw error;
  8455. return aBlock._value_(error);
  8456. }
  8457. ;
  8458. return self;
  8459. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  8460. },
  8461. args: ["aBlock"],
  8462. 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>",
  8463. referencedClasses: [],
  8464. messageSends: []
  8465. }),
  8466. $globals.BlockClosure);
  8467. $core.addMethod(
  8468. $core.method({
  8469. selector: "value",
  8470. protocol: 'evaluating',
  8471. fn: function (){
  8472. var self=this;
  8473. return $core.withContext(function($ctx1) {
  8474. return self();;
  8475. return self;
  8476. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  8477. },
  8478. args: [],
  8479. source: "value\x0a\x09<return self();>",
  8480. referencedClasses: [],
  8481. messageSends: []
  8482. }),
  8483. $globals.BlockClosure);
  8484. $core.addMethod(
  8485. $core.method({
  8486. selector: "value:",
  8487. protocol: 'evaluating',
  8488. fn: function (anArg){
  8489. var self=this;
  8490. return $core.withContext(function($ctx1) {
  8491. return self(anArg);;
  8492. return self;
  8493. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  8494. },
  8495. args: ["anArg"],
  8496. source: "value: anArg\x0a\x09<return self(anArg);>",
  8497. referencedClasses: [],
  8498. messageSends: []
  8499. }),
  8500. $globals.BlockClosure);
  8501. $core.addMethod(
  8502. $core.method({
  8503. selector: "value:value:",
  8504. protocol: 'evaluating',
  8505. fn: function (firstArg,secondArg){
  8506. var self=this;
  8507. return $core.withContext(function($ctx1) {
  8508. return self(firstArg, secondArg);;
  8509. return self;
  8510. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  8511. },
  8512. args: ["firstArg", "secondArg"],
  8513. source: "value: firstArg value: secondArg\x0a\x09<return self(firstArg, secondArg);>",
  8514. referencedClasses: [],
  8515. messageSends: []
  8516. }),
  8517. $globals.BlockClosure);
  8518. $core.addMethod(
  8519. $core.method({
  8520. selector: "value:value:value:",
  8521. protocol: 'evaluating',
  8522. fn: function (firstArg,secondArg,thirdArg){
  8523. var self=this;
  8524. return $core.withContext(function($ctx1) {
  8525. return self(firstArg, secondArg, thirdArg);;
  8526. return self;
  8527. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  8528. },
  8529. args: ["firstArg", "secondArg", "thirdArg"],
  8530. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<return self(firstArg, secondArg, thirdArg);>",
  8531. referencedClasses: [],
  8532. messageSends: []
  8533. }),
  8534. $globals.BlockClosure);
  8535. $core.addMethod(
  8536. $core.method({
  8537. selector: "valueWithInterval:",
  8538. protocol: 'timeout/interval',
  8539. fn: function (aNumber){
  8540. var self=this;
  8541. return $core.withContext(function($ctx1) {
  8542. var interval = setInterval(self, aNumber);
  8543. return $globals.Timeout._on_(interval);
  8544. ;
  8545. return self;
  8546. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  8547. },
  8548. args: ["aNumber"],
  8549. source: "valueWithInterval: aNumber\x0a\x09<\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09>",
  8550. referencedClasses: [],
  8551. messageSends: []
  8552. }),
  8553. $globals.BlockClosure);
  8554. $core.addMethod(
  8555. $core.method({
  8556. selector: "valueWithPossibleArguments:",
  8557. protocol: 'evaluating',
  8558. fn: function (aCollection){
  8559. var self=this;
  8560. return $core.withContext(function($ctx1) {
  8561. return self.apply(null, aCollection);;
  8562. return self;
  8563. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  8564. },
  8565. args: ["aCollection"],
  8566. source: "valueWithPossibleArguments: aCollection\x0a\x09<return self.apply(null, aCollection);>",
  8567. referencedClasses: [],
  8568. messageSends: []
  8569. }),
  8570. $globals.BlockClosure);
  8571. $core.addMethod(
  8572. $core.method({
  8573. selector: "valueWithTimeout:",
  8574. protocol: 'timeout/interval',
  8575. fn: function (aNumber){
  8576. var self=this;
  8577. return $core.withContext(function($ctx1) {
  8578. var timeout = setTimeout(self, aNumber);
  8579. return $globals.Timeout._on_(timeout);
  8580. ;
  8581. return self;
  8582. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  8583. },
  8584. args: ["aNumber"],
  8585. source: "valueWithTimeout: aNumber\x0a\x09<\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09>",
  8586. referencedClasses: [],
  8587. messageSends: []
  8588. }),
  8589. $globals.BlockClosure);
  8590. $core.addMethod(
  8591. $core.method({
  8592. selector: "whileFalse",
  8593. protocol: 'controlling',
  8594. fn: function (){
  8595. var self=this;
  8596. return $core.withContext(function($ctx1) {
  8597. self._whileFalse_((function(){
  8598. }));
  8599. return self;
  8600. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  8601. },
  8602. args: [],
  8603. source: "whileFalse\x0a\x09self whileFalse: []",
  8604. referencedClasses: [],
  8605. messageSends: ["whileFalse:"]
  8606. }),
  8607. $globals.BlockClosure);
  8608. $core.addMethod(
  8609. $core.method({
  8610. selector: "whileFalse:",
  8611. protocol: 'controlling',
  8612. fn: function (aBlock){
  8613. var self=this;
  8614. return $core.withContext(function($ctx1) {
  8615. while(!$core.assert(self._value())) {aBlock._value()};
  8616. return self;
  8617. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  8618. },
  8619. args: ["aBlock"],
  8620. source: "whileFalse: aBlock\x0a\x09<while(!$core.assert(self._value())) {aBlock._value()}>",
  8621. referencedClasses: [],
  8622. messageSends: []
  8623. }),
  8624. $globals.BlockClosure);
  8625. $core.addMethod(
  8626. $core.method({
  8627. selector: "whileTrue",
  8628. protocol: 'controlling',
  8629. fn: function (){
  8630. var self=this;
  8631. return $core.withContext(function($ctx1) {
  8632. self._whileTrue_((function(){
  8633. }));
  8634. return self;
  8635. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  8636. },
  8637. args: [],
  8638. source: "whileTrue\x0a\x09self whileTrue: []",
  8639. referencedClasses: [],
  8640. messageSends: ["whileTrue:"]
  8641. }),
  8642. $globals.BlockClosure);
  8643. $core.addMethod(
  8644. $core.method({
  8645. selector: "whileTrue:",
  8646. protocol: 'controlling',
  8647. fn: function (aBlock){
  8648. var self=this;
  8649. return $core.withContext(function($ctx1) {
  8650. while($core.assert(self._value())) {aBlock._value()};
  8651. return self;
  8652. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  8653. },
  8654. args: ["aBlock"],
  8655. source: "whileTrue: aBlock\x0a\x09<while($core.assert(self._value())) {aBlock._value()}>",
  8656. referencedClasses: [],
  8657. messageSends: []
  8658. }),
  8659. $globals.BlockClosure);
  8660. $core.addClass('CompiledMethod', $globals.Object, [], 'Kernel-Methods');
  8661. $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";
  8662. $core.addMethod(
  8663. $core.method({
  8664. selector: "arguments",
  8665. protocol: 'accessing',
  8666. fn: function (){
  8667. var self=this;
  8668. return $core.withContext(function($ctx1) {
  8669. return self.args || [];
  8670. return self;
  8671. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  8672. },
  8673. args: [],
  8674. source: "arguments\x0a\x09<return self.args || []>",
  8675. referencedClasses: [],
  8676. messageSends: []
  8677. }),
  8678. $globals.CompiledMethod);
  8679. $core.addMethod(
  8680. $core.method({
  8681. selector: "browse",
  8682. protocol: 'browsing',
  8683. fn: function (){
  8684. var self=this;
  8685. return $core.withContext(function($ctx1) {
  8686. $recv($globals.Finder)._findMethod_(self);
  8687. return self;
  8688. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  8689. },
  8690. args: [],
  8691. source: "browse\x0a\x09Finder findMethod: self",
  8692. referencedClasses: ["Finder"],
  8693. messageSends: ["findMethod:"]
  8694. }),
  8695. $globals.CompiledMethod);
  8696. $core.addMethod(
  8697. $core.method({
  8698. selector: "category",
  8699. protocol: 'accessing',
  8700. fn: function (){
  8701. var self=this;
  8702. return $core.withContext(function($ctx1) {
  8703. return self._protocol();
  8704. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  8705. },
  8706. args: [],
  8707. source: "category\x0a\x09^ self protocol",
  8708. referencedClasses: [],
  8709. messageSends: ["protocol"]
  8710. }),
  8711. $globals.CompiledMethod);
  8712. $core.addMethod(
  8713. $core.method({
  8714. selector: "defaultProtocol",
  8715. protocol: 'defaults',
  8716. fn: function (){
  8717. var self=this;
  8718. return "as yet unclassified";
  8719. },
  8720. args: [],
  8721. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  8722. referencedClasses: [],
  8723. messageSends: []
  8724. }),
  8725. $globals.CompiledMethod);
  8726. $core.addMethod(
  8727. $core.method({
  8728. selector: "fn",
  8729. protocol: 'accessing',
  8730. fn: function (){
  8731. var self=this;
  8732. return $core.withContext(function($ctx1) {
  8733. return self._basicAt_("fn");
  8734. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  8735. },
  8736. args: [],
  8737. source: "fn\x0a\x09^ self basicAt: 'fn'",
  8738. referencedClasses: [],
  8739. messageSends: ["basicAt:"]
  8740. }),
  8741. $globals.CompiledMethod);
  8742. $core.addMethod(
  8743. $core.method({
  8744. selector: "fn:",
  8745. protocol: 'accessing',
  8746. fn: function (aBlock){
  8747. var self=this;
  8748. return $core.withContext(function($ctx1) {
  8749. self._basicAt_put_("fn",aBlock);
  8750. return self;
  8751. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  8752. },
  8753. args: ["aBlock"],
  8754. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  8755. referencedClasses: [],
  8756. messageSends: ["basicAt:put:"]
  8757. }),
  8758. $globals.CompiledMethod);
  8759. $core.addMethod(
  8760. $core.method({
  8761. selector: "isCompiledMethod",
  8762. protocol: 'testing',
  8763. fn: function (){
  8764. var self=this;
  8765. return true;
  8766. },
  8767. args: [],
  8768. source: "isCompiledMethod\x0a\x09^ true",
  8769. referencedClasses: [],
  8770. messageSends: []
  8771. }),
  8772. $globals.CompiledMethod);
  8773. $core.addMethod(
  8774. $core.method({
  8775. selector: "isOverridden",
  8776. protocol: 'testing',
  8777. fn: function (){
  8778. var self=this;
  8779. var selector;
  8780. return $core.withContext(function($ctx1) {
  8781. var $1;
  8782. var $early={};
  8783. try {
  8784. selector=self._selector();
  8785. $recv(self._methodClass())._allSubclassesDo_((function(each){
  8786. return $core.withContext(function($ctx2) {
  8787. $1=$recv(each)._includesSelector_(selector);
  8788. if($core.assert($1)){
  8789. throw $early=[true];
  8790. };
  8791. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8792. }));
  8793. return false;
  8794. }
  8795. catch(e) {if(e===$early)return e[0]; throw e}
  8796. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  8797. },
  8798. args: [],
  8799. 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",
  8800. referencedClasses: [],
  8801. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  8802. }),
  8803. $globals.CompiledMethod);
  8804. $core.addMethod(
  8805. $core.method({
  8806. selector: "isOverride",
  8807. protocol: 'testing',
  8808. fn: function (){
  8809. var self=this;
  8810. var superclass;
  8811. return $core.withContext(function($ctx1) {
  8812. var $1,$2,$receiver;
  8813. $1=self._methodClass();
  8814. $ctx1.sendIdx["methodClass"]=1;
  8815. superclass=$recv($1)._superclass();
  8816. $ctx1.sendIdx["superclass"]=1;
  8817. $2=superclass;
  8818. if(($receiver = $2) == null || $receiver.isNil){
  8819. return false;
  8820. } else {
  8821. $2;
  8822. };
  8823. return $recv($recv($recv(self._methodClass())._superclass())._lookupSelector_(self._selector()))._notNil();
  8824. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  8825. },
  8826. args: [],
  8827. 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",
  8828. referencedClasses: [],
  8829. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  8830. }),
  8831. $globals.CompiledMethod);
  8832. $core.addMethod(
  8833. $core.method({
  8834. selector: "messageSends",
  8835. protocol: 'accessing',
  8836. fn: function (){
  8837. var self=this;
  8838. return $core.withContext(function($ctx1) {
  8839. return self._basicAt_("messageSends");
  8840. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  8841. },
  8842. args: [],
  8843. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  8844. referencedClasses: [],
  8845. messageSends: ["basicAt:"]
  8846. }),
  8847. $globals.CompiledMethod);
  8848. $core.addMethod(
  8849. $core.method({
  8850. selector: "methodClass",
  8851. protocol: 'accessing',
  8852. fn: function (){
  8853. var self=this;
  8854. return $core.withContext(function($ctx1) {
  8855. return self._basicAt_("methodClass");
  8856. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  8857. },
  8858. args: [],
  8859. source: "methodClass\x0a\x09^ self basicAt: 'methodClass'",
  8860. referencedClasses: [],
  8861. messageSends: ["basicAt:"]
  8862. }),
  8863. $globals.CompiledMethod);
  8864. $core.addMethod(
  8865. $core.method({
  8866. selector: "package",
  8867. protocol: 'accessing',
  8868. fn: function (){
  8869. var self=this;
  8870. return $core.withContext(function($ctx1) {
  8871. var $1,$receiver;
  8872. $1=self._methodClass();
  8873. if(($receiver = $1) == null || $receiver.isNil){
  8874. return $1;
  8875. } else {
  8876. var class_;
  8877. class_=$receiver;
  8878. return $recv(class_)._packageOfProtocol_(self._protocol());
  8879. };
  8880. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  8881. },
  8882. args: [],
  8883. 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 ]",
  8884. referencedClasses: [],
  8885. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  8886. }),
  8887. $globals.CompiledMethod);
  8888. $core.addMethod(
  8889. $core.method({
  8890. selector: "protocol",
  8891. protocol: 'accessing',
  8892. fn: function (){
  8893. var self=this;
  8894. return $core.withContext(function($ctx1) {
  8895. var $1,$receiver;
  8896. $1=self._basicAt_("protocol");
  8897. if(($receiver = $1) == null || $receiver.isNil){
  8898. return self._defaultProtocol();
  8899. } else {
  8900. return $1;
  8901. };
  8902. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  8903. },
  8904. args: [],
  8905. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  8906. referencedClasses: [],
  8907. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  8908. }),
  8909. $globals.CompiledMethod);
  8910. $core.addMethod(
  8911. $core.method({
  8912. selector: "protocol:",
  8913. protocol: 'accessing',
  8914. fn: function (aString){
  8915. var self=this;
  8916. var oldProtocol;
  8917. return $core.withContext(function($ctx1) {
  8918. var $1,$3,$2,$4,$receiver;
  8919. oldProtocol=self._protocol();
  8920. self._basicAt_put_("protocol",aString);
  8921. $1=$recv($globals.SystemAnnouncer)._current();
  8922. $3=$recv($globals.MethodMoved)._new();
  8923. $recv($3)._method_(self);
  8924. $recv($3)._oldProtocol_(oldProtocol);
  8925. $2=$recv($3)._yourself();
  8926. $recv($1)._announce_($2);
  8927. $4=self._methodClass();
  8928. if(($receiver = $4) == null || $receiver.isNil){
  8929. $4;
  8930. } else {
  8931. var methodClass;
  8932. methodClass=$receiver;
  8933. $recv($recv(methodClass)._organization())._addElement_(aString);
  8934. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  8935. };
  8936. return self;
  8937. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  8938. },
  8939. args: ["aString"],
  8940. 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 ]",
  8941. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  8942. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  8943. }),
  8944. $globals.CompiledMethod);
  8945. $core.addMethod(
  8946. $core.method({
  8947. selector: "referencedClasses",
  8948. protocol: 'accessing',
  8949. fn: function (){
  8950. var self=this;
  8951. return $core.withContext(function($ctx1) {
  8952. return self._basicAt_("referencedClasses");
  8953. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  8954. },
  8955. args: [],
  8956. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  8957. referencedClasses: [],
  8958. messageSends: ["basicAt:"]
  8959. }),
  8960. $globals.CompiledMethod);
  8961. $core.addMethod(
  8962. $core.method({
  8963. selector: "selector",
  8964. protocol: 'accessing',
  8965. fn: function (){
  8966. var self=this;
  8967. return $core.withContext(function($ctx1) {
  8968. return self._basicAt_("selector");
  8969. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  8970. },
  8971. args: [],
  8972. source: "selector\x0a\x09^ self basicAt: 'selector'",
  8973. referencedClasses: [],
  8974. messageSends: ["basicAt:"]
  8975. }),
  8976. $globals.CompiledMethod);
  8977. $core.addMethod(
  8978. $core.method({
  8979. selector: "selector:",
  8980. protocol: 'accessing',
  8981. fn: function (aString){
  8982. var self=this;
  8983. return $core.withContext(function($ctx1) {
  8984. self._basicAt_put_("selector",aString);
  8985. return self;
  8986. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  8987. },
  8988. args: ["aString"],
  8989. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  8990. referencedClasses: [],
  8991. messageSends: ["basicAt:put:"]
  8992. }),
  8993. $globals.CompiledMethod);
  8994. $core.addMethod(
  8995. $core.method({
  8996. selector: "sendTo:arguments:",
  8997. protocol: 'evaluating',
  8998. fn: function (anObject,aCollection){
  8999. var self=this;
  9000. return $core.withContext(function($ctx1) {
  9001. return $recv(self._fn())._applyTo_arguments_(anObject,aCollection);
  9002. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  9003. },
  9004. args: ["anObject", "aCollection"],
  9005. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  9006. referencedClasses: [],
  9007. messageSends: ["applyTo:arguments:", "fn"]
  9008. }),
  9009. $globals.CompiledMethod);
  9010. $core.addMethod(
  9011. $core.method({
  9012. selector: "source",
  9013. protocol: 'accessing',
  9014. fn: function (){
  9015. var self=this;
  9016. return $core.withContext(function($ctx1) {
  9017. var $1,$receiver;
  9018. $1=self._basicAt_("source");
  9019. if(($receiver = $1) == null || $receiver.isNil){
  9020. return "";
  9021. } else {
  9022. return $1;
  9023. };
  9024. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  9025. },
  9026. args: [],
  9027. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  9028. referencedClasses: [],
  9029. messageSends: ["ifNil:", "basicAt:"]
  9030. }),
  9031. $globals.CompiledMethod);
  9032. $core.addMethod(
  9033. $core.method({
  9034. selector: "source:",
  9035. protocol: 'accessing',
  9036. fn: function (aString){
  9037. var self=this;
  9038. return $core.withContext(function($ctx1) {
  9039. self._basicAt_put_("source",aString);
  9040. return self;
  9041. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  9042. },
  9043. args: ["aString"],
  9044. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  9045. referencedClasses: [],
  9046. messageSends: ["basicAt:put:"]
  9047. }),
  9048. $globals.CompiledMethod);
  9049. $core.addClass('ForkPool', $globals.Object, ['poolSize', 'maxPoolSize', 'queue', 'worker'], 'Kernel-Methods');
  9050. $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`";
  9051. $core.addMethod(
  9052. $core.method({
  9053. selector: "addWorker",
  9054. protocol: 'private',
  9055. fn: function (){
  9056. var self=this;
  9057. return $core.withContext(function($ctx1) {
  9058. $recv(self["@worker"])._valueWithTimeout_((0));
  9059. self["@poolSize"]=$recv(self["@poolSize"]).__plus((1));
  9060. return self;
  9061. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  9062. },
  9063. args: [],
  9064. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  9065. referencedClasses: [],
  9066. messageSends: ["valueWithTimeout:", "+"]
  9067. }),
  9068. $globals.ForkPool);
  9069. $core.addMethod(
  9070. $core.method({
  9071. selector: "defaultMaxPoolSize",
  9072. protocol: 'defaults',
  9073. fn: function (){
  9074. var self=this;
  9075. return $core.withContext(function($ctx1) {
  9076. return $recv(self._class())._defaultMaxPoolSize();
  9077. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  9078. },
  9079. args: [],
  9080. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  9081. referencedClasses: [],
  9082. messageSends: ["defaultMaxPoolSize", "class"]
  9083. }),
  9084. $globals.ForkPool);
  9085. $core.addMethod(
  9086. $core.method({
  9087. selector: "fork:",
  9088. protocol: 'actions',
  9089. fn: function (aBlock){
  9090. var self=this;
  9091. return $core.withContext(function($ctx1) {
  9092. var $1;
  9093. $1=$recv(self["@poolSize"]).__lt(self._maxPoolSize());
  9094. if($core.assert($1)){
  9095. self._addWorker();
  9096. };
  9097. $recv(self["@queue"])._nextPut_(aBlock);
  9098. return self;
  9099. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  9100. },
  9101. args: ["aBlock"],
  9102. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  9103. referencedClasses: [],
  9104. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  9105. }),
  9106. $globals.ForkPool);
  9107. $core.addMethod(
  9108. $core.method({
  9109. selector: "initialize",
  9110. protocol: 'initialization',
  9111. fn: function (){
  9112. var self=this;
  9113. return $core.withContext(function($ctx1) {
  9114. (
  9115. $ctx1.supercall = true,
  9116. ($globals.ForkPool.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  9117. $ctx1.supercall = false;
  9118. self["@poolSize"]=(0);
  9119. self["@queue"]=$recv($globals.Queue)._new();
  9120. self["@worker"]=self._makeWorker();
  9121. return self;
  9122. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  9123. },
  9124. args: [],
  9125. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  9126. referencedClasses: ["Queue"],
  9127. messageSends: ["initialize", "new", "makeWorker"]
  9128. }),
  9129. $globals.ForkPool);
  9130. $core.addMethod(
  9131. $core.method({
  9132. selector: "makeWorker",
  9133. protocol: 'initialization',
  9134. fn: function (){
  9135. var self=this;
  9136. var sentinel;
  9137. return $core.withContext(function($ctx1) {
  9138. var $1;
  9139. sentinel=$recv($globals.Object)._new();
  9140. return (function(){
  9141. var block;
  9142. return $core.withContext(function($ctx2) {
  9143. self["@poolSize"]=$recv(self["@poolSize"]).__minus((1));
  9144. self["@poolSize"];
  9145. block=$recv(self["@queue"])._nextIfAbsent_((function(){
  9146. return sentinel;
  9147. }));
  9148. block;
  9149. $1=$recv(block).__eq_eq(sentinel);
  9150. if(!$core.assert($1)){
  9151. return $recv((function(){
  9152. return $core.withContext(function($ctx3) {
  9153. return $recv(block)._value();
  9154. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  9155. }))._ensure_((function(){
  9156. return $core.withContext(function($ctx3) {
  9157. return self._addWorker();
  9158. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  9159. }));
  9160. };
  9161. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  9162. });
  9163. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  9164. },
  9165. args: [],
  9166. 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 ] ]]",
  9167. referencedClasses: ["Object"],
  9168. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  9169. }),
  9170. $globals.ForkPool);
  9171. $core.addMethod(
  9172. $core.method({
  9173. selector: "maxPoolSize",
  9174. protocol: 'accessing',
  9175. fn: function (){
  9176. var self=this;
  9177. return $core.withContext(function($ctx1) {
  9178. var $1,$receiver;
  9179. $1=self["@maxPoolSize"];
  9180. if(($receiver = $1) == null || $receiver.isNil){
  9181. return self._defaultMaxPoolSize();
  9182. } else {
  9183. return $1;
  9184. };
  9185. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  9186. },
  9187. args: [],
  9188. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  9189. referencedClasses: [],
  9190. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  9191. }),
  9192. $globals.ForkPool);
  9193. $core.addMethod(
  9194. $core.method({
  9195. selector: "maxPoolSize:",
  9196. protocol: 'accessing',
  9197. fn: function (anInteger){
  9198. var self=this;
  9199. self["@maxPoolSize"]=anInteger;
  9200. return self;
  9201. },
  9202. args: ["anInteger"],
  9203. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  9204. referencedClasses: [],
  9205. messageSends: []
  9206. }),
  9207. $globals.ForkPool);
  9208. $globals.ForkPool.klass.iVarNames = ['default'];
  9209. $core.addMethod(
  9210. $core.method({
  9211. selector: "default",
  9212. protocol: 'accessing',
  9213. fn: function (){
  9214. var self=this;
  9215. return $core.withContext(function($ctx1) {
  9216. var $1,$receiver;
  9217. $1=self["@default"];
  9218. if(($receiver = $1) == null || $receiver.isNil){
  9219. self["@default"]=self._new();
  9220. return self["@default"];
  9221. } else {
  9222. return $1;
  9223. };
  9224. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.klass)});
  9225. },
  9226. args: [],
  9227. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  9228. referencedClasses: [],
  9229. messageSends: ["ifNil:", "new"]
  9230. }),
  9231. $globals.ForkPool.klass);
  9232. $core.addMethod(
  9233. $core.method({
  9234. selector: "defaultMaxPoolSize",
  9235. protocol: 'accessing',
  9236. fn: function (){
  9237. var self=this;
  9238. return (100);
  9239. },
  9240. args: [],
  9241. source: "defaultMaxPoolSize\x0a\x09^ 100",
  9242. referencedClasses: [],
  9243. messageSends: []
  9244. }),
  9245. $globals.ForkPool.klass);
  9246. $core.addMethod(
  9247. $core.method({
  9248. selector: "resetDefault",
  9249. protocol: 'accessing',
  9250. fn: function (){
  9251. var self=this;
  9252. self["@default"]=nil;
  9253. return self;
  9254. },
  9255. args: [],
  9256. source: "resetDefault\x0a\x09default := nil",
  9257. referencedClasses: [],
  9258. messageSends: []
  9259. }),
  9260. $globals.ForkPool.klass);
  9261. $core.addClass('Message', $globals.Object, ['selector', 'arguments'], 'Kernel-Methods');
  9262. $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.";
  9263. $core.addMethod(
  9264. $core.method({
  9265. selector: "arguments",
  9266. protocol: 'accessing',
  9267. fn: function (){
  9268. var self=this;
  9269. return self["@arguments"];
  9270. },
  9271. args: [],
  9272. source: "arguments\x0a\x09^ arguments",
  9273. referencedClasses: [],
  9274. messageSends: []
  9275. }),
  9276. $globals.Message);
  9277. $core.addMethod(
  9278. $core.method({
  9279. selector: "arguments:",
  9280. protocol: 'accessing',
  9281. fn: function (anArray){
  9282. var self=this;
  9283. self["@arguments"]=anArray;
  9284. return self;
  9285. },
  9286. args: ["anArray"],
  9287. source: "arguments: anArray\x0a\x09arguments := anArray",
  9288. referencedClasses: [],
  9289. messageSends: []
  9290. }),
  9291. $globals.Message);
  9292. $core.addMethod(
  9293. $core.method({
  9294. selector: "printOn:",
  9295. protocol: 'printing',
  9296. fn: function (aStream){
  9297. var self=this;
  9298. return $core.withContext(function($ctx1) {
  9299. (
  9300. $ctx1.supercall = true,
  9301. ($globals.Message.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9302. $ctx1.supercall = false;
  9303. $recv(aStream)._nextPutAll_("(");
  9304. $ctx1.sendIdx["nextPutAll:"]=1;
  9305. $recv(aStream)._nextPutAll_(self._selector());
  9306. $ctx1.sendIdx["nextPutAll:"]=2;
  9307. $recv(aStream)._nextPutAll_(")");
  9308. return self;
  9309. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  9310. },
  9311. args: ["aStream"],
  9312. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  9313. referencedClasses: [],
  9314. messageSends: ["printOn:", "nextPutAll:", "selector"]
  9315. }),
  9316. $globals.Message);
  9317. $core.addMethod(
  9318. $core.method({
  9319. selector: "selector",
  9320. protocol: 'accessing',
  9321. fn: function (){
  9322. var self=this;
  9323. return self["@selector"];
  9324. },
  9325. args: [],
  9326. source: "selector\x0a\x09^ selector",
  9327. referencedClasses: [],
  9328. messageSends: []
  9329. }),
  9330. $globals.Message);
  9331. $core.addMethod(
  9332. $core.method({
  9333. selector: "selector:",
  9334. protocol: 'accessing',
  9335. fn: function (aString){
  9336. var self=this;
  9337. self["@selector"]=aString;
  9338. return self;
  9339. },
  9340. args: ["aString"],
  9341. source: "selector: aString\x0a\x09selector := aString",
  9342. referencedClasses: [],
  9343. messageSends: []
  9344. }),
  9345. $globals.Message);
  9346. $core.addMethod(
  9347. $core.method({
  9348. selector: "sendTo:",
  9349. protocol: 'actions',
  9350. fn: function (anObject){
  9351. var self=this;
  9352. return $core.withContext(function($ctx1) {
  9353. return $recv(anObject)._perform_withArguments_(self._selector(),self._arguments());
  9354. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  9355. },
  9356. args: ["anObject"],
  9357. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  9358. referencedClasses: [],
  9359. messageSends: ["perform:withArguments:", "selector", "arguments"]
  9360. }),
  9361. $globals.Message);
  9362. $core.addMethod(
  9363. $core.method({
  9364. selector: "selector:arguments:",
  9365. protocol: 'instance creation',
  9366. fn: function (aString,anArray){
  9367. var self=this;
  9368. return $core.withContext(function($ctx1) {
  9369. var $1;
  9370. $1=self._new();
  9371. $recv($1)._selector_(aString);
  9372. $recv($1)._arguments_(anArray);
  9373. return $recv($1)._yourself();
  9374. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.klass)});
  9375. },
  9376. args: ["aString", "anArray"],
  9377. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  9378. referencedClasses: [],
  9379. messageSends: ["selector:", "new", "arguments:", "yourself"]
  9380. }),
  9381. $globals.Message.klass);
  9382. $core.addClass('MessageSend', $globals.Object, ['receiver', 'message'], 'Kernel-Methods');
  9383. $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.";
  9384. $core.addMethod(
  9385. $core.method({
  9386. selector: "arguments",
  9387. protocol: 'accessing',
  9388. fn: function (){
  9389. var self=this;
  9390. return $core.withContext(function($ctx1) {
  9391. return $recv(self["@message"])._arguments();
  9392. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  9393. },
  9394. args: [],
  9395. source: "arguments\x0a\x09^ message arguments",
  9396. referencedClasses: [],
  9397. messageSends: ["arguments"]
  9398. }),
  9399. $globals.MessageSend);
  9400. $core.addMethod(
  9401. $core.method({
  9402. selector: "arguments:",
  9403. protocol: 'accessing',
  9404. fn: function (aCollection){
  9405. var self=this;
  9406. return $core.withContext(function($ctx1) {
  9407. $recv(self["@message"])._arguments_(aCollection);
  9408. return self;
  9409. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  9410. },
  9411. args: ["aCollection"],
  9412. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  9413. referencedClasses: [],
  9414. messageSends: ["arguments:"]
  9415. }),
  9416. $globals.MessageSend);
  9417. $core.addMethod(
  9418. $core.method({
  9419. selector: "initialize",
  9420. protocol: 'initialization',
  9421. fn: function (){
  9422. var self=this;
  9423. return $core.withContext(function($ctx1) {
  9424. (
  9425. $ctx1.supercall = true,
  9426. ($globals.MessageSend.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  9427. $ctx1.supercall = false;
  9428. self["@message"]=$recv($globals.Message)._new();
  9429. return self;
  9430. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  9431. },
  9432. args: [],
  9433. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  9434. referencedClasses: ["Message"],
  9435. messageSends: ["initialize", "new"]
  9436. }),
  9437. $globals.MessageSend);
  9438. $core.addMethod(
  9439. $core.method({
  9440. selector: "printOn:",
  9441. protocol: 'printing',
  9442. fn: function (aStream){
  9443. var self=this;
  9444. return $core.withContext(function($ctx1) {
  9445. (
  9446. $ctx1.supercall = true,
  9447. ($globals.MessageSend.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9448. $ctx1.supercall = false;
  9449. $recv(aStream)._nextPutAll_("(");
  9450. $ctx1.sendIdx["nextPutAll:"]=1;
  9451. $recv(aStream)._nextPutAll_(self._receiver());
  9452. $ctx1.sendIdx["nextPutAll:"]=2;
  9453. $recv(aStream)._nextPutAll_(" >> ");
  9454. $ctx1.sendIdx["nextPutAll:"]=3;
  9455. $recv(aStream)._nextPutAll_(self._selector());
  9456. $ctx1.sendIdx["nextPutAll:"]=4;
  9457. $recv(aStream)._nextPutAll_(")");
  9458. return self;
  9459. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  9460. },
  9461. args: ["aStream"],
  9462. 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: ')'",
  9463. referencedClasses: [],
  9464. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  9465. }),
  9466. $globals.MessageSend);
  9467. $core.addMethod(
  9468. $core.method({
  9469. selector: "receiver",
  9470. protocol: 'accessing',
  9471. fn: function (){
  9472. var self=this;
  9473. return self["@receiver"];
  9474. },
  9475. args: [],
  9476. source: "receiver\x0a\x09^ receiver",
  9477. referencedClasses: [],
  9478. messageSends: []
  9479. }),
  9480. $globals.MessageSend);
  9481. $core.addMethod(
  9482. $core.method({
  9483. selector: "receiver:",
  9484. protocol: 'accessing',
  9485. fn: function (anObject){
  9486. var self=this;
  9487. self["@receiver"]=anObject;
  9488. return self;
  9489. },
  9490. args: ["anObject"],
  9491. source: "receiver: anObject\x0a\x09receiver := anObject",
  9492. referencedClasses: [],
  9493. messageSends: []
  9494. }),
  9495. $globals.MessageSend);
  9496. $core.addMethod(
  9497. $core.method({
  9498. selector: "selector",
  9499. protocol: 'accessing',
  9500. fn: function (){
  9501. var self=this;
  9502. return $core.withContext(function($ctx1) {
  9503. return $recv(self["@message"])._selector();
  9504. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  9505. },
  9506. args: [],
  9507. source: "selector\x0a\x09^ message selector",
  9508. referencedClasses: [],
  9509. messageSends: ["selector"]
  9510. }),
  9511. $globals.MessageSend);
  9512. $core.addMethod(
  9513. $core.method({
  9514. selector: "selector:",
  9515. protocol: 'accessing',
  9516. fn: function (aString){
  9517. var self=this;
  9518. return $core.withContext(function($ctx1) {
  9519. $recv(self["@message"])._selector_(aString);
  9520. return self;
  9521. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  9522. },
  9523. args: ["aString"],
  9524. source: "selector: aString\x0a\x09message selector: aString",
  9525. referencedClasses: [],
  9526. messageSends: ["selector:"]
  9527. }),
  9528. $globals.MessageSend);
  9529. $core.addMethod(
  9530. $core.method({
  9531. selector: "value",
  9532. protocol: 'evaluating',
  9533. fn: function (){
  9534. var self=this;
  9535. return $core.withContext(function($ctx1) {
  9536. return $recv(self["@message"])._sendTo_(self._receiver());
  9537. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  9538. },
  9539. args: [],
  9540. source: "value\x0a\x09^ message sendTo: self receiver",
  9541. referencedClasses: [],
  9542. messageSends: ["sendTo:", "receiver"]
  9543. }),
  9544. $globals.MessageSend);
  9545. $core.addMethod(
  9546. $core.method({
  9547. selector: "value:",
  9548. protocol: 'evaluating',
  9549. fn: function (anObject){
  9550. var self=this;
  9551. return $core.withContext(function($ctx1) {
  9552. var $1;
  9553. $1=self["@message"];
  9554. $recv($1)._arguments_([anObject]);
  9555. return $recv($1)._sendTo_(self._receiver());
  9556. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  9557. },
  9558. args: ["anObject"],
  9559. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  9560. referencedClasses: [],
  9561. messageSends: ["arguments:", "sendTo:", "receiver"]
  9562. }),
  9563. $globals.MessageSend);
  9564. $core.addMethod(
  9565. $core.method({
  9566. selector: "value:value:",
  9567. protocol: 'evaluating',
  9568. fn: function (firstArgument,secondArgument){
  9569. var self=this;
  9570. return $core.withContext(function($ctx1) {
  9571. var $1;
  9572. $1=self["@message"];
  9573. $recv($1)._arguments_([firstArgument,secondArgument]);
  9574. return $recv($1)._sendTo_(self._receiver());
  9575. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  9576. },
  9577. args: ["firstArgument", "secondArgument"],
  9578. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  9579. referencedClasses: [],
  9580. messageSends: ["arguments:", "sendTo:", "receiver"]
  9581. }),
  9582. $globals.MessageSend);
  9583. $core.addMethod(
  9584. $core.method({
  9585. selector: "value:value:value:",
  9586. protocol: 'evaluating',
  9587. fn: function (firstArgument,secondArgument,thirdArgument){
  9588. var self=this;
  9589. return $core.withContext(function($ctx1) {
  9590. var $1;
  9591. $1=self["@message"];
  9592. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  9593. return $recv($1)._sendTo_(self._receiver());
  9594. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  9595. },
  9596. args: ["firstArgument", "secondArgument", "thirdArgument"],
  9597. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  9598. referencedClasses: [],
  9599. messageSends: ["arguments:", "sendTo:", "receiver"]
  9600. }),
  9601. $globals.MessageSend);
  9602. $core.addMethod(
  9603. $core.method({
  9604. selector: "valueWithPossibleArguments:",
  9605. protocol: 'evaluating',
  9606. fn: function (aCollection){
  9607. var self=this;
  9608. return $core.withContext(function($ctx1) {
  9609. self._arguments_(aCollection);
  9610. return self._value();
  9611. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  9612. },
  9613. args: ["aCollection"],
  9614. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  9615. referencedClasses: [],
  9616. messageSends: ["arguments:", "value"]
  9617. }),
  9618. $globals.MessageSend);
  9619. $core.addClass('MethodContext', $globals.Object, [], 'Kernel-Methods');
  9620. $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`.";
  9621. $core.addMethod(
  9622. $core.method({
  9623. selector: "asString",
  9624. protocol: 'converting',
  9625. fn: function (){
  9626. var self=this;
  9627. return $core.withContext(function($ctx1) {
  9628. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  9629. $2=self._isBlockContext();
  9630. if($core.assert($2)){
  9631. $3="a block (in ".__comma($recv(self._methodContext())._asString());
  9632. $ctx1.sendIdx[","]=2;
  9633. $1=$recv($3).__comma(")");
  9634. $ctx1.sendIdx[","]=1;
  9635. } else {
  9636. var methodClass;
  9637. methodClass=$recv(self._method())._methodClass();
  9638. methodClass;
  9639. $5=methodClass;
  9640. $7=self._receiver();
  9641. $ctx1.sendIdx["receiver"]=1;
  9642. $6=$recv($7)._class();
  9643. $ctx1.sendIdx["class"]=1;
  9644. $4=$recv($5).__eq($6);
  9645. if($core.assert($4)){
  9646. $11=self._receiver();
  9647. $ctx1.sendIdx["receiver"]=2;
  9648. $10=$recv($11)._class();
  9649. $ctx1.sendIdx["class"]=2;
  9650. $9=$recv($10)._name();
  9651. $ctx1.sendIdx["name"]=1;
  9652. $8=$recv($9).__comma(" >> ");
  9653. $ctx1.sendIdx[","]=4;
  9654. $12=self._selector();
  9655. $ctx1.sendIdx["selector"]=1;
  9656. $1=$recv($8).__comma($12);
  9657. $ctx1.sendIdx[","]=3;
  9658. } else {
  9659. $16=$recv($recv(self._receiver())._class())._name();
  9660. $ctx1.sendIdx["name"]=2;
  9661. $15=$recv($16).__comma("(");
  9662. $14=$recv($15).__comma($recv(methodClass)._name());
  9663. $ctx1.sendIdx[","]=7;
  9664. $13=$recv($14).__comma(") >> ");
  9665. $ctx1.sendIdx[","]=6;
  9666. $1=$recv($13).__comma(self._selector());
  9667. $ctx1.sendIdx[","]=5;
  9668. };
  9669. };
  9670. return $1;
  9671. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  9672. },
  9673. args: [],
  9674. 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 ] ]",
  9675. referencedClasses: [],
  9676. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  9677. }),
  9678. $globals.MethodContext);
  9679. $core.addMethod(
  9680. $core.method({
  9681. selector: "basicReceiver",
  9682. protocol: 'accessing',
  9683. fn: function (){
  9684. var self=this;
  9685. return $core.withContext(function($ctx1) {
  9686. return self.receiver;
  9687. return self;
  9688. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  9689. },
  9690. args: [],
  9691. source: "basicReceiver\x0a\x09<return self.receiver>",
  9692. referencedClasses: [],
  9693. messageSends: []
  9694. }),
  9695. $globals.MethodContext);
  9696. $core.addMethod(
  9697. $core.method({
  9698. selector: "evaluatedSelector",
  9699. protocol: 'accessing',
  9700. fn: function (){
  9701. var self=this;
  9702. return $core.withContext(function($ctx1) {
  9703. return self.evaluatedSelector;
  9704. return self;
  9705. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  9706. },
  9707. args: [],
  9708. source: "evaluatedSelector\x0a\x09<return self.evaluatedSelector>",
  9709. referencedClasses: [],
  9710. messageSends: []
  9711. }),
  9712. $globals.MethodContext);
  9713. $core.addMethod(
  9714. $core.method({
  9715. selector: "findContextSuchThat:",
  9716. protocol: 'accessing',
  9717. fn: function (testBlock){
  9718. var self=this;
  9719. var context;
  9720. return $core.withContext(function($ctx1) {
  9721. var $1;
  9722. var $early={};
  9723. try {
  9724. context=self;
  9725. $recv((function(){
  9726. return $core.withContext(function($ctx2) {
  9727. return $recv(context)._isNil();
  9728. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9729. }))._whileFalse_((function(){
  9730. return $core.withContext(function($ctx2) {
  9731. $1=$recv(testBlock)._value_(context);
  9732. if($core.assert($1)){
  9733. throw $early=[context];
  9734. };
  9735. context=$recv(context)._outerContext();
  9736. return context;
  9737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9738. }));
  9739. return nil;
  9740. }
  9741. catch(e) {if(e===$early)return e[0]; throw e}
  9742. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  9743. },
  9744. args: ["testBlock"],
  9745. 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",
  9746. referencedClasses: [],
  9747. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  9748. }),
  9749. $globals.MethodContext);
  9750. $core.addMethod(
  9751. $core.method({
  9752. selector: "home",
  9753. protocol: 'accessing',
  9754. fn: function (){
  9755. var self=this;
  9756. return $core.withContext(function($ctx1) {
  9757. return self.homeContext;
  9758. return self;
  9759. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  9760. },
  9761. args: [],
  9762. source: "home\x0a\x09<return self.homeContext>",
  9763. referencedClasses: [],
  9764. messageSends: []
  9765. }),
  9766. $globals.MethodContext);
  9767. $core.addMethod(
  9768. $core.method({
  9769. selector: "index",
  9770. protocol: 'accessing',
  9771. fn: function (){
  9772. var self=this;
  9773. return $core.withContext(function($ctx1) {
  9774. return self.index || 0;
  9775. return self;
  9776. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  9777. },
  9778. args: [],
  9779. source: "index\x0a\x09<return self.index || 0>",
  9780. referencedClasses: [],
  9781. messageSends: []
  9782. }),
  9783. $globals.MethodContext);
  9784. $core.addMethod(
  9785. $core.method({
  9786. selector: "isBlockContext",
  9787. protocol: 'testing',
  9788. fn: function (){
  9789. var self=this;
  9790. return $core.withContext(function($ctx1) {
  9791. return $recv(self._selector())._isNil();
  9792. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  9793. },
  9794. args: [],
  9795. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  9796. referencedClasses: [],
  9797. messageSends: ["isNil", "selector"]
  9798. }),
  9799. $globals.MethodContext);
  9800. $core.addMethod(
  9801. $core.method({
  9802. selector: "locals",
  9803. protocol: 'accessing',
  9804. fn: function (){
  9805. var self=this;
  9806. return $core.withContext(function($ctx1) {
  9807. return self.locals || {};
  9808. return self;
  9809. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  9810. },
  9811. args: [],
  9812. source: "locals\x0a\x09<return self.locals || {}>",
  9813. referencedClasses: [],
  9814. messageSends: []
  9815. }),
  9816. $globals.MethodContext);
  9817. $core.addMethod(
  9818. $core.method({
  9819. selector: "method",
  9820. protocol: 'accessing',
  9821. fn: function (){
  9822. var self=this;
  9823. var method,lookupClass,receiverClass,supercall;
  9824. return $core.withContext(function($ctx1) {
  9825. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  9826. $1=self._methodContext();
  9827. $ctx1.sendIdx["methodContext"]=1;
  9828. if(($receiver = $1) == null || $receiver.isNil){
  9829. return nil;
  9830. } else {
  9831. $1;
  9832. };
  9833. $3=self._methodContext();
  9834. $ctx1.sendIdx["methodContext"]=2;
  9835. $2=$recv($3)._receiver();
  9836. receiverClass=$recv($2)._class();
  9837. $4=receiverClass;
  9838. $6=self._methodContext();
  9839. $ctx1.sendIdx["methodContext"]=3;
  9840. $5=$recv($6)._selector();
  9841. $ctx1.sendIdx["selector"]=1;
  9842. method=$recv($4)._lookupSelector_($5);
  9843. $ctx1.sendIdx["lookupSelector:"]=1;
  9844. $7=self._outerContext();
  9845. if(($receiver = $7) == null || $receiver.isNil){
  9846. supercall=false;
  9847. } else {
  9848. var outer;
  9849. outer=$receiver;
  9850. supercall=$recv(outer)._supercall();
  9851. };
  9852. $8=supercall;
  9853. if($core.assert($8)){
  9854. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv(self._methodContext())._selector());
  9855. } else {
  9856. return method;
  9857. };
  9858. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  9859. },
  9860. args: [],
  9861. 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 ]",
  9862. referencedClasses: [],
  9863. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  9864. }),
  9865. $globals.MethodContext);
  9866. $core.addMethod(
  9867. $core.method({
  9868. selector: "methodContext",
  9869. protocol: 'accessing',
  9870. fn: function (){
  9871. var self=this;
  9872. return $core.withContext(function($ctx1) {
  9873. var $1,$2,$receiver;
  9874. $1=self._isBlockContext();
  9875. if(!$core.assert($1)){
  9876. return self;
  9877. };
  9878. $2=self._outerContext();
  9879. if(($receiver = $2) == null || $receiver.isNil){
  9880. return $2;
  9881. } else {
  9882. var outer;
  9883. outer=$receiver;
  9884. return $recv(outer)._methodContext();
  9885. };
  9886. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  9887. },
  9888. args: [],
  9889. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  9890. referencedClasses: [],
  9891. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  9892. }),
  9893. $globals.MethodContext);
  9894. $core.addMethod(
  9895. $core.method({
  9896. selector: "outerContext",
  9897. protocol: 'accessing',
  9898. fn: function (){
  9899. var self=this;
  9900. return $core.withContext(function($ctx1) {
  9901. return self.outerContext || self.homeContext;
  9902. return self;
  9903. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  9904. },
  9905. args: [],
  9906. source: "outerContext\x0a\x09<return self.outerContext || self.homeContext>",
  9907. referencedClasses: [],
  9908. messageSends: []
  9909. }),
  9910. $globals.MethodContext);
  9911. $core.addMethod(
  9912. $core.method({
  9913. selector: "printOn:",
  9914. protocol: 'printing',
  9915. fn: function (aStream){
  9916. var self=this;
  9917. return $core.withContext(function($ctx1) {
  9918. (
  9919. $ctx1.supercall = true,
  9920. ($globals.MethodContext.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  9921. $ctx1.supercall = false;
  9922. $recv(aStream)._nextPutAll_("(");
  9923. $ctx1.sendIdx["nextPutAll:"]=1;
  9924. $recv(aStream)._nextPutAll_(self._asString());
  9925. $ctx1.sendIdx["nextPutAll:"]=2;
  9926. $recv(aStream)._nextPutAll_(")");
  9927. return self;
  9928. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  9929. },
  9930. args: ["aStream"],
  9931. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  9932. referencedClasses: [],
  9933. messageSends: ["printOn:", "nextPutAll:", "asString"]
  9934. }),
  9935. $globals.MethodContext);
  9936. $core.addMethod(
  9937. $core.method({
  9938. selector: "receiver",
  9939. protocol: 'accessing',
  9940. fn: function (){
  9941. var self=this;
  9942. return $core.withContext(function($ctx1) {
  9943. var $2,$1;
  9944. $1=$recv(self._isBlockContext())._and_((function(){
  9945. return $core.withContext(function($ctx2) {
  9946. $2=self._outerContext();
  9947. $ctx2.sendIdx["outerContext"]=1;
  9948. return $recv($2)._notNil();
  9949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9950. }));
  9951. if($core.assert($1)){
  9952. return $recv(self._outerContext())._receiver();
  9953. } else {
  9954. return self._basicReceiver();
  9955. };
  9956. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  9957. },
  9958. args: [],
  9959. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  9960. referencedClasses: [],
  9961. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  9962. }),
  9963. $globals.MethodContext);
  9964. $core.addMethod(
  9965. $core.method({
  9966. selector: "selector",
  9967. protocol: 'accessing',
  9968. fn: function (){
  9969. var self=this;
  9970. return $core.withContext(function($ctx1) {
  9971. if(self.selector) {
  9972. return $core.js2st(self.selector);
  9973. } else {
  9974. return nil;
  9975. }
  9976. ;
  9977. return self;
  9978. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  9979. },
  9980. args: [],
  9981. 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>",
  9982. referencedClasses: [],
  9983. messageSends: []
  9984. }),
  9985. $globals.MethodContext);
  9986. $core.addMethod(
  9987. $core.method({
  9988. selector: "sendIndexAt:",
  9989. protocol: 'accessing',
  9990. fn: function (aSelector){
  9991. var self=this;
  9992. return $core.withContext(function($ctx1) {
  9993. return self.sendIdx[aSelector] || 0;
  9994. return self;
  9995. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  9996. },
  9997. args: ["aSelector"],
  9998. source: "sendIndexAt: aSelector\x0a\x09<return self.sendIdx[aSelector] || 0>",
  9999. referencedClasses: [],
  10000. messageSends: []
  10001. }),
  10002. $globals.MethodContext);
  10003. $core.addMethod(
  10004. $core.method({
  10005. selector: "sendIndexes",
  10006. protocol: 'accessing',
  10007. fn: function (){
  10008. var self=this;
  10009. return $core.withContext(function($ctx1) {
  10010. return self.sendIdx;
  10011. return self;
  10012. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  10013. },
  10014. args: [],
  10015. source: "sendIndexes\x0a\x09<return self.sendIdx>",
  10016. referencedClasses: [],
  10017. messageSends: []
  10018. }),
  10019. $globals.MethodContext);
  10020. $core.addMethod(
  10021. $core.method({
  10022. selector: "supercall",
  10023. protocol: 'accessing',
  10024. fn: function (){
  10025. var self=this;
  10026. return $core.withContext(function($ctx1) {
  10027. return self.supercall == true;
  10028. return self;
  10029. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  10030. },
  10031. args: [],
  10032. source: "supercall\x0a\x09<return self.supercall == true>",
  10033. referencedClasses: [],
  10034. messageSends: []
  10035. }),
  10036. $globals.MethodContext);
  10037. $core.addClass('NativeFunction', $globals.Object, [], 'Kernel-Methods');
  10038. $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' ]";
  10039. $core.addMethod(
  10040. $core.method({
  10041. selector: "constructor:",
  10042. protocol: 'instance creation',
  10043. fn: function (aString){
  10044. var self=this;
  10045. return $core.withContext(function($ctx1) {
  10046. self._deprecatedAPI_("Use constructorNamed:");
  10047. var nativeFunc=eval(aString);
  10048. return new nativeFunc();
  10049. ;
  10050. return self;
  10051. }, function($ctx1) {$ctx1.fill(self,"constructor:",{aString:aString},$globals.NativeFunction.klass)});
  10052. },
  10053. args: ["aString"],
  10054. source: "constructor: aString\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  10055. referencedClasses: [],
  10056. messageSends: []
  10057. }),
  10058. $globals.NativeFunction.klass);
  10059. $core.addMethod(
  10060. $core.method({
  10061. selector: "constructor:value:",
  10062. protocol: 'instance creation',
  10063. fn: function (aString,anObject){
  10064. var self=this;
  10065. return $core.withContext(function($ctx1) {
  10066. self._deprecatedAPI_("Use constructorNamed:value:");
  10067. var nativeFunc=eval(aString);
  10068. return new nativeFunc(anObject);
  10069. ;
  10070. return self;
  10071. }, function($ctx1) {$ctx1.fill(self,"constructor:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  10072. },
  10073. args: ["aString", "anObject"],
  10074. source: "constructor: aString value:anObject\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  10075. referencedClasses: [],
  10076. messageSends: []
  10077. }),
  10078. $globals.NativeFunction.klass);
  10079. $core.addMethod(
  10080. $core.method({
  10081. selector: "constructor:value:value:",
  10082. protocol: 'instance creation',
  10083. fn: function (aString,anObject,anObject2){
  10084. var self=this;
  10085. return $core.withContext(function($ctx1) {
  10086. self._deprecatedAPI_("Use constructorNamed:value:value:");
  10087. var nativeFunc=eval(aString);
  10088. return new nativeFunc(anObject,anObject2);
  10089. ;
  10090. return self;
  10091. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10092. },
  10093. args: ["aString", "anObject", "anObject2"],
  10094. source: "constructor: aString value:anObject value: anObject2\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:value:\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  10095. referencedClasses: [],
  10096. messageSends: []
  10097. }),
  10098. $globals.NativeFunction.klass);
  10099. $core.addMethod(
  10100. $core.method({
  10101. selector: "constructor:value:value:value:",
  10102. protocol: 'instance creation',
  10103. fn: function (aString,anObject,anObject2,anObject3){
  10104. var self=this;
  10105. return $core.withContext(function($ctx1) {
  10106. self._deprecatedAPI_("Use constructorNamed:value:value:value");
  10107. var nativeFunc=eval(aString);
  10108. return new nativeFunc(anObject,anObject2, anObject3);
  10109. ;
  10110. return self;
  10111. }, function($ctx1) {$ctx1.fill(self,"constructor:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10112. },
  10113. args: ["aString", "anObject", "anObject2", "anObject3"],
  10114. source: "constructor: aString value:anObject value: anObject2 value:anObject3\x0a\x09<\x0a\x09\x09self._deprecatedAPI_(\x22Use constructorNamed:value:value:value\x22);\x0a\x09\x09var nativeFunc=eval(aString);\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  10115. referencedClasses: [],
  10116. messageSends: []
  10117. }),
  10118. $globals.NativeFunction.klass);
  10119. $core.addMethod(
  10120. $core.method({
  10121. selector: "constructorNamed:",
  10122. protocol: 'instance creation',
  10123. fn: function (aString){
  10124. var self=this;
  10125. return $core.withContext(function($ctx1) {
  10126. var nativeFunc=(new Function('return this'))()[aString];
  10127. return new nativeFunc();
  10128. ;
  10129. return self;
  10130. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.klass)});
  10131. },
  10132. args: ["aString"],
  10133. source: "constructorNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  10134. referencedClasses: [],
  10135. messageSends: []
  10136. }),
  10137. $globals.NativeFunction.klass);
  10138. $core.addMethod(
  10139. $core.method({
  10140. selector: "constructorNamed:value:",
  10141. protocol: 'instance creation',
  10142. fn: function (aString,anObject){
  10143. var self=this;
  10144. return $core.withContext(function($ctx1) {
  10145. var nativeFunc=(new Function('return this'))()[aString];
  10146. return new nativeFunc(anObject);
  10147. ;
  10148. return self;
  10149. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  10150. },
  10151. args: ["aString", "anObject"],
  10152. source: "constructorNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  10153. referencedClasses: [],
  10154. messageSends: []
  10155. }),
  10156. $globals.NativeFunction.klass);
  10157. $core.addMethod(
  10158. $core.method({
  10159. selector: "constructorNamed:value:value:",
  10160. protocol: 'instance creation',
  10161. fn: function (aString,anObject,anObject2){
  10162. var self=this;
  10163. return $core.withContext(function($ctx1) {
  10164. var nativeFunc=(new Function('return this'))()[aString];
  10165. return new nativeFunc(anObject,anObject2);
  10166. ;
  10167. return self;
  10168. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10169. },
  10170. args: ["aString", "anObject", "anObject2"],
  10171. 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>",
  10172. referencedClasses: [],
  10173. messageSends: []
  10174. }),
  10175. $globals.NativeFunction.klass);
  10176. $core.addMethod(
  10177. $core.method({
  10178. selector: "constructorNamed:value:value:value:",
  10179. protocol: 'instance creation',
  10180. fn: function (aString,anObject,anObject2,anObject3){
  10181. var self=this;
  10182. return $core.withContext(function($ctx1) {
  10183. var nativeFunc=(new Function('return this'))()[aString];
  10184. return new nativeFunc(anObject,anObject2, anObject3);
  10185. ;
  10186. return self;
  10187. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10188. },
  10189. args: ["aString", "anObject", "anObject2", "anObject3"],
  10190. 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>",
  10191. referencedClasses: [],
  10192. messageSends: []
  10193. }),
  10194. $globals.NativeFunction.klass);
  10195. $core.addMethod(
  10196. $core.method({
  10197. selector: "constructorOf:",
  10198. protocol: 'instance creation',
  10199. fn: function (nativeFunc){
  10200. var self=this;
  10201. return $core.withContext(function($ctx1) {
  10202. return new nativeFunc();
  10203. ;
  10204. return self;
  10205. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  10206. },
  10207. args: ["nativeFunc"],
  10208. source: "constructorOf: nativeFunc\x0a\x09<\x0a\x09\x09return new nativeFunc();\x0a\x09>",
  10209. referencedClasses: [],
  10210. messageSends: []
  10211. }),
  10212. $globals.NativeFunction.klass);
  10213. $core.addMethod(
  10214. $core.method({
  10215. selector: "constructorOf:value:",
  10216. protocol: 'instance creation',
  10217. fn: function (nativeFunc,anObject){
  10218. var self=this;
  10219. return $core.withContext(function($ctx1) {
  10220. return new nativeFunc(anObject);
  10221. ;
  10222. return self;
  10223. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  10224. },
  10225. args: ["nativeFunc", "anObject"],
  10226. source: "constructorOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09>",
  10227. referencedClasses: [],
  10228. messageSends: []
  10229. }),
  10230. $globals.NativeFunction.klass);
  10231. $core.addMethod(
  10232. $core.method({
  10233. selector: "constructorOf:value:value:",
  10234. protocol: 'instance creation',
  10235. fn: function (nativeFunc,anObject,anObject2){
  10236. var self=this;
  10237. return $core.withContext(function($ctx1) {
  10238. return new nativeFunc(anObject,anObject2);
  10239. ;
  10240. return self;
  10241. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10242. },
  10243. args: ["nativeFunc", "anObject", "anObject2"],
  10244. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09>",
  10245. referencedClasses: [],
  10246. messageSends: []
  10247. }),
  10248. $globals.NativeFunction.klass);
  10249. $core.addMethod(
  10250. $core.method({
  10251. selector: "constructorOf:value:value:value:",
  10252. protocol: 'instance creation',
  10253. fn: function (nativeFunc,anObject,anObject2,anObject3){
  10254. var self=this;
  10255. return $core.withContext(function($ctx1) {
  10256. return new nativeFunc(anObject,anObject2, anObject3);
  10257. ;
  10258. return self;
  10259. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10260. },
  10261. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  10262. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  10263. referencedClasses: [],
  10264. messageSends: []
  10265. }),
  10266. $globals.NativeFunction.klass);
  10267. $core.addMethod(
  10268. $core.method({
  10269. selector: "exists:",
  10270. protocol: 'testing',
  10271. fn: function (aString){
  10272. var self=this;
  10273. return $core.withContext(function($ctx1) {
  10274. return $recv($globals.Smalltalk)._existsJsGlobal_(aString);
  10275. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.klass)});
  10276. },
  10277. args: ["aString"],
  10278. source: "exists: aString\x0a\x09^ Smalltalk existsJsGlobal: aString",
  10279. referencedClasses: ["Smalltalk"],
  10280. messageSends: ["existsJsGlobal:"]
  10281. }),
  10282. $globals.NativeFunction.klass);
  10283. $core.addMethod(
  10284. $core.method({
  10285. selector: "functionNamed:",
  10286. protocol: 'function calling',
  10287. fn: function (aString){
  10288. var self=this;
  10289. return $core.withContext(function($ctx1) {
  10290. var nativeFunc=(new Function('return this'))()[aString];
  10291. return nativeFunc();
  10292. ;
  10293. return self;
  10294. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.klass)});
  10295. },
  10296. args: ["aString"],
  10297. source: "functionNamed: aString\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc();\x0a\x09>",
  10298. referencedClasses: [],
  10299. messageSends: []
  10300. }),
  10301. $globals.NativeFunction.klass);
  10302. $core.addMethod(
  10303. $core.method({
  10304. selector: "functionNamed:value:",
  10305. protocol: 'function calling',
  10306. fn: function (aString,anObject){
  10307. var self=this;
  10308. return $core.withContext(function($ctx1) {
  10309. var nativeFunc=(new Function('return this'))()[aString];
  10310. return nativeFunc(anObject);
  10311. ;
  10312. return self;
  10313. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.klass)});
  10314. },
  10315. args: ["aString", "anObject"],
  10316. source: "functionNamed: aString value: anObject\x0a\x09<\x0a\x09\x09var nativeFunc=(new Function('return this'))()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  10317. referencedClasses: [],
  10318. messageSends: []
  10319. }),
  10320. $globals.NativeFunction.klass);
  10321. $core.addMethod(
  10322. $core.method({
  10323. selector: "functionNamed:value:value:",
  10324. protocol: 'function calling',
  10325. fn: function (aString,anObject,anObject2){
  10326. var self=this;
  10327. return $core.withContext(function($ctx1) {
  10328. var nativeFunc=(new Function('return this'))()[aString];
  10329. return nativeFunc(anObject,anObject2);
  10330. ;
  10331. return self;
  10332. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10333. },
  10334. args: ["aString", "anObject", "anObject2"],
  10335. 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>",
  10336. referencedClasses: [],
  10337. messageSends: []
  10338. }),
  10339. $globals.NativeFunction.klass);
  10340. $core.addMethod(
  10341. $core.method({
  10342. selector: "functionNamed:value:value:value:",
  10343. protocol: 'function calling',
  10344. fn: function (aString,anObject,anObject2,anObject3){
  10345. var self=this;
  10346. return $core.withContext(function($ctx1) {
  10347. var nativeFunc=(new Function('return this'))()[aString];
  10348. return nativeFunc(anObject,anObject2, anObject3);
  10349. ;
  10350. return self;
  10351. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10352. },
  10353. args: ["aString", "anObject", "anObject2", "anObject3"],
  10354. 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>",
  10355. referencedClasses: [],
  10356. messageSends: []
  10357. }),
  10358. $globals.NativeFunction.klass);
  10359. $core.addMethod(
  10360. $core.method({
  10361. selector: "functionNamed:valueWithArgs:",
  10362. protocol: 'function calling',
  10363. fn: function (aString,args){
  10364. var self=this;
  10365. return $core.withContext(function($ctx1) {
  10366. var nativeFunc=(new Function('return this'))()[aString];
  10367. return Function.prototype.apply.call(nativeFunc, null, args);
  10368. ;
  10369. return self;
  10370. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.klass)});
  10371. },
  10372. args: ["aString", "args"],
  10373. 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>",
  10374. referencedClasses: [],
  10375. messageSends: []
  10376. }),
  10377. $globals.NativeFunction.klass);
  10378. $core.addMethod(
  10379. $core.method({
  10380. selector: "functionOf:",
  10381. protocol: 'function calling',
  10382. fn: function (nativeFunc){
  10383. var self=this;
  10384. return $core.withContext(function($ctx1) {
  10385. return nativeFunc();
  10386. ;
  10387. return self;
  10388. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.klass)});
  10389. },
  10390. args: ["nativeFunc"],
  10391. source: "functionOf: nativeFunc\x0a\x09<\x0a\x09\x09return nativeFunc();\x0a\x09>",
  10392. referencedClasses: [],
  10393. messageSends: []
  10394. }),
  10395. $globals.NativeFunction.klass);
  10396. $core.addMethod(
  10397. $core.method({
  10398. selector: "functionOf:value:",
  10399. protocol: 'function calling',
  10400. fn: function (nativeFunc,anObject){
  10401. var self=this;
  10402. return $core.withContext(function($ctx1) {
  10403. return nativeFunc(anObject);
  10404. ;
  10405. return self;
  10406. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.klass)});
  10407. },
  10408. args: ["nativeFunc", "anObject"],
  10409. source: "functionOf: nativeFunc value: anObject\x0a\x09<\x0a\x09\x09return nativeFunc(anObject);\x0a\x09>",
  10410. referencedClasses: [],
  10411. messageSends: []
  10412. }),
  10413. $globals.NativeFunction.klass);
  10414. $core.addMethod(
  10415. $core.method({
  10416. selector: "functionOf:value:value:",
  10417. protocol: 'function calling',
  10418. fn: function (nativeFunc,anObject,anObject2){
  10419. var self=this;
  10420. return $core.withContext(function($ctx1) {
  10421. return nativeFunc(anObject,anObject2);
  10422. ;
  10423. return self;
  10424. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10425. },
  10426. args: ["nativeFunc", "anObject", "anObject2"],
  10427. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09>",
  10428. referencedClasses: [],
  10429. messageSends: []
  10430. }),
  10431. $globals.NativeFunction.klass);
  10432. $core.addMethod(
  10433. $core.method({
  10434. selector: "functionOf:value:value:value:",
  10435. protocol: 'function calling',
  10436. fn: function (nativeFunc,anObject,anObject2,anObject3){
  10437. var self=this;
  10438. return $core.withContext(function($ctx1) {
  10439. return nativeFunc(anObject,anObject2, anObject3);
  10440. ;
  10441. return self;
  10442. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10443. },
  10444. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  10445. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09>",
  10446. referencedClasses: [],
  10447. messageSends: []
  10448. }),
  10449. $globals.NativeFunction.klass);
  10450. $core.addMethod(
  10451. $core.method({
  10452. selector: "functionOf:valueWithArgs:",
  10453. protocol: 'function calling',
  10454. fn: function (nativeFunc,args){
  10455. var self=this;
  10456. return $core.withContext(function($ctx1) {
  10457. return Function.prototype.apply.call(nativeFunc, null, args);
  10458. ;
  10459. return self;
  10460. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.klass)});
  10461. },
  10462. args: ["nativeFunc", "args"],
  10463. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09>",
  10464. referencedClasses: [],
  10465. messageSends: []
  10466. }),
  10467. $globals.NativeFunction.klass);
  10468. $core.addMethod(
  10469. $core.method({
  10470. selector: "methodOf:this:",
  10471. protocol: 'method calling',
  10472. fn: function (nativeFunc,thisObject){
  10473. var self=this;
  10474. return $core.withContext(function($ctx1) {
  10475. return Function.prototype.call.call(nativeFunc, thisObject);
  10476. ;
  10477. return self;
  10478. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.klass)});
  10479. },
  10480. args: ["nativeFunc", "thisObject"],
  10481. source: "methodOf: nativeFunc this: thisObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09>",
  10482. referencedClasses: [],
  10483. messageSends: []
  10484. }),
  10485. $globals.NativeFunction.klass);
  10486. $core.addMethod(
  10487. $core.method({
  10488. selector: "methodOf:this:value:",
  10489. protocol: 'method calling',
  10490. fn: function (nativeFunc,thisObject,anObject){
  10491. var self=this;
  10492. return $core.withContext(function($ctx1) {
  10493. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  10494. ;
  10495. return self;
  10496. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.klass)});
  10497. },
  10498. args: ["nativeFunc", "thisObject", "anObject"],
  10499. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09>",
  10500. referencedClasses: [],
  10501. messageSends: []
  10502. }),
  10503. $globals.NativeFunction.klass);
  10504. $core.addMethod(
  10505. $core.method({
  10506. selector: "methodOf:this:value:value:",
  10507. protocol: 'method calling',
  10508. fn: function (nativeFunc,thisObject,anObject,anObject2){
  10509. var self=this;
  10510. return $core.withContext(function($ctx1) {
  10511. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  10512. ;
  10513. return self;
  10514. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.klass)});
  10515. },
  10516. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  10517. source: "methodOf: nativeFunc this: thisObject value: anObject value: anObject2\x0a\x09<\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);\x0a\x09>",
  10518. referencedClasses: [],
  10519. messageSends: []
  10520. }),
  10521. $globals.NativeFunction.klass);
  10522. $core.addMethod(
  10523. $core.method({
  10524. selector: "methodOf:this:value:value:value:",
  10525. protocol: 'method calling',
  10526. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  10527. var self=this;
  10528. return $core.withContext(function($ctx1) {
  10529. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  10530. ;
  10531. return self;
  10532. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.klass)});
  10533. },
  10534. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  10535. 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>",
  10536. referencedClasses: [],
  10537. messageSends: []
  10538. }),
  10539. $globals.NativeFunction.klass);
  10540. $core.addMethod(
  10541. $core.method({
  10542. selector: "methodOf:this:valueWithArgs:",
  10543. protocol: 'method calling',
  10544. fn: function (nativeFunc,thisObject,args){
  10545. var self=this;
  10546. return $core.withContext(function($ctx1) {
  10547. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  10548. ;
  10549. return self;
  10550. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.klass)});
  10551. },
  10552. args: ["nativeFunc", "thisObject", "args"],
  10553. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09>",
  10554. referencedClasses: [],
  10555. messageSends: []
  10556. }),
  10557. $globals.NativeFunction.klass);
  10558. $core.addClass('Timeout', $globals.Object, ['rawTimeout'], 'Kernel-Methods');
  10559. $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.";
  10560. $core.addMethod(
  10561. $core.method({
  10562. selector: "clearInterval",
  10563. protocol: 'timeout/interval',
  10564. fn: function (){
  10565. var self=this;
  10566. return $core.withContext(function($ctx1) {
  10567. var interval = self["@rawTimeout"];
  10568. clearInterval(interval);
  10569. ;
  10570. return self;
  10571. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  10572. },
  10573. args: [],
  10574. source: "clearInterval\x0a\x09<\x0a\x09\x09var interval = self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09>",
  10575. referencedClasses: [],
  10576. messageSends: []
  10577. }),
  10578. $globals.Timeout);
  10579. $core.addMethod(
  10580. $core.method({
  10581. selector: "clearTimeout",
  10582. protocol: 'timeout/interval',
  10583. fn: function (){
  10584. var self=this;
  10585. return $core.withContext(function($ctx1) {
  10586. var timeout = self["@rawTimeout"];
  10587. clearTimeout(timeout);
  10588. ;
  10589. return self;
  10590. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  10591. },
  10592. args: [],
  10593. source: "clearTimeout\x0a\x09<\x0a\x09\x09var timeout = self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09>",
  10594. referencedClasses: [],
  10595. messageSends: []
  10596. }),
  10597. $globals.Timeout);
  10598. $core.addMethod(
  10599. $core.method({
  10600. selector: "rawTimeout:",
  10601. protocol: 'accessing',
  10602. fn: function (anObject){
  10603. var self=this;
  10604. self["@rawTimeout"]=anObject;
  10605. return self;
  10606. },
  10607. args: ["anObject"],
  10608. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  10609. referencedClasses: [],
  10610. messageSends: []
  10611. }),
  10612. $globals.Timeout);
  10613. $core.addMethod(
  10614. $core.method({
  10615. selector: "on:",
  10616. protocol: 'instance creation',
  10617. fn: function (anObject){
  10618. var self=this;
  10619. return $core.withContext(function($ctx1) {
  10620. var $1;
  10621. $1=self._new();
  10622. $recv($1)._rawTimeout_(anObject);
  10623. return $recv($1)._yourself();
  10624. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.klass)});
  10625. },
  10626. args: ["anObject"],
  10627. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  10628. referencedClasses: [],
  10629. messageSends: ["rawTimeout:", "new", "yourself"]
  10630. }),
  10631. $globals.Timeout.klass);
  10632. });
  10633. define("amber_core/Kernel-Collections", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  10634. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  10635. $core.addPackage('Kernel-Collections');
  10636. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  10637. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  10638. $core.addClass('Association', $globals.Object, ['key', 'value'], 'Kernel-Collections');
  10639. $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:`";
  10640. $core.addMethod(
  10641. $core.method({
  10642. selector: "=",
  10643. protocol: 'comparing',
  10644. fn: function (anAssociation){
  10645. var self=this;
  10646. return $core.withContext(function($ctx1) {
  10647. var $3,$2,$5,$4,$6,$1;
  10648. $3=self._class();
  10649. $ctx1.sendIdx["class"]=1;
  10650. $2=$recv($3).__eq($recv(anAssociation)._class());
  10651. $ctx1.sendIdx["="]=1;
  10652. $1=$recv($2)._and_((function(){
  10653. return $core.withContext(function($ctx2) {
  10654. $5=self._key();
  10655. $ctx2.sendIdx["key"]=1;
  10656. $4=$recv($5).__eq($recv(anAssociation)._key());
  10657. $ctx2.sendIdx["="]=2;
  10658. return $recv($4)._and_((function(){
  10659. return $core.withContext(function($ctx3) {
  10660. $6=self._value();
  10661. $ctx3.sendIdx["value"]=1;
  10662. return $recv($6).__eq($recv(anAssociation)._value());
  10663. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  10664. }));
  10665. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  10666. }));
  10667. $ctx1.sendIdx["and:"]=1;
  10668. return $1;
  10669. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  10670. },
  10671. args: ["anAssociation"],
  10672. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  10673. referencedClasses: [],
  10674. messageSends: ["and:", "=", "class", "key", "value"]
  10675. }),
  10676. $globals.Association);
  10677. $core.addMethod(
  10678. $core.method({
  10679. selector: "key",
  10680. protocol: 'accessing',
  10681. fn: function (){
  10682. var self=this;
  10683. return self["@key"];
  10684. },
  10685. args: [],
  10686. source: "key\x0a\x09^ key",
  10687. referencedClasses: [],
  10688. messageSends: []
  10689. }),
  10690. $globals.Association);
  10691. $core.addMethod(
  10692. $core.method({
  10693. selector: "key:",
  10694. protocol: 'accessing',
  10695. fn: function (aKey){
  10696. var self=this;
  10697. self["@key"]=aKey;
  10698. return self;
  10699. },
  10700. args: ["aKey"],
  10701. source: "key: aKey\x0a\x09key := aKey",
  10702. referencedClasses: [],
  10703. messageSends: []
  10704. }),
  10705. $globals.Association);
  10706. $core.addMethod(
  10707. $core.method({
  10708. selector: "printOn:",
  10709. protocol: 'printing',
  10710. fn: function (aStream){
  10711. var self=this;
  10712. return $core.withContext(function($ctx1) {
  10713. $recv(self._key())._printOn_(aStream);
  10714. $ctx1.sendIdx["printOn:"]=1;
  10715. $recv(aStream)._nextPutAll_(" -> ");
  10716. $recv(self._value())._printOn_(aStream);
  10717. return self;
  10718. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  10719. },
  10720. args: ["aStream"],
  10721. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  10722. referencedClasses: [],
  10723. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  10724. }),
  10725. $globals.Association);
  10726. $core.addMethod(
  10727. $core.method({
  10728. selector: "value",
  10729. protocol: 'accessing',
  10730. fn: function (){
  10731. var self=this;
  10732. return self["@value"];
  10733. },
  10734. args: [],
  10735. source: "value\x0a\x09^ value",
  10736. referencedClasses: [],
  10737. messageSends: []
  10738. }),
  10739. $globals.Association);
  10740. $core.addMethod(
  10741. $core.method({
  10742. selector: "value:",
  10743. protocol: 'accessing',
  10744. fn: function (aValue){
  10745. var self=this;
  10746. self["@value"]=aValue;
  10747. return self;
  10748. },
  10749. args: ["aValue"],
  10750. source: "value: aValue\x0a\x09value := aValue",
  10751. referencedClasses: [],
  10752. messageSends: []
  10753. }),
  10754. $globals.Association);
  10755. $core.addMethod(
  10756. $core.method({
  10757. selector: "key:value:",
  10758. protocol: 'instance creation',
  10759. fn: function (aKey,aValue){
  10760. var self=this;
  10761. return $core.withContext(function($ctx1) {
  10762. var $1;
  10763. $1=self._new();
  10764. $recv($1)._key_(aKey);
  10765. $recv($1)._value_(aValue);
  10766. return $recv($1)._yourself();
  10767. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  10768. },
  10769. args: ["aKey", "aValue"],
  10770. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  10771. referencedClasses: [],
  10772. messageSends: ["key:", "new", "value:", "yourself"]
  10773. }),
  10774. $globals.Association.klass);
  10775. $core.addClass('BucketStore', $globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  10776. $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`.";
  10777. $core.addMethod(
  10778. $core.method({
  10779. selector: "bucketOfElement:",
  10780. protocol: 'accessing',
  10781. fn: function (anObject){
  10782. var self=this;
  10783. return $core.withContext(function($ctx1) {
  10784. var hash = self['@hashBlock'](anObject);
  10785. if (!hash) return null;
  10786. var buckets = self['@buckets'],
  10787. bucket = buckets[hash];
  10788. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  10789. return bucket;
  10790. ;
  10791. return self;
  10792. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  10793. },
  10794. args: ["anObject"],
  10795. 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>",
  10796. referencedClasses: [],
  10797. messageSends: []
  10798. }),
  10799. $globals.BucketStore);
  10800. $core.addMethod(
  10801. $core.method({
  10802. selector: "do:",
  10803. protocol: 'enumerating',
  10804. fn: function (aBlock){
  10805. var self=this;
  10806. return $core.withContext(function($ctx1) {
  10807. var buckets = self['@buckets'];
  10808. var keys = Object.keys(buckets);
  10809. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  10810. ;
  10811. return self;
  10812. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  10813. },
  10814. args: ["aBlock"],
  10815. 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>",
  10816. referencedClasses: [],
  10817. messageSends: []
  10818. }),
  10819. $globals.BucketStore);
  10820. $core.addMethod(
  10821. $core.method({
  10822. selector: "hashBlock:",
  10823. protocol: 'accessing',
  10824. fn: function (aBlock){
  10825. var self=this;
  10826. self["@hashBlock"]=aBlock;
  10827. return self;
  10828. },
  10829. args: ["aBlock"],
  10830. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  10831. referencedClasses: [],
  10832. messageSends: []
  10833. }),
  10834. $globals.BucketStore);
  10835. $core.addMethod(
  10836. $core.method({
  10837. selector: "initialize",
  10838. protocol: 'initialization',
  10839. fn: function (){
  10840. var self=this;
  10841. return $core.withContext(function($ctx1) {
  10842. (
  10843. $ctx1.supercall = true,
  10844. ($globals.BucketStore.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  10845. $ctx1.supercall = false;
  10846. self._removeAll();
  10847. return self;
  10848. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  10849. },
  10850. args: [],
  10851. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  10852. referencedClasses: [],
  10853. messageSends: ["initialize", "removeAll"]
  10854. }),
  10855. $globals.BucketStore);
  10856. $core.addMethod(
  10857. $core.method({
  10858. selector: "newBucket",
  10859. protocol: 'private',
  10860. fn: function (){
  10861. var self=this;
  10862. return $core.withContext(function($ctx1) {
  10863. self._subclassResponsibility();
  10864. return self;
  10865. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  10866. },
  10867. args: [],
  10868. source: "newBucket\x0a\x09self subclassResponsibility",
  10869. referencedClasses: [],
  10870. messageSends: ["subclassResponsibility"]
  10871. }),
  10872. $globals.BucketStore);
  10873. $core.addMethod(
  10874. $core.method({
  10875. selector: "removeAll",
  10876. protocol: 'adding/removing',
  10877. fn: function (){
  10878. var self=this;
  10879. return $core.withContext(function($ctx1) {
  10880. self['@buckets'] = Object.create(null);;
  10881. return self;
  10882. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  10883. },
  10884. args: [],
  10885. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  10886. referencedClasses: [],
  10887. messageSends: []
  10888. }),
  10889. $globals.BucketStore);
  10890. $core.addMethod(
  10891. $core.method({
  10892. selector: "hashBlock:",
  10893. protocol: 'instance creation',
  10894. fn: function (aBlock){
  10895. var self=this;
  10896. return $core.withContext(function($ctx1) {
  10897. var $1;
  10898. $1=self._new();
  10899. $recv($1)._hashBlock_(aBlock);
  10900. return $recv($1)._yourself();
  10901. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  10902. },
  10903. args: ["aBlock"],
  10904. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  10905. referencedClasses: [],
  10906. messageSends: ["hashBlock:", "new", "yourself"]
  10907. }),
  10908. $globals.BucketStore.klass);
  10909. $core.addClass('ArrayBucketStore', $globals.BucketStore, [], 'Kernel-Collections');
  10910. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  10911. $core.addMethod(
  10912. $core.method({
  10913. selector: "newBucket",
  10914. protocol: 'private',
  10915. fn: function (){
  10916. var self=this;
  10917. return [];
  10918. },
  10919. args: [],
  10920. source: "newBucket\x0a\x09^ #()",
  10921. referencedClasses: [],
  10922. messageSends: []
  10923. }),
  10924. $globals.ArrayBucketStore);
  10925. $core.addClass('Collection', $globals.Object, [], 'Kernel-Collections');
  10926. $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.";
  10927. $core.addMethod(
  10928. $core.method({
  10929. selector: ",",
  10930. protocol: 'copying',
  10931. fn: function (aCollection){
  10932. var self=this;
  10933. return $core.withContext(function($ctx1) {
  10934. var $1;
  10935. $1=self._copy();
  10936. $recv($1)._addAll_(aCollection);
  10937. return $recv($1)._yourself();
  10938. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  10939. },
  10940. args: ["aCollection"],
  10941. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  10942. referencedClasses: [],
  10943. messageSends: ["addAll:", "copy", "yourself"]
  10944. }),
  10945. $globals.Collection);
  10946. $core.addMethod(
  10947. $core.method({
  10948. selector: "add:",
  10949. protocol: 'adding/removing',
  10950. fn: function (anObject){
  10951. var self=this;
  10952. return $core.withContext(function($ctx1) {
  10953. self._subclassResponsibility();
  10954. return self;
  10955. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  10956. },
  10957. args: ["anObject"],
  10958. source: "add: anObject\x0a\x09self subclassResponsibility",
  10959. referencedClasses: [],
  10960. messageSends: ["subclassResponsibility"]
  10961. }),
  10962. $globals.Collection);
  10963. $core.addMethod(
  10964. $core.method({
  10965. selector: "addAll:",
  10966. protocol: 'adding/removing',
  10967. fn: function (aCollection){
  10968. var self=this;
  10969. return $core.withContext(function($ctx1) {
  10970. $recv(aCollection)._do_((function(each){
  10971. return $core.withContext(function($ctx2) {
  10972. return self._add_(each);
  10973. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10974. }));
  10975. return aCollection;
  10976. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  10977. },
  10978. args: ["aCollection"],
  10979. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  10980. referencedClasses: [],
  10981. messageSends: ["do:", "add:"]
  10982. }),
  10983. $globals.Collection);
  10984. $core.addMethod(
  10985. $core.method({
  10986. selector: "allSatisfy:",
  10987. protocol: 'enumerating',
  10988. fn: function (aBlock){
  10989. var self=this;
  10990. return $core.withContext(function($ctx1) {
  10991. var $1;
  10992. var $early={};
  10993. try {
  10994. self._do_((function(each){
  10995. return $core.withContext(function($ctx2) {
  10996. $1=$recv(aBlock)._value_(each);
  10997. if(!$core.assert($1)){
  10998. throw $early=[false];
  10999. };
  11000. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11001. }));
  11002. return true;
  11003. }
  11004. catch(e) {if(e===$early)return e[0]; throw e}
  11005. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  11006. },
  11007. args: ["aBlock"],
  11008. 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",
  11009. referencedClasses: [],
  11010. messageSends: ["do:", "ifFalse:", "value:"]
  11011. }),
  11012. $globals.Collection);
  11013. $core.addMethod(
  11014. $core.method({
  11015. selector: "anyOne",
  11016. protocol: 'adding/removing',
  11017. fn: function (){
  11018. var self=this;
  11019. return $core.withContext(function($ctx1) {
  11020. var $early={};
  11021. try {
  11022. self._ifEmpty_((function(){
  11023. return $core.withContext(function($ctx2) {
  11024. return self._error_("Collection is empty");
  11025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11026. }));
  11027. self._do_((function(each){
  11028. throw $early=[each];
  11029. }));
  11030. return self;
  11031. }
  11032. catch(e) {if(e===$early)return e[0]; throw e}
  11033. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  11034. },
  11035. args: [],
  11036. 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 ]",
  11037. referencedClasses: [],
  11038. messageSends: ["ifEmpty:", "error:", "do:"]
  11039. }),
  11040. $globals.Collection);
  11041. $core.addMethod(
  11042. $core.method({
  11043. selector: "anySatisfy:",
  11044. protocol: 'enumerating',
  11045. fn: function (aBlock){
  11046. var self=this;
  11047. return $core.withContext(function($ctx1) {
  11048. var $1;
  11049. var $early={};
  11050. try {
  11051. self._do_((function(each){
  11052. return $core.withContext(function($ctx2) {
  11053. $1=$recv(aBlock)._value_(each);
  11054. if($core.assert($1)){
  11055. throw $early=[true];
  11056. };
  11057. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11058. }));
  11059. return false;
  11060. }
  11061. catch(e) {if(e===$early)return e[0]; throw e}
  11062. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  11063. },
  11064. args: ["aBlock"],
  11065. 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",
  11066. referencedClasses: [],
  11067. messageSends: ["do:", "ifTrue:", "value:"]
  11068. }),
  11069. $globals.Collection);
  11070. $core.addMethod(
  11071. $core.method({
  11072. selector: "asArray",
  11073. protocol: 'converting',
  11074. fn: function (){
  11075. var self=this;
  11076. return $core.withContext(function($ctx1) {
  11077. return $recv($globals.Array)._withAll_(self);
  11078. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  11079. },
  11080. args: [],
  11081. source: "asArray\x0a\x09^ Array withAll: self",
  11082. referencedClasses: ["Array"],
  11083. messageSends: ["withAll:"]
  11084. }),
  11085. $globals.Collection);
  11086. $core.addMethod(
  11087. $core.method({
  11088. selector: "asJSON",
  11089. protocol: 'converting',
  11090. fn: function (){
  11091. var self=this;
  11092. return $core.withContext(function($ctx1) {
  11093. return $recv(self._asArray())._collect_((function(each){
  11094. return $core.withContext(function($ctx2) {
  11095. return $recv(each)._asJSON();
  11096. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11097. }));
  11098. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)});
  11099. },
  11100. args: [],
  11101. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  11102. referencedClasses: [],
  11103. messageSends: ["collect:", "asArray", "asJSON"]
  11104. }),
  11105. $globals.Collection);
  11106. $core.addMethod(
  11107. $core.method({
  11108. selector: "asOrderedCollection",
  11109. protocol: 'converting',
  11110. fn: function (){
  11111. var self=this;
  11112. return $core.withContext(function($ctx1) {
  11113. return self._asArray();
  11114. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  11115. },
  11116. args: [],
  11117. source: "asOrderedCollection\x0a\x09^ self asArray",
  11118. referencedClasses: [],
  11119. messageSends: ["asArray"]
  11120. }),
  11121. $globals.Collection);
  11122. $core.addMethod(
  11123. $core.method({
  11124. selector: "asSet",
  11125. protocol: 'converting',
  11126. fn: function (){
  11127. var self=this;
  11128. return $core.withContext(function($ctx1) {
  11129. return $recv($globals.Set)._withAll_(self);
  11130. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  11131. },
  11132. args: [],
  11133. source: "asSet\x0a\x09^ Set withAll: self",
  11134. referencedClasses: ["Set"],
  11135. messageSends: ["withAll:"]
  11136. }),
  11137. $globals.Collection);
  11138. $core.addMethod(
  11139. $core.method({
  11140. selector: "collect:",
  11141. protocol: 'enumerating',
  11142. fn: function (aBlock){
  11143. var self=this;
  11144. var stream;
  11145. return $core.withContext(function($ctx1) {
  11146. stream=$recv($recv(self._class())._new())._writeStream();
  11147. self._do_((function(each){
  11148. return $core.withContext(function($ctx2) {
  11149. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  11150. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11151. }));
  11152. return $recv(stream)._contents();
  11153. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  11154. },
  11155. args: ["aBlock"],
  11156. 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",
  11157. referencedClasses: [],
  11158. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  11159. }),
  11160. $globals.Collection);
  11161. $core.addMethod(
  11162. $core.method({
  11163. selector: "copyWith:",
  11164. protocol: 'copying',
  11165. fn: function (anObject){
  11166. var self=this;
  11167. return $core.withContext(function($ctx1) {
  11168. var $1;
  11169. $1=self._copy();
  11170. $recv($1)._add_(anObject);
  11171. return $recv($1)._yourself();
  11172. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  11173. },
  11174. args: ["anObject"],
  11175. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  11176. referencedClasses: [],
  11177. messageSends: ["add:", "copy", "yourself"]
  11178. }),
  11179. $globals.Collection);
  11180. $core.addMethod(
  11181. $core.method({
  11182. selector: "copyWithAll:",
  11183. protocol: 'copying',
  11184. fn: function (aCollection){
  11185. var self=this;
  11186. return $core.withContext(function($ctx1) {
  11187. var $1;
  11188. $1=self._copy();
  11189. $recv($1)._addAll_(aCollection);
  11190. return $recv($1)._yourself();
  11191. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  11192. },
  11193. args: ["aCollection"],
  11194. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  11195. referencedClasses: [],
  11196. messageSends: ["addAll:", "copy", "yourself"]
  11197. }),
  11198. $globals.Collection);
  11199. $core.addMethod(
  11200. $core.method({
  11201. selector: "copyWithoutAll:",
  11202. protocol: 'copying',
  11203. fn: function (aCollection){
  11204. var self=this;
  11205. return $core.withContext(function($ctx1) {
  11206. return self._reject_((function(each){
  11207. return $core.withContext(function($ctx2) {
  11208. return $recv(aCollection)._includes_(each);
  11209. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11210. }));
  11211. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  11212. },
  11213. args: ["aCollection"],
  11214. 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 ]",
  11215. referencedClasses: [],
  11216. messageSends: ["reject:", "includes:"]
  11217. }),
  11218. $globals.Collection);
  11219. $core.addMethod(
  11220. $core.method({
  11221. selector: "deepCopy",
  11222. protocol: 'copying',
  11223. fn: function (){
  11224. var self=this;
  11225. return $core.withContext(function($ctx1) {
  11226. return self._collect_((function(each){
  11227. return $core.withContext(function($ctx2) {
  11228. return $recv(each)._deepCopy();
  11229. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11230. }));
  11231. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  11232. },
  11233. args: [],
  11234. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  11235. referencedClasses: [],
  11236. messageSends: ["collect:", "deepCopy"]
  11237. }),
  11238. $globals.Collection);
  11239. $core.addMethod(
  11240. $core.method({
  11241. selector: "detect:",
  11242. protocol: 'enumerating',
  11243. fn: function (aBlock){
  11244. var self=this;
  11245. return $core.withContext(function($ctx1) {
  11246. return self._detect_ifNone_(aBlock,(function(){
  11247. return $core.withContext(function($ctx2) {
  11248. return self._errorNotFound();
  11249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11250. }));
  11251. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  11252. },
  11253. args: ["aBlock"],
  11254. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  11255. referencedClasses: [],
  11256. messageSends: ["detect:ifNone:", "errorNotFound"]
  11257. }),
  11258. $globals.Collection);
  11259. $core.addMethod(
  11260. $core.method({
  11261. selector: "detect:ifNone:",
  11262. protocol: 'enumerating',
  11263. fn: function (aBlock,anotherBlock){
  11264. var self=this;
  11265. return $core.withContext(function($ctx1) {
  11266. self._subclassResponsibility();
  11267. return self;
  11268. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  11269. },
  11270. args: ["aBlock", "anotherBlock"],
  11271. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  11272. referencedClasses: [],
  11273. messageSends: ["subclassResponsibility"]
  11274. }),
  11275. $globals.Collection);
  11276. $core.addMethod(
  11277. $core.method({
  11278. selector: "do:",
  11279. protocol: 'enumerating',
  11280. fn: function (aBlock){
  11281. var self=this;
  11282. return $core.withContext(function($ctx1) {
  11283. self._subclassResponsibility();
  11284. return self;
  11285. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  11286. },
  11287. args: ["aBlock"],
  11288. source: "do: aBlock\x0a\x09self subclassResponsibility",
  11289. referencedClasses: [],
  11290. messageSends: ["subclassResponsibility"]
  11291. }),
  11292. $globals.Collection);
  11293. $core.addMethod(
  11294. $core.method({
  11295. selector: "do:separatedBy:",
  11296. protocol: 'enumerating',
  11297. fn: function (aBlock,anotherBlock){
  11298. var self=this;
  11299. var actionBeforeElement;
  11300. return $core.withContext(function($ctx1) {
  11301. actionBeforeElement=(function(){
  11302. actionBeforeElement=anotherBlock;
  11303. return actionBeforeElement;
  11304. });
  11305. self._do_((function(each){
  11306. return $core.withContext(function($ctx2) {
  11307. $recv(actionBeforeElement)._value();
  11308. return $recv(aBlock)._value_(each);
  11309. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  11310. }));
  11311. return self;
  11312. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  11313. },
  11314. args: ["aBlock", "anotherBlock"],
  11315. 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 ]",
  11316. referencedClasses: [],
  11317. messageSends: ["do:", "value", "value:"]
  11318. }),
  11319. $globals.Collection);
  11320. $core.addMethod(
  11321. $core.method({
  11322. selector: "errorNotFound",
  11323. protocol: 'error handling',
  11324. fn: function (){
  11325. var self=this;
  11326. return $core.withContext(function($ctx1) {
  11327. self._error_("Object is not in the collection");
  11328. return self;
  11329. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  11330. },
  11331. args: [],
  11332. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  11333. referencedClasses: [],
  11334. messageSends: ["error:"]
  11335. }),
  11336. $globals.Collection);
  11337. $core.addMethod(
  11338. $core.method({
  11339. selector: "ifEmpty:",
  11340. protocol: 'testing',
  11341. fn: function (aBlock){
  11342. var self=this;
  11343. return $core.withContext(function($ctx1) {
  11344. var $1;
  11345. $1=self._isEmpty();
  11346. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  11347. return self;
  11348. }));
  11349. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  11350. },
  11351. args: ["aBlock"],
  11352. 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 ]",
  11353. referencedClasses: [],
  11354. messageSends: ["ifTrue:ifFalse:", "isEmpty"]
  11355. }),
  11356. $globals.Collection);
  11357. $core.addMethod(
  11358. $core.method({
  11359. selector: "ifEmpty:ifNotEmpty:",
  11360. protocol: 'testing',
  11361. fn: function (aBlock,anotherBlock){
  11362. var self=this;
  11363. return $core.withContext(function($ctx1) {
  11364. var $1;
  11365. $1=self._isEmpty();
  11366. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  11367. return $core.withContext(function($ctx2) {
  11368. return $recv(anotherBlock)._value_(self);
  11369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11370. }));
  11371. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  11372. },
  11373. args: ["aBlock", "anotherBlock"],
  11374. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  11375. referencedClasses: [],
  11376. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"]
  11377. }),
  11378. $globals.Collection);
  11379. $core.addMethod(
  11380. $core.method({
  11381. selector: "ifNotEmpty:",
  11382. protocol: 'testing',
  11383. fn: function (aBlock){
  11384. var self=this;
  11385. return $core.withContext(function($ctx1) {
  11386. var $1;
  11387. $1=self._notEmpty();
  11388. if($core.assert($1)){
  11389. return $recv(aBlock)._value_(self);
  11390. } else {
  11391. return self;
  11392. };
  11393. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  11394. },
  11395. args: ["aBlock"],
  11396. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  11397. referencedClasses: [],
  11398. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  11399. }),
  11400. $globals.Collection);
  11401. $core.addMethod(
  11402. $core.method({
  11403. selector: "ifNotEmpty:ifEmpty:",
  11404. protocol: 'testing',
  11405. fn: function (aBlock,anotherBlock){
  11406. var self=this;
  11407. return $core.withContext(function($ctx1) {
  11408. var $1;
  11409. $1=self._notEmpty();
  11410. return $recv($1)._ifTrue_ifFalse_((function(){
  11411. return $core.withContext(function($ctx2) {
  11412. return $recv(aBlock)._value_(self);
  11413. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11414. }),anotherBlock);
  11415. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  11416. },
  11417. args: ["aBlock", "anotherBlock"],
  11418. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock",
  11419. referencedClasses: [],
  11420. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  11421. }),
  11422. $globals.Collection);
  11423. $core.addMethod(
  11424. $core.method({
  11425. selector: "includes:",
  11426. protocol: 'testing',
  11427. fn: function (anObject){
  11428. var self=this;
  11429. return $core.withContext(function($ctx1) {
  11430. return self._anySatisfy_((function(each){
  11431. return $core.withContext(function($ctx2) {
  11432. return $recv(each).__eq(anObject);
  11433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11434. }));
  11435. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  11436. },
  11437. args: ["anObject"],
  11438. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  11439. referencedClasses: [],
  11440. messageSends: ["anySatisfy:", "="]
  11441. }),
  11442. $globals.Collection);
  11443. $core.addMethod(
  11444. $core.method({
  11445. selector: "inject:into:",
  11446. protocol: 'enumerating',
  11447. fn: function (anObject,aBlock){
  11448. var self=this;
  11449. var result;
  11450. return $core.withContext(function($ctx1) {
  11451. result=anObject;
  11452. self._do_((function(each){
  11453. return $core.withContext(function($ctx2) {
  11454. result=$recv(aBlock)._value_value_(result,each);
  11455. return result;
  11456. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11457. }));
  11458. return result;
  11459. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  11460. },
  11461. args: ["anObject", "aBlock"],
  11462. 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",
  11463. referencedClasses: [],
  11464. messageSends: ["do:", "value:value:"]
  11465. }),
  11466. $globals.Collection);
  11467. $core.addMethod(
  11468. $core.method({
  11469. selector: "intersection:",
  11470. protocol: 'enumerating',
  11471. fn: function (aCollection){
  11472. var self=this;
  11473. var set,outputSet;
  11474. return $core.withContext(function($ctx1) {
  11475. var $2,$1;
  11476. set=self._asSet();
  11477. outputSet=$recv($globals.Set)._new();
  11478. $recv(aCollection)._do_((function(each){
  11479. return $core.withContext(function($ctx2) {
  11480. $2=$recv(set)._includes_(each);
  11481. $ctx2.sendIdx["includes:"]=1;
  11482. $1=$recv($2)._and_((function(){
  11483. return $core.withContext(function($ctx3) {
  11484. return $recv($recv(outputSet)._includes_(each))._not();
  11485. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  11486. }));
  11487. if($core.assert($1)){
  11488. return $recv(outputSet)._add_(each);
  11489. };
  11490. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11491. }));
  11492. return $recv(self._class())._withAll_($recv(outputSet)._asArray());
  11493. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  11494. },
  11495. args: ["aCollection"],
  11496. 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",
  11497. referencedClasses: ["Set"],
  11498. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  11499. }),
  11500. $globals.Collection);
  11501. $core.addMethod(
  11502. $core.method({
  11503. selector: "isEmpty",
  11504. protocol: 'testing',
  11505. fn: function (){
  11506. var self=this;
  11507. return $core.withContext(function($ctx1) {
  11508. return $recv(self._size()).__eq((0));
  11509. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  11510. },
  11511. args: [],
  11512. source: "isEmpty\x0a\x09^ self size = 0",
  11513. referencedClasses: [],
  11514. messageSends: ["=", "size"]
  11515. }),
  11516. $globals.Collection);
  11517. $core.addMethod(
  11518. $core.method({
  11519. selector: "noneSatisfy:",
  11520. protocol: 'enumerating',
  11521. fn: function (aBlock){
  11522. var self=this;
  11523. return $core.withContext(function($ctx1) {
  11524. var $1;
  11525. var $early={};
  11526. try {
  11527. self._do_((function(item){
  11528. return $core.withContext(function($ctx2) {
  11529. $1=$recv(aBlock)._value_(item);
  11530. if($core.assert($1)){
  11531. throw $early=[false];
  11532. };
  11533. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  11534. }));
  11535. return true;
  11536. }
  11537. catch(e) {if(e===$early)return e[0]; throw e}
  11538. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  11539. },
  11540. args: ["aBlock"],
  11541. 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",
  11542. referencedClasses: [],
  11543. messageSends: ["do:", "ifTrue:", "value:"]
  11544. }),
  11545. $globals.Collection);
  11546. $core.addMethod(
  11547. $core.method({
  11548. selector: "notEmpty",
  11549. protocol: 'testing',
  11550. fn: function (){
  11551. var self=this;
  11552. return $core.withContext(function($ctx1) {
  11553. return $recv(self._isEmpty())._not();
  11554. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  11555. },
  11556. args: [],
  11557. source: "notEmpty\x0a\x09^ self isEmpty not",
  11558. referencedClasses: [],
  11559. messageSends: ["not", "isEmpty"]
  11560. }),
  11561. $globals.Collection);
  11562. $core.addMethod(
  11563. $core.method({
  11564. selector: "occurrencesOf:",
  11565. protocol: 'accessing',
  11566. fn: function (anObject){
  11567. var self=this;
  11568. var tally;
  11569. return $core.withContext(function($ctx1) {
  11570. var $1;
  11571. tally=(0);
  11572. self._do_((function(each){
  11573. return $core.withContext(function($ctx2) {
  11574. $1=$recv(anObject).__eq(each);
  11575. if($core.assert($1)){
  11576. tally=$recv(tally).__plus((1));
  11577. return tally;
  11578. };
  11579. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11580. }));
  11581. return tally;
  11582. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  11583. },
  11584. args: ["anObject"],
  11585. 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",
  11586. referencedClasses: [],
  11587. messageSends: ["do:", "ifTrue:", "=", "+"]
  11588. }),
  11589. $globals.Collection);
  11590. $core.addMethod(
  11591. $core.method({
  11592. selector: "putOn:",
  11593. protocol: 'streaming',
  11594. fn: function (aStream){
  11595. var self=this;
  11596. return $core.withContext(function($ctx1) {
  11597. self._do_((function(each){
  11598. return $core.withContext(function($ctx2) {
  11599. return $recv(each)._putOn_(aStream);
  11600. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11601. }));
  11602. return self;
  11603. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  11604. },
  11605. args: ["aStream"],
  11606. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  11607. referencedClasses: [],
  11608. messageSends: ["do:", "putOn:"]
  11609. }),
  11610. $globals.Collection);
  11611. $core.addMethod(
  11612. $core.method({
  11613. selector: "reject:",
  11614. protocol: 'enumerating',
  11615. fn: function (aBlock){
  11616. var self=this;
  11617. return $core.withContext(function($ctx1) {
  11618. return self._select_((function(each){
  11619. return $core.withContext(function($ctx2) {
  11620. return $recv($recv(aBlock)._value_(each)).__eq(false);
  11621. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11622. }));
  11623. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  11624. },
  11625. args: ["aBlock"],
  11626. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  11627. referencedClasses: [],
  11628. messageSends: ["select:", "=", "value:"]
  11629. }),
  11630. $globals.Collection);
  11631. $core.addMethod(
  11632. $core.method({
  11633. selector: "remove:",
  11634. protocol: 'adding/removing',
  11635. fn: function (anObject){
  11636. var self=this;
  11637. return $core.withContext(function($ctx1) {
  11638. return self._remove_ifAbsent_(anObject,(function(){
  11639. return $core.withContext(function($ctx2) {
  11640. return self._errorNotFound();
  11641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11642. }));
  11643. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  11644. },
  11645. args: ["anObject"],
  11646. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  11647. referencedClasses: [],
  11648. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  11649. }),
  11650. $globals.Collection);
  11651. $core.addMethod(
  11652. $core.method({
  11653. selector: "remove:ifAbsent:",
  11654. protocol: 'adding/removing',
  11655. fn: function (anObject,aBlock){
  11656. var self=this;
  11657. return $core.withContext(function($ctx1) {
  11658. self._subclassResponsibility();
  11659. return self;
  11660. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  11661. },
  11662. args: ["anObject", "aBlock"],
  11663. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  11664. referencedClasses: [],
  11665. messageSends: ["subclassResponsibility"]
  11666. }),
  11667. $globals.Collection);
  11668. $core.addMethod(
  11669. $core.method({
  11670. selector: "removeAll",
  11671. protocol: 'adding/removing',
  11672. fn: function (){
  11673. var self=this;
  11674. return $core.withContext(function($ctx1) {
  11675. self._subclassResponsibility();
  11676. return self;
  11677. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  11678. },
  11679. args: [],
  11680. source: "removeAll\x0a\x09self subclassResponsibility",
  11681. referencedClasses: [],
  11682. messageSends: ["subclassResponsibility"]
  11683. }),
  11684. $globals.Collection);
  11685. $core.addMethod(
  11686. $core.method({
  11687. selector: "select:",
  11688. protocol: 'enumerating',
  11689. fn: function (aBlock){
  11690. var self=this;
  11691. var stream;
  11692. return $core.withContext(function($ctx1) {
  11693. var $1;
  11694. stream=$recv($recv(self._class())._new())._writeStream();
  11695. self._do_((function(each){
  11696. return $core.withContext(function($ctx2) {
  11697. $1=$recv(aBlock)._value_(each);
  11698. if($core.assert($1)){
  11699. return $recv(stream)._nextPut_(each);
  11700. };
  11701. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11702. }));
  11703. return $recv(stream)._contents();
  11704. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  11705. },
  11706. args: ["aBlock"],
  11707. 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",
  11708. referencedClasses: [],
  11709. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11710. }),
  11711. $globals.Collection);
  11712. $core.addMethod(
  11713. $core.method({
  11714. selector: "select:thenCollect:",
  11715. protocol: 'enumerating',
  11716. fn: function (selectBlock,collectBlock){
  11717. var self=this;
  11718. var stream;
  11719. return $core.withContext(function($ctx1) {
  11720. var $1;
  11721. stream=$recv($recv(self._class())._new())._writeStream();
  11722. self._do_((function(each){
  11723. return $core.withContext(function($ctx2) {
  11724. $1=$recv(selectBlock)._value_(each);
  11725. $ctx2.sendIdx["value:"]=1;
  11726. if($core.assert($1)){
  11727. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  11728. };
  11729. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11730. }));
  11731. return $recv(stream)._contents();
  11732. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  11733. },
  11734. args: ["selectBlock", "collectBlock"],
  11735. 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",
  11736. referencedClasses: [],
  11737. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  11738. }),
  11739. $globals.Collection);
  11740. $core.addMethod(
  11741. $core.method({
  11742. selector: "shallowCopy",
  11743. protocol: 'copying',
  11744. fn: function (){
  11745. var self=this;
  11746. return $core.withContext(function($ctx1) {
  11747. return self._collect_((function(each){
  11748. return each;
  11749. }));
  11750. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  11751. },
  11752. args: [],
  11753. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  11754. referencedClasses: [],
  11755. messageSends: ["collect:"]
  11756. }),
  11757. $globals.Collection);
  11758. $core.addMethod(
  11759. $core.method({
  11760. selector: "size",
  11761. protocol: 'accessing',
  11762. fn: function (){
  11763. var self=this;
  11764. return $core.withContext(function($ctx1) {
  11765. self._subclassResponsibility();
  11766. return self;
  11767. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  11768. },
  11769. args: [],
  11770. source: "size\x0a\x09self subclassResponsibility",
  11771. referencedClasses: [],
  11772. messageSends: ["subclassResponsibility"]
  11773. }),
  11774. $globals.Collection);
  11775. $core.addMethod(
  11776. $core.method({
  11777. selector: "classTag",
  11778. protocol: 'accessing',
  11779. fn: function (){
  11780. var self=this;
  11781. return "collection";
  11782. },
  11783. args: [],
  11784. 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'",
  11785. referencedClasses: [],
  11786. messageSends: []
  11787. }),
  11788. $globals.Collection.klass);
  11789. $core.addMethod(
  11790. $core.method({
  11791. selector: "new:",
  11792. protocol: 'instance creation',
  11793. fn: function (anInteger){
  11794. var self=this;
  11795. return $core.withContext(function($ctx1) {
  11796. return self._new();
  11797. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  11798. },
  11799. args: ["anInteger"],
  11800. source: "new: anInteger\x0a\x09^ self new",
  11801. referencedClasses: [],
  11802. messageSends: ["new"]
  11803. }),
  11804. $globals.Collection.klass);
  11805. $core.addMethod(
  11806. $core.method({
  11807. selector: "with:",
  11808. protocol: 'instance creation',
  11809. fn: function (anObject){
  11810. var self=this;
  11811. return $core.withContext(function($ctx1) {
  11812. var $1;
  11813. $1=self._new();
  11814. $recv($1)._add_(anObject);
  11815. return $recv($1)._yourself();
  11816. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  11817. },
  11818. args: ["anObject"],
  11819. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  11820. referencedClasses: [],
  11821. messageSends: ["add:", "new", "yourself"]
  11822. }),
  11823. $globals.Collection.klass);
  11824. $core.addMethod(
  11825. $core.method({
  11826. selector: "with:with:",
  11827. protocol: 'instance creation',
  11828. fn: function (anObject,anotherObject){
  11829. var self=this;
  11830. return $core.withContext(function($ctx1) {
  11831. var $1;
  11832. $1=self._new();
  11833. $recv($1)._add_(anObject);
  11834. $ctx1.sendIdx["add:"]=1;
  11835. $recv($1)._add_(anotherObject);
  11836. return $recv($1)._yourself();
  11837. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  11838. },
  11839. args: ["anObject", "anotherObject"],
  11840. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  11841. referencedClasses: [],
  11842. messageSends: ["add:", "new", "yourself"]
  11843. }),
  11844. $globals.Collection.klass);
  11845. $core.addMethod(
  11846. $core.method({
  11847. selector: "with:with:with:",
  11848. protocol: 'instance creation',
  11849. fn: function (firstObject,secondObject,thirdObject){
  11850. var self=this;
  11851. return $core.withContext(function($ctx1) {
  11852. var $1;
  11853. $1=self._new();
  11854. $recv($1)._add_(firstObject);
  11855. $ctx1.sendIdx["add:"]=1;
  11856. $recv($1)._add_(secondObject);
  11857. $ctx1.sendIdx["add:"]=2;
  11858. $recv($1)._add_(thirdObject);
  11859. return $recv($1)._yourself();
  11860. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  11861. },
  11862. args: ["firstObject", "secondObject", "thirdObject"],
  11863. 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",
  11864. referencedClasses: [],
  11865. messageSends: ["add:", "new", "yourself"]
  11866. }),
  11867. $globals.Collection.klass);
  11868. $core.addMethod(
  11869. $core.method({
  11870. selector: "withAll:",
  11871. protocol: 'instance creation',
  11872. fn: function (aCollection){
  11873. var self=this;
  11874. return $core.withContext(function($ctx1) {
  11875. var $1;
  11876. $1=self._new();
  11877. $recv($1)._addAll_(aCollection);
  11878. return $recv($1)._yourself();
  11879. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  11880. },
  11881. args: ["aCollection"],
  11882. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  11883. referencedClasses: [],
  11884. messageSends: ["addAll:", "new", "yourself"]
  11885. }),
  11886. $globals.Collection.klass);
  11887. $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections');
  11888. $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.";
  11889. $core.addMethod(
  11890. $core.method({
  11891. selector: "at:",
  11892. protocol: 'accessing',
  11893. fn: function (anIndex){
  11894. var self=this;
  11895. return $core.withContext(function($ctx1) {
  11896. return self._at_ifAbsent_(anIndex,(function(){
  11897. return $core.withContext(function($ctx2) {
  11898. return self._errorNotFound();
  11899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11900. }));
  11901. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  11902. },
  11903. args: ["anIndex"],
  11904. 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 ]",
  11905. referencedClasses: [],
  11906. messageSends: ["at:ifAbsent:", "errorNotFound"]
  11907. }),
  11908. $globals.IndexableCollection);
  11909. $core.addMethod(
  11910. $core.method({
  11911. selector: "at:ifAbsent:",
  11912. protocol: 'accessing',
  11913. fn: function (anIndex,aBlock){
  11914. var self=this;
  11915. return $core.withContext(function($ctx1) {
  11916. self._subclassResponsibility();
  11917. return self;
  11918. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11919. },
  11920. args: ["anIndex", "aBlock"],
  11921. 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",
  11922. referencedClasses: [],
  11923. messageSends: ["subclassResponsibility"]
  11924. }),
  11925. $globals.IndexableCollection);
  11926. $core.addMethod(
  11927. $core.method({
  11928. selector: "at:ifAbsentPut:",
  11929. protocol: 'accessing',
  11930. fn: function (aKey,aBlock){
  11931. var self=this;
  11932. return $core.withContext(function($ctx1) {
  11933. return self._at_ifAbsent_(aKey,(function(){
  11934. return $core.withContext(function($ctx2) {
  11935. return self._at_put_(aKey,$recv(aBlock)._value());
  11936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11937. }));
  11938. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  11939. },
  11940. args: ["aKey", "aBlock"],
  11941. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  11942. referencedClasses: [],
  11943. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  11944. }),
  11945. $globals.IndexableCollection);
  11946. $core.addMethod(
  11947. $core.method({
  11948. selector: "at:ifPresent:",
  11949. protocol: 'accessing',
  11950. fn: function (anIndex,aBlock){
  11951. var self=this;
  11952. return $core.withContext(function($ctx1) {
  11953. return self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  11954. return nil;
  11955. }));
  11956. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  11957. },
  11958. args: ["anIndex", "aBlock"],
  11959. 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 ]",
  11960. referencedClasses: [],
  11961. messageSends: ["at:ifPresent:ifAbsent:"]
  11962. }),
  11963. $globals.IndexableCollection);
  11964. $core.addMethod(
  11965. $core.method({
  11966. selector: "at:ifPresent:ifAbsent:",
  11967. protocol: 'accessing',
  11968. fn: function (anIndex,aBlock,anotherBlock){
  11969. var self=this;
  11970. return $core.withContext(function($ctx1) {
  11971. self._subclassResponsibility();
  11972. return self;
  11973. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  11974. },
  11975. args: ["anIndex", "aBlock", "anotherBlock"],
  11976. 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",
  11977. referencedClasses: [],
  11978. messageSends: ["subclassResponsibility"]
  11979. }),
  11980. $globals.IndexableCollection);
  11981. $core.addMethod(
  11982. $core.method({
  11983. selector: "at:put:",
  11984. protocol: 'accessing',
  11985. fn: function (anIndex,anObject){
  11986. var self=this;
  11987. return $core.withContext(function($ctx1) {
  11988. self._subclassResponsibility();
  11989. return self;
  11990. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  11991. },
  11992. args: ["anIndex", "anObject"],
  11993. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  11994. referencedClasses: [],
  11995. messageSends: ["subclassResponsibility"]
  11996. }),
  11997. $globals.IndexableCollection);
  11998. $core.addMethod(
  11999. $core.method({
  12000. selector: "indexOf:",
  12001. protocol: 'accessing',
  12002. fn: function (anObject){
  12003. var self=this;
  12004. return $core.withContext(function($ctx1) {
  12005. return self._indexOf_ifAbsent_(anObject,(function(){
  12006. return $core.withContext(function($ctx2) {
  12007. return self._errorNotFound();
  12008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12009. }));
  12010. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  12011. },
  12012. args: ["anObject"],
  12013. 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 ]",
  12014. referencedClasses: [],
  12015. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  12016. }),
  12017. $globals.IndexableCollection);
  12018. $core.addMethod(
  12019. $core.method({
  12020. selector: "indexOf:ifAbsent:",
  12021. protocol: 'accessing',
  12022. fn: function (anObject,aBlock){
  12023. var self=this;
  12024. return $core.withContext(function($ctx1) {
  12025. self._subclassResponsibility();
  12026. return self;
  12027. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  12028. },
  12029. args: ["anObject", "aBlock"],
  12030. 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",
  12031. referencedClasses: [],
  12032. messageSends: ["subclassResponsibility"]
  12033. }),
  12034. $globals.IndexableCollection);
  12035. $core.addMethod(
  12036. $core.method({
  12037. selector: "with:do:",
  12038. protocol: 'enumerating',
  12039. fn: function (anotherCollection,aBlock){
  12040. var self=this;
  12041. return $core.withContext(function($ctx1) {
  12042. self._withIndexDo_((function(each,index){
  12043. return $core.withContext(function($ctx2) {
  12044. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  12045. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  12046. }));
  12047. return self;
  12048. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  12049. },
  12050. args: ["anotherCollection", "aBlock"],
  12051. 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) ]",
  12052. referencedClasses: [],
  12053. messageSends: ["withIndexDo:", "value:value:", "at:"]
  12054. }),
  12055. $globals.IndexableCollection);
  12056. $core.addMethod(
  12057. $core.method({
  12058. selector: "withIndexDo:",
  12059. protocol: 'enumerating',
  12060. fn: function (aBlock){
  12061. var self=this;
  12062. return $core.withContext(function($ctx1) {
  12063. self._subclassResponsibility();
  12064. return self;
  12065. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  12066. },
  12067. args: ["aBlock"],
  12068. 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",
  12069. referencedClasses: [],
  12070. messageSends: ["subclassResponsibility"]
  12071. }),
  12072. $globals.IndexableCollection);
  12073. $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  12074. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  12075. $core.addMethod(
  12076. $core.method({
  12077. selector: "=",
  12078. protocol: 'comparing',
  12079. fn: function (anAssocitativeCollection){
  12080. var self=this;
  12081. return $core.withContext(function($ctx1) {
  12082. var $2,$1,$4,$3,$5;
  12083. $2=self._class();
  12084. $ctx1.sendIdx["class"]=1;
  12085. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  12086. $ctx1.sendIdx["="]=1;
  12087. if(!$core.assert($1)){
  12088. return false;
  12089. };
  12090. $4=self._size();
  12091. $ctx1.sendIdx["size"]=1;
  12092. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  12093. $ctx1.sendIdx["="]=2;
  12094. if(!$core.assert($3)){
  12095. return false;
  12096. };
  12097. $5=self._associations();
  12098. $ctx1.sendIdx["associations"]=1;
  12099. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  12100. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  12101. },
  12102. args: ["anAssocitativeCollection"],
  12103. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  12104. referencedClasses: [],
  12105. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  12106. }),
  12107. $globals.AssociativeCollection);
  12108. $core.addMethod(
  12109. $core.method({
  12110. selector: "add:",
  12111. protocol: 'adding/removing',
  12112. fn: function (anAssociation){
  12113. var self=this;
  12114. return $core.withContext(function($ctx1) {
  12115. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  12116. return self;
  12117. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  12118. },
  12119. args: ["anAssociation"],
  12120. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  12121. referencedClasses: [],
  12122. messageSends: ["at:put:", "key", "value"]
  12123. }),
  12124. $globals.AssociativeCollection);
  12125. $core.addMethod(
  12126. $core.method({
  12127. selector: "addAll:",
  12128. protocol: 'adding/removing',
  12129. fn: function (anAssociativeCollection){
  12130. var self=this;
  12131. return $core.withContext(function($ctx1) {
  12132. (
  12133. $ctx1.supercall = true,
  12134. ($globals.AssociativeCollection.superclass||$boot.dnu).fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  12135. $ctx1.supercall = false;
  12136. return anAssociativeCollection;
  12137. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  12138. },
  12139. args: ["anAssociativeCollection"],
  12140. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  12141. referencedClasses: [],
  12142. messageSends: ["addAll:", "associations"]
  12143. }),
  12144. $globals.AssociativeCollection);
  12145. $core.addMethod(
  12146. $core.method({
  12147. selector: "asDictionary",
  12148. protocol: 'converting',
  12149. fn: function (){
  12150. var self=this;
  12151. return $core.withContext(function($ctx1) {
  12152. return $recv($globals.Dictionary)._from_(self._associations());
  12153. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  12154. },
  12155. args: [],
  12156. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  12157. referencedClasses: ["Dictionary"],
  12158. messageSends: ["from:", "associations"]
  12159. }),
  12160. $globals.AssociativeCollection);
  12161. $core.addMethod(
  12162. $core.method({
  12163. selector: "asHashedCollection",
  12164. protocol: 'converting',
  12165. fn: function (){
  12166. var self=this;
  12167. return $core.withContext(function($ctx1) {
  12168. return $recv($globals.HashedCollection)._from_(self._associations());
  12169. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  12170. },
  12171. args: [],
  12172. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  12173. referencedClasses: ["HashedCollection"],
  12174. messageSends: ["from:", "associations"]
  12175. }),
  12176. $globals.AssociativeCollection);
  12177. $core.addMethod(
  12178. $core.method({
  12179. selector: "asJSON",
  12180. protocol: 'converting',
  12181. fn: function (){
  12182. var self=this;
  12183. var hash;
  12184. return $core.withContext(function($ctx1) {
  12185. hash=$recv($globals.HashedCollection)._new();
  12186. self._keysAndValuesDo_((function(key,value){
  12187. return $core.withContext(function($ctx2) {
  12188. return $recv(hash)._at_put_(key,$recv(value)._asJSON());
  12189. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12190. }));
  12191. return hash;
  12192. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
  12193. },
  12194. args: [],
  12195. 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",
  12196. referencedClasses: ["HashedCollection"],
  12197. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  12198. }),
  12199. $globals.AssociativeCollection);
  12200. $core.addMethod(
  12201. $core.method({
  12202. selector: "associations",
  12203. protocol: 'accessing',
  12204. fn: function (){
  12205. var self=this;
  12206. var associations;
  12207. return $core.withContext(function($ctx1) {
  12208. associations=[];
  12209. self._associationsDo_((function(each){
  12210. return $core.withContext(function($ctx2) {
  12211. return $recv(associations)._add_(each);
  12212. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12213. }));
  12214. return associations;
  12215. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  12216. },
  12217. args: [],
  12218. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  12219. referencedClasses: [],
  12220. messageSends: ["associationsDo:", "add:"]
  12221. }),
  12222. $globals.AssociativeCollection);
  12223. $core.addMethod(
  12224. $core.method({
  12225. selector: "associationsDo:",
  12226. protocol: 'enumerating',
  12227. fn: function (aBlock){
  12228. var self=this;
  12229. return $core.withContext(function($ctx1) {
  12230. self._keysAndValuesDo_((function(key,value){
  12231. return $core.withContext(function($ctx2) {
  12232. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  12233. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12234. }));
  12235. return self;
  12236. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12237. },
  12238. args: ["aBlock"],
  12239. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  12240. referencedClasses: ["Association"],
  12241. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  12242. }),
  12243. $globals.AssociativeCollection);
  12244. $core.addMethod(
  12245. $core.method({
  12246. selector: "at:ifPresent:ifAbsent:",
  12247. protocol: 'accessing',
  12248. fn: function (aKey,aBlock,anotherBlock){
  12249. var self=this;
  12250. return $core.withContext(function($ctx1) {
  12251. var $1;
  12252. $1=self._includesKey_(aKey);
  12253. if($core.assert($1)){
  12254. return $recv(aBlock)._value_(self._at_(aKey));
  12255. } else {
  12256. return $recv(anotherBlock)._value();
  12257. };
  12258. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  12259. },
  12260. args: ["aKey", "aBlock", "anotherBlock"],
  12261. 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 ]",
  12262. referencedClasses: [],
  12263. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  12264. }),
  12265. $globals.AssociativeCollection);
  12266. $core.addMethod(
  12267. $core.method({
  12268. selector: "collect:",
  12269. protocol: 'enumerating',
  12270. fn: function (aBlock){
  12271. var self=this;
  12272. var newDict;
  12273. return $core.withContext(function($ctx1) {
  12274. newDict=$recv(self._class())._new();
  12275. self._keysAndValuesDo_((function(key,value){
  12276. return $core.withContext(function($ctx2) {
  12277. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  12278. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12279. }));
  12280. return newDict;
  12281. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12282. },
  12283. args: ["aBlock"],
  12284. 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",
  12285. referencedClasses: [],
  12286. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  12287. }),
  12288. $globals.AssociativeCollection);
  12289. $core.addMethod(
  12290. $core.method({
  12291. selector: "deepCopy",
  12292. protocol: 'copying',
  12293. fn: function (){
  12294. var self=this;
  12295. var copy;
  12296. return $core.withContext(function($ctx1) {
  12297. copy=$recv(self._class())._new();
  12298. self._keysAndValuesDo_((function(key,value){
  12299. return $core.withContext(function($ctx2) {
  12300. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  12301. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12302. }));
  12303. return copy;
  12304. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  12305. },
  12306. args: [],
  12307. 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",
  12308. referencedClasses: [],
  12309. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  12310. }),
  12311. $globals.AssociativeCollection);
  12312. $core.addMethod(
  12313. $core.method({
  12314. selector: "detect:ifNone:",
  12315. protocol: 'enumerating',
  12316. fn: function (aBlock,anotherBlock){
  12317. var self=this;
  12318. return $core.withContext(function($ctx1) {
  12319. return $recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  12320. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  12321. },
  12322. args: ["aBlock", "anotherBlock"],
  12323. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  12324. referencedClasses: [],
  12325. messageSends: ["detect:ifNone:", "values"]
  12326. }),
  12327. $globals.AssociativeCollection);
  12328. $core.addMethod(
  12329. $core.method({
  12330. selector: "do:",
  12331. protocol: 'enumerating',
  12332. fn: function (aBlock){
  12333. var self=this;
  12334. return $core.withContext(function($ctx1) {
  12335. self._valuesDo_(aBlock);
  12336. return self;
  12337. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12338. },
  12339. args: ["aBlock"],
  12340. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  12341. referencedClasses: [],
  12342. messageSends: ["valuesDo:"]
  12343. }),
  12344. $globals.AssociativeCollection);
  12345. $core.addMethod(
  12346. $core.method({
  12347. selector: "includes:",
  12348. protocol: 'enumerating',
  12349. fn: function (anObject){
  12350. var self=this;
  12351. return $core.withContext(function($ctx1) {
  12352. return $recv(self._values())._includes_(anObject);
  12353. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  12354. },
  12355. args: ["anObject"],
  12356. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  12357. referencedClasses: [],
  12358. messageSends: ["includes:", "values"]
  12359. }),
  12360. $globals.AssociativeCollection);
  12361. $core.addMethod(
  12362. $core.method({
  12363. selector: "includesKey:",
  12364. protocol: 'testing',
  12365. fn: function (aKey){
  12366. var self=this;
  12367. return $core.withContext(function($ctx1) {
  12368. self._subclassResponsibility();
  12369. return self;
  12370. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12371. },
  12372. args: ["aKey"],
  12373. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  12374. referencedClasses: [],
  12375. messageSends: ["subclassResponsibility"]
  12376. }),
  12377. $globals.AssociativeCollection);
  12378. $core.addMethod(
  12379. $core.method({
  12380. selector: "indexOf:ifAbsent:",
  12381. protocol: 'accessing',
  12382. fn: function (anObject,aBlock){
  12383. var self=this;
  12384. return $core.withContext(function($ctx1) {
  12385. return $recv(self._keys())._detect_ifNone_((function(each){
  12386. return $core.withContext(function($ctx2) {
  12387. return $recv(self._at_(each)).__eq(anObject);
  12388. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12389. }),aBlock);
  12390. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12391. },
  12392. args: ["anObject", "aBlock"],
  12393. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  12394. referencedClasses: [],
  12395. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  12396. }),
  12397. $globals.AssociativeCollection);
  12398. $core.addMethod(
  12399. $core.method({
  12400. selector: "keyAtValue:",
  12401. protocol: 'accessing',
  12402. fn: function (anObject){
  12403. var self=this;
  12404. return $core.withContext(function($ctx1) {
  12405. return self._keyAtValue_ifAbsent_(anObject,(function(){
  12406. return $core.withContext(function($ctx2) {
  12407. return self._errorNotFound();
  12408. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12409. }));
  12410. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  12411. },
  12412. args: ["anObject"],
  12413. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  12414. referencedClasses: [],
  12415. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  12416. }),
  12417. $globals.AssociativeCollection);
  12418. $core.addMethod(
  12419. $core.method({
  12420. selector: "keyAtValue:ifAbsent:",
  12421. protocol: 'accessing',
  12422. fn: function (anObject,aBlock){
  12423. var self=this;
  12424. return $core.withContext(function($ctx1) {
  12425. return self._indexOf_ifAbsent_(anObject,aBlock);
  12426. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  12427. },
  12428. args: ["anObject", "aBlock"],
  12429. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  12430. referencedClasses: [],
  12431. messageSends: ["indexOf:ifAbsent:"]
  12432. }),
  12433. $globals.AssociativeCollection);
  12434. $core.addMethod(
  12435. $core.method({
  12436. selector: "keys",
  12437. protocol: 'accessing',
  12438. fn: function (){
  12439. var self=this;
  12440. return $core.withContext(function($ctx1) {
  12441. self._subclassResponsibility();
  12442. return self;
  12443. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  12444. },
  12445. args: [],
  12446. source: "keys\x0a\x09self subclassResponsibility",
  12447. referencedClasses: [],
  12448. messageSends: ["subclassResponsibility"]
  12449. }),
  12450. $globals.AssociativeCollection);
  12451. $core.addMethod(
  12452. $core.method({
  12453. selector: "keysAndValuesDo:",
  12454. protocol: 'enumerating',
  12455. fn: function (aBlock){
  12456. var self=this;
  12457. return $core.withContext(function($ctx1) {
  12458. self._keysDo_((function(each){
  12459. return $core.withContext(function($ctx2) {
  12460. return $recv(aBlock)._value_value_(each,self._at_(each));
  12461. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12462. }));
  12463. return self;
  12464. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12465. },
  12466. args: ["aBlock"],
  12467. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  12468. referencedClasses: [],
  12469. messageSends: ["keysDo:", "value:value:", "at:"]
  12470. }),
  12471. $globals.AssociativeCollection);
  12472. $core.addMethod(
  12473. $core.method({
  12474. selector: "keysDo:",
  12475. protocol: 'enumerating',
  12476. fn: function (aBlock){
  12477. var self=this;
  12478. return $core.withContext(function($ctx1) {
  12479. self._subclassResponsibility();
  12480. return self;
  12481. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12482. },
  12483. args: ["aBlock"],
  12484. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  12485. referencedClasses: [],
  12486. messageSends: ["subclassResponsibility"]
  12487. }),
  12488. $globals.AssociativeCollection);
  12489. $core.addMethod(
  12490. $core.method({
  12491. selector: "printOn:",
  12492. protocol: 'printing',
  12493. fn: function (aStream){
  12494. var self=this;
  12495. return $core.withContext(function($ctx1) {
  12496. (
  12497. $ctx1.supercall = true,
  12498. ($globals.AssociativeCollection.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  12499. $ctx1.supercall = false;
  12500. $ctx1.sendIdx["printOn:"]=1;
  12501. $recv(aStream)._nextPutAll_(" (");
  12502. $ctx1.sendIdx["nextPutAll:"]=1;
  12503. $recv(self._associations())._do_separatedBy_((function(each){
  12504. return $core.withContext(function($ctx2) {
  12505. return $recv(each)._printOn_(aStream);
  12506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12507. }),(function(){
  12508. return $core.withContext(function($ctx2) {
  12509. return $recv(aStream)._nextPutAll_(" , ");
  12510. $ctx2.sendIdx["nextPutAll:"]=2;
  12511. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12512. }));
  12513. $recv(aStream)._nextPutAll_(")");
  12514. return self;
  12515. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  12516. },
  12517. args: ["aStream"],
  12518. 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: ')'",
  12519. referencedClasses: [],
  12520. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  12521. }),
  12522. $globals.AssociativeCollection);
  12523. $core.addMethod(
  12524. $core.method({
  12525. selector: "remove:ifAbsent:",
  12526. protocol: 'adding/removing',
  12527. fn: function (aKey,aBlock){
  12528. var self=this;
  12529. return $core.withContext(function($ctx1) {
  12530. return self._removeKey_ifAbsent_(aKey,aBlock);
  12531. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12532. },
  12533. args: ["aKey", "aBlock"],
  12534. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  12535. referencedClasses: [],
  12536. messageSends: ["removeKey:ifAbsent:"]
  12537. }),
  12538. $globals.AssociativeCollection);
  12539. $core.addMethod(
  12540. $core.method({
  12541. selector: "removeAll",
  12542. protocol: 'adding/removing',
  12543. fn: function (){
  12544. var self=this;
  12545. return $core.withContext(function($ctx1) {
  12546. return $recv(self._keys())._do_((function(each){
  12547. return $core.withContext(function($ctx2) {
  12548. return self._removeKey_(each);
  12549. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12550. }));
  12551. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  12552. },
  12553. args: [],
  12554. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  12555. referencedClasses: [],
  12556. messageSends: ["do:", "keys", "removeKey:"]
  12557. }),
  12558. $globals.AssociativeCollection);
  12559. $core.addMethod(
  12560. $core.method({
  12561. selector: "removeKey:",
  12562. protocol: 'adding/removing',
  12563. fn: function (aKey){
  12564. var self=this;
  12565. return $core.withContext(function($ctx1) {
  12566. return self._remove_(aKey);
  12567. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  12568. },
  12569. args: ["aKey"],
  12570. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  12571. referencedClasses: [],
  12572. messageSends: ["remove:"]
  12573. }),
  12574. $globals.AssociativeCollection);
  12575. $core.addMethod(
  12576. $core.method({
  12577. selector: "removeKey:ifAbsent:",
  12578. protocol: 'adding/removing',
  12579. fn: function (aKey,aBlock){
  12580. var self=this;
  12581. return $core.withContext(function($ctx1) {
  12582. self._subclassResponsibility();
  12583. return self;
  12584. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  12585. },
  12586. args: ["aKey", "aBlock"],
  12587. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  12588. referencedClasses: [],
  12589. messageSends: ["subclassResponsibility"]
  12590. }),
  12591. $globals.AssociativeCollection);
  12592. $core.addMethod(
  12593. $core.method({
  12594. selector: "select:",
  12595. protocol: 'enumerating',
  12596. fn: function (aBlock){
  12597. var self=this;
  12598. var newDict;
  12599. return $core.withContext(function($ctx1) {
  12600. var $1;
  12601. newDict=$recv(self._class())._new();
  12602. self._keysAndValuesDo_((function(key,value){
  12603. return $core.withContext(function($ctx2) {
  12604. $1=$recv(aBlock)._value_(value);
  12605. if($core.assert($1)){
  12606. return $recv(newDict)._at_put_(key,value);
  12607. };
  12608. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12609. }));
  12610. return newDict;
  12611. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  12612. },
  12613. args: ["aBlock"],
  12614. 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",
  12615. referencedClasses: [],
  12616. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  12617. }),
  12618. $globals.AssociativeCollection);
  12619. $core.addMethod(
  12620. $core.method({
  12621. selector: "shallowCopy",
  12622. protocol: 'copying',
  12623. fn: function (){
  12624. var self=this;
  12625. var copy;
  12626. return $core.withContext(function($ctx1) {
  12627. copy=$recv(self._class())._new();
  12628. self._keysAndValuesDo_((function(key,value){
  12629. return $core.withContext(function($ctx2) {
  12630. return $recv(copy)._at_put_(key,value);
  12631. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12632. }));
  12633. return copy;
  12634. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  12635. },
  12636. args: [],
  12637. 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",
  12638. referencedClasses: [],
  12639. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  12640. }),
  12641. $globals.AssociativeCollection);
  12642. $core.addMethod(
  12643. $core.method({
  12644. selector: "size",
  12645. protocol: 'accessing',
  12646. fn: function (){
  12647. var self=this;
  12648. return $core.withContext(function($ctx1) {
  12649. return $recv(self._keys())._size();
  12650. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  12651. },
  12652. args: [],
  12653. source: "size\x0a\x09^ self keys size",
  12654. referencedClasses: [],
  12655. messageSends: ["size", "keys"]
  12656. }),
  12657. $globals.AssociativeCollection);
  12658. $core.addMethod(
  12659. $core.method({
  12660. selector: "values",
  12661. protocol: 'accessing',
  12662. fn: function (){
  12663. var self=this;
  12664. return $core.withContext(function($ctx1) {
  12665. self._subclassResponsibility();
  12666. return self;
  12667. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  12668. },
  12669. args: [],
  12670. source: "values\x0a\x09self subclassResponsibility",
  12671. referencedClasses: [],
  12672. messageSends: ["subclassResponsibility"]
  12673. }),
  12674. $globals.AssociativeCollection);
  12675. $core.addMethod(
  12676. $core.method({
  12677. selector: "valuesDo:",
  12678. protocol: 'enumerating',
  12679. fn: function (aBlock){
  12680. var self=this;
  12681. return $core.withContext(function($ctx1) {
  12682. self._subclassResponsibility();
  12683. return self;
  12684. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12685. },
  12686. args: ["aBlock"],
  12687. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  12688. referencedClasses: [],
  12689. messageSends: ["subclassResponsibility"]
  12690. }),
  12691. $globals.AssociativeCollection);
  12692. $core.addMethod(
  12693. $core.method({
  12694. selector: "withIndexDo:",
  12695. protocol: 'enumerating',
  12696. fn: function (aBlock){
  12697. var self=this;
  12698. return $core.withContext(function($ctx1) {
  12699. self._keysAndValuesDo_((function(key,value){
  12700. return $core.withContext(function($ctx2) {
  12701. return $recv(aBlock)._value_value_(value,key);
  12702. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  12703. }));
  12704. return self;
  12705. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  12706. },
  12707. args: ["aBlock"],
  12708. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  12709. referencedClasses: [],
  12710. messageSends: ["keysAndValuesDo:", "value:value:"]
  12711. }),
  12712. $globals.AssociativeCollection);
  12713. $core.addMethod(
  12714. $core.method({
  12715. selector: "from:",
  12716. protocol: 'instance creation',
  12717. fn: function (aCollection){
  12718. var self=this;
  12719. var newCollection;
  12720. return $core.withContext(function($ctx1) {
  12721. newCollection=self._new();
  12722. $recv(aCollection)._do_((function(each){
  12723. return $core.withContext(function($ctx2) {
  12724. return $recv(newCollection)._add_(each);
  12725. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12726. }));
  12727. return newCollection;
  12728. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12729. },
  12730. args: ["aCollection"],
  12731. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  12732. referencedClasses: [],
  12733. messageSends: ["new", "do:", "add:"]
  12734. }),
  12735. $globals.AssociativeCollection.klass);
  12736. $core.addMethod(
  12737. $core.method({
  12738. selector: "fromPairs:",
  12739. protocol: 'instance creation',
  12740. fn: function (aCollection){
  12741. var self=this;
  12742. return $core.withContext(function($ctx1) {
  12743. return self._from_(aCollection);
  12744. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  12745. },
  12746. args: ["aCollection"],
  12747. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  12748. referencedClasses: [],
  12749. messageSends: ["from:"]
  12750. }),
  12751. $globals.AssociativeCollection.klass);
  12752. $core.addMethod(
  12753. $core.method({
  12754. selector: "newFromPairs:",
  12755. protocol: 'instance creation',
  12756. fn: function (aCollection){
  12757. var self=this;
  12758. var newCollection;
  12759. return $core.withContext(function($ctx1) {
  12760. var $2,$1,$3,$4;
  12761. $2=$recv(aCollection)._size();
  12762. $ctx1.sendIdx["size"]=1;
  12763. $1=$recv($2)._even();
  12764. if(!$core.assert($1)){
  12765. self._error_("#newFromPairs only accepts arrays of an even length");
  12766. };
  12767. newCollection=self._new();
  12768. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  12769. return $core.withContext(function($ctx2) {
  12770. $3=newCollection;
  12771. $4=$recv(aCollection)._at_(each);
  12772. $ctx2.sendIdx["at:"]=1;
  12773. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  12774. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  12775. }));
  12776. return newCollection;
  12777. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  12778. },
  12779. args: ["aCollection"],
  12780. 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",
  12781. referencedClasses: [],
  12782. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  12783. }),
  12784. $globals.AssociativeCollection.klass);
  12785. $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  12786. $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.";
  12787. $core.addMethod(
  12788. $core.method({
  12789. selector: "at:ifAbsent:",
  12790. protocol: 'accessing',
  12791. fn: function (aKey,aBlock){
  12792. var self=this;
  12793. return $core.withContext(function($ctx1) {
  12794. var index = self._positionOfKey_(aKey);
  12795. return index >=0 ? self['@values'][index] : aBlock._value();
  12796. ;
  12797. return self;
  12798. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  12799. },
  12800. args: ["aKey", "aBlock"],
  12801. 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>",
  12802. referencedClasses: [],
  12803. messageSends: []
  12804. }),
  12805. $globals.Dictionary);
  12806. $core.addMethod(
  12807. $core.method({
  12808. selector: "at:put:",
  12809. protocol: 'accessing',
  12810. fn: function (aKey,aValue){
  12811. var self=this;
  12812. return $core.withContext(function($ctx1) {
  12813. var index = self._positionOfKey_(aKey);
  12814. if(index === -1) {
  12815. var keys = self['@keys'];
  12816. index = keys.length;
  12817. keys.push(aKey);
  12818. }
  12819. return self['@values'][index] = aValue;
  12820. ;
  12821. return self;
  12822. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  12823. },
  12824. args: ["aKey", "aValue"],
  12825. 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>",
  12826. referencedClasses: [],
  12827. messageSends: []
  12828. }),
  12829. $globals.Dictionary);
  12830. $core.addMethod(
  12831. $core.method({
  12832. selector: "includesKey:",
  12833. protocol: 'testing',
  12834. fn: function (aKey){
  12835. var self=this;
  12836. return $core.withContext(function($ctx1) {
  12837. return self._positionOfKey_(aKey) >= 0; ;
  12838. return self;
  12839. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  12840. },
  12841. args: ["aKey"],
  12842. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  12843. referencedClasses: [],
  12844. messageSends: []
  12845. }),
  12846. $globals.Dictionary);
  12847. $core.addMethod(
  12848. $core.method({
  12849. selector: "indexOf:ifAbsent:",
  12850. protocol: 'accessing',
  12851. fn: function (anObject,aBlock){
  12852. var self=this;
  12853. var index;
  12854. return $core.withContext(function($ctx1) {
  12855. var $1;
  12856. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  12857. return (0);
  12858. }));
  12859. $1=$recv(index).__eq((0));
  12860. if($core.assert($1)){
  12861. return $recv(aBlock)._value();
  12862. } else {
  12863. return $recv(self["@keys"])._at_(index);
  12864. };
  12865. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  12866. },
  12867. args: ["anObject", "aBlock"],
  12868. 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 ]",
  12869. referencedClasses: [],
  12870. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  12871. }),
  12872. $globals.Dictionary);
  12873. $core.addMethod(
  12874. $core.method({
  12875. selector: "initialize",
  12876. protocol: 'initialization',
  12877. fn: function (){
  12878. var self=this;
  12879. return $core.withContext(function($ctx1) {
  12880. (
  12881. $ctx1.supercall = true,
  12882. ($globals.Dictionary.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  12883. $ctx1.supercall = false;
  12884. self["@keys"]=[];
  12885. self["@values"]=[];
  12886. return self;
  12887. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  12888. },
  12889. args: [],
  12890. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  12891. referencedClasses: [],
  12892. messageSends: ["initialize"]
  12893. }),
  12894. $globals.Dictionary);
  12895. $core.addMethod(
  12896. $core.method({
  12897. selector: "keys",
  12898. protocol: 'accessing',
  12899. fn: function (){
  12900. var self=this;
  12901. return $core.withContext(function($ctx1) {
  12902. return $recv(self["@keys"])._copy();
  12903. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  12904. },
  12905. args: [],
  12906. source: "keys\x0a\x09^ keys copy",
  12907. referencedClasses: [],
  12908. messageSends: ["copy"]
  12909. }),
  12910. $globals.Dictionary);
  12911. $core.addMethod(
  12912. $core.method({
  12913. selector: "keysAndValuesDo:",
  12914. protocol: 'enumerating',
  12915. fn: function (aBlock){
  12916. var self=this;
  12917. return $core.withContext(function($ctx1) {
  12918. return $recv(self["@keys"])._with_do_(self["@values"],aBlock);
  12919. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  12920. },
  12921. args: ["aBlock"],
  12922. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  12923. referencedClasses: [],
  12924. messageSends: ["with:do:"]
  12925. }),
  12926. $globals.Dictionary);
  12927. $core.addMethod(
  12928. $core.method({
  12929. selector: "keysDo:",
  12930. protocol: 'enumerating',
  12931. fn: function (aBlock){
  12932. var self=this;
  12933. return $core.withContext(function($ctx1) {
  12934. return $recv(self["@keys"])._do_(aBlock);
  12935. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  12936. },
  12937. args: ["aBlock"],
  12938. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  12939. referencedClasses: [],
  12940. messageSends: ["do:"]
  12941. }),
  12942. $globals.Dictionary);
  12943. $core.addMethod(
  12944. $core.method({
  12945. selector: "positionOfKey:",
  12946. protocol: 'private',
  12947. fn: function (anObject){
  12948. var self=this;
  12949. return $core.withContext(function($ctx1) {
  12950. var keys = self['@keys'];
  12951. for(var i=0;i<keys.length;i++){
  12952. if(keys[i].__eq(anObject)) { return i;}
  12953. }
  12954. return -1;
  12955. ;
  12956. return self;
  12957. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  12958. },
  12959. args: ["anObject"],
  12960. 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>",
  12961. referencedClasses: [],
  12962. messageSends: []
  12963. }),
  12964. $globals.Dictionary);
  12965. $core.addMethod(
  12966. $core.method({
  12967. selector: "removeAll",
  12968. protocol: 'adding/removing',
  12969. fn: function (){
  12970. var self=this;
  12971. return $core.withContext(function($ctx1) {
  12972. $recv(self["@keys"])._removeAll();
  12973. $ctx1.sendIdx["removeAll"]=1;
  12974. $recv(self["@values"])._removeAll();
  12975. return self;
  12976. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  12977. },
  12978. args: [],
  12979. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  12980. referencedClasses: [],
  12981. messageSends: ["removeAll"]
  12982. }),
  12983. $globals.Dictionary);
  12984. $core.addMethod(
  12985. $core.method({
  12986. selector: "removeKey:ifAbsent:",
  12987. protocol: 'adding/removing',
  12988. fn: function (aKey,aBlock){
  12989. var self=this;
  12990. return $core.withContext(function($ctx1) {
  12991. var index = self._positionOfKey_(aKey);
  12992. if(index === -1) {
  12993. return aBlock._value()
  12994. } else {
  12995. var keys = self['@keys'], values = self['@values'];
  12996. var value = values[index], l = keys.length;
  12997. keys[index] = keys[l-1];
  12998. keys.pop();
  12999. values[index] = values[l-1];
  13000. values.pop();
  13001. return value;
  13002. }
  13003. ;
  13004. return self;
  13005. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  13006. },
  13007. args: ["aKey", "aBlock"],
  13008. 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>",
  13009. referencedClasses: [],
  13010. messageSends: []
  13011. }),
  13012. $globals.Dictionary);
  13013. $core.addMethod(
  13014. $core.method({
  13015. selector: "values",
  13016. protocol: 'accessing',
  13017. fn: function (){
  13018. var self=this;
  13019. return self["@values"];
  13020. },
  13021. args: [],
  13022. source: "values\x0a\x09^ values",
  13023. referencedClasses: [],
  13024. messageSends: []
  13025. }),
  13026. $globals.Dictionary);
  13027. $core.addMethod(
  13028. $core.method({
  13029. selector: "valuesDo:",
  13030. protocol: 'enumerating',
  13031. fn: function (aBlock){
  13032. var self=this;
  13033. return $core.withContext(function($ctx1) {
  13034. return $recv(self["@values"])._do_(aBlock);
  13035. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  13036. },
  13037. args: ["aBlock"],
  13038. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  13039. referencedClasses: [],
  13040. messageSends: ["do:"]
  13041. }),
  13042. $globals.Dictionary);
  13043. $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections');
  13044. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  13045. $core.addMethod(
  13046. $core.method({
  13047. selector: "at:ifAbsent:",
  13048. protocol: 'accessing',
  13049. fn: function (aKey,aBlock){
  13050. var self=this;
  13051. return $core.withContext(function($ctx1) {
  13052. var $1;
  13053. $1=self._includesKey_(aKey);
  13054. if($core.assert($1)){
  13055. return self._basicAt_(aKey);
  13056. } else {
  13057. return $recv(aBlock)._value();
  13058. };
  13059. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  13060. },
  13061. args: ["aKey", "aBlock"],
  13062. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  13063. referencedClasses: [],
  13064. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  13065. }),
  13066. $globals.HashedCollection);
  13067. $core.addMethod(
  13068. $core.method({
  13069. selector: "at:put:",
  13070. protocol: 'accessing',
  13071. fn: function (aKey,aValue){
  13072. var self=this;
  13073. return $core.withContext(function($ctx1) {
  13074. return self._basicAt_put_(aKey,aValue);
  13075. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  13076. },
  13077. args: ["aKey", "aValue"],
  13078. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  13079. referencedClasses: [],
  13080. messageSends: ["basicAt:put:"]
  13081. }),
  13082. $globals.HashedCollection);
  13083. $core.addMethod(
  13084. $core.method({
  13085. selector: "includesKey:",
  13086. protocol: 'testing',
  13087. fn: function (aKey){
  13088. var self=this;
  13089. return $core.withContext(function($ctx1) {
  13090. return self.hasOwnProperty(aKey);
  13091. return self;
  13092. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  13093. },
  13094. args: ["aKey"],
  13095. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  13096. referencedClasses: [],
  13097. messageSends: []
  13098. }),
  13099. $globals.HashedCollection);
  13100. $core.addMethod(
  13101. $core.method({
  13102. selector: "keys",
  13103. protocol: 'accessing',
  13104. fn: function (){
  13105. var self=this;
  13106. return $core.withContext(function($ctx1) {
  13107. return Object.keys(self);
  13108. return self;
  13109. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  13110. },
  13111. args: [],
  13112. source: "keys\x0a\x09<return Object.keys(self)>",
  13113. referencedClasses: [],
  13114. messageSends: []
  13115. }),
  13116. $globals.HashedCollection);
  13117. $core.addMethod(
  13118. $core.method({
  13119. selector: "keysDo:",
  13120. protocol: 'enumerating',
  13121. fn: function (aBlock){
  13122. var self=this;
  13123. return $core.withContext(function($ctx1) {
  13124. $recv(self._keys())._do_(aBlock);
  13125. return self;
  13126. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  13127. },
  13128. args: ["aBlock"],
  13129. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  13130. referencedClasses: [],
  13131. messageSends: ["do:", "keys"]
  13132. }),
  13133. $globals.HashedCollection);
  13134. $core.addMethod(
  13135. $core.method({
  13136. selector: "removeKey:ifAbsent:",
  13137. protocol: 'adding/removing',
  13138. fn: function (aKey,aBlock){
  13139. var self=this;
  13140. return $core.withContext(function($ctx1) {
  13141. return self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  13142. return $core.withContext(function($ctx2) {
  13143. self._basicDelete_(aKey);
  13144. return removed;
  13145. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  13146. }),(function(){
  13147. return $core.withContext(function($ctx2) {
  13148. return $recv(aBlock)._value();
  13149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13150. }));
  13151. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  13152. },
  13153. args: ["aKey", "aBlock"],
  13154. 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 ]",
  13155. referencedClasses: [],
  13156. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  13157. }),
  13158. $globals.HashedCollection);
  13159. $core.addMethod(
  13160. $core.method({
  13161. selector: "values",
  13162. protocol: 'accessing',
  13163. fn: function (){
  13164. var self=this;
  13165. return $core.withContext(function($ctx1) {
  13166. return self._keys().map(function(key){
  13167. return self._at_(key);
  13168. });
  13169. ;
  13170. return self;
  13171. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  13172. },
  13173. args: [],
  13174. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  13175. referencedClasses: [],
  13176. messageSends: []
  13177. }),
  13178. $globals.HashedCollection);
  13179. $core.addMethod(
  13180. $core.method({
  13181. selector: "valuesDo:",
  13182. protocol: 'enumerating',
  13183. fn: function (aBlock){
  13184. var self=this;
  13185. return $core.withContext(function($ctx1) {
  13186. $recv(self._values())._do_(aBlock);
  13187. return self;
  13188. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  13189. },
  13190. args: ["aBlock"],
  13191. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  13192. referencedClasses: [],
  13193. messageSends: ["do:", "values"]
  13194. }),
  13195. $globals.HashedCollection);
  13196. $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  13197. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  13198. $core.addMethod(
  13199. $core.method({
  13200. selector: "=",
  13201. protocol: 'comparing',
  13202. fn: function (aCollection){
  13203. var self=this;
  13204. return $core.withContext(function($ctx1) {
  13205. var $3,$2,$4,$1,$5;
  13206. var $early={};
  13207. try {
  13208. $3=self._class();
  13209. $ctx1.sendIdx["class"]=1;
  13210. $2=$recv($3).__eq($recv(aCollection)._class());
  13211. $ctx1.sendIdx["="]=1;
  13212. $1=$recv($2)._and_((function(){
  13213. return $core.withContext(function($ctx2) {
  13214. $4=self._size();
  13215. $ctx2.sendIdx["size"]=1;
  13216. return $recv($4).__eq($recv(aCollection)._size());
  13217. $ctx2.sendIdx["="]=2;
  13218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13219. }));
  13220. if(!$core.assert($1)){
  13221. return false;
  13222. };
  13223. self._withIndexDo_((function(each,i){
  13224. return $core.withContext(function($ctx2) {
  13225. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  13226. if(!$core.assert($5)){
  13227. throw $early=[false];
  13228. };
  13229. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  13230. }));
  13231. return true;
  13232. }
  13233. catch(e) {if(e===$early)return e[0]; throw e}
  13234. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  13235. },
  13236. args: ["aCollection"],
  13237. 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",
  13238. referencedClasses: [],
  13239. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  13240. }),
  13241. $globals.SequenceableCollection);
  13242. $core.addMethod(
  13243. $core.method({
  13244. selector: "addLast:",
  13245. protocol: 'adding/removing',
  13246. fn: function (anObject){
  13247. var self=this;
  13248. return $core.withContext(function($ctx1) {
  13249. self._add_(anObject);
  13250. return self;
  13251. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  13252. },
  13253. args: ["anObject"],
  13254. source: "addLast: anObject\x0a\x09self add: anObject",
  13255. referencedClasses: [],
  13256. messageSends: ["add:"]
  13257. }),
  13258. $globals.SequenceableCollection);
  13259. $core.addMethod(
  13260. $core.method({
  13261. selector: "allButFirst",
  13262. protocol: 'accessing',
  13263. fn: function (){
  13264. var self=this;
  13265. return $core.withContext(function($ctx1) {
  13266. return self._copyFrom_to_((2),self._size());
  13267. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  13268. },
  13269. args: [],
  13270. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  13271. referencedClasses: [],
  13272. messageSends: ["copyFrom:to:", "size"]
  13273. }),
  13274. $globals.SequenceableCollection);
  13275. $core.addMethod(
  13276. $core.method({
  13277. selector: "allButLast",
  13278. protocol: 'accessing',
  13279. fn: function (){
  13280. var self=this;
  13281. return $core.withContext(function($ctx1) {
  13282. return self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  13283. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  13284. },
  13285. args: [],
  13286. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  13287. referencedClasses: [],
  13288. messageSends: ["copyFrom:to:", "-", "size"]
  13289. }),
  13290. $globals.SequenceableCollection);
  13291. $core.addMethod(
  13292. $core.method({
  13293. selector: "atRandom",
  13294. protocol: 'accessing',
  13295. fn: function (){
  13296. var self=this;
  13297. return $core.withContext(function($ctx1) {
  13298. return self._at_($recv(self._size())._atRandom());
  13299. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  13300. },
  13301. args: [],
  13302. source: "atRandom\x0a\x09^ self at: self size atRandom",
  13303. referencedClasses: [],
  13304. messageSends: ["at:", "atRandom", "size"]
  13305. }),
  13306. $globals.SequenceableCollection);
  13307. $core.addMethod(
  13308. $core.method({
  13309. selector: "beginsWith:",
  13310. protocol: 'testing',
  13311. fn: function (prefix){
  13312. var self=this;
  13313. return $core.withContext(function($ctx1) {
  13314. var $2,$3,$1;
  13315. $2=self._size();
  13316. $ctx1.sendIdx["size"]=1;
  13317. $3=$recv(prefix)._size();
  13318. $ctx1.sendIdx["size"]=2;
  13319. $1=$recv($2).__lt($3);
  13320. if($core.assert($1)){
  13321. return false;
  13322. };
  13323. return $recv(self._first_($recv(prefix)._size())).__eq(prefix);
  13324. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  13325. },
  13326. args: ["prefix"],
  13327. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  13328. referencedClasses: [],
  13329. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  13330. }),
  13331. $globals.SequenceableCollection);
  13332. $core.addMethod(
  13333. $core.method({
  13334. selector: "copyFrom:to:",
  13335. protocol: 'copying',
  13336. fn: function (anIndex,anotherIndex){
  13337. var self=this;
  13338. return $core.withContext(function($ctx1) {
  13339. self._subclassResponsibility();
  13340. return self;
  13341. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  13342. },
  13343. args: ["anIndex", "anotherIndex"],
  13344. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  13345. referencedClasses: [],
  13346. messageSends: ["subclassResponsibility"]
  13347. }),
  13348. $globals.SequenceableCollection);
  13349. $core.addMethod(
  13350. $core.method({
  13351. selector: "detect:ifNone:",
  13352. protocol: 'enumerating',
  13353. fn: function (aBlock,anotherBlock){
  13354. var self=this;
  13355. return $core.withContext(function($ctx1) {
  13356. self = self._numericallyIndexable();
  13357. for(var i = 0; i < self.length; i++)
  13358. if(aBlock._value_(self[i]))
  13359. return self[i];
  13360. return anotherBlock._value();
  13361. ;
  13362. return self;
  13363. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  13364. },
  13365. args: ["aBlock", "anotherBlock"],
  13366. 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>",
  13367. referencedClasses: [],
  13368. messageSends: []
  13369. }),
  13370. $globals.SequenceableCollection);
  13371. $core.addMethod(
  13372. $core.method({
  13373. selector: "do:",
  13374. protocol: 'enumerating',
  13375. fn: function (aBlock){
  13376. var self=this;
  13377. return $core.withContext(function($ctx1) {
  13378. self = self._numericallyIndexable();
  13379. for(var i=0; i < self.length; i++) {
  13380. aBlock._value_(self[i]);
  13381. }
  13382. ;
  13383. return self;
  13384. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13385. },
  13386. args: ["aBlock"],
  13387. 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>",
  13388. referencedClasses: [],
  13389. messageSends: []
  13390. }),
  13391. $globals.SequenceableCollection);
  13392. $core.addMethod(
  13393. $core.method({
  13394. selector: "endsWith:",
  13395. protocol: 'testing',
  13396. fn: function (suffix){
  13397. var self=this;
  13398. return $core.withContext(function($ctx1) {
  13399. var $2,$3,$1;
  13400. $2=self._size();
  13401. $ctx1.sendIdx["size"]=1;
  13402. $3=$recv(suffix)._size();
  13403. $ctx1.sendIdx["size"]=2;
  13404. $1=$recv($2).__lt($3);
  13405. if($core.assert($1)){
  13406. return false;
  13407. };
  13408. return $recv(self._last_($recv(suffix)._size())).__eq(suffix);
  13409. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  13410. },
  13411. args: ["suffix"],
  13412. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  13413. referencedClasses: [],
  13414. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  13415. }),
  13416. $globals.SequenceableCollection);
  13417. $core.addMethod(
  13418. $core.method({
  13419. selector: "first",
  13420. protocol: 'accessing',
  13421. fn: function (){
  13422. var self=this;
  13423. return $core.withContext(function($ctx1) {
  13424. return self._at_((1));
  13425. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  13426. },
  13427. args: [],
  13428. source: "first\x0a\x09^ self at: 1",
  13429. referencedClasses: [],
  13430. messageSends: ["at:"]
  13431. }),
  13432. $globals.SequenceableCollection);
  13433. $core.addMethod(
  13434. $core.method({
  13435. selector: "first:",
  13436. protocol: 'accessing',
  13437. fn: function (aNumber){
  13438. var self=this;
  13439. return $core.withContext(function($ctx1) {
  13440. var $1;
  13441. $1=$recv(self._size()).__lt(aNumber);
  13442. if($core.assert($1)){
  13443. self._error_("Invalid number of elements");
  13444. };
  13445. return self._copyFrom_to_((1),aNumber);
  13446. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13447. },
  13448. args: ["aNumber"],
  13449. 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",
  13450. referencedClasses: [],
  13451. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  13452. }),
  13453. $globals.SequenceableCollection);
  13454. $core.addMethod(
  13455. $core.method({
  13456. selector: "fourth",
  13457. protocol: 'accessing',
  13458. fn: function (){
  13459. var self=this;
  13460. return $core.withContext(function($ctx1) {
  13461. return self._at_((4));
  13462. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  13463. },
  13464. args: [],
  13465. source: "fourth\x0a\x09^ self at: 4",
  13466. referencedClasses: [],
  13467. messageSends: ["at:"]
  13468. }),
  13469. $globals.SequenceableCollection);
  13470. $core.addMethod(
  13471. $core.method({
  13472. selector: "includes:",
  13473. protocol: 'testing',
  13474. fn: function (anObject){
  13475. var self=this;
  13476. return $core.withContext(function($ctx1) {
  13477. return $recv(self._indexOf_ifAbsent_(anObject,(function(){
  13478. return nil;
  13479. })))._notNil();
  13480. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  13481. },
  13482. args: ["anObject"],
  13483. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  13484. referencedClasses: [],
  13485. messageSends: ["notNil", "indexOf:ifAbsent:"]
  13486. }),
  13487. $globals.SequenceableCollection);
  13488. $core.addMethod(
  13489. $core.method({
  13490. selector: "indexOf:ifAbsent:",
  13491. protocol: 'accessing',
  13492. fn: function (anObject,aBlock){
  13493. var self=this;
  13494. return $core.withContext(function($ctx1) {
  13495. self = self._numericallyIndexable();
  13496. for(var i=0; i < self.length; i++) {
  13497. if($recv(self[i]).__eq(anObject)) {return i+1}
  13498. };
  13499. return aBlock._value();
  13500. ;
  13501. return self;
  13502. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  13503. },
  13504. args: ["anObject", "aBlock"],
  13505. 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>",
  13506. referencedClasses: [],
  13507. messageSends: []
  13508. }),
  13509. $globals.SequenceableCollection);
  13510. $core.addMethod(
  13511. $core.method({
  13512. selector: "indexOf:startingAt:",
  13513. protocol: 'accessing',
  13514. fn: function (anObject,start){
  13515. var self=this;
  13516. return $core.withContext(function($ctx1) {
  13517. return self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  13518. return (0);
  13519. }));
  13520. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  13521. },
  13522. args: ["anObject", "start"],
  13523. 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 ]",
  13524. referencedClasses: [],
  13525. messageSends: ["indexOf:startingAt:ifAbsent:"]
  13526. }),
  13527. $globals.SequenceableCollection);
  13528. $core.addMethod(
  13529. $core.method({
  13530. selector: "indexOf:startingAt:ifAbsent:",
  13531. protocol: 'accessing',
  13532. fn: function (anObject,start,aBlock){
  13533. var self=this;
  13534. return $core.withContext(function($ctx1) {
  13535. self = self._numericallyIndexable();
  13536. for(var i=start - 1; i < self.length; i++){
  13537. if($recv(self[i]).__eq(anObject)) {return i+1}
  13538. }
  13539. return aBlock._value();
  13540. ;
  13541. return self;
  13542. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  13543. },
  13544. args: ["anObject", "start", "aBlock"],
  13545. 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>",
  13546. referencedClasses: [],
  13547. messageSends: []
  13548. }),
  13549. $globals.SequenceableCollection);
  13550. $core.addMethod(
  13551. $core.method({
  13552. selector: "last",
  13553. protocol: 'accessing',
  13554. fn: function (){
  13555. var self=this;
  13556. return $core.withContext(function($ctx1) {
  13557. return self._at_(self._size());
  13558. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  13559. },
  13560. args: [],
  13561. source: "last\x0a\x09^ self at: self size",
  13562. referencedClasses: [],
  13563. messageSends: ["at:", "size"]
  13564. }),
  13565. $globals.SequenceableCollection);
  13566. $core.addMethod(
  13567. $core.method({
  13568. selector: "last:",
  13569. protocol: 'accessing',
  13570. fn: function (aNumber){
  13571. var self=this;
  13572. return $core.withContext(function($ctx1) {
  13573. var $2,$1,$5,$4,$3;
  13574. $2=self._size();
  13575. $ctx1.sendIdx["size"]=1;
  13576. $1=$recv($2).__lt(aNumber);
  13577. if($core.assert($1)){
  13578. self._error_("Invalid number of elements");
  13579. };
  13580. $5=self._size();
  13581. $ctx1.sendIdx["size"]=2;
  13582. $4=$recv($5).__minus(aNumber);
  13583. $3=$recv($4).__plus((1));
  13584. return self._copyFrom_to_($3,self._size());
  13585. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  13586. },
  13587. args: ["aNumber"],
  13588. 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",
  13589. referencedClasses: [],
  13590. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  13591. }),
  13592. $globals.SequenceableCollection);
  13593. $core.addMethod(
  13594. $core.method({
  13595. selector: "newStream",
  13596. protocol: 'streaming',
  13597. fn: function (){
  13598. var self=this;
  13599. return $core.withContext(function($ctx1) {
  13600. return $recv(self._streamClass())._on_(self);
  13601. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  13602. },
  13603. args: [],
  13604. source: "newStream\x0a\x09^ self streamClass on: self",
  13605. referencedClasses: [],
  13606. messageSends: ["on:", "streamClass"]
  13607. }),
  13608. $globals.SequenceableCollection);
  13609. $core.addMethod(
  13610. $core.method({
  13611. selector: "numericallyIndexable",
  13612. protocol: 'private',
  13613. fn: function (){
  13614. var self=this;
  13615. return $core.withContext(function($ctx1) {
  13616. self._subclassResponsibility();
  13617. return self;
  13618. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  13619. },
  13620. args: [],
  13621. 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",
  13622. referencedClasses: [],
  13623. messageSends: ["subclassResponsibility"]
  13624. }),
  13625. $globals.SequenceableCollection);
  13626. $core.addMethod(
  13627. $core.method({
  13628. selector: "readStream",
  13629. protocol: 'streaming',
  13630. fn: function (){
  13631. var self=this;
  13632. return $core.withContext(function($ctx1) {
  13633. return self._stream();
  13634. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  13635. },
  13636. args: [],
  13637. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13638. referencedClasses: [],
  13639. messageSends: ["stream"]
  13640. }),
  13641. $globals.SequenceableCollection);
  13642. $core.addMethod(
  13643. $core.method({
  13644. selector: "removeLast",
  13645. protocol: 'adding/removing',
  13646. fn: function (){
  13647. var self=this;
  13648. return $core.withContext(function($ctx1) {
  13649. return self._remove_(self._last());
  13650. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  13651. },
  13652. args: [],
  13653. source: "removeLast\x0a\x09^ self remove: self last",
  13654. referencedClasses: [],
  13655. messageSends: ["remove:", "last"]
  13656. }),
  13657. $globals.SequenceableCollection);
  13658. $core.addMethod(
  13659. $core.method({
  13660. selector: "reversed",
  13661. protocol: 'converting',
  13662. fn: function (){
  13663. var self=this;
  13664. return $core.withContext(function($ctx1) {
  13665. self._subclassResponsibility();
  13666. return self;
  13667. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  13668. },
  13669. args: [],
  13670. source: "reversed\x0a\x09self subclassResponsibility",
  13671. referencedClasses: [],
  13672. messageSends: ["subclassResponsibility"]
  13673. }),
  13674. $globals.SequenceableCollection);
  13675. $core.addMethod(
  13676. $core.method({
  13677. selector: "second",
  13678. protocol: 'accessing',
  13679. fn: function (){
  13680. var self=this;
  13681. return $core.withContext(function($ctx1) {
  13682. return self._at_((2));
  13683. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  13684. },
  13685. args: [],
  13686. source: "second\x0a\x09^ self at: 2",
  13687. referencedClasses: [],
  13688. messageSends: ["at:"]
  13689. }),
  13690. $globals.SequenceableCollection);
  13691. $core.addMethod(
  13692. $core.method({
  13693. selector: "stream",
  13694. protocol: 'streaming',
  13695. fn: function (){
  13696. var self=this;
  13697. return $core.withContext(function($ctx1) {
  13698. return self._newStream();
  13699. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  13700. },
  13701. args: [],
  13702. source: "stream\x0a\x09^ self newStream",
  13703. referencedClasses: [],
  13704. messageSends: ["newStream"]
  13705. }),
  13706. $globals.SequenceableCollection);
  13707. $core.addMethod(
  13708. $core.method({
  13709. selector: "streamClass",
  13710. protocol: 'streaming',
  13711. fn: function (){
  13712. var self=this;
  13713. return $core.withContext(function($ctx1) {
  13714. return $recv(self._class())._streamClass();
  13715. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  13716. },
  13717. args: [],
  13718. source: "streamClass\x0a\x09^ self class streamClass",
  13719. referencedClasses: [],
  13720. messageSends: ["streamClass", "class"]
  13721. }),
  13722. $globals.SequenceableCollection);
  13723. $core.addMethod(
  13724. $core.method({
  13725. selector: "third",
  13726. protocol: 'accessing',
  13727. fn: function (){
  13728. var self=this;
  13729. return $core.withContext(function($ctx1) {
  13730. return self._at_((3));
  13731. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  13732. },
  13733. args: [],
  13734. source: "third\x0a\x09^ self at: 3",
  13735. referencedClasses: [],
  13736. messageSends: ["at:"]
  13737. }),
  13738. $globals.SequenceableCollection);
  13739. $core.addMethod(
  13740. $core.method({
  13741. selector: "with:do:",
  13742. protocol: 'enumerating',
  13743. fn: function (anotherCollection,aBlock){
  13744. var self=this;
  13745. return $core.withContext(function($ctx1) {
  13746. self = self._numericallyIndexable();
  13747. anotherCollection = anotherCollection._numericallyIndexable();
  13748. for(var i=0; i<self.length; i++) {
  13749. aBlock._value_value_(self[i], anotherCollection[i]);
  13750. }
  13751. ;
  13752. return self;
  13753. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  13754. },
  13755. args: ["anotherCollection", "aBlock"],
  13756. 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>",
  13757. referencedClasses: [],
  13758. messageSends: []
  13759. }),
  13760. $globals.SequenceableCollection);
  13761. $core.addMethod(
  13762. $core.method({
  13763. selector: "withIndexDo:",
  13764. protocol: 'enumerating',
  13765. fn: function (aBlock){
  13766. var self=this;
  13767. return $core.withContext(function($ctx1) {
  13768. self = self._numericallyIndexable();
  13769. for(var i=0; i < self.length; i++) {
  13770. aBlock._value_value_(self[i], i+1);
  13771. }
  13772. ;
  13773. return self;
  13774. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  13775. },
  13776. args: ["aBlock"],
  13777. 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>",
  13778. referencedClasses: [],
  13779. messageSends: []
  13780. }),
  13781. $globals.SequenceableCollection);
  13782. $core.addMethod(
  13783. $core.method({
  13784. selector: "writeStream",
  13785. protocol: 'streaming',
  13786. fn: function (){
  13787. var self=this;
  13788. return $core.withContext(function($ctx1) {
  13789. return self._stream();
  13790. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  13791. },
  13792. args: [],
  13793. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  13794. referencedClasses: [],
  13795. messageSends: ["stream"]
  13796. }),
  13797. $globals.SequenceableCollection);
  13798. $core.addMethod(
  13799. $core.method({
  13800. selector: "streamClass",
  13801. protocol: 'accessing',
  13802. fn: function (){
  13803. var self=this;
  13804. return $globals.Stream;
  13805. },
  13806. args: [],
  13807. source: "streamClass\x0a\x09\x09^ Stream",
  13808. referencedClasses: ["Stream"],
  13809. messageSends: []
  13810. }),
  13811. $globals.SequenceableCollection.klass);
  13812. $core.addMethod(
  13813. $core.method({
  13814. selector: "streamContents:",
  13815. protocol: 'streaming',
  13816. fn: function (aBlock){
  13817. var self=this;
  13818. var stream;
  13819. return $core.withContext(function($ctx1) {
  13820. stream=$recv(self._streamClass())._on_(self._new());
  13821. $recv(aBlock)._value_(stream);
  13822. return $recv(stream)._contents();
  13823. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  13824. },
  13825. args: ["aBlock"],
  13826. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  13827. referencedClasses: [],
  13828. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  13829. }),
  13830. $globals.SequenceableCollection.klass);
  13831. $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections');
  13832. $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`.";
  13833. $core.addMethod(
  13834. $core.method({
  13835. selector: "add:",
  13836. protocol: 'adding/removing',
  13837. fn: function (anObject){
  13838. var self=this;
  13839. return $core.withContext(function($ctx1) {
  13840. self.push(anObject); return anObject;;
  13841. return self;
  13842. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  13843. },
  13844. args: ["anObject"],
  13845. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  13846. referencedClasses: [],
  13847. messageSends: []
  13848. }),
  13849. $globals.Array);
  13850. $core.addMethod(
  13851. $core.method({
  13852. selector: "addAll:",
  13853. protocol: 'adding/removing',
  13854. fn: function (aCollection){
  13855. var self=this;
  13856. return $core.withContext(function($ctx1) {
  13857. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  13858. else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);
  13859. return aCollection;;
  13860. return self;
  13861. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  13862. },
  13863. args: ["aCollection"],
  13864. 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>",
  13865. referencedClasses: [],
  13866. messageSends: []
  13867. }),
  13868. $globals.Array);
  13869. $core.addMethod(
  13870. $core.method({
  13871. selector: "addFirst:",
  13872. protocol: 'adding/removing',
  13873. fn: function (anObject){
  13874. var self=this;
  13875. return $core.withContext(function($ctx1) {
  13876. self.unshift(anObject); return anObject;;
  13877. return self;
  13878. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  13879. },
  13880. args: ["anObject"],
  13881. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  13882. referencedClasses: [],
  13883. messageSends: []
  13884. }),
  13885. $globals.Array);
  13886. $core.addMethod(
  13887. $core.method({
  13888. selector: "asJavascript",
  13889. protocol: 'converting',
  13890. fn: function (){
  13891. var self=this;
  13892. return $core.withContext(function($ctx1) {
  13893. var $1;
  13894. $1=$recv("[".__comma($recv(self._collect_((function(each){
  13895. return $core.withContext(function($ctx2) {
  13896. return $recv(each)._asJavascript();
  13897. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13898. })))._join_(", "))).__comma("]");
  13899. $ctx1.sendIdx[","]=1;
  13900. return $1;
  13901. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
  13902. },
  13903. args: [],
  13904. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  13905. referencedClasses: [],
  13906. messageSends: [",", "join:", "collect:", "asJavascript"]
  13907. }),
  13908. $globals.Array);
  13909. $core.addMethod(
  13910. $core.method({
  13911. selector: "at:ifAbsent:",
  13912. protocol: 'accessing',
  13913. fn: function (anIndex,aBlock){
  13914. var self=this;
  13915. return $core.withContext(function($ctx1) {
  13916. return anIndex >= 1 && anIndex <= self.length
  13917. ? self[anIndex - 1]
  13918. : aBlock._value()
  13919. ;
  13920. return self;
  13921. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  13922. },
  13923. args: ["anIndex", "aBlock"],
  13924. 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>",
  13925. referencedClasses: [],
  13926. messageSends: []
  13927. }),
  13928. $globals.Array);
  13929. $core.addMethod(
  13930. $core.method({
  13931. selector: "at:ifPresent:ifAbsent:",
  13932. protocol: 'accessing',
  13933. fn: function (anIndex,aBlock,anotherBlock){
  13934. var self=this;
  13935. return $core.withContext(function($ctx1) {
  13936. return anIndex >= 1 && anIndex <= self.length
  13937. ? aBlock._value_(self[anIndex - 1])
  13938. : anotherBlock._value()
  13939. ;
  13940. return self;
  13941. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  13942. },
  13943. args: ["anIndex", "aBlock", "anotherBlock"],
  13944. 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>",
  13945. referencedClasses: [],
  13946. messageSends: []
  13947. }),
  13948. $globals.Array);
  13949. $core.addMethod(
  13950. $core.method({
  13951. selector: "at:put:",
  13952. protocol: 'accessing',
  13953. fn: function (anIndex,anObject){
  13954. var self=this;
  13955. return $core.withContext(function($ctx1) {
  13956. return self[anIndex - 1] = anObject;
  13957. return self;
  13958. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  13959. },
  13960. args: ["anIndex", "anObject"],
  13961. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  13962. referencedClasses: [],
  13963. messageSends: []
  13964. }),
  13965. $globals.Array);
  13966. $core.addMethod(
  13967. $core.method({
  13968. selector: "collect:",
  13969. protocol: 'enumerating',
  13970. fn: function (aBlock){
  13971. var self=this;
  13972. return $core.withContext(function($ctx1) {
  13973. return self.map(function(each) {return aBlock._value_(each)});
  13974. return self;
  13975. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  13976. },
  13977. args: ["aBlock"],
  13978. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  13979. referencedClasses: [],
  13980. messageSends: []
  13981. }),
  13982. $globals.Array);
  13983. $core.addMethod(
  13984. $core.method({
  13985. selector: "copyFrom:to:",
  13986. protocol: 'copying',
  13987. fn: function (anIndex,anotherIndex){
  13988. var self=this;
  13989. return $core.withContext(function($ctx1) {
  13990. if (anIndex >= 1 && anotherIndex <= self.length) {
  13991. return self.slice(anIndex - 1, anotherIndex);
  13992. } else {
  13993. self._at_(anIndex);
  13994. self._at_(self.length + 1);
  13995. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  13996. };
  13997. return self;
  13998. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  13999. },
  14000. args: ["anIndex", "anotherIndex"],
  14001. 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>",
  14002. referencedClasses: [],
  14003. messageSends: []
  14004. }),
  14005. $globals.Array);
  14006. $core.addMethod(
  14007. $core.method({
  14008. selector: "join:",
  14009. protocol: 'enumerating',
  14010. fn: function (aString){
  14011. var self=this;
  14012. return $core.withContext(function($ctx1) {
  14013. return self.join(aString);
  14014. return self;
  14015. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  14016. },
  14017. args: ["aString"],
  14018. source: "join: aString\x0a\x09<return self.join(aString)>",
  14019. referencedClasses: [],
  14020. messageSends: []
  14021. }),
  14022. $globals.Array);
  14023. $core.addMethod(
  14024. $core.method({
  14025. selector: "numericallyIndexable",
  14026. protocol: 'private',
  14027. fn: function (){
  14028. var self=this;
  14029. return self;
  14030. },
  14031. args: [],
  14032. source: "numericallyIndexable\x0a\x09^ self",
  14033. referencedClasses: [],
  14034. messageSends: []
  14035. }),
  14036. $globals.Array);
  14037. $core.addMethod(
  14038. $core.method({
  14039. selector: "printOn:",
  14040. protocol: 'printing',
  14041. fn: function (aStream){
  14042. var self=this;
  14043. return $core.withContext(function($ctx1) {
  14044. (
  14045. $ctx1.supercall = true,
  14046. ($globals.Array.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  14047. $ctx1.supercall = false;
  14048. $ctx1.sendIdx["printOn:"]=1;
  14049. $recv(aStream)._nextPutAll_(" (");
  14050. $ctx1.sendIdx["nextPutAll:"]=1;
  14051. self._do_separatedBy_((function(each){
  14052. return $core.withContext(function($ctx2) {
  14053. return $recv(each)._printOn_(aStream);
  14054. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14055. }),(function(){
  14056. return $core.withContext(function($ctx2) {
  14057. return $recv(aStream)._nextPutAll_(" ");
  14058. $ctx2.sendIdx["nextPutAll:"]=2;
  14059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14060. }));
  14061. $recv(aStream)._nextPutAll_(")");
  14062. return self;
  14063. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  14064. },
  14065. args: ["aStream"],
  14066. 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: ')'",
  14067. referencedClasses: [],
  14068. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  14069. }),
  14070. $globals.Array);
  14071. $core.addMethod(
  14072. $core.method({
  14073. selector: "remove:ifAbsent:",
  14074. protocol: 'adding/removing',
  14075. fn: function (anObject,aBlock){
  14076. var self=this;
  14077. var index;
  14078. return $core.withContext(function($ctx1) {
  14079. var $1;
  14080. index=self._indexOf_ifAbsent_(anObject,(function(){
  14081. return (0);
  14082. }));
  14083. $1=$recv(index).__eq((0));
  14084. if($core.assert($1)){
  14085. return $recv(aBlock)._value();
  14086. } else {
  14087. self._removeIndex_(index);
  14088. return anObject;
  14089. };
  14090. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  14091. },
  14092. args: ["anObject", "aBlock"],
  14093. 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 ]",
  14094. referencedClasses: [],
  14095. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  14096. }),
  14097. $globals.Array);
  14098. $core.addMethod(
  14099. $core.method({
  14100. selector: "removeAll",
  14101. protocol: 'adding/removing',
  14102. fn: function (){
  14103. var self=this;
  14104. return $core.withContext(function($ctx1) {
  14105. self.length = 0;
  14106. return self;
  14107. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  14108. },
  14109. args: [],
  14110. source: "removeAll\x0a\x09<self.length = 0>",
  14111. referencedClasses: [],
  14112. messageSends: []
  14113. }),
  14114. $globals.Array);
  14115. $core.addMethod(
  14116. $core.method({
  14117. selector: "removeFrom:to:",
  14118. protocol: 'adding/removing',
  14119. fn: function (aNumber,anotherNumber){
  14120. var self=this;
  14121. return $core.withContext(function($ctx1) {
  14122. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  14123. return self;
  14124. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  14125. },
  14126. args: ["aNumber", "anotherNumber"],
  14127. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  14128. referencedClasses: [],
  14129. messageSends: []
  14130. }),
  14131. $globals.Array);
  14132. $core.addMethod(
  14133. $core.method({
  14134. selector: "removeIndex:",
  14135. protocol: 'adding/removing',
  14136. fn: function (anInteger){
  14137. var self=this;
  14138. return $core.withContext(function($ctx1) {
  14139. self.splice(anInteger - 1, 1);
  14140. return self;
  14141. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  14142. },
  14143. args: ["anInteger"],
  14144. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  14145. referencedClasses: [],
  14146. messageSends: []
  14147. }),
  14148. $globals.Array);
  14149. $core.addMethod(
  14150. $core.method({
  14151. selector: "removeLast",
  14152. protocol: 'adding/removing',
  14153. fn: function (){
  14154. var self=this;
  14155. return $core.withContext(function($ctx1) {
  14156. return self.pop();;
  14157. return self;
  14158. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  14159. },
  14160. args: [],
  14161. source: "removeLast\x0a\x09<return self.pop();>",
  14162. referencedClasses: [],
  14163. messageSends: []
  14164. }),
  14165. $globals.Array);
  14166. $core.addMethod(
  14167. $core.method({
  14168. selector: "reversed",
  14169. protocol: 'converting',
  14170. fn: function (){
  14171. var self=this;
  14172. return $core.withContext(function($ctx1) {
  14173. return self.slice().reverse();
  14174. return self;
  14175. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  14176. },
  14177. args: [],
  14178. source: "reversed\x0a\x09<return self.slice().reverse()>",
  14179. referencedClasses: [],
  14180. messageSends: []
  14181. }),
  14182. $globals.Array);
  14183. $core.addMethod(
  14184. $core.method({
  14185. selector: "select:",
  14186. protocol: 'enumerating',
  14187. fn: function (aBlock){
  14188. var self=this;
  14189. return $core.withContext(function($ctx1) {
  14190. return self.filter(function(each) {return aBlock._value_(each)});
  14191. return self;
  14192. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  14193. },
  14194. args: ["aBlock"],
  14195. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.filter(function(each) {return aBlock._value_(each)})>",
  14196. referencedClasses: [],
  14197. messageSends: []
  14198. }),
  14199. $globals.Array);
  14200. $core.addMethod(
  14201. $core.method({
  14202. selector: "shallowCopy",
  14203. protocol: 'copying',
  14204. fn: function (){
  14205. var self=this;
  14206. return $core.withContext(function($ctx1) {
  14207. return self.slice();
  14208. return self;
  14209. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  14210. },
  14211. args: [],
  14212. source: "shallowCopy\x0a\x09<return self.slice()>",
  14213. referencedClasses: [],
  14214. messageSends: []
  14215. }),
  14216. $globals.Array);
  14217. $core.addMethod(
  14218. $core.method({
  14219. selector: "size",
  14220. protocol: 'accessing',
  14221. fn: function (){
  14222. var self=this;
  14223. return $core.withContext(function($ctx1) {
  14224. return self.length;
  14225. return self;
  14226. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  14227. },
  14228. args: [],
  14229. source: "size\x0a\x09<return self.length>",
  14230. referencedClasses: [],
  14231. messageSends: []
  14232. }),
  14233. $globals.Array);
  14234. $core.addMethod(
  14235. $core.method({
  14236. selector: "sort",
  14237. protocol: 'enumerating',
  14238. fn: function (){
  14239. var self=this;
  14240. return $core.withContext(function($ctx1) {
  14241. return self._sort_((function(a,b){
  14242. return $core.withContext(function($ctx2) {
  14243. return $recv(a).__lt(b);
  14244. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  14245. }));
  14246. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  14247. },
  14248. args: [],
  14249. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  14250. referencedClasses: [],
  14251. messageSends: ["sort:", "<"]
  14252. }),
  14253. $globals.Array);
  14254. $core.addMethod(
  14255. $core.method({
  14256. selector: "sort:",
  14257. protocol: 'enumerating',
  14258. fn: function (aBlock){
  14259. var self=this;
  14260. return $core.withContext(function($ctx1) {
  14261. return self.sort(function(a, b) {
  14262. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  14263. })
  14264. ;
  14265. return self;
  14266. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  14267. },
  14268. args: ["aBlock"],
  14269. 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>",
  14270. referencedClasses: [],
  14271. messageSends: []
  14272. }),
  14273. $globals.Array);
  14274. $core.addMethod(
  14275. $core.method({
  14276. selector: "sorted",
  14277. protocol: 'enumerating',
  14278. fn: function (){
  14279. var self=this;
  14280. return $core.withContext(function($ctx1) {
  14281. return $recv(self._copy())._sort();
  14282. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  14283. },
  14284. args: [],
  14285. source: "sorted\x0a\x09^ self copy sort",
  14286. referencedClasses: [],
  14287. messageSends: ["sort", "copy"]
  14288. }),
  14289. $globals.Array);
  14290. $core.addMethod(
  14291. $core.method({
  14292. selector: "sorted:",
  14293. protocol: 'enumerating',
  14294. fn: function (aBlock){
  14295. var self=this;
  14296. return $core.withContext(function($ctx1) {
  14297. return $recv(self._copy())._sort_(aBlock);
  14298. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  14299. },
  14300. args: ["aBlock"],
  14301. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  14302. referencedClasses: [],
  14303. messageSends: ["sort:", "copy"]
  14304. }),
  14305. $globals.Array);
  14306. $core.addMethod(
  14307. $core.method({
  14308. selector: "new:",
  14309. protocol: 'instance creation',
  14310. fn: function (anInteger){
  14311. var self=this;
  14312. return $core.withContext(function($ctx1) {
  14313. return new Array(anInteger);
  14314. return self;
  14315. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  14316. },
  14317. args: ["anInteger"],
  14318. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  14319. referencedClasses: [],
  14320. messageSends: []
  14321. }),
  14322. $globals.Array.klass);
  14323. $core.addMethod(
  14324. $core.method({
  14325. selector: "with:",
  14326. protocol: 'instance creation',
  14327. fn: function (anObject){
  14328. var self=this;
  14329. return $core.withContext(function($ctx1) {
  14330. var $1;
  14331. $1=self._new_((1));
  14332. $recv($1)._at_put_((1),anObject);
  14333. return $recv($1)._yourself();
  14334. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  14335. },
  14336. args: ["anObject"],
  14337. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  14338. referencedClasses: [],
  14339. messageSends: ["at:put:", "new:", "yourself"]
  14340. }),
  14341. $globals.Array.klass);
  14342. $core.addMethod(
  14343. $core.method({
  14344. selector: "with:with:",
  14345. protocol: 'instance creation',
  14346. fn: function (anObject,anObject2){
  14347. var self=this;
  14348. return $core.withContext(function($ctx1) {
  14349. var $1;
  14350. $1=self._new_((2));
  14351. $recv($1)._at_put_((1),anObject);
  14352. $ctx1.sendIdx["at:put:"]=1;
  14353. $recv($1)._at_put_((2),anObject2);
  14354. return $recv($1)._yourself();
  14355. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  14356. },
  14357. args: ["anObject", "anObject2"],
  14358. 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",
  14359. referencedClasses: [],
  14360. messageSends: ["at:put:", "new:", "yourself"]
  14361. }),
  14362. $globals.Array.klass);
  14363. $core.addMethod(
  14364. $core.method({
  14365. selector: "with:with:with:",
  14366. protocol: 'instance creation',
  14367. fn: function (anObject,anObject2,anObject3){
  14368. var self=this;
  14369. return $core.withContext(function($ctx1) {
  14370. var $1;
  14371. $1=self._new_((3));
  14372. $recv($1)._at_put_((1),anObject);
  14373. $ctx1.sendIdx["at:put:"]=1;
  14374. $recv($1)._at_put_((2),anObject2);
  14375. $ctx1.sendIdx["at:put:"]=2;
  14376. $recv($1)._at_put_((3),anObject3);
  14377. return $recv($1)._yourself();
  14378. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  14379. },
  14380. args: ["anObject", "anObject2", "anObject3"],
  14381. 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",
  14382. referencedClasses: [],
  14383. messageSends: ["at:put:", "new:", "yourself"]
  14384. }),
  14385. $globals.Array.klass);
  14386. $core.addMethod(
  14387. $core.method({
  14388. selector: "withAll:",
  14389. protocol: 'instance creation',
  14390. fn: function (aCollection){
  14391. var self=this;
  14392. var instance,index;
  14393. return $core.withContext(function($ctx1) {
  14394. index=(1);
  14395. instance=self._new_($recv(aCollection)._size());
  14396. $recv(aCollection)._do_((function(each){
  14397. return $core.withContext(function($ctx2) {
  14398. $recv(instance)._at_put_(index,each);
  14399. index=$recv(index).__plus((1));
  14400. return index;
  14401. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  14402. }));
  14403. return instance;
  14404. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  14405. },
  14406. args: ["aCollection"],
  14407. 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",
  14408. referencedClasses: [],
  14409. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  14410. }),
  14411. $globals.Array.klass);
  14412. $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections');
  14413. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  14414. $core.addMethod(
  14415. $core.method({
  14416. selector: ",",
  14417. protocol: 'copying',
  14418. fn: function (aString){
  14419. var self=this;
  14420. return $core.withContext(function($ctx1) {
  14421. var $1;
  14422. $1=self._asString();
  14423. $ctx1.sendIdx["asString"]=1;
  14424. return $recv($1).__comma($recv(aString)._asString());
  14425. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  14426. },
  14427. args: ["aString"],
  14428. source: ", aString\x0a\x09^ self asString, aString asString",
  14429. referencedClasses: [],
  14430. messageSends: [",", "asString"]
  14431. }),
  14432. $globals.CharacterArray);
  14433. $core.addMethod(
  14434. $core.method({
  14435. selector: "add:",
  14436. protocol: 'adding/removing',
  14437. fn: function (anObject){
  14438. var self=this;
  14439. return $core.withContext(function($ctx1) {
  14440. self._errorReadOnly();
  14441. return self;
  14442. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  14443. },
  14444. args: ["anObject"],
  14445. source: "add: anObject\x0a\x09self errorReadOnly",
  14446. referencedClasses: [],
  14447. messageSends: ["errorReadOnly"]
  14448. }),
  14449. $globals.CharacterArray);
  14450. $core.addMethod(
  14451. $core.method({
  14452. selector: "asLowercase",
  14453. protocol: 'converting',
  14454. fn: function (){
  14455. var self=this;
  14456. return $core.withContext(function($ctx1) {
  14457. return $recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  14458. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  14459. },
  14460. args: [],
  14461. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  14462. referencedClasses: [],
  14463. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  14464. }),
  14465. $globals.CharacterArray);
  14466. $core.addMethod(
  14467. $core.method({
  14468. selector: "asNumber",
  14469. protocol: 'converting',
  14470. fn: function (){
  14471. var self=this;
  14472. return $core.withContext(function($ctx1) {
  14473. return $recv(self._asString())._asNumber();
  14474. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  14475. },
  14476. args: [],
  14477. source: "asNumber\x0a\x09^ self asString asNumber",
  14478. referencedClasses: [],
  14479. messageSends: ["asNumber", "asString"]
  14480. }),
  14481. $globals.CharacterArray);
  14482. $core.addMethod(
  14483. $core.method({
  14484. selector: "asString",
  14485. protocol: 'converting',
  14486. fn: function (){
  14487. var self=this;
  14488. return $core.withContext(function($ctx1) {
  14489. return self._subclassResponsibility();
  14490. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  14491. },
  14492. args: [],
  14493. source: "asString\x0a\x09^ self subclassResponsibility",
  14494. referencedClasses: [],
  14495. messageSends: ["subclassResponsibility"]
  14496. }),
  14497. $globals.CharacterArray);
  14498. $core.addMethod(
  14499. $core.method({
  14500. selector: "asSymbol",
  14501. protocol: 'converting',
  14502. fn: function (){
  14503. var self=this;
  14504. return $core.withContext(function($ctx1) {
  14505. return self._asString();
  14506. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  14507. },
  14508. args: [],
  14509. source: "asSymbol\x0a\x09^ self asString",
  14510. referencedClasses: [],
  14511. messageSends: ["asString"]
  14512. }),
  14513. $globals.CharacterArray);
  14514. $core.addMethod(
  14515. $core.method({
  14516. selector: "asUppercase",
  14517. protocol: 'converting',
  14518. fn: function (){
  14519. var self=this;
  14520. return $core.withContext(function($ctx1) {
  14521. return $recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  14522. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  14523. },
  14524. args: [],
  14525. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  14526. referencedClasses: [],
  14527. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  14528. }),
  14529. $globals.CharacterArray);
  14530. $core.addMethod(
  14531. $core.method({
  14532. selector: "at:put:",
  14533. protocol: 'accessing',
  14534. fn: function (anIndex,anObject){
  14535. var self=this;
  14536. return $core.withContext(function($ctx1) {
  14537. self._errorReadOnly();
  14538. return self;
  14539. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  14540. },
  14541. args: ["anIndex", "anObject"],
  14542. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  14543. referencedClasses: [],
  14544. messageSends: ["errorReadOnly"]
  14545. }),
  14546. $globals.CharacterArray);
  14547. $core.addMethod(
  14548. $core.method({
  14549. selector: "errorReadOnly",
  14550. protocol: 'error handling',
  14551. fn: function (){
  14552. var self=this;
  14553. return $core.withContext(function($ctx1) {
  14554. self._error_("Object is read-only");
  14555. return self;
  14556. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  14557. },
  14558. args: [],
  14559. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  14560. referencedClasses: [],
  14561. messageSends: ["error:"]
  14562. }),
  14563. $globals.CharacterArray);
  14564. $core.addMethod(
  14565. $core.method({
  14566. selector: "printOn:",
  14567. protocol: 'printing',
  14568. fn: function (aStream){
  14569. var self=this;
  14570. return $core.withContext(function($ctx1) {
  14571. $recv(self._asString())._printOn_(aStream);
  14572. return self;
  14573. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  14574. },
  14575. args: ["aStream"],
  14576. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  14577. referencedClasses: [],
  14578. messageSends: ["printOn:", "asString"]
  14579. }),
  14580. $globals.CharacterArray);
  14581. $core.addMethod(
  14582. $core.method({
  14583. selector: "putOn:",
  14584. protocol: 'streaming',
  14585. fn: function (aStream){
  14586. var self=this;
  14587. return $core.withContext(function($ctx1) {
  14588. $recv(aStream)._nextPutString_(self);
  14589. return self;
  14590. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  14591. },
  14592. args: ["aStream"],
  14593. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  14594. referencedClasses: [],
  14595. messageSends: ["nextPutString:"]
  14596. }),
  14597. $globals.CharacterArray);
  14598. $core.addMethod(
  14599. $core.method({
  14600. selector: "remove:",
  14601. protocol: 'adding/removing',
  14602. fn: function (anObject){
  14603. var self=this;
  14604. return $core.withContext(function($ctx1) {
  14605. self._errorReadOnly();
  14606. return self;
  14607. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  14608. },
  14609. args: ["anObject"],
  14610. source: "remove: anObject\x0a\x09self errorReadOnly",
  14611. referencedClasses: [],
  14612. messageSends: ["errorReadOnly"]
  14613. }),
  14614. $globals.CharacterArray);
  14615. $core.addMethod(
  14616. $core.method({
  14617. selector: "fromString:",
  14618. protocol: 'instance creation',
  14619. fn: function (aString){
  14620. var self=this;
  14621. return $core.withContext(function($ctx1) {
  14622. self._subclassResponsibility();
  14623. return self;
  14624. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  14625. },
  14626. args: ["aString"],
  14627. source: "fromString: aString\x0a\x09self subclassResponsibility",
  14628. referencedClasses: [],
  14629. messageSends: ["subclassResponsibility"]
  14630. }),
  14631. $globals.CharacterArray.klass);
  14632. $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections');
  14633. $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 >> #,`";
  14634. $core.addMethod(
  14635. $core.method({
  14636. selector: ",",
  14637. protocol: 'copying',
  14638. fn: function (aString){
  14639. var self=this;
  14640. return $core.withContext(function($ctx1) {
  14641. return String(self) + aString;
  14642. return self;
  14643. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  14644. },
  14645. args: ["aString"],
  14646. source: ", aString\x0a\x09<return String(self) + aString>",
  14647. referencedClasses: [],
  14648. messageSends: []
  14649. }),
  14650. $globals.String);
  14651. $core.addMethod(
  14652. $core.method({
  14653. selector: "<",
  14654. protocol: 'comparing',
  14655. fn: function (aString){
  14656. var self=this;
  14657. return $core.withContext(function($ctx1) {
  14658. return String(self) < aString._asString();
  14659. return self;
  14660. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  14661. },
  14662. args: ["aString"],
  14663. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  14664. referencedClasses: [],
  14665. messageSends: []
  14666. }),
  14667. $globals.String);
  14668. $core.addMethod(
  14669. $core.method({
  14670. selector: "<=",
  14671. protocol: 'comparing',
  14672. fn: function (aString){
  14673. var self=this;
  14674. return $core.withContext(function($ctx1) {
  14675. return String(self) <= aString._asString();
  14676. return self;
  14677. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  14678. },
  14679. args: ["aString"],
  14680. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  14681. referencedClasses: [],
  14682. messageSends: []
  14683. }),
  14684. $globals.String);
  14685. $core.addMethod(
  14686. $core.method({
  14687. selector: "=",
  14688. protocol: 'comparing',
  14689. fn: function (aString){
  14690. var self=this;
  14691. return $core.withContext(function($ctx1) {
  14692. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  14693. return self;
  14694. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  14695. },
  14696. args: ["aString"],
  14697. source: "= aString\x0a<return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())>",
  14698. referencedClasses: [],
  14699. messageSends: []
  14700. }),
  14701. $globals.String);
  14702. $core.addMethod(
  14703. $core.method({
  14704. selector: "==",
  14705. protocol: 'comparing',
  14706. fn: function (aString){
  14707. var self=this;
  14708. return $core.withContext(function($ctx1) {
  14709. if (typeof aString === "string") return String(self) === aString;
  14710. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  14711. else return false;;
  14712. return self;
  14713. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  14714. },
  14715. args: ["aString"],
  14716. 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>",
  14717. referencedClasses: [],
  14718. messageSends: []
  14719. }),
  14720. $globals.String);
  14721. $core.addMethod(
  14722. $core.method({
  14723. selector: ">",
  14724. protocol: 'comparing',
  14725. fn: function (aString){
  14726. var self=this;
  14727. return $core.withContext(function($ctx1) {
  14728. return String(self) > aString._asString();
  14729. return self;
  14730. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  14731. },
  14732. args: ["aString"],
  14733. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  14734. referencedClasses: [],
  14735. messageSends: []
  14736. }),
  14737. $globals.String);
  14738. $core.addMethod(
  14739. $core.method({
  14740. selector: ">=",
  14741. protocol: 'comparing',
  14742. fn: function (aString){
  14743. var self=this;
  14744. return $core.withContext(function($ctx1) {
  14745. return String(self) >= aString._asString();
  14746. return self;
  14747. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  14748. },
  14749. args: ["aString"],
  14750. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  14751. referencedClasses: [],
  14752. messageSends: []
  14753. }),
  14754. $globals.String);
  14755. $core.addMethod(
  14756. $core.method({
  14757. selector: "asJSON",
  14758. protocol: 'converting',
  14759. fn: function (){
  14760. var self=this;
  14761. return self;
  14762. },
  14763. args: [],
  14764. source: "asJSON\x0a\x09^ self",
  14765. referencedClasses: [],
  14766. messageSends: []
  14767. }),
  14768. $globals.String);
  14769. $core.addMethod(
  14770. $core.method({
  14771. selector: "asJavaScriptMethodName",
  14772. protocol: 'converting',
  14773. fn: function (){
  14774. var self=this;
  14775. return $core.withContext(function($ctx1) {
  14776. return $core.st2js(self);
  14777. return self;
  14778. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  14779. },
  14780. args: [],
  14781. source: "asJavaScriptMethodName\x0a\x09<return $core.st2js(self)>",
  14782. referencedClasses: [],
  14783. messageSends: []
  14784. }),
  14785. $globals.String);
  14786. $core.addMethod(
  14787. $core.method({
  14788. selector: "asJavascript",
  14789. protocol: 'converting',
  14790. fn: function (){
  14791. var self=this;
  14792. return $core.withContext(function($ctx1) {
  14793. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  14794. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  14795. else
  14796. return "\"" + self + "\"";
  14797. ;
  14798. return self;
  14799. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  14800. },
  14801. args: [],
  14802. 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>",
  14803. referencedClasses: [],
  14804. messageSends: []
  14805. }),
  14806. $globals.String);
  14807. $core.addMethod(
  14808. $core.method({
  14809. selector: "asLowercase",
  14810. protocol: 'converting',
  14811. fn: function (){
  14812. var self=this;
  14813. return $core.withContext(function($ctx1) {
  14814. return self.toLowerCase();
  14815. return self;
  14816. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  14817. },
  14818. args: [],
  14819. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  14820. referencedClasses: [],
  14821. messageSends: []
  14822. }),
  14823. $globals.String);
  14824. $core.addMethod(
  14825. $core.method({
  14826. selector: "asMutator",
  14827. protocol: 'converting',
  14828. fn: function (){
  14829. var self=this;
  14830. return $core.withContext(function($ctx1) {
  14831. var $1;
  14832. $1=$recv(self._last()).__eq(":");
  14833. if(!$core.assert($1)){
  14834. return self.__comma(":");
  14835. };
  14836. return self;
  14837. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  14838. },
  14839. args: [],
  14840. 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",
  14841. referencedClasses: [],
  14842. messageSends: ["ifFalse:", "=", "last", ","]
  14843. }),
  14844. $globals.String);
  14845. $core.addMethod(
  14846. $core.method({
  14847. selector: "asNumber",
  14848. protocol: 'converting',
  14849. fn: function (){
  14850. var self=this;
  14851. return $core.withContext(function($ctx1) {
  14852. return Number(self);
  14853. return self;
  14854. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  14855. },
  14856. args: [],
  14857. source: "asNumber\x0a\x09<return Number(self)>",
  14858. referencedClasses: [],
  14859. messageSends: []
  14860. }),
  14861. $globals.String);
  14862. $core.addMethod(
  14863. $core.method({
  14864. selector: "asRegexp",
  14865. protocol: 'converting',
  14866. fn: function (){
  14867. var self=this;
  14868. return $core.withContext(function($ctx1) {
  14869. return $recv($globals.RegularExpression)._fromString_(self);
  14870. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  14871. },
  14872. args: [],
  14873. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  14874. referencedClasses: ["RegularExpression"],
  14875. messageSends: ["fromString:"]
  14876. }),
  14877. $globals.String);
  14878. $core.addMethod(
  14879. $core.method({
  14880. selector: "asString",
  14881. protocol: 'converting',
  14882. fn: function (){
  14883. var self=this;
  14884. return self;
  14885. },
  14886. args: [],
  14887. source: "asString\x0a\x09^ self",
  14888. referencedClasses: [],
  14889. messageSends: []
  14890. }),
  14891. $globals.String);
  14892. $core.addMethod(
  14893. $core.method({
  14894. selector: "asSymbol",
  14895. protocol: 'converting',
  14896. fn: function (){
  14897. var self=this;
  14898. return self;
  14899. },
  14900. args: [],
  14901. source: "asSymbol\x0a\x09^ self",
  14902. referencedClasses: [],
  14903. messageSends: []
  14904. }),
  14905. $globals.String);
  14906. $core.addMethod(
  14907. $core.method({
  14908. selector: "asUppercase",
  14909. protocol: 'converting',
  14910. fn: function (){
  14911. var self=this;
  14912. return $core.withContext(function($ctx1) {
  14913. return self.toUpperCase();
  14914. return self;
  14915. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  14916. },
  14917. args: [],
  14918. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  14919. referencedClasses: [],
  14920. messageSends: []
  14921. }),
  14922. $globals.String);
  14923. $core.addMethod(
  14924. $core.method({
  14925. selector: "asciiValue",
  14926. protocol: 'accessing',
  14927. fn: function (){
  14928. var self=this;
  14929. return $core.withContext(function($ctx1) {
  14930. return self.charCodeAt(0);;
  14931. return self;
  14932. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  14933. },
  14934. args: [],
  14935. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  14936. referencedClasses: [],
  14937. messageSends: []
  14938. }),
  14939. $globals.String);
  14940. $core.addMethod(
  14941. $core.method({
  14942. selector: "at:ifAbsent:",
  14943. protocol: 'accessing',
  14944. fn: function (anIndex,aBlock){
  14945. var self=this;
  14946. return $core.withContext(function($ctx1) {
  14947. return String(self)[anIndex - 1] || aBlock._value();
  14948. return self;
  14949. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  14950. },
  14951. args: ["anIndex", "aBlock"],
  14952. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  14953. referencedClasses: [],
  14954. messageSends: []
  14955. }),
  14956. $globals.String);
  14957. $core.addMethod(
  14958. $core.method({
  14959. selector: "at:ifPresent:ifAbsent:",
  14960. protocol: 'accessing',
  14961. fn: function (anIndex,aBlock,anotherBlock){
  14962. var self=this;
  14963. return $core.withContext(function($ctx1) {
  14964. var result = String(self)[anIndex - 1];
  14965. return result ? aBlock._value_(result) : anotherBlock._value();
  14966. ;
  14967. return self;
  14968. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  14969. },
  14970. args: ["anIndex", "aBlock", "anotherBlock"],
  14971. 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>",
  14972. referencedClasses: [],
  14973. messageSends: []
  14974. }),
  14975. $globals.String);
  14976. $core.addMethod(
  14977. $core.method({
  14978. selector: "capitalized",
  14979. protocol: 'converting',
  14980. fn: function (){
  14981. var self=this;
  14982. return $core.withContext(function($ctx1) {
  14983. var $1;
  14984. $1=self._isEmpty();
  14985. if($core.assert($1)){
  14986. return self;
  14987. } else {
  14988. return $recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  14989. };
  14990. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  14991. },
  14992. args: [],
  14993. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  14994. referencedClasses: [],
  14995. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"]
  14996. }),
  14997. $globals.String);
  14998. $core.addMethod(
  14999. $core.method({
  15000. selector: "charCodeAt:",
  15001. protocol: 'accessing',
  15002. fn: function (anInteger){
  15003. var self=this;
  15004. return $core.withContext(function($ctx1) {
  15005. return self.charCodeAt(anInteger - 1);
  15006. return self;
  15007. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  15008. },
  15009. args: ["anInteger"],
  15010. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  15011. referencedClasses: [],
  15012. messageSends: []
  15013. }),
  15014. $globals.String);
  15015. $core.addMethod(
  15016. $core.method({
  15017. selector: "copyFrom:to:",
  15018. protocol: 'copying',
  15019. fn: function (anIndex,anotherIndex){
  15020. var self=this;
  15021. return $core.withContext(function($ctx1) {
  15022. return self.substring(anIndex - 1, anotherIndex);
  15023. return self;
  15024. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  15025. },
  15026. args: ["anIndex", "anotherIndex"],
  15027. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  15028. referencedClasses: [],
  15029. messageSends: []
  15030. }),
  15031. $globals.String);
  15032. $core.addMethod(
  15033. $core.method({
  15034. selector: "crlfSanitized",
  15035. protocol: 'converting',
  15036. fn: function (){
  15037. var self=this;
  15038. return $core.withContext(function($ctx1) {
  15039. return $recv(self._lines())._join_($recv($globals.String)._lf());
  15040. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  15041. },
  15042. args: [],
  15043. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  15044. referencedClasses: ["String"],
  15045. messageSends: ["join:", "lines", "lf"]
  15046. }),
  15047. $globals.String);
  15048. $core.addMethod(
  15049. $core.method({
  15050. selector: "deepCopy",
  15051. protocol: 'copying',
  15052. fn: function (){
  15053. var self=this;
  15054. return $core.withContext(function($ctx1) {
  15055. return self._shallowCopy();
  15056. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  15057. },
  15058. args: [],
  15059. source: "deepCopy\x0a\x09^ self shallowCopy",
  15060. referencedClasses: [],
  15061. messageSends: ["shallowCopy"]
  15062. }),
  15063. $globals.String);
  15064. $core.addMethod(
  15065. $core.method({
  15066. selector: "escaped",
  15067. protocol: 'converting',
  15068. fn: function (){
  15069. var self=this;
  15070. return $core.withContext(function($ctx1) {
  15071. return escape(self);
  15072. return self;
  15073. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  15074. },
  15075. args: [],
  15076. source: "escaped\x0a\x09<return escape(self)>",
  15077. referencedClasses: [],
  15078. messageSends: []
  15079. }),
  15080. $globals.String);
  15081. $core.addMethod(
  15082. $core.method({
  15083. selector: "includesSubString:",
  15084. protocol: 'testing',
  15085. fn: function (subString){
  15086. var self=this;
  15087. return $core.withContext(function($ctx1) {
  15088. return self.indexOf(subString) != -1;
  15089. return self;
  15090. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  15091. },
  15092. args: ["subString"],
  15093. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  15094. referencedClasses: [],
  15095. messageSends: []
  15096. }),
  15097. $globals.String);
  15098. $core.addMethod(
  15099. $core.method({
  15100. selector: "isCapitalized",
  15101. protocol: 'testing',
  15102. fn: function (){
  15103. var self=this;
  15104. return $core.withContext(function($ctx1) {
  15105. var $2,$1;
  15106. $2=self._first();
  15107. $ctx1.sendIdx["first"]=1;
  15108. $1=$recv($2)._asUppercase();
  15109. return $recv($1).__eq_eq(self._first());
  15110. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  15111. },
  15112. args: [],
  15113. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  15114. referencedClasses: [],
  15115. messageSends: ["==", "asUppercase", "first"]
  15116. }),
  15117. $globals.String);
  15118. $core.addMethod(
  15119. $core.method({
  15120. selector: "isImmutable",
  15121. protocol: 'testing',
  15122. fn: function (){
  15123. var self=this;
  15124. return true;
  15125. },
  15126. args: [],
  15127. source: "isImmutable\x0a\x09^ true",
  15128. referencedClasses: [],
  15129. messageSends: []
  15130. }),
  15131. $globals.String);
  15132. $core.addMethod(
  15133. $core.method({
  15134. selector: "isString",
  15135. protocol: 'testing',
  15136. fn: function (){
  15137. var self=this;
  15138. return true;
  15139. },
  15140. args: [],
  15141. source: "isString\x0a\x09^ true",
  15142. referencedClasses: [],
  15143. messageSends: []
  15144. }),
  15145. $globals.String);
  15146. $core.addMethod(
  15147. $core.method({
  15148. selector: "isVowel",
  15149. protocol: 'testing',
  15150. fn: function (){
  15151. var self=this;
  15152. return $core.withContext(function($ctx1) {
  15153. return $recv($recv(self._size()).__eq((1)))._and_((function(){
  15154. return $core.withContext(function($ctx2) {
  15155. return "aeiou"._includes_(self._asLowercase());
  15156. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15157. }));
  15158. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  15159. },
  15160. args: [],
  15161. 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 ]",
  15162. referencedClasses: [],
  15163. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  15164. }),
  15165. $globals.String);
  15166. $core.addMethod(
  15167. $core.method({
  15168. selector: "join:",
  15169. protocol: 'split join',
  15170. fn: function (aCollection){
  15171. var self=this;
  15172. return $core.withContext(function($ctx1) {
  15173. return $recv($globals.String)._streamContents_((function(stream){
  15174. return $core.withContext(function($ctx2) {
  15175. return $recv(aCollection)._do_separatedBy_((function(each){
  15176. return $core.withContext(function($ctx3) {
  15177. return $recv(stream)._nextPutAll_($recv(each)._asString());
  15178. $ctx3.sendIdx["nextPutAll:"]=1;
  15179. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  15180. }),(function(){
  15181. return $core.withContext(function($ctx3) {
  15182. return $recv(stream)._nextPutAll_(self);
  15183. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  15184. }));
  15185. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15186. }));
  15187. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  15188. },
  15189. args: ["aCollection"],
  15190. 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 ]]",
  15191. referencedClasses: ["String"],
  15192. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  15193. }),
  15194. $globals.String);
  15195. $core.addMethod(
  15196. $core.method({
  15197. selector: "lineIndicesDo:",
  15198. protocol: 'split join',
  15199. fn: function (aBlock){
  15200. var self=this;
  15201. var cr,lf,start,sz,nextLF,nextCR;
  15202. return $core.withContext(function($ctx1) {
  15203. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  15204. var $early={};
  15205. try {
  15206. start=(1);
  15207. sz=self._size();
  15208. cr=$recv($globals.String)._cr();
  15209. nextCR=self._indexOf_startingAt_(cr,(1));
  15210. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  15211. lf=$recv($globals.String)._lf();
  15212. nextLF=self._indexOf_startingAt_(lf,(1));
  15213. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  15214. $recv((function(){
  15215. return $core.withContext(function($ctx2) {
  15216. return $recv(start).__lt_eq(sz);
  15217. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15218. }))._whileTrue_((function(){
  15219. return $core.withContext(function($ctx2) {
  15220. $2=$recv(nextLF).__eq((0));
  15221. $ctx2.sendIdx["="]=1;
  15222. $1=$recv($2)._and_((function(){
  15223. return $core.withContext(function($ctx3) {
  15224. return $recv(nextCR).__eq((0));
  15225. $ctx3.sendIdx["="]=2;
  15226. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  15227. }));
  15228. $ctx2.sendIdx["and:"]=1;
  15229. if($core.assert($1)){
  15230. $recv(aBlock)._value_value_value_(start,sz,sz);
  15231. $ctx2.sendIdx["value:value:value:"]=1;
  15232. throw $early=[self];
  15233. };
  15234. $4=$recv(nextCR).__eq((0));
  15235. $ctx2.sendIdx["="]=3;
  15236. $3=$recv($4)._or_((function(){
  15237. return $core.withContext(function($ctx3) {
  15238. $5=(0).__lt(nextLF);
  15239. $ctx3.sendIdx["<"]=1;
  15240. return $recv($5)._and_((function(){
  15241. return $core.withContext(function($ctx4) {
  15242. return $recv(nextLF).__lt(nextCR);
  15243. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  15244. }));
  15245. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  15246. }));
  15247. if($core.assert($3)){
  15248. $6=start;
  15249. $7=$recv(nextLF).__minus((1));
  15250. $ctx2.sendIdx["-"]=1;
  15251. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  15252. $ctx2.sendIdx["value:value:value:"]=2;
  15253. start=(1).__plus(nextLF);
  15254. $ctx2.sendIdx["+"]=1;
  15255. start;
  15256. nextLF=self._indexOf_startingAt_(lf,start);
  15257. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  15258. return nextLF;
  15259. } else {
  15260. $9=(1).__plus(nextCR);
  15261. $ctx2.sendIdx["+"]=2;
  15262. $8=$recv($9).__eq(nextLF);
  15263. if($core.assert($8)){
  15264. $10=start;
  15265. $11=$recv(nextCR).__minus((1));
  15266. $ctx2.sendIdx["-"]=2;
  15267. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  15268. $ctx2.sendIdx["value:value:value:"]=3;
  15269. start=(1).__plus(nextLF);
  15270. $ctx2.sendIdx["+"]=3;
  15271. start;
  15272. nextCR=self._indexOf_startingAt_(cr,start);
  15273. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  15274. nextCR;
  15275. nextLF=self._indexOf_startingAt_(lf,start);
  15276. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  15277. return nextLF;
  15278. } else {
  15279. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  15280. start=(1).__plus(nextCR);
  15281. start;
  15282. nextCR=self._indexOf_startingAt_(cr,start);
  15283. return nextCR;
  15284. };
  15285. };
  15286. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  15287. }));
  15288. return self;
  15289. }
  15290. catch(e) {if(e===$early)return e[0]; throw e}
  15291. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  15292. },
  15293. args: ["aBlock"],
  15294. 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 ] ]]",
  15295. referencedClasses: ["String"],
  15296. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  15297. }),
  15298. $globals.String);
  15299. $core.addMethod(
  15300. $core.method({
  15301. selector: "lineNumber:",
  15302. protocol: 'split join',
  15303. fn: function (anIndex){
  15304. var self=this;
  15305. var lineCount;
  15306. return $core.withContext(function($ctx1) {
  15307. var $2,$1;
  15308. var $early={};
  15309. try {
  15310. lineCount=(0);
  15311. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  15312. return $core.withContext(function($ctx2) {
  15313. lineCount=$recv(lineCount).__plus((1));
  15314. $2=lineCount;
  15315. $1=$recv($2).__eq(anIndex);
  15316. if($core.assert($1)){
  15317. throw $early=[self._copyFrom_to_(start,endWithoutDelimiters)];
  15318. };
  15319. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  15320. }));
  15321. return nil;
  15322. }
  15323. catch(e) {if(e===$early)return e[0]; throw e}
  15324. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  15325. },
  15326. args: ["anIndex"],
  15327. 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",
  15328. referencedClasses: [],
  15329. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  15330. }),
  15331. $globals.String);
  15332. $core.addMethod(
  15333. $core.method({
  15334. selector: "lines",
  15335. protocol: 'split join',
  15336. fn: function (){
  15337. var self=this;
  15338. return $core.withContext(function($ctx1) {
  15339. var result = self.split(/\r\n|\r|\n/);
  15340. if (!result[result.length-1]) result.pop();
  15341. return result;;
  15342. return self;
  15343. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  15344. },
  15345. args: [],
  15346. 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>",
  15347. referencedClasses: [],
  15348. messageSends: []
  15349. }),
  15350. $globals.String);
  15351. $core.addMethod(
  15352. $core.method({
  15353. selector: "linesDo:",
  15354. protocol: 'split join',
  15355. fn: function (aBlock){
  15356. var self=this;
  15357. return $core.withContext(function($ctx1) {
  15358. $recv(self._lines())._do_(aBlock);
  15359. return self;
  15360. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  15361. },
  15362. args: ["aBlock"],
  15363. 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",
  15364. referencedClasses: [],
  15365. messageSends: ["do:", "lines"]
  15366. }),
  15367. $globals.String);
  15368. $core.addMethod(
  15369. $core.method({
  15370. selector: "match:",
  15371. protocol: 'regular expressions',
  15372. fn: function (aRegexp){
  15373. var self=this;
  15374. return $core.withContext(function($ctx1) {
  15375. return self.search(aRegexp) != -1;
  15376. return self;
  15377. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  15378. },
  15379. args: ["aRegexp"],
  15380. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  15381. referencedClasses: [],
  15382. messageSends: []
  15383. }),
  15384. $globals.String);
  15385. $core.addMethod(
  15386. $core.method({
  15387. selector: "matchesOf:",
  15388. protocol: 'regular expressions',
  15389. fn: function (aRegularExpression){
  15390. var self=this;
  15391. return $core.withContext(function($ctx1) {
  15392. return self.match(aRegularExpression);
  15393. return self;
  15394. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  15395. },
  15396. args: ["aRegularExpression"],
  15397. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  15398. referencedClasses: [],
  15399. messageSends: []
  15400. }),
  15401. $globals.String);
  15402. $core.addMethod(
  15403. $core.method({
  15404. selector: "numericallyIndexable",
  15405. protocol: 'private',
  15406. fn: function (){
  15407. var self=this;
  15408. return $core.withContext(function($ctx1) {
  15409. return String(self);
  15410. return self;
  15411. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  15412. },
  15413. args: [],
  15414. source: "numericallyIndexable\x0a\x09<return String(self)>",
  15415. referencedClasses: [],
  15416. messageSends: []
  15417. }),
  15418. $globals.String);
  15419. $core.addMethod(
  15420. $core.method({
  15421. selector: "printNl",
  15422. protocol: 'printing',
  15423. fn: function (){
  15424. var self=this;
  15425. return $core.withContext(function($ctx1) {
  15426. console.log(self);
  15427. return self;
  15428. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  15429. },
  15430. args: [],
  15431. source: "printNl\x0a\x09<console.log(self)>",
  15432. referencedClasses: [],
  15433. messageSends: []
  15434. }),
  15435. $globals.String);
  15436. $core.addMethod(
  15437. $core.method({
  15438. selector: "printOn:",
  15439. protocol: 'printing',
  15440. fn: function (aStream){
  15441. var self=this;
  15442. return $core.withContext(function($ctx1) {
  15443. $recv(aStream)._nextPutAll_("'");
  15444. $ctx1.sendIdx["nextPutAll:"]=1;
  15445. $recv(aStream)._nextPutAll_(self);
  15446. $ctx1.sendIdx["nextPutAll:"]=2;
  15447. $recv(aStream)._nextPutAll_("'");
  15448. return self;
  15449. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  15450. },
  15451. args: ["aStream"],
  15452. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  15453. referencedClasses: [],
  15454. messageSends: ["nextPutAll:"]
  15455. }),
  15456. $globals.String);
  15457. $core.addMethod(
  15458. $core.method({
  15459. selector: "replace:with:",
  15460. protocol: 'regular expressions',
  15461. fn: function (aString,anotherString){
  15462. var self=this;
  15463. return $core.withContext(function($ctx1) {
  15464. return self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  15465. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  15466. },
  15467. args: ["aString", "anotherString"],
  15468. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  15469. referencedClasses: ["RegularExpression"],
  15470. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  15471. }),
  15472. $globals.String);
  15473. $core.addMethod(
  15474. $core.method({
  15475. selector: "replaceRegexp:with:",
  15476. protocol: 'regular expressions',
  15477. fn: function (aRegexp,aString){
  15478. var self=this;
  15479. return $core.withContext(function($ctx1) {
  15480. return self.replace(aRegexp, aString);
  15481. return self;
  15482. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  15483. },
  15484. args: ["aRegexp", "aString"],
  15485. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  15486. referencedClasses: [],
  15487. messageSends: []
  15488. }),
  15489. $globals.String);
  15490. $core.addMethod(
  15491. $core.method({
  15492. selector: "reversed",
  15493. protocol: 'converting',
  15494. fn: function (){
  15495. var self=this;
  15496. return $core.withContext(function($ctx1) {
  15497. return self.split("").reverse().join("");
  15498. return self;
  15499. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  15500. },
  15501. args: [],
  15502. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  15503. referencedClasses: [],
  15504. messageSends: []
  15505. }),
  15506. $globals.String);
  15507. $core.addMethod(
  15508. $core.method({
  15509. selector: "shallowCopy",
  15510. protocol: 'copying',
  15511. fn: function (){
  15512. var self=this;
  15513. return self;
  15514. },
  15515. args: [],
  15516. source: "shallowCopy\x0a\x09^ self",
  15517. referencedClasses: [],
  15518. messageSends: []
  15519. }),
  15520. $globals.String);
  15521. $core.addMethod(
  15522. $core.method({
  15523. selector: "size",
  15524. protocol: 'accessing',
  15525. fn: function (){
  15526. var self=this;
  15527. return $core.withContext(function($ctx1) {
  15528. return self.length;
  15529. return self;
  15530. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  15531. },
  15532. args: [],
  15533. source: "size\x0a\x09<return self.length>",
  15534. referencedClasses: [],
  15535. messageSends: []
  15536. }),
  15537. $globals.String);
  15538. $core.addMethod(
  15539. $core.method({
  15540. selector: "subStrings:",
  15541. protocol: 'split join',
  15542. fn: function (aString){
  15543. var self=this;
  15544. return $core.withContext(function($ctx1) {
  15545. return self._tokenize_(aString);
  15546. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  15547. },
  15548. args: ["aString"],
  15549. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  15550. referencedClasses: [],
  15551. messageSends: ["tokenize:"]
  15552. }),
  15553. $globals.String);
  15554. $core.addMethod(
  15555. $core.method({
  15556. selector: "tokenize:",
  15557. protocol: 'split join',
  15558. fn: function (aString){
  15559. var self=this;
  15560. return $core.withContext(function($ctx1) {
  15561. return self.split(aString);
  15562. return self;
  15563. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  15564. },
  15565. args: ["aString"],
  15566. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  15567. referencedClasses: [],
  15568. messageSends: []
  15569. }),
  15570. $globals.String);
  15571. $core.addMethod(
  15572. $core.method({
  15573. selector: "trimBoth",
  15574. protocol: 'regular expressions',
  15575. fn: function (){
  15576. var self=this;
  15577. return $core.withContext(function($ctx1) {
  15578. return self._trimBoth_("\x5cs");
  15579. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  15580. },
  15581. args: [],
  15582. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  15583. referencedClasses: [],
  15584. messageSends: ["trimBoth:"]
  15585. }),
  15586. $globals.String);
  15587. $core.addMethod(
  15588. $core.method({
  15589. selector: "trimBoth:",
  15590. protocol: 'regular expressions',
  15591. fn: function (separators){
  15592. var self=this;
  15593. return $core.withContext(function($ctx1) {
  15594. return $recv(self._trimLeft_(separators))._trimRight_(separators);
  15595. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  15596. },
  15597. args: ["separators"],
  15598. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  15599. referencedClasses: [],
  15600. messageSends: ["trimRight:", "trimLeft:"]
  15601. }),
  15602. $globals.String);
  15603. $core.addMethod(
  15604. $core.method({
  15605. selector: "trimLeft",
  15606. protocol: 'regular expressions',
  15607. fn: function (){
  15608. var self=this;
  15609. return $core.withContext(function($ctx1) {
  15610. return self._trimLeft_("\x5cs");
  15611. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  15612. },
  15613. args: [],
  15614. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  15615. referencedClasses: [],
  15616. messageSends: ["trimLeft:"]
  15617. }),
  15618. $globals.String);
  15619. $core.addMethod(
  15620. $core.method({
  15621. selector: "trimLeft:",
  15622. protocol: 'regular expressions',
  15623. fn: function (separators){
  15624. var self=this;
  15625. return $core.withContext(function($ctx1) {
  15626. var $2,$1;
  15627. $2=$recv("^[".__comma(separators)).__comma("]+");
  15628. $ctx1.sendIdx[","]=1;
  15629. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  15630. return self._replaceRegexp_with_($1,"");
  15631. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  15632. },
  15633. args: ["separators"],
  15634. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  15635. referencedClasses: ["RegularExpression"],
  15636. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15637. }),
  15638. $globals.String);
  15639. $core.addMethod(
  15640. $core.method({
  15641. selector: "trimRight",
  15642. protocol: 'regular expressions',
  15643. fn: function (){
  15644. var self=this;
  15645. return $core.withContext(function($ctx1) {
  15646. return self._trimRight_("\x5cs");
  15647. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  15648. },
  15649. args: [],
  15650. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  15651. referencedClasses: [],
  15652. messageSends: ["trimRight:"]
  15653. }),
  15654. $globals.String);
  15655. $core.addMethod(
  15656. $core.method({
  15657. selector: "trimRight:",
  15658. protocol: 'regular expressions',
  15659. fn: function (separators){
  15660. var self=this;
  15661. return $core.withContext(function($ctx1) {
  15662. var $2,$1;
  15663. $2=$recv("[".__comma(separators)).__comma("]+$");
  15664. $ctx1.sendIdx[","]=1;
  15665. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  15666. return self._replaceRegexp_with_($1,"");
  15667. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  15668. },
  15669. args: ["separators"],
  15670. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  15671. referencedClasses: ["RegularExpression"],
  15672. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  15673. }),
  15674. $globals.String);
  15675. $core.addMethod(
  15676. $core.method({
  15677. selector: "unescaped",
  15678. protocol: 'converting',
  15679. fn: function (){
  15680. var self=this;
  15681. return $core.withContext(function($ctx1) {
  15682. return unescape(self);
  15683. return self;
  15684. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  15685. },
  15686. args: [],
  15687. source: "unescaped\x0a\x09<return unescape(self)>",
  15688. referencedClasses: [],
  15689. messageSends: []
  15690. }),
  15691. $globals.String);
  15692. $core.addMethod(
  15693. $core.method({
  15694. selector: "uriComponentDecoded",
  15695. protocol: 'converting',
  15696. fn: function (){
  15697. var self=this;
  15698. return $core.withContext(function($ctx1) {
  15699. return decodeURIComponent(self);
  15700. return self;
  15701. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  15702. },
  15703. args: [],
  15704. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  15705. referencedClasses: [],
  15706. messageSends: []
  15707. }),
  15708. $globals.String);
  15709. $core.addMethod(
  15710. $core.method({
  15711. selector: "uriComponentEncoded",
  15712. protocol: 'converting',
  15713. fn: function (){
  15714. var self=this;
  15715. return $core.withContext(function($ctx1) {
  15716. return encodeURIComponent(self);
  15717. return self;
  15718. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  15719. },
  15720. args: [],
  15721. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  15722. referencedClasses: [],
  15723. messageSends: []
  15724. }),
  15725. $globals.String);
  15726. $core.addMethod(
  15727. $core.method({
  15728. selector: "uriDecoded",
  15729. protocol: 'converting',
  15730. fn: function (){
  15731. var self=this;
  15732. return $core.withContext(function($ctx1) {
  15733. return decodeURI(self);
  15734. return self;
  15735. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  15736. },
  15737. args: [],
  15738. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  15739. referencedClasses: [],
  15740. messageSends: []
  15741. }),
  15742. $globals.String);
  15743. $core.addMethod(
  15744. $core.method({
  15745. selector: "uriEncoded",
  15746. protocol: 'converting',
  15747. fn: function (){
  15748. var self=this;
  15749. return $core.withContext(function($ctx1) {
  15750. return encodeURI(self);
  15751. return self;
  15752. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  15753. },
  15754. args: [],
  15755. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  15756. referencedClasses: [],
  15757. messageSends: []
  15758. }),
  15759. $globals.String);
  15760. $core.addMethod(
  15761. $core.method({
  15762. selector: "value:",
  15763. protocol: 'evaluating',
  15764. fn: function (anObject){
  15765. var self=this;
  15766. return $core.withContext(function($ctx1) {
  15767. return $recv(anObject)._perform_(self);
  15768. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  15769. },
  15770. args: ["anObject"],
  15771. source: "value: anObject \x0a\x09^ anObject perform: self",
  15772. referencedClasses: [],
  15773. messageSends: ["perform:"]
  15774. }),
  15775. $globals.String);
  15776. $core.addMethod(
  15777. $core.method({
  15778. selector: "cr",
  15779. protocol: 'accessing',
  15780. fn: function (){
  15781. var self=this;
  15782. return $core.withContext(function($ctx1) {
  15783. return '\r';
  15784. return self;
  15785. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  15786. },
  15787. args: [],
  15788. source: "cr\x0a\x09<return '\x5cr'>",
  15789. referencedClasses: [],
  15790. messageSends: []
  15791. }),
  15792. $globals.String.klass);
  15793. $core.addMethod(
  15794. $core.method({
  15795. selector: "crlf",
  15796. protocol: 'accessing',
  15797. fn: function (){
  15798. var self=this;
  15799. return $core.withContext(function($ctx1) {
  15800. return '\r\n';
  15801. return self;
  15802. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  15803. },
  15804. args: [],
  15805. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  15806. referencedClasses: [],
  15807. messageSends: []
  15808. }),
  15809. $globals.String.klass);
  15810. $core.addMethod(
  15811. $core.method({
  15812. selector: "esc",
  15813. protocol: 'accessing',
  15814. fn: function (){
  15815. var self=this;
  15816. return $core.withContext(function($ctx1) {
  15817. return self._fromCharCode_((27));
  15818. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  15819. },
  15820. args: [],
  15821. source: "esc\x0a\x09^ self fromCharCode: 27",
  15822. referencedClasses: [],
  15823. messageSends: ["fromCharCode:"]
  15824. }),
  15825. $globals.String.klass);
  15826. $core.addMethod(
  15827. $core.method({
  15828. selector: "fromCharCode:",
  15829. protocol: 'instance creation',
  15830. fn: function (anInteger){
  15831. var self=this;
  15832. return $core.withContext(function($ctx1) {
  15833. return String.fromCharCode(anInteger);
  15834. return self;
  15835. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  15836. },
  15837. args: ["anInteger"],
  15838. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  15839. referencedClasses: [],
  15840. messageSends: []
  15841. }),
  15842. $globals.String.klass);
  15843. $core.addMethod(
  15844. $core.method({
  15845. selector: "fromString:",
  15846. protocol: 'instance creation',
  15847. fn: function (aString){
  15848. var self=this;
  15849. return $core.withContext(function($ctx1) {
  15850. return String(aString);
  15851. return self;
  15852. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  15853. },
  15854. args: ["aString"],
  15855. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  15856. referencedClasses: [],
  15857. messageSends: []
  15858. }),
  15859. $globals.String.klass);
  15860. $core.addMethod(
  15861. $core.method({
  15862. selector: "lf",
  15863. protocol: 'accessing',
  15864. fn: function (){
  15865. var self=this;
  15866. return $core.withContext(function($ctx1) {
  15867. return '\n';
  15868. return self;
  15869. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  15870. },
  15871. args: [],
  15872. source: "lf\x0a\x09<return '\x5cn'>",
  15873. referencedClasses: [],
  15874. messageSends: []
  15875. }),
  15876. $globals.String.klass);
  15877. $core.addMethod(
  15878. $core.method({
  15879. selector: "random",
  15880. protocol: 'random',
  15881. fn: function (){
  15882. var self=this;
  15883. return $core.withContext(function($ctx1) {
  15884. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  15885. return self;
  15886. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  15887. },
  15888. args: [],
  15889. 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);>",
  15890. referencedClasses: [],
  15891. messageSends: []
  15892. }),
  15893. $globals.String.klass);
  15894. $core.addMethod(
  15895. $core.method({
  15896. selector: "randomNotIn:",
  15897. protocol: 'random',
  15898. fn: function (aString){
  15899. var self=this;
  15900. var result;
  15901. return $core.withContext(function($ctx1) {
  15902. $recv((function(){
  15903. return $core.withContext(function($ctx2) {
  15904. result=self._random();
  15905. result;
  15906. return $recv(aString)._includesSubString_(result);
  15907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15908. }))._whileTrue();
  15909. return result;
  15910. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  15911. },
  15912. args: ["aString"],
  15913. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  15914. referencedClasses: [],
  15915. messageSends: ["whileTrue", "random", "includesSubString:"]
  15916. }),
  15917. $globals.String.klass);
  15918. $core.addMethod(
  15919. $core.method({
  15920. selector: "space",
  15921. protocol: 'accessing',
  15922. fn: function (){
  15923. var self=this;
  15924. return $core.withContext(function($ctx1) {
  15925. return ' ';
  15926. return self;
  15927. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  15928. },
  15929. args: [],
  15930. source: "space\x0a\x09<return ' '>",
  15931. referencedClasses: [],
  15932. messageSends: []
  15933. }),
  15934. $globals.String.klass);
  15935. $core.addMethod(
  15936. $core.method({
  15937. selector: "streamClass",
  15938. protocol: 'accessing',
  15939. fn: function (){
  15940. var self=this;
  15941. return $globals.StringStream;
  15942. },
  15943. args: [],
  15944. source: "streamClass\x0a\x09\x09^ StringStream",
  15945. referencedClasses: ["StringStream"],
  15946. messageSends: []
  15947. }),
  15948. $globals.String.klass);
  15949. $core.addMethod(
  15950. $core.method({
  15951. selector: "tab",
  15952. protocol: 'accessing',
  15953. fn: function (){
  15954. var self=this;
  15955. return $core.withContext(function($ctx1) {
  15956. return '\t';
  15957. return self;
  15958. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  15959. },
  15960. args: [],
  15961. source: "tab\x0a\x09<return '\x5ct'>",
  15962. referencedClasses: [],
  15963. messageSends: []
  15964. }),
  15965. $globals.String.klass);
  15966. $core.addMethod(
  15967. $core.method({
  15968. selector: "value:",
  15969. protocol: 'instance creation',
  15970. fn: function (aUTFCharCode){
  15971. var self=this;
  15972. return $core.withContext(function($ctx1) {
  15973. return String.fromCharCode(aUTFCharCode);;
  15974. return self;
  15975. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  15976. },
  15977. args: ["aUTFCharCode"],
  15978. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  15979. referencedClasses: [],
  15980. messageSends: []
  15981. }),
  15982. $globals.String.klass);
  15983. $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  15984. $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`.";
  15985. $core.addMethod(
  15986. $core.method({
  15987. selector: "=",
  15988. protocol: 'comparing',
  15989. fn: function (aCollection){
  15990. var self=this;
  15991. return $core.withContext(function($ctx1) {
  15992. var $2,$1,$4,$3,$5;
  15993. var $early={};
  15994. try {
  15995. $2=self._class();
  15996. $ctx1.sendIdx["class"]=1;
  15997. $1=$recv($2).__eq($recv(aCollection)._class());
  15998. $ctx1.sendIdx["="]=1;
  15999. if(!$core.assert($1)){
  16000. return false;
  16001. };
  16002. $4=self._size();
  16003. $ctx1.sendIdx["size"]=1;
  16004. $3=$recv($4).__eq($recv(aCollection)._size());
  16005. if(!$core.assert($3)){
  16006. return false;
  16007. };
  16008. self._do_((function(each){
  16009. return $core.withContext(function($ctx2) {
  16010. $5=$recv(aCollection)._includes_(each);
  16011. if(!$core.assert($5)){
  16012. throw $early=[false];
  16013. };
  16014. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16015. }));
  16016. return true;
  16017. }
  16018. catch(e) {if(e===$early)return e[0]; throw e}
  16019. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  16020. },
  16021. args: ["aCollection"],
  16022. 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",
  16023. referencedClasses: [],
  16024. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  16025. }),
  16026. $globals.Set);
  16027. $core.addMethod(
  16028. $core.method({
  16029. selector: "add:",
  16030. protocol: 'adding/removing',
  16031. fn: function (anObject){
  16032. var self=this;
  16033. var bucket;
  16034. return $core.withContext(function($ctx1) {
  16035. var $1,$receiver;
  16036. bucket=self._bucketsOfElement_(anObject);
  16037. $1=$recv(bucket)._second();
  16038. if(($receiver = $1) == null || $receiver.isNil){
  16039. var object,slowBucket;
  16040. object=$recv(bucket)._first();
  16041. $ctx1.sendIdx["first"]=1;
  16042. object;
  16043. slowBucket=$recv(bucket)._third();
  16044. slowBucket;
  16045. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  16046. return $core.withContext(function($ctx2) {
  16047. $recv(slowBucket)._add_(object);
  16048. self["@size"]=$recv(self["@size"]).__plus((1));
  16049. return self["@size"];
  16050. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16051. }));
  16052. return object;
  16053. } else {
  16054. var primitiveBucket;
  16055. primitiveBucket=$receiver;
  16056. return self._add_in_($recv(bucket)._first(),primitiveBucket);
  16057. };
  16058. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  16059. },
  16060. args: ["anObject"],
  16061. 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 ]",
  16062. referencedClasses: [],
  16063. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  16064. }),
  16065. $globals.Set);
  16066. $core.addMethod(
  16067. $core.method({
  16068. selector: "add:in:",
  16069. protocol: 'private',
  16070. fn: function (anObject,anotherObject){
  16071. var self=this;
  16072. return $core.withContext(function($ctx1) {
  16073. if (anObject in anotherObject.store) { return false; }
  16074. self['@size']++;
  16075. anotherObject.store[anObject] = true;
  16076. return anObject;
  16077. ;
  16078. return self;
  16079. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16080. },
  16081. args: ["anObject", "anotherObject"],
  16082. 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>",
  16083. referencedClasses: [],
  16084. messageSends: []
  16085. }),
  16086. $globals.Set);
  16087. $core.addMethod(
  16088. $core.method({
  16089. selector: "bucketsOfElement:",
  16090. protocol: 'private',
  16091. fn: function (anObject){
  16092. var self=this;
  16093. return $core.withContext(function($ctx1) {
  16094. // include nil to well-known objects under 'boolean' fastBucket
  16095. if (anObject == null || anObject.isNil) return [ null, self['@fastBuckets'].boolean ];
  16096. var prim = anObject.valueOf();
  16097. if (typeof prim === "object" || typeof prim === "function" || !self['@fastBuckets'][typeof prim]) {
  16098. var bucket = null;
  16099. self['@slowBucketStores'].some(function (store) {
  16100. return bucket = store._bucketOfElement_(anObject);
  16101. });
  16102. return [ anObject, null, bucket || self['@defaultBucket'] ];
  16103. }
  16104. return [ prim, self['@fastBuckets'][typeof prim] ];
  16105. ;
  16106. return self;
  16107. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  16108. },
  16109. args: ["anObject"],
  16110. 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>",
  16111. referencedClasses: [],
  16112. messageSends: []
  16113. }),
  16114. $globals.Set);
  16115. $core.addMethod(
  16116. $core.method({
  16117. selector: "classNameOf:",
  16118. protocol: 'private',
  16119. fn: function (anObject){
  16120. var self=this;
  16121. return $core.withContext(function($ctx1) {
  16122. return anObject.klass != null && anObject.klass.className;
  16123. return self;
  16124. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  16125. },
  16126. args: ["anObject"],
  16127. 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>",
  16128. referencedClasses: [],
  16129. messageSends: []
  16130. }),
  16131. $globals.Set);
  16132. $core.addMethod(
  16133. $core.method({
  16134. selector: "collect:",
  16135. protocol: 'enumerating',
  16136. fn: function (aBlock){
  16137. var self=this;
  16138. var collection;
  16139. return $core.withContext(function($ctx1) {
  16140. collection=$recv(self._class())._new();
  16141. self._do_((function(each){
  16142. return $core.withContext(function($ctx2) {
  16143. return $recv(collection)._add_($recv(aBlock)._value_(each));
  16144. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16145. }));
  16146. return collection;
  16147. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  16148. },
  16149. args: ["aBlock"],
  16150. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  16151. referencedClasses: [],
  16152. messageSends: ["new", "class", "do:", "add:", "value:"]
  16153. }),
  16154. $globals.Set);
  16155. $core.addMethod(
  16156. $core.method({
  16157. selector: "detect:ifNone:",
  16158. protocol: 'enumerating',
  16159. fn: function (aBlock,anotherBlock){
  16160. var self=this;
  16161. return $core.withContext(function($ctx1) {
  16162. var $1;
  16163. var $early={};
  16164. try {
  16165. self._do_((function(each){
  16166. return $core.withContext(function($ctx2) {
  16167. $1=$recv(aBlock)._value_(each);
  16168. if($core.assert($1)){
  16169. throw $early=[each];
  16170. };
  16171. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16172. }));
  16173. return $recv(anotherBlock)._value();
  16174. }
  16175. catch(e) {if(e===$early)return e[0]; throw e}
  16176. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  16177. },
  16178. args: ["aBlock", "anotherBlock"],
  16179. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  16180. referencedClasses: [],
  16181. messageSends: ["do:", "ifTrue:", "value:", "value"]
  16182. }),
  16183. $globals.Set);
  16184. $core.addMethod(
  16185. $core.method({
  16186. selector: "do:",
  16187. protocol: 'enumerating',
  16188. fn: function (aBlock){
  16189. var self=this;
  16190. return $core.withContext(function($ctx1) {
  16191. var el, keys, i;
  16192. el = self['@fastBuckets'];
  16193. keys = Object.keys(el);
  16194. for (i = 0; i < keys.length; ++i) {
  16195. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  16196. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  16197. else { store._do_(aBlock); }
  16198. }
  16199. el = self['@slowBucketStores'];
  16200. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  16201. self['@defaultBucket']._do_(aBlock);
  16202. ;
  16203. return self;
  16204. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  16205. },
  16206. args: ["aBlock"],
  16207. 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>",
  16208. referencedClasses: [],
  16209. messageSends: []
  16210. }),
  16211. $globals.Set);
  16212. $core.addMethod(
  16213. $core.method({
  16214. selector: "includes:",
  16215. protocol: 'testing',
  16216. fn: function (anObject){
  16217. var self=this;
  16218. var bucket;
  16219. return $core.withContext(function($ctx1) {
  16220. var $1,$2,$3,$receiver;
  16221. bucket=self._bucketsOfElement_(anObject);
  16222. $1=$recv(bucket)._second();
  16223. if(($receiver = $1) == null || $receiver.isNil){
  16224. $2=$recv(bucket)._third();
  16225. $3=$recv(bucket)._first();
  16226. $ctx1.sendIdx["first"]=1;
  16227. return $recv($2)._includes_($3);
  16228. } else {
  16229. var primitiveBucket;
  16230. primitiveBucket=$receiver;
  16231. return self._includes_in_($recv(bucket)._first(),primitiveBucket);
  16232. };
  16233. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  16234. },
  16235. args: ["anObject"],
  16236. 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 ]",
  16237. referencedClasses: [],
  16238. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  16239. }),
  16240. $globals.Set);
  16241. $core.addMethod(
  16242. $core.method({
  16243. selector: "includes:in:",
  16244. protocol: 'private',
  16245. fn: function (anObject,anotherObject){
  16246. var self=this;
  16247. return $core.withContext(function($ctx1) {
  16248. return anObject in anotherObject.store;
  16249. return self;
  16250. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16251. },
  16252. args: ["anObject", "anotherObject"],
  16253. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  16254. referencedClasses: [],
  16255. messageSends: []
  16256. }),
  16257. $globals.Set);
  16258. $core.addMethod(
  16259. $core.method({
  16260. selector: "initialize",
  16261. protocol: 'initialization',
  16262. fn: function (){
  16263. var self=this;
  16264. return $core.withContext(function($ctx1) {
  16265. (
  16266. $ctx1.supercall = true,
  16267. ($globals.Set.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  16268. $ctx1.supercall = false;
  16269. self["@defaultBucket"]=[];
  16270. self._initializeSlowBucketStores();
  16271. self._removeAll();
  16272. return self;
  16273. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  16274. },
  16275. args: [],
  16276. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  16277. referencedClasses: [],
  16278. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  16279. }),
  16280. $globals.Set);
  16281. $core.addMethod(
  16282. $core.method({
  16283. selector: "initializeSlowBucketStores",
  16284. protocol: 'initialization',
  16285. fn: function (){
  16286. var self=this;
  16287. return $core.withContext(function($ctx1) {
  16288. var $1;
  16289. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  16290. return $core.withContext(function($ctx2) {
  16291. return self._classNameOf_(x);
  16292. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  16293. }));
  16294. $ctx1.sendIdx["hashBlock:"]=1;
  16295. self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  16296. return $core.withContext(function($ctx2) {
  16297. return self._jsConstructorNameOf_(x);
  16298. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  16299. }))];
  16300. return self;
  16301. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  16302. },
  16303. args: [],
  16304. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  16305. referencedClasses: ["ArrayBucketStore"],
  16306. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  16307. }),
  16308. $globals.Set);
  16309. $core.addMethod(
  16310. $core.method({
  16311. selector: "jsConstructorNameOf:",
  16312. protocol: 'private',
  16313. fn: function (anObject){
  16314. var self=this;
  16315. return $core.withContext(function($ctx1) {
  16316. return anObject.constructor && anObject.constructor.name;
  16317. return self;
  16318. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  16319. },
  16320. args: ["anObject"],
  16321. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  16322. referencedClasses: [],
  16323. messageSends: []
  16324. }),
  16325. $globals.Set);
  16326. $core.addMethod(
  16327. $core.method({
  16328. selector: "printOn:",
  16329. protocol: 'printing',
  16330. fn: function (aStream){
  16331. var self=this;
  16332. return $core.withContext(function($ctx1) {
  16333. (
  16334. $ctx1.supercall = true,
  16335. ($globals.Set.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  16336. $ctx1.supercall = false;
  16337. $ctx1.sendIdx["printOn:"]=1;
  16338. $recv(aStream)._nextPutAll_(" (");
  16339. $ctx1.sendIdx["nextPutAll:"]=1;
  16340. self._do_separatedBy_((function(each){
  16341. return $core.withContext(function($ctx2) {
  16342. return $recv(each)._printOn_(aStream);
  16343. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16344. }),(function(){
  16345. return $core.withContext(function($ctx2) {
  16346. return $recv(aStream)._nextPutAll_(" ");
  16347. $ctx2.sendIdx["nextPutAll:"]=2;
  16348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16349. }));
  16350. $recv(aStream)._nextPutAll_(")");
  16351. return self;
  16352. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  16353. },
  16354. args: ["aStream"],
  16355. 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: ')'",
  16356. referencedClasses: [],
  16357. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  16358. }),
  16359. $globals.Set);
  16360. $core.addMethod(
  16361. $core.method({
  16362. selector: "remove:ifAbsent:",
  16363. protocol: 'adding/removing',
  16364. fn: function (anObject,aBlock){
  16365. var self=this;
  16366. var bucket;
  16367. return $core.withContext(function($ctx1) {
  16368. var $1,$2,$3,$receiver;
  16369. var $early={};
  16370. try {
  16371. bucket=self._bucketsOfElement_(anObject);
  16372. $1=$recv(bucket)._second();
  16373. if(($receiver = $1) == null || $receiver.isNil){
  16374. $2=$recv(bucket)._third();
  16375. $3=$recv(bucket)._first();
  16376. $ctx1.sendIdx["first"]=1;
  16377. $recv($2)._remove_ifAbsent_($3,(function(){
  16378. return $core.withContext(function($ctx2) {
  16379. throw $early=[$recv(aBlock)._value()];
  16380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16381. }));
  16382. self["@size"]=$recv(self["@size"]).__minus((1));
  16383. return self["@size"];
  16384. } else {
  16385. var primitiveBucket;
  16386. primitiveBucket=$receiver;
  16387. return self._remove_in_($recv(bucket)._first(),primitiveBucket);
  16388. };
  16389. }
  16390. catch(e) {if(e===$early)return e[0]; throw e}
  16391. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  16392. },
  16393. args: ["anObject", "aBlock"],
  16394. 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 ]",
  16395. referencedClasses: [],
  16396. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  16397. }),
  16398. $globals.Set);
  16399. $core.addMethod(
  16400. $core.method({
  16401. selector: "remove:in:",
  16402. protocol: 'private',
  16403. fn: function (anObject,anotherObject){
  16404. var self=this;
  16405. return $core.withContext(function($ctx1) {
  16406. if (delete anotherObject.store[anObject]) self['@size']--;
  16407. return self;
  16408. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  16409. },
  16410. args: ["anObject", "anotherObject"],
  16411. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  16412. referencedClasses: [],
  16413. messageSends: []
  16414. }),
  16415. $globals.Set);
  16416. $core.addMethod(
  16417. $core.method({
  16418. selector: "removeAll",
  16419. protocol: 'adding/removing',
  16420. fn: function (){
  16421. var self=this;
  16422. return $core.withContext(function($ctx1) {
  16423. self['@fastBuckets'] = {
  16424. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  16425. 'number': { store: Object.create(null), fn: Number },
  16426. 'string': { store: Object.create(null) }
  16427. };
  16428. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  16429. self['@defaultBucket']._removeAll();
  16430. self['@size'] = 0;
  16431. ;
  16432. return self;
  16433. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  16434. },
  16435. args: [],
  16436. 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>",
  16437. referencedClasses: [],
  16438. messageSends: []
  16439. }),
  16440. $globals.Set);
  16441. $core.addMethod(
  16442. $core.method({
  16443. selector: "select:",
  16444. protocol: 'enumerating',
  16445. fn: function (aBlock){
  16446. var self=this;
  16447. var collection;
  16448. return $core.withContext(function($ctx1) {
  16449. var $1;
  16450. collection=$recv(self._class())._new();
  16451. self._do_((function(each){
  16452. return $core.withContext(function($ctx2) {
  16453. $1=$recv(aBlock)._value_(each);
  16454. if($core.assert($1)){
  16455. return $recv(collection)._add_(each);
  16456. };
  16457. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16458. }));
  16459. return collection;
  16460. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  16461. },
  16462. args: ["aBlock"],
  16463. 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",
  16464. referencedClasses: [],
  16465. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  16466. }),
  16467. $globals.Set);
  16468. $core.addMethod(
  16469. $core.method({
  16470. selector: "size",
  16471. protocol: 'accessing',
  16472. fn: function (){
  16473. var self=this;
  16474. return self["@size"];
  16475. },
  16476. args: [],
  16477. source: "size\x0a\x09^ size",
  16478. referencedClasses: [],
  16479. messageSends: []
  16480. }),
  16481. $globals.Set);
  16482. $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
  16483. $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.";
  16484. $core.addMethod(
  16485. $core.method({
  16486. selector: "<<",
  16487. protocol: 'writing',
  16488. fn: function (anObject){
  16489. var self=this;
  16490. return $core.withContext(function($ctx1) {
  16491. self._write_(anObject);
  16492. return self;
  16493. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  16494. },
  16495. args: ["anObject"],
  16496. source: "<< anObject\x0a\x09self write: anObject",
  16497. referencedClasses: [],
  16498. messageSends: ["write:"]
  16499. }),
  16500. $globals.ProtoStream);
  16501. $core.addMethod(
  16502. $core.method({
  16503. selector: "atEnd",
  16504. protocol: 'testing',
  16505. fn: function (){
  16506. var self=this;
  16507. return $core.withContext(function($ctx1) {
  16508. self._subclassResponsibility();
  16509. return self;
  16510. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  16511. },
  16512. args: [],
  16513. source: "atEnd\x0a\x09self subclassResponsibility",
  16514. referencedClasses: [],
  16515. messageSends: ["subclassResponsibility"]
  16516. }),
  16517. $globals.ProtoStream);
  16518. $core.addMethod(
  16519. $core.method({
  16520. selector: "atStart",
  16521. protocol: 'testing',
  16522. fn: function (){
  16523. var self=this;
  16524. return $core.withContext(function($ctx1) {
  16525. self._subclassResponsibility();
  16526. return self;
  16527. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  16528. },
  16529. args: [],
  16530. source: "atStart\x0a\x09self subclassResponsibility",
  16531. referencedClasses: [],
  16532. messageSends: ["subclassResponsibility"]
  16533. }),
  16534. $globals.ProtoStream);
  16535. $core.addMethod(
  16536. $core.method({
  16537. selector: "contents",
  16538. protocol: 'accessing',
  16539. fn: function (){
  16540. var self=this;
  16541. return $core.withContext(function($ctx1) {
  16542. self._subclassResponsibility();
  16543. return self;
  16544. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  16545. },
  16546. args: [],
  16547. source: "contents\x0a\x09self subclassResponsibility",
  16548. referencedClasses: [],
  16549. messageSends: ["subclassResponsibility"]
  16550. }),
  16551. $globals.ProtoStream);
  16552. $core.addMethod(
  16553. $core.method({
  16554. selector: "do:",
  16555. protocol: 'enumerating',
  16556. fn: function (aBlock){
  16557. var self=this;
  16558. return $core.withContext(function($ctx1) {
  16559. $recv((function(){
  16560. return $core.withContext(function($ctx2) {
  16561. return self._atEnd();
  16562. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16563. }))._whileFalse_((function(){
  16564. return $core.withContext(function($ctx2) {
  16565. return $recv(aBlock)._value_(self._next());
  16566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16567. }));
  16568. return self;
  16569. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  16570. },
  16571. args: ["aBlock"],
  16572. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  16573. referencedClasses: [],
  16574. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  16575. }),
  16576. $globals.ProtoStream);
  16577. $core.addMethod(
  16578. $core.method({
  16579. selector: "isEmpty",
  16580. protocol: 'testing',
  16581. fn: function (){
  16582. var self=this;
  16583. return $core.withContext(function($ctx1) {
  16584. return $recv(self._atStart())._and_((function(){
  16585. return $core.withContext(function($ctx2) {
  16586. return self._atEnd();
  16587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16588. }));
  16589. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  16590. },
  16591. args: [],
  16592. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  16593. referencedClasses: [],
  16594. messageSends: ["and:", "atStart", "atEnd"]
  16595. }),
  16596. $globals.ProtoStream);
  16597. $core.addMethod(
  16598. $core.method({
  16599. selector: "next",
  16600. protocol: 'reading',
  16601. fn: function (){
  16602. var self=this;
  16603. return $core.withContext(function($ctx1) {
  16604. var $1;
  16605. $1=self._atEnd();
  16606. if($core.assert($1)){
  16607. return nil;
  16608. } else {
  16609. return self._subclassResponsibility();
  16610. };
  16611. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  16612. },
  16613. args: [],
  16614. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16615. referencedClasses: [],
  16616. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16617. }),
  16618. $globals.ProtoStream);
  16619. $core.addMethod(
  16620. $core.method({
  16621. selector: "nextPut:",
  16622. protocol: 'writing',
  16623. fn: function (anObject){
  16624. var self=this;
  16625. return $core.withContext(function($ctx1) {
  16626. self._subclassResponsibility();
  16627. return self;
  16628. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  16629. },
  16630. args: ["anObject"],
  16631. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  16632. referencedClasses: [],
  16633. messageSends: ["subclassResponsibility"]
  16634. }),
  16635. $globals.ProtoStream);
  16636. $core.addMethod(
  16637. $core.method({
  16638. selector: "nextPutAll:",
  16639. protocol: 'writing',
  16640. fn: function (aCollection){
  16641. var self=this;
  16642. return $core.withContext(function($ctx1) {
  16643. $recv(aCollection)._do_((function(each){
  16644. return $core.withContext(function($ctx2) {
  16645. return self._nextPut_(each);
  16646. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16647. }));
  16648. return self;
  16649. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  16650. },
  16651. args: ["aCollection"],
  16652. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  16653. referencedClasses: [],
  16654. messageSends: ["do:", "nextPut:"]
  16655. }),
  16656. $globals.ProtoStream);
  16657. $core.addMethod(
  16658. $core.method({
  16659. selector: "nextPutJSObject:",
  16660. protocol: 'writing',
  16661. fn: function (aJSObject){
  16662. var self=this;
  16663. return $core.withContext(function($ctx1) {
  16664. self._nextPut_(aJSObject);
  16665. return self;
  16666. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  16667. },
  16668. args: ["aJSObject"],
  16669. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  16670. referencedClasses: [],
  16671. messageSends: ["nextPut:"]
  16672. }),
  16673. $globals.ProtoStream);
  16674. $core.addMethod(
  16675. $core.method({
  16676. selector: "nextPutString:",
  16677. protocol: 'writing',
  16678. fn: function (aString){
  16679. var self=this;
  16680. return $core.withContext(function($ctx1) {
  16681. self._nextPut_(aString);
  16682. return self;
  16683. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  16684. },
  16685. args: ["aString"],
  16686. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  16687. referencedClasses: [],
  16688. messageSends: ["nextPut:"]
  16689. }),
  16690. $globals.ProtoStream);
  16691. $core.addMethod(
  16692. $core.method({
  16693. selector: "peek",
  16694. protocol: 'reading',
  16695. fn: function (){
  16696. var self=this;
  16697. return $core.withContext(function($ctx1) {
  16698. var $1;
  16699. $1=self._atEnd();
  16700. if($core.assert($1)){
  16701. return nil;
  16702. } else {
  16703. return self._subclassResponsibility();
  16704. };
  16705. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  16706. },
  16707. args: [],
  16708. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  16709. referencedClasses: [],
  16710. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  16711. }),
  16712. $globals.ProtoStream);
  16713. $core.addMethod(
  16714. $core.method({
  16715. selector: "reset",
  16716. protocol: 'actions',
  16717. fn: function (){
  16718. var self=this;
  16719. return $core.withContext(function($ctx1) {
  16720. self._subclassResponsibility();
  16721. return self;
  16722. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  16723. },
  16724. args: [],
  16725. source: "reset\x0a\x09self subclassResponsibility",
  16726. referencedClasses: [],
  16727. messageSends: ["subclassResponsibility"]
  16728. }),
  16729. $globals.ProtoStream);
  16730. $core.addMethod(
  16731. $core.method({
  16732. selector: "resetContents",
  16733. protocol: 'actions',
  16734. fn: function (){
  16735. var self=this;
  16736. return $core.withContext(function($ctx1) {
  16737. self._subclassResponsibility();
  16738. return self;
  16739. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  16740. },
  16741. args: [],
  16742. source: "resetContents\x0a\x09self subclassResponsibility",
  16743. referencedClasses: [],
  16744. messageSends: ["subclassResponsibility"]
  16745. }),
  16746. $globals.ProtoStream);
  16747. $core.addMethod(
  16748. $core.method({
  16749. selector: "setToEnd",
  16750. protocol: 'positioning',
  16751. fn: function (){
  16752. var self=this;
  16753. return $core.withContext(function($ctx1) {
  16754. self._subclassResponsibility();
  16755. return self;
  16756. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  16757. },
  16758. args: [],
  16759. source: "setToEnd\x0a\x09self subclassResponsibility",
  16760. referencedClasses: [],
  16761. messageSends: ["subclassResponsibility"]
  16762. }),
  16763. $globals.ProtoStream);
  16764. $core.addMethod(
  16765. $core.method({
  16766. selector: "setToStart",
  16767. protocol: 'positioning',
  16768. fn: function (){
  16769. var self=this;
  16770. return $core.withContext(function($ctx1) {
  16771. self._reset();
  16772. return self;
  16773. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  16774. },
  16775. args: [],
  16776. source: "setToStart\x0a\x09self reset",
  16777. referencedClasses: [],
  16778. messageSends: ["reset"]
  16779. }),
  16780. $globals.ProtoStream);
  16781. $core.addMethod(
  16782. $core.method({
  16783. selector: "write:",
  16784. protocol: 'writing',
  16785. fn: function (anObject){
  16786. var self=this;
  16787. return $core.withContext(function($ctx1) {
  16788. $recv(anObject)._putOn_(self);
  16789. return self;
  16790. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  16791. },
  16792. args: ["anObject"],
  16793. source: "write: anObject\x0a\x09anObject putOn: self",
  16794. referencedClasses: [],
  16795. messageSends: ["putOn:"]
  16796. }),
  16797. $globals.ProtoStream);
  16798. $core.addMethod(
  16799. $core.method({
  16800. selector: "on:",
  16801. protocol: 'instance creation',
  16802. fn: function (aCollection){
  16803. var self=this;
  16804. return $core.withContext(function($ctx1) {
  16805. var $1;
  16806. $1=self._new();
  16807. $recv($1)._setCollection_(aCollection);
  16808. $recv($1)._setStreamSize_($recv(aCollection)._size());
  16809. return $recv($1)._yourself();
  16810. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  16811. },
  16812. args: ["aCollection"],
  16813. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  16814. referencedClasses: [],
  16815. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  16816. }),
  16817. $globals.ProtoStream.klass);
  16818. $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  16819. $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.";
  16820. $core.addMethod(
  16821. $core.method({
  16822. selector: "atEnd",
  16823. protocol: 'testing',
  16824. fn: function (){
  16825. var self=this;
  16826. return $core.withContext(function($ctx1) {
  16827. return $recv(self._position()).__eq(self._size());
  16828. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  16829. },
  16830. args: [],
  16831. source: "atEnd\x0a\x09^ self position = self size",
  16832. referencedClasses: [],
  16833. messageSends: ["=", "position", "size"]
  16834. }),
  16835. $globals.Stream);
  16836. $core.addMethod(
  16837. $core.method({
  16838. selector: "atStart",
  16839. protocol: 'testing',
  16840. fn: function (){
  16841. var self=this;
  16842. return $core.withContext(function($ctx1) {
  16843. return $recv(self._position()).__eq((0));
  16844. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  16845. },
  16846. args: [],
  16847. source: "atStart\x0a\x09^ self position = 0",
  16848. referencedClasses: [],
  16849. messageSends: ["=", "position"]
  16850. }),
  16851. $globals.Stream);
  16852. $core.addMethod(
  16853. $core.method({
  16854. selector: "close",
  16855. protocol: 'actions',
  16856. fn: function (){
  16857. var self=this;
  16858. return self;
  16859. },
  16860. args: [],
  16861. source: "close",
  16862. referencedClasses: [],
  16863. messageSends: []
  16864. }),
  16865. $globals.Stream);
  16866. $core.addMethod(
  16867. $core.method({
  16868. selector: "collection",
  16869. protocol: 'accessing',
  16870. fn: function (){
  16871. var self=this;
  16872. return self["@collection"];
  16873. },
  16874. args: [],
  16875. source: "collection\x0a\x09^ collection",
  16876. referencedClasses: [],
  16877. messageSends: []
  16878. }),
  16879. $globals.Stream);
  16880. $core.addMethod(
  16881. $core.method({
  16882. selector: "contents",
  16883. protocol: 'accessing',
  16884. fn: function (){
  16885. var self=this;
  16886. return $core.withContext(function($ctx1) {
  16887. return $recv(self._collection())._copyFrom_to_((1),self._streamSize());
  16888. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  16889. },
  16890. args: [],
  16891. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  16892. referencedClasses: [],
  16893. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  16894. }),
  16895. $globals.Stream);
  16896. $core.addMethod(
  16897. $core.method({
  16898. selector: "flush",
  16899. protocol: 'actions',
  16900. fn: function (){
  16901. var self=this;
  16902. return self;
  16903. },
  16904. args: [],
  16905. source: "flush",
  16906. referencedClasses: [],
  16907. messageSends: []
  16908. }),
  16909. $globals.Stream);
  16910. $core.addMethod(
  16911. $core.method({
  16912. selector: "isEmpty",
  16913. protocol: 'testing',
  16914. fn: function (){
  16915. var self=this;
  16916. return $core.withContext(function($ctx1) {
  16917. return $recv(self._size()).__eq((0));
  16918. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  16919. },
  16920. args: [],
  16921. source: "isEmpty\x0a\x09^ self size = 0",
  16922. referencedClasses: [],
  16923. messageSends: ["=", "size"]
  16924. }),
  16925. $globals.Stream);
  16926. $core.addMethod(
  16927. $core.method({
  16928. selector: "next",
  16929. protocol: 'reading',
  16930. fn: function (){
  16931. var self=this;
  16932. return $core.withContext(function($ctx1) {
  16933. var $1,$3,$2;
  16934. $1=self._atEnd();
  16935. if($core.assert($1)){
  16936. return nil;
  16937. } else {
  16938. $3=self._position();
  16939. $ctx1.sendIdx["position"]=1;
  16940. $2=$recv($3).__plus((1));
  16941. self._position_($2);
  16942. return $recv(self["@collection"])._at_(self._position());
  16943. };
  16944. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  16945. },
  16946. args: [],
  16947. 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 ]",
  16948. referencedClasses: [],
  16949. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  16950. }),
  16951. $globals.Stream);
  16952. $core.addMethod(
  16953. $core.method({
  16954. selector: "next:",
  16955. protocol: 'reading',
  16956. fn: function (anInteger){
  16957. var self=this;
  16958. var tempCollection;
  16959. return $core.withContext(function($ctx1) {
  16960. var $1;
  16961. tempCollection=$recv($recv(self._collection())._class())._new();
  16962. $recv(anInteger)._timesRepeat_((function(){
  16963. return $core.withContext(function($ctx2) {
  16964. $1=self._atEnd();
  16965. if(!$core.assert($1)){
  16966. return $recv(tempCollection)._add_(self._next());
  16967. };
  16968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  16969. }));
  16970. return tempCollection;
  16971. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  16972. },
  16973. args: ["anInteger"],
  16974. 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",
  16975. referencedClasses: [],
  16976. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  16977. }),
  16978. $globals.Stream);
  16979. $core.addMethod(
  16980. $core.method({
  16981. selector: "nextPut:",
  16982. protocol: 'writing',
  16983. fn: function (anObject){
  16984. var self=this;
  16985. return $core.withContext(function($ctx1) {
  16986. var $2,$1,$3,$4;
  16987. $2=self._position();
  16988. $ctx1.sendIdx["position"]=1;
  16989. $1=$recv($2).__plus((1));
  16990. self._position_($1);
  16991. $3=self._collection();
  16992. $4=self._position();
  16993. $ctx1.sendIdx["position"]=2;
  16994. $recv($3)._at_put_($4,anObject);
  16995. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  16996. return self;
  16997. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  16998. },
  16999. args: ["anObject"],
  17000. 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)",
  17001. referencedClasses: [],
  17002. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  17003. }),
  17004. $globals.Stream);
  17005. $core.addMethod(
  17006. $core.method({
  17007. selector: "peek",
  17008. protocol: 'reading',
  17009. fn: function (){
  17010. var self=this;
  17011. return $core.withContext(function($ctx1) {
  17012. var $1;
  17013. $1=self._atEnd();
  17014. if(!$core.assert($1)){
  17015. return $recv(self._collection())._at_($recv(self._position()).__plus((1)));
  17016. };
  17017. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  17018. },
  17019. args: [],
  17020. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  17021. referencedClasses: [],
  17022. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  17023. }),
  17024. $globals.Stream);
  17025. $core.addMethod(
  17026. $core.method({
  17027. selector: "position",
  17028. protocol: 'accessing',
  17029. fn: function (){
  17030. var self=this;
  17031. return $core.withContext(function($ctx1) {
  17032. var $1,$receiver;
  17033. $1=self["@position"];
  17034. if(($receiver = $1) == null || $receiver.isNil){
  17035. self["@position"]=(0);
  17036. return self["@position"];
  17037. } else {
  17038. return $1;
  17039. };
  17040. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  17041. },
  17042. args: [],
  17043. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  17044. referencedClasses: [],
  17045. messageSends: ["ifNil:"]
  17046. }),
  17047. $globals.Stream);
  17048. $core.addMethod(
  17049. $core.method({
  17050. selector: "position:",
  17051. protocol: 'accessing',
  17052. fn: function (anInteger){
  17053. var self=this;
  17054. self["@position"]=anInteger;
  17055. return self;
  17056. },
  17057. args: ["anInteger"],
  17058. source: "position: anInteger\x0a\x09position := anInteger",
  17059. referencedClasses: [],
  17060. messageSends: []
  17061. }),
  17062. $globals.Stream);
  17063. $core.addMethod(
  17064. $core.method({
  17065. selector: "reset",
  17066. protocol: 'actions',
  17067. fn: function (){
  17068. var self=this;
  17069. return $core.withContext(function($ctx1) {
  17070. self._position_((0));
  17071. return self;
  17072. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  17073. },
  17074. args: [],
  17075. source: "reset\x0a\x09self position: 0",
  17076. referencedClasses: [],
  17077. messageSends: ["position:"]
  17078. }),
  17079. $globals.Stream);
  17080. $core.addMethod(
  17081. $core.method({
  17082. selector: "resetContents",
  17083. protocol: 'actions',
  17084. fn: function (){
  17085. var self=this;
  17086. return $core.withContext(function($ctx1) {
  17087. self._reset();
  17088. self._setStreamSize_((0));
  17089. return self;
  17090. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  17091. },
  17092. args: [],
  17093. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  17094. referencedClasses: [],
  17095. messageSends: ["reset", "setStreamSize:"]
  17096. }),
  17097. $globals.Stream);
  17098. $core.addMethod(
  17099. $core.method({
  17100. selector: "setCollection:",
  17101. protocol: 'accessing',
  17102. fn: function (aCollection){
  17103. var self=this;
  17104. self["@collection"]=aCollection;
  17105. return self;
  17106. },
  17107. args: ["aCollection"],
  17108. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  17109. referencedClasses: [],
  17110. messageSends: []
  17111. }),
  17112. $globals.Stream);
  17113. $core.addMethod(
  17114. $core.method({
  17115. selector: "setStreamSize:",
  17116. protocol: 'accessing',
  17117. fn: function (anInteger){
  17118. var self=this;
  17119. self["@streamSize"]=anInteger;
  17120. return self;
  17121. },
  17122. args: ["anInteger"],
  17123. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  17124. referencedClasses: [],
  17125. messageSends: []
  17126. }),
  17127. $globals.Stream);
  17128. $core.addMethod(
  17129. $core.method({
  17130. selector: "setToEnd",
  17131. protocol: 'positioning',
  17132. fn: function (){
  17133. var self=this;
  17134. return $core.withContext(function($ctx1) {
  17135. self._position_(self._size());
  17136. return self;
  17137. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  17138. },
  17139. args: [],
  17140. source: "setToEnd\x0a\x09self position: self size",
  17141. referencedClasses: [],
  17142. messageSends: ["position:", "size"]
  17143. }),
  17144. $globals.Stream);
  17145. $core.addMethod(
  17146. $core.method({
  17147. selector: "size",
  17148. protocol: 'accessing',
  17149. fn: function (){
  17150. var self=this;
  17151. return $core.withContext(function($ctx1) {
  17152. return self._streamSize();
  17153. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  17154. },
  17155. args: [],
  17156. source: "size\x0a\x09^ self streamSize",
  17157. referencedClasses: [],
  17158. messageSends: ["streamSize"]
  17159. }),
  17160. $globals.Stream);
  17161. $core.addMethod(
  17162. $core.method({
  17163. selector: "skip:",
  17164. protocol: 'positioning',
  17165. fn: function (anInteger){
  17166. var self=this;
  17167. return $core.withContext(function($ctx1) {
  17168. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  17169. return self;
  17170. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  17171. },
  17172. args: ["anInteger"],
  17173. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  17174. referencedClasses: [],
  17175. messageSends: ["position:", "min:max:", "+", "position", "size"]
  17176. }),
  17177. $globals.Stream);
  17178. $core.addMethod(
  17179. $core.method({
  17180. selector: "streamSize",
  17181. protocol: 'accessing',
  17182. fn: function (){
  17183. var self=this;
  17184. return self["@streamSize"];
  17185. },
  17186. args: [],
  17187. source: "streamSize\x0a\x09^ streamSize",
  17188. referencedClasses: [],
  17189. messageSends: []
  17190. }),
  17191. $globals.Stream);
  17192. $core.addMethod(
  17193. $core.method({
  17194. selector: "on:",
  17195. protocol: 'instance creation',
  17196. fn: function (aCollection){
  17197. var self=this;
  17198. return $core.withContext(function($ctx1) {
  17199. var $1;
  17200. $1=self._new();
  17201. $recv($1)._setCollection_(aCollection);
  17202. $recv($1)._setStreamSize_($recv(aCollection)._size());
  17203. return $recv($1)._yourself();
  17204. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  17205. },
  17206. args: ["aCollection"],
  17207. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  17208. referencedClasses: [],
  17209. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  17210. }),
  17211. $globals.Stream.klass);
  17212. $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
  17213. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  17214. $core.addMethod(
  17215. $core.method({
  17216. selector: "cr",
  17217. protocol: 'writing',
  17218. fn: function (){
  17219. var self=this;
  17220. return $core.withContext(function($ctx1) {
  17221. return self._nextPutAll_($recv($globals.String)._cr());
  17222. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  17223. },
  17224. args: [],
  17225. source: "cr\x0a\x09^ self nextPutAll: String cr",
  17226. referencedClasses: ["String"],
  17227. messageSends: ["nextPutAll:", "cr"]
  17228. }),
  17229. $globals.StringStream);
  17230. $core.addMethod(
  17231. $core.method({
  17232. selector: "crlf",
  17233. protocol: 'writing',
  17234. fn: function (){
  17235. var self=this;
  17236. return $core.withContext(function($ctx1) {
  17237. return self._nextPutAll_($recv($globals.String)._crlf());
  17238. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  17239. },
  17240. args: [],
  17241. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  17242. referencedClasses: ["String"],
  17243. messageSends: ["nextPutAll:", "crlf"]
  17244. }),
  17245. $globals.StringStream);
  17246. $core.addMethod(
  17247. $core.method({
  17248. selector: "lf",
  17249. protocol: 'writing',
  17250. fn: function (){
  17251. var self=this;
  17252. return $core.withContext(function($ctx1) {
  17253. return self._nextPutAll_($recv($globals.String)._lf());
  17254. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  17255. },
  17256. args: [],
  17257. source: "lf\x0a\x09^ self nextPutAll: String lf",
  17258. referencedClasses: ["String"],
  17259. messageSends: ["nextPutAll:", "lf"]
  17260. }),
  17261. $globals.StringStream);
  17262. $core.addMethod(
  17263. $core.method({
  17264. selector: "next:",
  17265. protocol: 'reading',
  17266. fn: function (anInteger){
  17267. var self=this;
  17268. var tempCollection;
  17269. return $core.withContext(function($ctx1) {
  17270. var $1;
  17271. tempCollection=$recv($recv(self._collection())._class())._new();
  17272. $recv(anInteger)._timesRepeat_((function(){
  17273. return $core.withContext(function($ctx2) {
  17274. $1=self._atEnd();
  17275. if(!$core.assert($1)){
  17276. tempCollection=$recv(tempCollection).__comma(self._next());
  17277. return tempCollection;
  17278. };
  17279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17280. }));
  17281. return tempCollection;
  17282. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  17283. },
  17284. args: ["anInteger"],
  17285. 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",
  17286. referencedClasses: [],
  17287. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  17288. }),
  17289. $globals.StringStream);
  17290. $core.addMethod(
  17291. $core.method({
  17292. selector: "nextPut:",
  17293. protocol: 'writing',
  17294. fn: function (aString){
  17295. var self=this;
  17296. return $core.withContext(function($ctx1) {
  17297. self._nextPutAll_(aString);
  17298. return self;
  17299. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  17300. },
  17301. args: ["aString"],
  17302. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  17303. referencedClasses: [],
  17304. messageSends: ["nextPutAll:"]
  17305. }),
  17306. $globals.StringStream);
  17307. $core.addMethod(
  17308. $core.method({
  17309. selector: "nextPutAll:",
  17310. protocol: 'writing',
  17311. fn: function (aString){
  17312. var self=this;
  17313. var pre,post;
  17314. return $core.withContext(function($ctx1) {
  17315. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  17316. $1=self._atEnd();
  17317. if($core.assert($1)){
  17318. $3=self._collection();
  17319. $ctx1.sendIdx["collection"]=1;
  17320. $2=$recv($3).__comma(aString);
  17321. $ctx1.sendIdx[","]=1;
  17322. self._setCollection_($2);
  17323. $ctx1.sendIdx["setCollection:"]=1;
  17324. } else {
  17325. $4=self._collection();
  17326. $ctx1.sendIdx["collection"]=2;
  17327. $5=self._position();
  17328. $ctx1.sendIdx["position"]=1;
  17329. pre=$recv($4)._copyFrom_to_((1),$5);
  17330. $ctx1.sendIdx["copyFrom:to:"]=1;
  17331. pre;
  17332. $6=self._collection();
  17333. $ctx1.sendIdx["collection"]=3;
  17334. $9=self._position();
  17335. $ctx1.sendIdx["position"]=2;
  17336. $8=$recv($9).__plus((1));
  17337. $ctx1.sendIdx["+"]=2;
  17338. $10=$recv(aString)._size();
  17339. $ctx1.sendIdx["size"]=1;
  17340. $7=$recv($8).__plus($10);
  17341. $ctx1.sendIdx["+"]=1;
  17342. $11=$recv(self._collection())._size();
  17343. $ctx1.sendIdx["size"]=2;
  17344. post=$recv($6)._copyFrom_to_($7,$11);
  17345. post;
  17346. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  17347. $ctx1.sendIdx[","]=2;
  17348. self._setCollection_($12);
  17349. };
  17350. $14=self._position();
  17351. $ctx1.sendIdx["position"]=3;
  17352. $13=$recv($14).__plus($recv(aString)._size());
  17353. self._position_($13);
  17354. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  17355. return self;
  17356. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  17357. },
  17358. args: ["aString"],
  17359. 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)",
  17360. referencedClasses: [],
  17361. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  17362. }),
  17363. $globals.StringStream);
  17364. $core.addMethod(
  17365. $core.method({
  17366. selector: "nextPutString:",
  17367. protocol: 'writing',
  17368. fn: function (aString){
  17369. var self=this;
  17370. return $core.withContext(function($ctx1) {
  17371. self._nextPutAll_(aString);
  17372. return self;
  17373. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  17374. },
  17375. args: ["aString"],
  17376. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  17377. referencedClasses: [],
  17378. messageSends: ["nextPutAll:"]
  17379. }),
  17380. $globals.StringStream);
  17381. $core.addMethod(
  17382. $core.method({
  17383. selector: "space",
  17384. protocol: 'writing',
  17385. fn: function (){
  17386. var self=this;
  17387. return $core.withContext(function($ctx1) {
  17388. self._nextPut_(" ");
  17389. return self;
  17390. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  17391. },
  17392. args: [],
  17393. source: "space\x0a\x09self nextPut: ' '",
  17394. referencedClasses: [],
  17395. messageSends: ["nextPut:"]
  17396. }),
  17397. $globals.StringStream);
  17398. $core.addMethod(
  17399. $core.method({
  17400. selector: "tab",
  17401. protocol: 'writing',
  17402. fn: function (){
  17403. var self=this;
  17404. return $core.withContext(function($ctx1) {
  17405. return self._nextPutAll_($recv($globals.String)._tab());
  17406. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  17407. },
  17408. args: [],
  17409. source: "tab\x0a\x09^ self nextPutAll: String tab",
  17410. referencedClasses: ["String"],
  17411. messageSends: ["nextPutAll:", "tab"]
  17412. }),
  17413. $globals.StringStream);
  17414. $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  17415. $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.";
  17416. $core.addMethod(
  17417. $core.method({
  17418. selector: "initialize",
  17419. protocol: 'initialization',
  17420. fn: function (){
  17421. var self=this;
  17422. return $core.withContext(function($ctx1) {
  17423. (
  17424. $ctx1.supercall = true,
  17425. ($globals.Queue.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  17426. $ctx1.supercall = false;
  17427. self["@read"]=$recv($globals.OrderedCollection)._new();
  17428. $ctx1.sendIdx["new"]=1;
  17429. self["@write"]=$recv($globals.OrderedCollection)._new();
  17430. self["@readIndex"]=(1);
  17431. return self;
  17432. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  17433. },
  17434. args: [],
  17435. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  17436. referencedClasses: ["OrderedCollection"],
  17437. messageSends: ["initialize", "new"]
  17438. }),
  17439. $globals.Queue);
  17440. $core.addMethod(
  17441. $core.method({
  17442. selector: "next",
  17443. protocol: 'accessing',
  17444. fn: function (){
  17445. var self=this;
  17446. return $core.withContext(function($ctx1) {
  17447. return self._nextIfAbsent_((function(){
  17448. return $core.withContext(function($ctx2) {
  17449. return self._error_("Cannot read from empty Queue.");
  17450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17451. }));
  17452. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  17453. },
  17454. args: [],
  17455. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  17456. referencedClasses: [],
  17457. messageSends: ["nextIfAbsent:", "error:"]
  17458. }),
  17459. $globals.Queue);
  17460. $core.addMethod(
  17461. $core.method({
  17462. selector: "nextIfAbsent:",
  17463. protocol: 'accessing',
  17464. fn: function (aBlock){
  17465. var self=this;
  17466. var result;
  17467. return $core.withContext(function($ctx1) {
  17468. var $1,$2;
  17469. var $early={};
  17470. try {
  17471. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  17472. return $core.withContext(function($ctx2) {
  17473. $1=$recv(self["@write"])._isEmpty();
  17474. if($core.assert($1)){
  17475. $2=$recv(self["@readIndex"]).__gt((1));
  17476. if($core.assert($2)){
  17477. self["@read"]=[];
  17478. self["@read"];
  17479. self["@readIndex"]=(1);
  17480. self["@readIndex"];
  17481. };
  17482. throw $early=[$recv(aBlock)._value()];
  17483. };
  17484. self["@read"]=self["@write"];
  17485. self["@read"];
  17486. self["@readIndex"]=(1);
  17487. self["@readIndex"];
  17488. self["@write"]=$recv($globals.OrderedCollection)._new();
  17489. self["@write"];
  17490. return $recv(self["@read"])._first();
  17491. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  17492. }));
  17493. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  17494. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  17495. return result;
  17496. }
  17497. catch(e) {if(e===$early)return e[0]; throw e}
  17498. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  17499. },
  17500. args: ["aBlock"],
  17501. source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write isEmpty ifTrue: [\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",
  17502. referencedClasses: ["OrderedCollection"],
  17503. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"]
  17504. }),
  17505. $globals.Queue);
  17506. $core.addMethod(
  17507. $core.method({
  17508. selector: "nextPut:",
  17509. protocol: 'accessing',
  17510. fn: function (anObject){
  17511. var self=this;
  17512. return $core.withContext(function($ctx1) {
  17513. $recv(self["@write"])._add_(anObject);
  17514. return self;
  17515. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  17516. },
  17517. args: ["anObject"],
  17518. source: "nextPut: anObject\x0a\x09write add: anObject",
  17519. referencedClasses: [],
  17520. messageSends: ["add:"]
  17521. }),
  17522. $globals.Queue);
  17523. $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
  17524. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  17525. $core.addMethod(
  17526. $core.method({
  17527. selector: "compile:",
  17528. protocol: 'evaluating',
  17529. fn: function (aString){
  17530. var self=this;
  17531. return $core.withContext(function($ctx1) {
  17532. return self.compile(aString);
  17533. return self;
  17534. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  17535. },
  17536. args: ["aString"],
  17537. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  17538. referencedClasses: [],
  17539. messageSends: []
  17540. }),
  17541. $globals.RegularExpression);
  17542. $core.addMethod(
  17543. $core.method({
  17544. selector: "exec:",
  17545. protocol: 'evaluating',
  17546. fn: function (aString){
  17547. var self=this;
  17548. return $core.withContext(function($ctx1) {
  17549. return self.exec(aString) || nil;
  17550. return self;
  17551. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  17552. },
  17553. args: ["aString"],
  17554. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  17555. referencedClasses: [],
  17556. messageSends: []
  17557. }),
  17558. $globals.RegularExpression);
  17559. $core.addMethod(
  17560. $core.method({
  17561. selector: "test:",
  17562. protocol: 'evaluating',
  17563. fn: function (aString){
  17564. var self=this;
  17565. return $core.withContext(function($ctx1) {
  17566. return self.test(aString);
  17567. return self;
  17568. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  17569. },
  17570. args: ["aString"],
  17571. source: "test: aString\x0a\x09<return self.test(aString)>",
  17572. referencedClasses: [],
  17573. messageSends: []
  17574. }),
  17575. $globals.RegularExpression);
  17576. $core.addMethod(
  17577. $core.method({
  17578. selector: "fromString:",
  17579. protocol: 'instance creation',
  17580. fn: function (aString){
  17581. var self=this;
  17582. return $core.withContext(function($ctx1) {
  17583. return self._fromString_flag_(aString,"");
  17584. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  17585. },
  17586. args: ["aString"],
  17587. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  17588. referencedClasses: [],
  17589. messageSends: ["fromString:flag:"]
  17590. }),
  17591. $globals.RegularExpression.klass);
  17592. $core.addMethod(
  17593. $core.method({
  17594. selector: "fromString:flag:",
  17595. protocol: 'instance creation',
  17596. fn: function (aString,anotherString){
  17597. var self=this;
  17598. return $core.withContext(function($ctx1) {
  17599. return new RegExp(aString, anotherString);
  17600. return self;
  17601. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  17602. },
  17603. args: ["aString", "anotherString"],
  17604. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  17605. referencedClasses: [],
  17606. messageSends: []
  17607. }),
  17608. $globals.RegularExpression.klass);
  17609. });
  17610. define("amber_core/Kernel-Exceptions", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17611. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  17612. $core.addPackage('Kernel-Exceptions');
  17613. $core.packages["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  17614. $core.packages["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17615. $core.addClass('Error', $globals.Object, ['messageText'], 'Kernel-Exceptions');
  17616. $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.";
  17617. $core.addMethod(
  17618. $core.method({
  17619. selector: "beHandled",
  17620. protocol: 'accessing',
  17621. fn: function (){
  17622. var self=this;
  17623. return $core.withContext(function($ctx1) {
  17624. self.amberHandled = true;
  17625. return self;
  17626. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  17627. },
  17628. args: [],
  17629. source: "beHandled\x0a\x09<self.amberHandled = true>",
  17630. referencedClasses: [],
  17631. messageSends: []
  17632. }),
  17633. $globals.Error);
  17634. $core.addMethod(
  17635. $core.method({
  17636. selector: "beUnhandled",
  17637. protocol: 'accessing',
  17638. fn: function (){
  17639. var self=this;
  17640. return $core.withContext(function($ctx1) {
  17641. self.amberHandled = false;
  17642. return self;
  17643. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  17644. },
  17645. args: [],
  17646. source: "beUnhandled\x0a\x09<self.amberHandled = false>",
  17647. referencedClasses: [],
  17648. messageSends: []
  17649. }),
  17650. $globals.Error);
  17651. $core.addMethod(
  17652. $core.method({
  17653. selector: "context",
  17654. protocol: 'accessing',
  17655. fn: function (){
  17656. var self=this;
  17657. return $core.withContext(function($ctx1) {
  17658. return self.context;
  17659. return self;
  17660. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  17661. },
  17662. args: [],
  17663. source: "context\x0a\x09<return self.context>",
  17664. referencedClasses: [],
  17665. messageSends: []
  17666. }),
  17667. $globals.Error);
  17668. $core.addMethod(
  17669. $core.method({
  17670. selector: "initialize",
  17671. protocol: 'initialization',
  17672. fn: function (){
  17673. var self=this;
  17674. return $core.withContext(function($ctx1) {
  17675. self._messageText_("Errorclass: ".__comma($recv(self._class())._name()));
  17676. return self;
  17677. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  17678. },
  17679. args: [],
  17680. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  17681. referencedClasses: [],
  17682. messageSends: ["messageText:", ",", "name", "class"]
  17683. }),
  17684. $globals.Error);
  17685. $core.addMethod(
  17686. $core.method({
  17687. selector: "isSmalltalkError",
  17688. protocol: 'testing',
  17689. fn: function (){
  17690. var self=this;
  17691. return $core.withContext(function($ctx1) {
  17692. return self.smalltalkError === true;
  17693. return self;
  17694. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  17695. },
  17696. args: [],
  17697. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  17698. referencedClasses: [],
  17699. messageSends: []
  17700. }),
  17701. $globals.Error);
  17702. $core.addMethod(
  17703. $core.method({
  17704. selector: "jsStack",
  17705. protocol: 'accessing',
  17706. fn: function (){
  17707. var self=this;
  17708. return $core.withContext(function($ctx1) {
  17709. return self.stack;
  17710. return self;
  17711. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  17712. },
  17713. args: [],
  17714. source: "jsStack\x0a\x09<return self.stack>",
  17715. referencedClasses: [],
  17716. messageSends: []
  17717. }),
  17718. $globals.Error);
  17719. $core.addMethod(
  17720. $core.method({
  17721. selector: "messageText",
  17722. protocol: 'accessing',
  17723. fn: function (){
  17724. var self=this;
  17725. return self["@messageText"];
  17726. },
  17727. args: [],
  17728. source: "messageText\x0a\x09^ messageText",
  17729. referencedClasses: [],
  17730. messageSends: []
  17731. }),
  17732. $globals.Error);
  17733. $core.addMethod(
  17734. $core.method({
  17735. selector: "messageText:",
  17736. protocol: 'accessing',
  17737. fn: function (aString){
  17738. var self=this;
  17739. self["@messageText"]=aString;
  17740. return self;
  17741. },
  17742. args: ["aString"],
  17743. source: "messageText: aString\x0a\x09messageText := aString",
  17744. referencedClasses: [],
  17745. messageSends: []
  17746. }),
  17747. $globals.Error);
  17748. $core.addMethod(
  17749. $core.method({
  17750. selector: "resignal",
  17751. protocol: 'signaling',
  17752. fn: function (){
  17753. var self=this;
  17754. return $core.withContext(function($ctx1) {
  17755. self.amberHandled = false;
  17756. throw(self);
  17757. ;
  17758. return self;
  17759. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  17760. },
  17761. args: [],
  17762. 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>",
  17763. referencedClasses: [],
  17764. messageSends: []
  17765. }),
  17766. $globals.Error);
  17767. $core.addMethod(
  17768. $core.method({
  17769. selector: "signal",
  17770. protocol: 'signaling',
  17771. fn: function (){
  17772. var self=this;
  17773. return $core.withContext(function($ctx1) {
  17774. self.amberHandled = false;
  17775. self.context = $core.getThisContext();
  17776. self.smalltalkError = true;
  17777. throw self;
  17778. ;
  17779. return self;
  17780. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  17781. },
  17782. args: [],
  17783. 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>",
  17784. referencedClasses: [],
  17785. messageSends: []
  17786. }),
  17787. $globals.Error);
  17788. $core.addMethod(
  17789. $core.method({
  17790. selector: "signal:",
  17791. protocol: 'signaling',
  17792. fn: function (aString){
  17793. var self=this;
  17794. return $core.withContext(function($ctx1) {
  17795. self._messageText_(aString);
  17796. self._signal();
  17797. return self;
  17798. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  17799. },
  17800. args: ["aString"],
  17801. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  17802. referencedClasses: [],
  17803. messageSends: ["messageText:", "signal"]
  17804. }),
  17805. $globals.Error);
  17806. $core.addMethod(
  17807. $core.method({
  17808. selector: "signalerContext",
  17809. protocol: 'accessing',
  17810. fn: function (){
  17811. var self=this;
  17812. return $core.withContext(function($ctx1) {
  17813. return self._signalerContextFrom_(self._context());
  17814. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  17815. },
  17816. args: [],
  17817. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  17818. referencedClasses: [],
  17819. messageSends: ["signalerContextFrom:", "context"]
  17820. }),
  17821. $globals.Error);
  17822. $core.addMethod(
  17823. $core.method({
  17824. selector: "signalerContextFrom:",
  17825. protocol: 'accessing',
  17826. fn: function (aContext){
  17827. var self=this;
  17828. return $core.withContext(function($ctx1) {
  17829. var $3,$2,$1;
  17830. return $recv(aContext)._findContextSuchThat_((function(context){
  17831. return $core.withContext(function($ctx2) {
  17832. $3=$recv(context)._receiver();
  17833. $ctx2.sendIdx["receiver"]=1;
  17834. $2=$recv($3).__eq_eq(self);
  17835. $ctx2.sendIdx["=="]=1;
  17836. $1=$recv($2)._or_((function(){
  17837. return $core.withContext(function($ctx3) {
  17838. return $recv($recv(context)._receiver()).__eq_eq(self._class());
  17839. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17840. }));
  17841. return $recv($1)._not();
  17842. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  17843. }));
  17844. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  17845. },
  17846. args: ["aContext"],
  17847. 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 ]",
  17848. referencedClasses: [],
  17849. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  17850. }),
  17851. $globals.Error);
  17852. $core.addMethod(
  17853. $core.method({
  17854. selector: "wasHandled",
  17855. protocol: 'testing',
  17856. fn: function (){
  17857. var self=this;
  17858. return $core.withContext(function($ctx1) {
  17859. return self.amberHandled || false;
  17860. return self;
  17861. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  17862. },
  17863. args: [],
  17864. source: "wasHandled\x0a\x09<return self.amberHandled || false>",
  17865. referencedClasses: [],
  17866. messageSends: []
  17867. }),
  17868. $globals.Error);
  17869. $core.addMethod(
  17870. $core.method({
  17871. selector: "classTag",
  17872. protocol: 'accessing',
  17873. fn: function (){
  17874. var self=this;
  17875. return "exception";
  17876. },
  17877. args: [],
  17878. 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'",
  17879. referencedClasses: [],
  17880. messageSends: []
  17881. }),
  17882. $globals.Error.klass);
  17883. $core.addMethod(
  17884. $core.method({
  17885. selector: "signal",
  17886. protocol: 'instance creation',
  17887. fn: function (){
  17888. var self=this;
  17889. return $core.withContext(function($ctx1) {
  17890. return $recv(self._new())._signal();
  17891. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.klass)});
  17892. },
  17893. args: [],
  17894. source: "signal\x0a\x09^ self new signal",
  17895. referencedClasses: [],
  17896. messageSends: ["signal", "new"]
  17897. }),
  17898. $globals.Error.klass);
  17899. $core.addMethod(
  17900. $core.method({
  17901. selector: "signal:",
  17902. protocol: 'instance creation',
  17903. fn: function (aString){
  17904. var self=this;
  17905. return $core.withContext(function($ctx1) {
  17906. return $recv(self._new())._signal_(aString);
  17907. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.klass)});
  17908. },
  17909. args: ["aString"],
  17910. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  17911. referencedClasses: [],
  17912. messageSends: ["signal:", "new"]
  17913. }),
  17914. $globals.Error.klass);
  17915. $core.addClass('Halt', $globals.Error, [], 'Kernel-Exceptions');
  17916. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  17917. $core.addMethod(
  17918. $core.method({
  17919. selector: "messageText",
  17920. protocol: 'accessing',
  17921. fn: function (){
  17922. var self=this;
  17923. return "Halt encountered";
  17924. },
  17925. args: [],
  17926. source: "messageText\x0a\x09^ 'Halt encountered'",
  17927. referencedClasses: [],
  17928. messageSends: []
  17929. }),
  17930. $globals.Halt);
  17931. $core.addMethod(
  17932. $core.method({
  17933. selector: "signalerContextFrom:",
  17934. protocol: 'accessing',
  17935. fn: function (aContext){
  17936. var self=this;
  17937. return $core.withContext(function($ctx1) {
  17938. var $3,$2,$1;
  17939. return $recv(aContext)._findContextSuchThat_((function(context){
  17940. return $core.withContext(function($ctx2) {
  17941. $3=$recv(context)._receiver();
  17942. $ctx2.sendIdx["receiver"]=1;
  17943. $2=$recv($3).__eq_eq(self);
  17944. $ctx2.sendIdx["=="]=1;
  17945. $1=$recv($2)._or_((function(){
  17946. return $core.withContext(function($ctx3) {
  17947. return $recv($recv($recv(context)._receiver()).__eq_eq(self._class()))._or_((function(){
  17948. return $core.withContext(function($ctx4) {
  17949. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  17950. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  17951. }));
  17952. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17953. }));
  17954. $ctx2.sendIdx["or:"]=1;
  17955. return $recv($1)._not();
  17956. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  17957. }));
  17958. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  17959. },
  17960. args: ["aContext"],
  17961. 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 ]",
  17962. referencedClasses: [],
  17963. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  17964. }),
  17965. $globals.Halt);
  17966. $core.addClass('JavaScriptException', $globals.Error, ['exception'], 'Kernel-Exceptions');
  17967. $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:`";
  17968. $core.addMethod(
  17969. $core.method({
  17970. selector: "context:",
  17971. protocol: 'accessing',
  17972. fn: function (aMethodContext){
  17973. var self=this;
  17974. return $core.withContext(function($ctx1) {
  17975. self.context = aMethodContext;
  17976. return self;
  17977. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  17978. },
  17979. args: ["aMethodContext"],
  17980. 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>",
  17981. referencedClasses: [],
  17982. messageSends: []
  17983. }),
  17984. $globals.JavaScriptException);
  17985. $core.addMethod(
  17986. $core.method({
  17987. selector: "exception",
  17988. protocol: 'accessing',
  17989. fn: function (){
  17990. var self=this;
  17991. return self["@exception"];
  17992. },
  17993. args: [],
  17994. source: "exception\x0a\x09^ exception",
  17995. referencedClasses: [],
  17996. messageSends: []
  17997. }),
  17998. $globals.JavaScriptException);
  17999. $core.addMethod(
  18000. $core.method({
  18001. selector: "exception:",
  18002. protocol: 'accessing',
  18003. fn: function (anException){
  18004. var self=this;
  18005. self["@exception"]=anException;
  18006. return self;
  18007. },
  18008. args: ["anException"],
  18009. source: "exception: anException\x0a\x09exception := anException",
  18010. referencedClasses: [],
  18011. messageSends: []
  18012. }),
  18013. $globals.JavaScriptException);
  18014. $core.addMethod(
  18015. $core.method({
  18016. selector: "messageText",
  18017. protocol: 'accessing',
  18018. fn: function (){
  18019. var self=this;
  18020. return $core.withContext(function($ctx1) {
  18021. return 'JavaScript exception: ' + self["@exception"].toString();
  18022. return self;
  18023. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  18024. },
  18025. args: [],
  18026. source: "messageText\x0a\x09<return 'JavaScript exception: ' + self[\x22@exception\x22].toString()>",
  18027. referencedClasses: [],
  18028. messageSends: []
  18029. }),
  18030. $globals.JavaScriptException);
  18031. $core.addMethod(
  18032. $core.method({
  18033. selector: "on:",
  18034. protocol: 'instance creation',
  18035. fn: function (anException){
  18036. var self=this;
  18037. return $core.withContext(function($ctx1) {
  18038. var $1;
  18039. $1=self._new();
  18040. $recv($1)._exception_(anException);
  18041. return $recv($1)._yourself();
  18042. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.klass)});
  18043. },
  18044. args: ["anException"],
  18045. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  18046. referencedClasses: [],
  18047. messageSends: ["exception:", "new", "yourself"]
  18048. }),
  18049. $globals.JavaScriptException.klass);
  18050. $core.addMethod(
  18051. $core.method({
  18052. selector: "on:context:",
  18053. protocol: 'instance creation',
  18054. fn: function (anException,aMethodContext){
  18055. var self=this;
  18056. return $core.withContext(function($ctx1) {
  18057. var $1;
  18058. $1=self._new();
  18059. $recv($1)._exception_(anException);
  18060. $recv($1)._context_(aMethodContext);
  18061. return $recv($1)._yourself();
  18062. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.klass)});
  18063. },
  18064. args: ["anException", "aMethodContext"],
  18065. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  18066. referencedClasses: [],
  18067. messageSends: ["exception:", "new", "context:", "yourself"]
  18068. }),
  18069. $globals.JavaScriptException.klass);
  18070. $core.addClass('MessageNotUnderstood', $globals.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  18071. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  18072. $core.addMethod(
  18073. $core.method({
  18074. selector: "message",
  18075. protocol: 'accessing',
  18076. fn: function (){
  18077. var self=this;
  18078. return self["@message"];
  18079. },
  18080. args: [],
  18081. source: "message\x0a\x09^ message",
  18082. referencedClasses: [],
  18083. messageSends: []
  18084. }),
  18085. $globals.MessageNotUnderstood);
  18086. $core.addMethod(
  18087. $core.method({
  18088. selector: "message:",
  18089. protocol: 'accessing',
  18090. fn: function (aMessage){
  18091. var self=this;
  18092. self["@message"]=aMessage;
  18093. return self;
  18094. },
  18095. args: ["aMessage"],
  18096. source: "message: aMessage\x0a\x09message := aMessage",
  18097. referencedClasses: [],
  18098. messageSends: []
  18099. }),
  18100. $globals.MessageNotUnderstood);
  18101. $core.addMethod(
  18102. $core.method({
  18103. selector: "messageText",
  18104. protocol: 'accessing',
  18105. fn: function (){
  18106. var self=this;
  18107. return $core.withContext(function($ctx1) {
  18108. var $1;
  18109. $1=$recv($recv($recv(self._receiver())._asString()).__comma(" does not understand #")).__comma($recv(self._message())._selector());
  18110. $ctx1.sendIdx[","]=1;
  18111. return $1;
  18112. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  18113. },
  18114. args: [],
  18115. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  18116. referencedClasses: [],
  18117. messageSends: [",", "asString", "receiver", "selector", "message"]
  18118. }),
  18119. $globals.MessageNotUnderstood);
  18120. $core.addMethod(
  18121. $core.method({
  18122. selector: "receiver",
  18123. protocol: 'accessing',
  18124. fn: function (){
  18125. var self=this;
  18126. return self["@receiver"];
  18127. },
  18128. args: [],
  18129. source: "receiver\x0a\x09^ receiver",
  18130. referencedClasses: [],
  18131. messageSends: []
  18132. }),
  18133. $globals.MessageNotUnderstood);
  18134. $core.addMethod(
  18135. $core.method({
  18136. selector: "receiver:",
  18137. protocol: 'accessing',
  18138. fn: function (anObject){
  18139. var self=this;
  18140. self["@receiver"]=anObject;
  18141. return self;
  18142. },
  18143. args: ["anObject"],
  18144. source: "receiver: anObject\x0a\x09receiver := anObject",
  18145. referencedClasses: [],
  18146. messageSends: []
  18147. }),
  18148. $globals.MessageNotUnderstood);
  18149. $core.addClass('NonBooleanReceiver', $globals.Error, ['object'], 'Kernel-Exceptions');
  18150. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  18151. $core.addMethod(
  18152. $core.method({
  18153. selector: "object",
  18154. protocol: 'accessing',
  18155. fn: function (){
  18156. var self=this;
  18157. return self["@object"];
  18158. },
  18159. args: [],
  18160. source: "object\x0a\x09^ object",
  18161. referencedClasses: [],
  18162. messageSends: []
  18163. }),
  18164. $globals.NonBooleanReceiver);
  18165. $core.addMethod(
  18166. $core.method({
  18167. selector: "object:",
  18168. protocol: 'accessing',
  18169. fn: function (anObject){
  18170. var self=this;
  18171. self["@object"]=anObject;
  18172. return self;
  18173. },
  18174. args: ["anObject"],
  18175. source: "object: anObject\x0a\x09object := anObject",
  18176. referencedClasses: [],
  18177. messageSends: []
  18178. }),
  18179. $globals.NonBooleanReceiver);
  18180. });
  18181. define("amber_core/Kernel-Infrastructure", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Collections"], function($boot){"use strict";
  18182. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  18183. $core.addPackage('Kernel-Infrastructure');
  18184. $core.packages["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  18185. $core.packages["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  18186. $core.addClass('JSObjectProxy', $globals.ProtoObject, ['jsObject'], 'Kernel-Infrastructure');
  18187. $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`.";
  18188. $core.addMethod(
  18189. $core.method({
  18190. selector: "=",
  18191. protocol: 'comparing',
  18192. fn: function (anObject){
  18193. var self=this;
  18194. return $core.withContext(function($ctx1) {
  18195. var $2,$1;
  18196. $2=$recv(anObject)._class();
  18197. $ctx1.sendIdx["class"]=1;
  18198. $1=$recv($2).__eq_eq(self._class());
  18199. if(!$core.assert($1)){
  18200. return false;
  18201. };
  18202. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  18203. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  18204. },
  18205. args: ["anObject"],
  18206. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  18207. referencedClasses: ["JSObjectProxy"],
  18208. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  18209. }),
  18210. $globals.JSObjectProxy);
  18211. $core.addMethod(
  18212. $core.method({
  18213. selector: "asJSON",
  18214. protocol: 'enumerating',
  18215. fn: function (){
  18216. var self=this;
  18217. return self["@jsObject"];
  18218. },
  18219. args: [],
  18220. source: "asJSON\x0a\x09\x22Answers the receiver in a stringyfy-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  18221. referencedClasses: [],
  18222. messageSends: []
  18223. }),
  18224. $globals.JSObjectProxy);
  18225. $core.addMethod(
  18226. $core.method({
  18227. selector: "at:",
  18228. protocol: 'accessing',
  18229. fn: function (aString){
  18230. var self=this;
  18231. return $core.withContext(function($ctx1) {
  18232. return self['@jsObject'][aString];
  18233. return self;
  18234. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  18235. },
  18236. args: ["aString"],
  18237. source: "at: aString\x0a\x09<return self['@jsObject'][aString]>",
  18238. referencedClasses: [],
  18239. messageSends: []
  18240. }),
  18241. $globals.JSObjectProxy);
  18242. $core.addMethod(
  18243. $core.method({
  18244. selector: "at:ifAbsent:",
  18245. protocol: 'accessing',
  18246. fn: function (aString,aBlock){
  18247. var self=this;
  18248. return $core.withContext(function($ctx1) {
  18249. var obj = self['@jsObject'];
  18250. return aString in obj ? obj[aString] : aBlock._value();
  18251. ;
  18252. return self;
  18253. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  18254. },
  18255. args: ["aString", "aBlock"],
  18256. 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>",
  18257. referencedClasses: [],
  18258. messageSends: []
  18259. }),
  18260. $globals.JSObjectProxy);
  18261. $core.addMethod(
  18262. $core.method({
  18263. selector: "at:ifPresent:",
  18264. protocol: 'accessing',
  18265. fn: function (aString,aBlock){
  18266. var self=this;
  18267. return $core.withContext(function($ctx1) {
  18268. var obj = self['@jsObject'];
  18269. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  18270. ;
  18271. return self;
  18272. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  18273. },
  18274. args: ["aString", "aBlock"],
  18275. 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>",
  18276. referencedClasses: [],
  18277. messageSends: []
  18278. }),
  18279. $globals.JSObjectProxy);
  18280. $core.addMethod(
  18281. $core.method({
  18282. selector: "at:ifPresent:ifAbsent:",
  18283. protocol: 'accessing',
  18284. fn: function (aString,aBlock,anotherBlock){
  18285. var self=this;
  18286. return $core.withContext(function($ctx1) {
  18287. var obj = self['@jsObject'];
  18288. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  18289. ;
  18290. return self;
  18291. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  18292. },
  18293. args: ["aString", "aBlock", "anotherBlock"],
  18294. 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>",
  18295. referencedClasses: [],
  18296. messageSends: []
  18297. }),
  18298. $globals.JSObjectProxy);
  18299. $core.addMethod(
  18300. $core.method({
  18301. selector: "at:put:",
  18302. protocol: 'accessing',
  18303. fn: function (aString,anObject){
  18304. var self=this;
  18305. return $core.withContext(function($ctx1) {
  18306. return self['@jsObject'][aString] = anObject;
  18307. return self;
  18308. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  18309. },
  18310. args: ["aString", "anObject"],
  18311. source: "at: aString put: anObject\x0a\x09<return self['@jsObject'][aString] = anObject>",
  18312. referencedClasses: [],
  18313. messageSends: []
  18314. }),
  18315. $globals.JSObjectProxy);
  18316. $core.addMethod(
  18317. $core.method({
  18318. selector: "doesNotUnderstand:",
  18319. protocol: 'proxy',
  18320. fn: function (aMessage){
  18321. var self=this;
  18322. return $core.withContext(function($ctx1) {
  18323. var $1,$receiver;
  18324. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  18325. if(($receiver = $1) == null || $receiver.isNil){
  18326. return (
  18327. $ctx1.supercall = true,
  18328. ($globals.JSObjectProxy.superclass||$boot.dnu).fn.prototype._doesNotUnderstand_.apply($recv(self), [aMessage]));
  18329. $ctx1.supercall = false;
  18330. } else {
  18331. var jsSelector;
  18332. jsSelector=$receiver;
  18333. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  18334. };
  18335. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  18336. },
  18337. args: ["aMessage"],
  18338. 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 ]",
  18339. referencedClasses: ["JSObjectProxy"],
  18340. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  18341. }),
  18342. $globals.JSObjectProxy);
  18343. $core.addMethod(
  18344. $core.method({
  18345. selector: "in:",
  18346. protocol: 'accessing',
  18347. fn: function (aValuable){
  18348. var self=this;
  18349. return $core.withContext(function($ctx1) {
  18350. return $recv(aValuable)._value_(self["@jsObject"]);
  18351. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  18352. },
  18353. args: ["aValuable"],
  18354. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  18355. referencedClasses: [],
  18356. messageSends: ["value:"]
  18357. }),
  18358. $globals.JSObjectProxy);
  18359. $core.addMethod(
  18360. $core.method({
  18361. selector: "jsObject",
  18362. protocol: 'accessing',
  18363. fn: function (){
  18364. var self=this;
  18365. return self["@jsObject"];
  18366. },
  18367. args: [],
  18368. source: "jsObject\x0a\x09^ jsObject",
  18369. referencedClasses: [],
  18370. messageSends: []
  18371. }),
  18372. $globals.JSObjectProxy);
  18373. $core.addMethod(
  18374. $core.method({
  18375. selector: "keysAndValuesDo:",
  18376. protocol: 'enumerating',
  18377. fn: function (aBlock){
  18378. var self=this;
  18379. return $core.withContext(function($ctx1) {
  18380. var o = self['@jsObject'];
  18381. for(var i in o) {
  18382. aBlock._value_value_(i, o[i]);
  18383. }
  18384. ;
  18385. return self;
  18386. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  18387. },
  18388. args: ["aBlock"],
  18389. 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>",
  18390. referencedClasses: [],
  18391. messageSends: []
  18392. }),
  18393. $globals.JSObjectProxy);
  18394. $core.addMethod(
  18395. $core.method({
  18396. selector: "printOn:",
  18397. protocol: 'printing',
  18398. fn: function (aStream){
  18399. var self=this;
  18400. return $core.withContext(function($ctx1) {
  18401. $recv(aStream)._nextPutAll_(self._printString());
  18402. return self;
  18403. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  18404. },
  18405. args: ["aStream"],
  18406. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  18407. referencedClasses: [],
  18408. messageSends: ["nextPutAll:", "printString"]
  18409. }),
  18410. $globals.JSObjectProxy);
  18411. $core.addMethod(
  18412. $core.method({
  18413. selector: "printString",
  18414. protocol: 'printing',
  18415. fn: function (){
  18416. var self=this;
  18417. return $core.withContext(function($ctx1) {
  18418. var js = self['@jsObject'];
  18419. return js.toString
  18420. ? js.toString()
  18421. : Object.prototype.toString.call(js)
  18422. ;
  18423. return self;
  18424. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  18425. },
  18426. args: [],
  18427. 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>",
  18428. referencedClasses: [],
  18429. messageSends: []
  18430. }),
  18431. $globals.JSObjectProxy);
  18432. $core.addMethod(
  18433. $core.method({
  18434. selector: "putOn:",
  18435. protocol: 'streaming',
  18436. fn: function (aStream){
  18437. var self=this;
  18438. return $core.withContext(function($ctx1) {
  18439. $recv(aStream)._nextPutJSObject_(self["@jsObject"]);
  18440. return self;
  18441. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  18442. },
  18443. args: ["aStream"],
  18444. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  18445. referencedClasses: [],
  18446. messageSends: ["nextPutJSObject:"]
  18447. }),
  18448. $globals.JSObjectProxy);
  18449. $core.addMethod(
  18450. $core.method({
  18451. selector: "addObjectVariablesTo:ofProxy:",
  18452. protocol: 'proxy',
  18453. fn: function (aDictionary,aProxy){
  18454. var self=this;
  18455. return $core.withContext(function($ctx1) {
  18456. var jsObject = aProxy['@jsObject'];
  18457. for(var i in jsObject) {
  18458. aDictionary._at_put_(i, jsObject[i]);
  18459. }
  18460. ;
  18461. return self;
  18462. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18463. },
  18464. args: ["aDictionary", "aProxy"],
  18465. 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>",
  18466. referencedClasses: [],
  18467. messageSends: []
  18468. }),
  18469. $globals.JSObjectProxy.klass);
  18470. $core.addMethod(
  18471. $core.method({
  18472. selector: "compareJSObjectOfProxy:withProxy:",
  18473. protocol: 'proxy',
  18474. fn: function (aProxy,anotherProxy){
  18475. var self=this;
  18476. return $core.withContext(function($ctx1) {
  18477. var anotherJSObject = anotherProxy.klass ? anotherProxy["@jsObject"] : anotherProxy;
  18478. return aProxy["@jsObject"] === anotherJSObject;
  18479. return self;
  18480. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.klass)});
  18481. },
  18482. args: ["aProxy", "anotherProxy"],
  18483. source: "compareJSObjectOfProxy: aProxy withProxy: anotherProxy\x0a<\x0a\x09var anotherJSObject = anotherProxy.klass ? anotherProxy[\x22@jsObject\x22] : anotherProxy;\x0a\x09return aProxy[\x22@jsObject\x22] === anotherJSObject\x0a>",
  18484. referencedClasses: [],
  18485. messageSends: []
  18486. }),
  18487. $globals.JSObjectProxy.klass);
  18488. $core.addMethod(
  18489. $core.method({
  18490. selector: "forwardMessage:withArguments:ofProxy:",
  18491. protocol: 'proxy',
  18492. fn: function (aString,anArray,aProxy){
  18493. var self=this;
  18494. return $core.withContext(function($ctx1) {
  18495. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  18496. ;
  18497. return self;
  18498. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18499. },
  18500. args: ["aString", "anArray", "aProxy"],
  18501. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09>",
  18502. referencedClasses: [],
  18503. messageSends: []
  18504. }),
  18505. $globals.JSObjectProxy.klass);
  18506. $core.addMethod(
  18507. $core.method({
  18508. selector: "jsObject:ofProxy:",
  18509. protocol: 'proxy',
  18510. fn: function (aJSObject,aProxy){
  18511. var self=this;
  18512. return $core.withContext(function($ctx1) {
  18513. aProxy['@jsObject'] = aJSObject;
  18514. return self;
  18515. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18516. },
  18517. args: ["aJSObject", "aProxy"],
  18518. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<aProxy['@jsObject'] = aJSObject>",
  18519. referencedClasses: [],
  18520. messageSends: []
  18521. }),
  18522. $globals.JSObjectProxy.klass);
  18523. $core.addMethod(
  18524. $core.method({
  18525. selector: "lookupProperty:ofProxy:",
  18526. protocol: 'proxy',
  18527. fn: function (aString,aProxy){
  18528. var self=this;
  18529. return $core.withContext(function($ctx1) {
  18530. return aString in aProxy._jsObject() ? aString : nil;
  18531. return self;
  18532. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.klass)});
  18533. },
  18534. args: ["aString", "aProxy"],
  18535. 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>",
  18536. referencedClasses: [],
  18537. messageSends: []
  18538. }),
  18539. $globals.JSObjectProxy.klass);
  18540. $core.addMethod(
  18541. $core.method({
  18542. selector: "on:",
  18543. protocol: 'instance creation',
  18544. fn: function (aJSObject){
  18545. var self=this;
  18546. var instance;
  18547. return $core.withContext(function($ctx1) {
  18548. instance=self._new();
  18549. self._jsObject_ofProxy_(aJSObject,instance);
  18550. return instance;
  18551. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.klass)});
  18552. },
  18553. args: ["aJSObject"],
  18554. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  18555. referencedClasses: [],
  18556. messageSends: ["new", "jsObject:ofProxy:"]
  18557. }),
  18558. $globals.JSObjectProxy.klass);
  18559. $core.addClass('Organizer', $globals.Object, [], 'Kernel-Infrastructure');
  18560. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  18561. $core.addMethod(
  18562. $core.method({
  18563. selector: "addElement:",
  18564. protocol: 'accessing',
  18565. fn: function (anObject){
  18566. var self=this;
  18567. return $core.withContext(function($ctx1) {
  18568. self.elements.addElement(anObject);
  18569. return self;
  18570. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  18571. },
  18572. args: ["anObject"],
  18573. source: "addElement: anObject\x0a\x09<self.elements.addElement(anObject)>",
  18574. referencedClasses: [],
  18575. messageSends: []
  18576. }),
  18577. $globals.Organizer);
  18578. $core.addMethod(
  18579. $core.method({
  18580. selector: "elements",
  18581. protocol: 'accessing',
  18582. fn: function (){
  18583. var self=this;
  18584. return $core.withContext(function($ctx1) {
  18585. return $recv(self._basicAt_("elements"))._copy();
  18586. }, function($ctx1) {$ctx1.fill(self,"elements",{},$globals.Organizer)});
  18587. },
  18588. args: [],
  18589. source: "elements\x0a\x09^ (self basicAt: 'elements') copy",
  18590. referencedClasses: [],
  18591. messageSends: ["copy", "basicAt:"]
  18592. }),
  18593. $globals.Organizer);
  18594. $core.addMethod(
  18595. $core.method({
  18596. selector: "removeElement:",
  18597. protocol: 'accessing',
  18598. fn: function (anObject){
  18599. var self=this;
  18600. return $core.withContext(function($ctx1) {
  18601. self.elements.removeElement(anObject);
  18602. return self;
  18603. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  18604. },
  18605. args: ["anObject"],
  18606. source: "removeElement: anObject\x0a\x09<self.elements.removeElement(anObject)>",
  18607. referencedClasses: [],
  18608. messageSends: []
  18609. }),
  18610. $globals.Organizer);
  18611. $core.addClass('ClassOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  18612. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  18613. $core.addMethod(
  18614. $core.method({
  18615. selector: "addElement:",
  18616. protocol: 'accessing',
  18617. fn: function (aString){
  18618. var self=this;
  18619. return $core.withContext(function($ctx1) {
  18620. var $1,$3,$2;
  18621. (
  18622. $ctx1.supercall = true,
  18623. ($globals.ClassOrganizer.superclass||$boot.dnu).fn.prototype._addElement_.apply($recv(self), [aString]));
  18624. $ctx1.supercall = false;
  18625. $1=$recv($globals.SystemAnnouncer)._current();
  18626. $3=$recv($globals.ProtocolAdded)._new();
  18627. $recv($3)._protocol_(aString);
  18628. $recv($3)._theClass_(self._theClass());
  18629. $2=$recv($3)._yourself();
  18630. $recv($1)._announce_($2);
  18631. return self;
  18632. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  18633. },
  18634. args: ["aString"],
  18635. 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)",
  18636. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  18637. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  18638. }),
  18639. $globals.ClassOrganizer);
  18640. $core.addMethod(
  18641. $core.method({
  18642. selector: "removeElement:",
  18643. protocol: 'accessing',
  18644. fn: function (aString){
  18645. var self=this;
  18646. return $core.withContext(function($ctx1) {
  18647. var $1,$3,$2;
  18648. (
  18649. $ctx1.supercall = true,
  18650. ($globals.ClassOrganizer.superclass||$boot.dnu).fn.prototype._removeElement_.apply($recv(self), [aString]));
  18651. $ctx1.supercall = false;
  18652. $1=$recv($globals.SystemAnnouncer)._current();
  18653. $3=$recv($globals.ProtocolRemoved)._new();
  18654. $recv($3)._protocol_(aString);
  18655. $recv($3)._theClass_(self._theClass());
  18656. $2=$recv($3)._yourself();
  18657. $recv($1)._announce_($2);
  18658. return self;
  18659. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  18660. },
  18661. args: ["aString"],
  18662. 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)",
  18663. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  18664. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  18665. }),
  18666. $globals.ClassOrganizer);
  18667. $core.addMethod(
  18668. $core.method({
  18669. selector: "theClass",
  18670. protocol: 'accessing',
  18671. fn: function (){
  18672. var self=this;
  18673. return $core.withContext(function($ctx1) {
  18674. return self.theClass ;
  18675. return self;
  18676. }, function($ctx1) {$ctx1.fill(self,"theClass",{},$globals.ClassOrganizer)});
  18677. },
  18678. args: [],
  18679. source: "theClass\x0a\x09< return self.theClass >",
  18680. referencedClasses: [],
  18681. messageSends: []
  18682. }),
  18683. $globals.ClassOrganizer);
  18684. $core.addClass('PackageOrganizer', $globals.Organizer, [], 'Kernel-Infrastructure');
  18685. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  18686. $core.addClass('Package', $globals.Object, ['transport', 'imports', 'dirty'], 'Kernel-Infrastructure');
  18687. $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'";
  18688. $core.addMethod(
  18689. $core.method({
  18690. selector: "basicImports",
  18691. protocol: 'private',
  18692. fn: function (){
  18693. var self=this;
  18694. return $core.withContext(function($ctx1) {
  18695. return self.imports || [];
  18696. return self;
  18697. }, function($ctx1) {$ctx1.fill(self,"basicImports",{},$globals.Package)});
  18698. },
  18699. args: [],
  18700. 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 || []>",
  18701. referencedClasses: [],
  18702. messageSends: []
  18703. }),
  18704. $globals.Package);
  18705. $core.addMethod(
  18706. $core.method({
  18707. selector: "basicName:",
  18708. protocol: 'private',
  18709. fn: function (aString){
  18710. var self=this;
  18711. return $core.withContext(function($ctx1) {
  18712. self.pkgName = aString;
  18713. return self;
  18714. }, function($ctx1) {$ctx1.fill(self,"basicName:",{aString:aString},$globals.Package)});
  18715. },
  18716. args: ["aString"],
  18717. source: "basicName: aString\x0a\x09<self.pkgName = aString>",
  18718. referencedClasses: [],
  18719. messageSends: []
  18720. }),
  18721. $globals.Package);
  18722. $core.addMethod(
  18723. $core.method({
  18724. selector: "basicTransport",
  18725. protocol: 'private',
  18726. fn: function (){
  18727. var self=this;
  18728. return $core.withContext(function($ctx1) {
  18729. return self.transport;
  18730. return self;
  18731. }, function($ctx1) {$ctx1.fill(self,"basicTransport",{},$globals.Package)});
  18732. },
  18733. args: [],
  18734. 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>",
  18735. referencedClasses: [],
  18736. messageSends: []
  18737. }),
  18738. $globals.Package);
  18739. $core.addMethod(
  18740. $core.method({
  18741. selector: "beClean",
  18742. protocol: 'accessing',
  18743. fn: function (){
  18744. var self=this;
  18745. return $core.withContext(function($ctx1) {
  18746. var $1,$3,$2;
  18747. self["@dirty"]=false;
  18748. $1=$recv($globals.SystemAnnouncer)._current();
  18749. $3=$recv($globals.PackageClean)._new();
  18750. $recv($3)._package_(self);
  18751. $2=$recv($3)._yourself();
  18752. $recv($1)._announce_($2);
  18753. return self;
  18754. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  18755. },
  18756. args: [],
  18757. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18758. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  18759. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18760. }),
  18761. $globals.Package);
  18762. $core.addMethod(
  18763. $core.method({
  18764. selector: "beDirty",
  18765. protocol: 'accessing',
  18766. fn: function (){
  18767. var self=this;
  18768. return $core.withContext(function($ctx1) {
  18769. var $1,$3,$2;
  18770. self["@dirty"]=true;
  18771. $1=$recv($globals.SystemAnnouncer)._current();
  18772. $3=$recv($globals.PackageDirty)._new();
  18773. $recv($3)._package_(self);
  18774. $2=$recv($3)._yourself();
  18775. $recv($1)._announce_($2);
  18776. return self;
  18777. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  18778. },
  18779. args: [],
  18780. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  18781. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  18782. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  18783. }),
  18784. $globals.Package);
  18785. $core.addMethod(
  18786. $core.method({
  18787. selector: "classTemplate",
  18788. protocol: 'accessing',
  18789. fn: function (){
  18790. var self=this;
  18791. return $core.withContext(function($ctx1) {
  18792. var $2,$3,$1,$4,$5;
  18793. return $recv($globals.String)._streamContents_((function(stream){
  18794. return $core.withContext(function($ctx2) {
  18795. $recv(stream)._nextPutAll_("Object");
  18796. $ctx2.sendIdx["nextPutAll:"]=1;
  18797. $recv(stream)._nextPutAll_(" subclass: #NameOfSubclass");
  18798. $ctx2.sendIdx["nextPutAll:"]=2;
  18799. $2=$recv($globals.String)._lf();
  18800. $ctx2.sendIdx["lf"]=1;
  18801. $3=$recv($globals.String)._tab();
  18802. $ctx2.sendIdx["tab"]=1;
  18803. $1=$recv($2).__comma($3);
  18804. $ctx2.sendIdx[","]=1;
  18805. $recv(stream)._nextPutAll_($1);
  18806. $ctx2.sendIdx["nextPutAll:"]=3;
  18807. $4=$recv(stream)._nextPutAll_("instanceVariableNames: ''");
  18808. $ctx2.sendIdx["nextPutAll:"]=4;
  18809. $4;
  18810. $5=$recv("'".__comma($recv($globals.String)._lf())).__comma($recv($globals.String)._tab());
  18811. $ctx2.sendIdx[","]=2;
  18812. $recv(stream)._nextPutAll_($5);
  18813. $ctx2.sendIdx["nextPutAll:"]=5;
  18814. $recv(stream)._nextPutAll_("package: '");
  18815. $ctx2.sendIdx["nextPutAll:"]=6;
  18816. $recv(stream)._nextPutAll_(self._name());
  18817. $ctx2.sendIdx["nextPutAll:"]=7;
  18818. return $recv(stream)._nextPutAll_("'");
  18819. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18820. }));
  18821. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  18822. },
  18823. args: [],
  18824. 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: '''' ]",
  18825. referencedClasses: ["String"],
  18826. messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"]
  18827. }),
  18828. $globals.Package);
  18829. $core.addMethod(
  18830. $core.method({
  18831. selector: "classes",
  18832. protocol: 'classes',
  18833. fn: function (){
  18834. var self=this;
  18835. return $core.withContext(function($ctx1) {
  18836. return $recv(self._organization())._elements();
  18837. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  18838. },
  18839. args: [],
  18840. source: "classes\x0a\x09^ self organization elements",
  18841. referencedClasses: [],
  18842. messageSends: ["elements", "organization"]
  18843. }),
  18844. $globals.Package);
  18845. $core.addMethod(
  18846. $core.method({
  18847. selector: "definition",
  18848. protocol: 'accessing',
  18849. fn: function (){
  18850. var self=this;
  18851. return $core.withContext(function($ctx1) {
  18852. var $1,$3,$4,$2,$6,$5,$8,$9,$7,$10;
  18853. return $recv($globals.String)._streamContents_((function(stream){
  18854. return $core.withContext(function($ctx2) {
  18855. $1=$recv(self._class())._name();
  18856. $ctx2.sendIdx["name"]=1;
  18857. $recv(stream)._nextPutAll_($1);
  18858. $ctx2.sendIdx["nextPutAll:"]=1;
  18859. $3=$recv($globals.String)._lf();
  18860. $ctx2.sendIdx["lf"]=1;
  18861. $4=$recv($globals.String)._tab();
  18862. $ctx2.sendIdx["tab"]=1;
  18863. $2=$recv($3).__comma($4);
  18864. $ctx2.sendIdx[","]=1;
  18865. $recv(stream)._nextPutAll_($2);
  18866. $ctx2.sendIdx["nextPutAll:"]=2;
  18867. $recv(stream)._nextPutAll_("named: ");
  18868. $ctx2.sendIdx["nextPutAll:"]=3;
  18869. $6="'".__comma(self._name());
  18870. $ctx2.sendIdx[","]=3;
  18871. $5=$recv($6).__comma("'");
  18872. $ctx2.sendIdx[","]=2;
  18873. $recv(stream)._nextPutAll_($5);
  18874. $ctx2.sendIdx["nextPutAll:"]=4;
  18875. $8=$recv($globals.String)._lf();
  18876. $ctx2.sendIdx["lf"]=2;
  18877. $9=$recv($globals.String)._tab();
  18878. $ctx2.sendIdx["tab"]=2;
  18879. $7=$recv($8).__comma($9);
  18880. $ctx2.sendIdx[","]=4;
  18881. $recv(stream)._nextPutAll_($7);
  18882. $ctx2.sendIdx["nextPutAll:"]=5;
  18883. $recv(stream)._nextPutAll_("imports: ");
  18884. $ctx2.sendIdx["nextPutAll:"]=6;
  18885. $recv(stream)._nextPutAll_(self._importsDefinition());
  18886. $ctx2.sendIdx["nextPutAll:"]=7;
  18887. $10=$recv($recv($globals.String)._lf()).__comma($recv($globals.String)._tab());
  18888. $ctx2.sendIdx[","]=5;
  18889. $recv(stream)._nextPutAll_($10);
  18890. $ctx2.sendIdx["nextPutAll:"]=8;
  18891. $recv(stream)._nextPutAll_("transport: (");
  18892. $ctx2.sendIdx["nextPutAll:"]=9;
  18893. return $recv(stream)._nextPutAll_($recv($recv(self._transport())._definition()).__comma(")"));
  18894. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18895. }));
  18896. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  18897. },
  18898. args: [],
  18899. 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, ')' ]",
  18900. referencedClasses: ["String"],
  18901. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "lf", "tab", "importsDefinition", "definition", "transport"]
  18902. }),
  18903. $globals.Package);
  18904. $core.addMethod(
  18905. $core.method({
  18906. selector: "imports",
  18907. protocol: 'accessing',
  18908. fn: function (){
  18909. var self=this;
  18910. return $core.withContext(function($ctx1) {
  18911. var $1,$receiver;
  18912. $1=self["@imports"];
  18913. if(($receiver = $1) == null || $receiver.isNil){
  18914. var parsed;
  18915. parsed=self._importsFromJson_(self._basicImports());
  18916. parsed;
  18917. self._imports_(parsed);
  18918. return self["@imports"];
  18919. } else {
  18920. return $1;
  18921. };
  18922. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  18923. },
  18924. args: [],
  18925. 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 ]",
  18926. referencedClasses: [],
  18927. messageSends: ["ifNil:", "importsFromJson:", "basicImports", "imports:"]
  18928. }),
  18929. $globals.Package);
  18930. $core.addMethod(
  18931. $core.method({
  18932. selector: "imports:",
  18933. protocol: 'accessing',
  18934. fn: function (anArray){
  18935. var self=this;
  18936. return $core.withContext(function($ctx1) {
  18937. self._validateImports_(anArray);
  18938. self["@imports"]=$recv(anArray)._asSet();
  18939. return self;
  18940. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  18941. },
  18942. args: ["anArray"],
  18943. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  18944. referencedClasses: [],
  18945. messageSends: ["validateImports:", "asSet"]
  18946. }),
  18947. $globals.Package);
  18948. $core.addMethod(
  18949. $core.method({
  18950. selector: "importsAsJson",
  18951. protocol: 'converting',
  18952. fn: function (){
  18953. var self=this;
  18954. return $core.withContext(function($ctx1) {
  18955. var $1;
  18956. return $recv(self._sortedImportsAsArray())._collect_((function(each){
  18957. return $core.withContext(function($ctx2) {
  18958. $1=$recv(each)._isString();
  18959. if($core.assert($1)){
  18960. return each;
  18961. } else {
  18962. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  18963. $ctx2.sendIdx[","]=1;
  18964. };
  18965. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18966. }));
  18967. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  18968. },
  18969. args: [],
  18970. 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 ]]",
  18971. referencedClasses: [],
  18972. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  18973. }),
  18974. $globals.Package);
  18975. $core.addMethod(
  18976. $core.method({
  18977. selector: "importsDefinition",
  18978. protocol: 'accessing',
  18979. fn: function (){
  18980. var self=this;
  18981. return $core.withContext(function($ctx1) {
  18982. return $recv($globals.String)._streamContents_((function(stream){
  18983. return $core.withContext(function($ctx2) {
  18984. $recv(stream)._nextPutAll_("{");
  18985. $ctx2.sendIdx["nextPutAll:"]=1;
  18986. $recv(self._sortedImportsAsArray())._do_separatedBy_((function(each){
  18987. return $core.withContext(function($ctx3) {
  18988. return $recv(stream)._nextPutAll_($recv(each)._importsString());
  18989. $ctx3.sendIdx["nextPutAll:"]=2;
  18990. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  18991. }),(function(){
  18992. return $core.withContext(function($ctx3) {
  18993. return $recv(stream)._nextPutAll_(". ");
  18994. $ctx3.sendIdx["nextPutAll:"]=3;
  18995. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  18996. }));
  18997. return $recv(stream)._nextPutAll_("}");
  18998. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  18999. }));
  19000. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  19001. },
  19002. args: [],
  19003. 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: '}' ]",
  19004. referencedClasses: ["String"],
  19005. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "sortedImportsAsArray", "importsString"]
  19006. }),
  19007. $globals.Package);
  19008. $core.addMethod(
  19009. $core.method({
  19010. selector: "importsFromJson:",
  19011. protocol: 'converting',
  19012. fn: function (anArray){
  19013. var self=this;
  19014. return $core.withContext(function($ctx1) {
  19015. var $1;
  19016. return $recv(anArray)._collect_((function(each){
  19017. var split;
  19018. return $core.withContext(function($ctx2) {
  19019. split=$recv(each)._tokenize_("=");
  19020. split;
  19021. $1=$recv($recv(split)._size()).__eq((1));
  19022. if($core.assert($1)){
  19023. return $recv(split)._first();
  19024. $ctx2.sendIdx["first"]=1;
  19025. } else {
  19026. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  19027. };
  19028. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  19029. }));
  19030. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  19031. },
  19032. args: ["anArray"],
  19033. 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 ]]",
  19034. referencedClasses: [],
  19035. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  19036. }),
  19037. $globals.Package);
  19038. $core.addMethod(
  19039. $core.method({
  19040. selector: "isDirty",
  19041. protocol: 'testing',
  19042. fn: function (){
  19043. var self=this;
  19044. return $core.withContext(function($ctx1) {
  19045. var $1,$receiver;
  19046. $1=self["@dirty"];
  19047. if(($receiver = $1) == null || $receiver.isNil){
  19048. return false;
  19049. } else {
  19050. return $1;
  19051. };
  19052. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  19053. },
  19054. args: [],
  19055. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  19056. referencedClasses: [],
  19057. messageSends: ["ifNil:"]
  19058. }),
  19059. $globals.Package);
  19060. $core.addMethod(
  19061. $core.method({
  19062. selector: "isPackage",
  19063. protocol: 'testing',
  19064. fn: function (){
  19065. var self=this;
  19066. return true;
  19067. },
  19068. args: [],
  19069. source: "isPackage\x0a\x09^ true",
  19070. referencedClasses: [],
  19071. messageSends: []
  19072. }),
  19073. $globals.Package);
  19074. $core.addMethod(
  19075. $core.method({
  19076. selector: "loadDependencies",
  19077. protocol: 'dependencies',
  19078. fn: function (){
  19079. var self=this;
  19080. var classes,packages;
  19081. return $core.withContext(function($ctx1) {
  19082. var $1;
  19083. classes=self._loadDependencyClasses();
  19084. $1=$recv($recv(classes)._collect_((function(each){
  19085. return $core.withContext(function($ctx2) {
  19086. return $recv(each)._package();
  19087. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19088. })))._asSet();
  19089. $recv($1)._remove_ifAbsent_(self,(function(){
  19090. }));
  19091. return $recv($1)._yourself();
  19092. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  19093. },
  19094. args: [],
  19095. 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",
  19096. referencedClasses: [],
  19097. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  19098. }),
  19099. $globals.Package);
  19100. $core.addMethod(
  19101. $core.method({
  19102. selector: "loadDependencyClasses",
  19103. protocol: 'dependencies',
  19104. fn: function (){
  19105. var self=this;
  19106. var starCategoryName;
  19107. return $core.withContext(function($ctx1) {
  19108. var $3,$2,$1,$5,$4;
  19109. starCategoryName="*".__comma(self._name());
  19110. $ctx1.sendIdx[","]=1;
  19111. $3=self._classes();
  19112. $ctx1.sendIdx["classes"]=1;
  19113. $2=$recv($3)._collect_((function(each){
  19114. return $core.withContext(function($ctx2) {
  19115. return $recv(each)._superclass();
  19116. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19117. }));
  19118. $1=$recv($2)._asSet();
  19119. $recv($1)._remove_ifAbsent_(nil,(function(){
  19120. }));
  19121. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  19122. return $core.withContext(function($ctx2) {
  19123. $5=$recv(each)._protocols();
  19124. $ctx2.sendIdx["protocols"]=1;
  19125. $4=$recv($5).__comma($recv($recv(each)._class())._protocols());
  19126. return $recv($4)._includes_(starCategoryName);
  19127. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  19128. })));
  19129. return $recv($1)._yourself();
  19130. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  19131. },
  19132. args: [],
  19133. 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",
  19134. referencedClasses: ["Smalltalk"],
  19135. messageSends: [",", "name", "remove:ifAbsent:", "asSet", "collect:", "classes", "superclass", "addAll:", "select:", "includes:", "protocols", "class", "yourself"]
  19136. }),
  19137. $globals.Package);
  19138. $core.addMethod(
  19139. $core.method({
  19140. selector: "name",
  19141. protocol: 'accessing',
  19142. fn: function (){
  19143. var self=this;
  19144. return $core.withContext(function($ctx1) {
  19145. return self.pkgName;
  19146. return self;
  19147. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Package)});
  19148. },
  19149. args: [],
  19150. source: "name\x0a\x09<return self.pkgName>",
  19151. referencedClasses: [],
  19152. messageSends: []
  19153. }),
  19154. $globals.Package);
  19155. $core.addMethod(
  19156. $core.method({
  19157. selector: "name:",
  19158. protocol: 'accessing',
  19159. fn: function (aString){
  19160. var self=this;
  19161. return $core.withContext(function($ctx1) {
  19162. self._basicName_(aString);
  19163. self._beDirty();
  19164. return self;
  19165. }, function($ctx1) {$ctx1.fill(self,"name:",{aString:aString},$globals.Package)});
  19166. },
  19167. args: ["aString"],
  19168. source: "name: aString\x0a\x09self basicName: aString.\x0a\x09self beDirty",
  19169. referencedClasses: [],
  19170. messageSends: ["basicName:", "beDirty"]
  19171. }),
  19172. $globals.Package);
  19173. $core.addMethod(
  19174. $core.method({
  19175. selector: "organization",
  19176. protocol: 'accessing',
  19177. fn: function (){
  19178. var self=this;
  19179. return $core.withContext(function($ctx1) {
  19180. return self._basicAt_("organization");
  19181. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.Package)});
  19182. },
  19183. args: [],
  19184. source: "organization\x0a\x09^ self basicAt: 'organization'",
  19185. referencedClasses: [],
  19186. messageSends: ["basicAt:"]
  19187. }),
  19188. $globals.Package);
  19189. $core.addMethod(
  19190. $core.method({
  19191. selector: "printOn:",
  19192. protocol: 'printing',
  19193. fn: function (aStream){
  19194. var self=this;
  19195. return $core.withContext(function($ctx1) {
  19196. (
  19197. $ctx1.supercall = true,
  19198. ($globals.Package.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  19199. $ctx1.supercall = false;
  19200. $recv(aStream)._nextPutAll_(" (");
  19201. $ctx1.sendIdx["nextPutAll:"]=1;
  19202. $recv(aStream)._nextPutAll_(self._name());
  19203. $ctx1.sendIdx["nextPutAll:"]=2;
  19204. $recv(aStream)._nextPutAll_(")");
  19205. return self;
  19206. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  19207. },
  19208. args: ["aStream"],
  19209. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  19210. referencedClasses: [],
  19211. messageSends: ["printOn:", "nextPutAll:", "name"]
  19212. }),
  19213. $globals.Package);
  19214. $core.addMethod(
  19215. $core.method({
  19216. selector: "setupClasses",
  19217. protocol: 'classes',
  19218. fn: function (){
  19219. var self=this;
  19220. return $core.withContext(function($ctx1) {
  19221. var $1;
  19222. $1=self._classes();
  19223. $recv($1)._do_((function(each){
  19224. return $core.withContext(function($ctx2) {
  19225. return $recv($recv($globals.ClassBuilder)._new())._setupClass_(each);
  19226. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19227. }));
  19228. $ctx1.sendIdx["do:"]=1;
  19229. $recv($1)._do_((function(each){
  19230. return $core.withContext(function($ctx2) {
  19231. return $recv(each)._initialize();
  19232. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  19233. }));
  19234. return self;
  19235. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  19236. },
  19237. args: [],
  19238. source: "setupClasses\x0a\x09self classes\x0a\x09\x09do: [ :each | ClassBuilder new setupClass: each ];\x0a\x09\x09do: [ :each | each initialize ]",
  19239. referencedClasses: ["ClassBuilder"],
  19240. messageSends: ["do:", "classes", "setupClass:", "new", "initialize"]
  19241. }),
  19242. $globals.Package);
  19243. $core.addMethod(
  19244. $core.method({
  19245. selector: "sortedClasses",
  19246. protocol: 'classes',
  19247. fn: function (){
  19248. var self=this;
  19249. return $core.withContext(function($ctx1) {
  19250. return $recv(self._class())._sortedClasses_(self._classes());
  19251. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  19252. },
  19253. args: [],
  19254. 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",
  19255. referencedClasses: [],
  19256. messageSends: ["sortedClasses:", "class", "classes"]
  19257. }),
  19258. $globals.Package);
  19259. $core.addMethod(
  19260. $core.method({
  19261. selector: "sortedImportsAsArray",
  19262. protocol: 'private',
  19263. fn: function (){
  19264. var self=this;
  19265. return $core.withContext(function($ctx1) {
  19266. var $3,$2,$4,$1,$6,$5,$7;
  19267. return $recv($recv(self._imports())._asArray())._sorted_((function(a,b){
  19268. return $core.withContext(function($ctx2) {
  19269. $3=$recv(a)._isString();
  19270. $ctx2.sendIdx["isString"]=1;
  19271. $2=$recv($3)._not();
  19272. $4=$recv(b)._isString();
  19273. $ctx2.sendIdx["isString"]=2;
  19274. $1=$recv($2).__and($4);
  19275. return $recv($1)._or_((function(){
  19276. return $core.withContext(function($ctx3) {
  19277. $6=$recv(a)._isString();
  19278. $ctx3.sendIdx["isString"]=3;
  19279. $5=$recv($6).__eq($recv(b)._isString());
  19280. return $recv($5)._and_((function(){
  19281. return $core.withContext(function($ctx4) {
  19282. $7=$recv(a)._value();
  19283. $ctx4.sendIdx["value"]=1;
  19284. return $recv($7).__lt_eq($recv(b)._value());
  19285. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  19286. }));
  19287. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  19288. }));
  19289. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  19290. }));
  19291. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  19292. },
  19293. args: [],
  19294. 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 ]]]",
  19295. referencedClasses: [],
  19296. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  19297. }),
  19298. $globals.Package);
  19299. $core.addMethod(
  19300. $core.method({
  19301. selector: "transport",
  19302. protocol: 'accessing',
  19303. fn: function (){
  19304. var self=this;
  19305. return $core.withContext(function($ctx1) {
  19306. var $1,$2,$receiver;
  19307. $1=self["@transport"];
  19308. if(($receiver = $1) == null || $receiver.isNil){
  19309. $2=$recv($globals.PackageTransport)._fromJson_(self._basicTransport());
  19310. $recv($2)._package_(self);
  19311. self["@transport"]=$recv($2)._yourself();
  19312. return self["@transport"];
  19313. } else {
  19314. return $1;
  19315. };
  19316. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  19317. },
  19318. args: [],
  19319. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09transport := (PackageTransport fromJson: self basicTransport)\x0a\x09\x09\x09package: self;\x0a\x09\x09\x09yourself ]",
  19320. referencedClasses: ["PackageTransport"],
  19321. messageSends: ["ifNil:", "package:", "fromJson:", "basicTransport", "yourself"]
  19322. }),
  19323. $globals.Package);
  19324. $core.addMethod(
  19325. $core.method({
  19326. selector: "transport:",
  19327. protocol: 'accessing',
  19328. fn: function (aPackageTransport){
  19329. var self=this;
  19330. return $core.withContext(function($ctx1) {
  19331. self["@transport"]=aPackageTransport;
  19332. $recv(aPackageTransport)._package_(self);
  19333. return self;
  19334. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  19335. },
  19336. args: ["aPackageTransport"],
  19337. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  19338. referencedClasses: [],
  19339. messageSends: ["package:"]
  19340. }),
  19341. $globals.Package);
  19342. $core.addMethod(
  19343. $core.method({
  19344. selector: "validateImports:",
  19345. protocol: 'validation',
  19346. fn: function (aCollection){
  19347. var self=this;
  19348. return $core.withContext(function($ctx1) {
  19349. var $1,$2,$5,$4,$3,$6;
  19350. $recv(aCollection)._do_((function(import_){
  19351. return $core.withContext(function($ctx2) {
  19352. $1=$recv(import_)._isString();
  19353. $ctx2.sendIdx["isString"]=1;
  19354. if(!$core.assert($1)){
  19355. $2=$recv(import_)._respondsTo_("key");
  19356. if(!$core.assert($2)){
  19357. self._error_("Imports must be Strings or Associations");
  19358. $ctx2.sendIdx["error:"]=1;
  19359. };
  19360. $5=$recv(import_)._key();
  19361. $ctx2.sendIdx["key"]=1;
  19362. $4=$recv($5)._isString();
  19363. $ctx2.sendIdx["isString"]=2;
  19364. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  19365. if(!$core.assert($3)){
  19366. self._error_("Key and value must be Strings");
  19367. $ctx2.sendIdx["error:"]=2;
  19368. };
  19369. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  19370. if(!$core.assert($6)){
  19371. return self._error_("Keys must be identifiers");
  19372. };
  19373. };
  19374. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  19375. }));
  19376. return self;
  19377. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  19378. },
  19379. args: ["aCollection"],
  19380. 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' ]]]",
  19381. referencedClasses: [],
  19382. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  19383. }),
  19384. $globals.Package);
  19385. $globals.Package.klass.iVarNames = ['defaultCommitPathJs','defaultCommitPathSt'];
  19386. $core.addMethod(
  19387. $core.method({
  19388. selector: "named:",
  19389. protocol: 'accessing',
  19390. fn: function (aPackageName){
  19391. var self=this;
  19392. return $core.withContext(function($ctx1) {
  19393. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  19394. return $core.withContext(function($ctx2) {
  19395. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  19396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19397. }));
  19398. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.klass)});
  19399. },
  19400. args: ["aPackageName"],
  19401. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  19402. referencedClasses: ["Smalltalk"],
  19403. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  19404. }),
  19405. $globals.Package.klass);
  19406. $core.addMethod(
  19407. $core.method({
  19408. selector: "named:ifAbsent:",
  19409. protocol: 'accessing',
  19410. fn: function (aPackageName,aBlock){
  19411. var self=this;
  19412. return $core.withContext(function($ctx1) {
  19413. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  19414. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.klass)});
  19415. },
  19416. args: ["aPackageName", "aBlock"],
  19417. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  19418. referencedClasses: ["Smalltalk"],
  19419. messageSends: ["packageAt:ifAbsent:"]
  19420. }),
  19421. $globals.Package.klass);
  19422. $core.addMethod(
  19423. $core.method({
  19424. selector: "named:imports:transport:",
  19425. protocol: 'accessing',
  19426. fn: function (aPackageName,anArray,aTransport){
  19427. var self=this;
  19428. var package_;
  19429. return $core.withContext(function($ctx1) {
  19430. package_=self._named_(aPackageName);
  19431. $recv(package_)._imports_(anArray);
  19432. $recv(package_)._transport_(aTransport);
  19433. return package_;
  19434. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  19435. },
  19436. args: ["aPackageName", "anArray", "aTransport"],
  19437. 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",
  19438. referencedClasses: [],
  19439. messageSends: ["named:", "imports:", "transport:"]
  19440. }),
  19441. $globals.Package.klass);
  19442. $core.addMethod(
  19443. $core.method({
  19444. selector: "named:transport:",
  19445. protocol: 'accessing',
  19446. fn: function (aPackageName,aTransport){
  19447. var self=this;
  19448. var package_;
  19449. return $core.withContext(function($ctx1) {
  19450. package_=self._named_(aPackageName);
  19451. $recv(package_)._transport_(aTransport);
  19452. return package_;
  19453. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,package_:package_},$globals.Package.klass)});
  19454. },
  19455. args: ["aPackageName", "aTransport"],
  19456. source: "named: aPackageName transport: aTransport\x0a\x09| package |\x0a\x09\x0a\x09package := self named: aPackageName.\x0a\x09package transport: aTransport.\x0a\x09\x0a\x09^ package",
  19457. referencedClasses: [],
  19458. messageSends: ["named:", "transport:"]
  19459. }),
  19460. $globals.Package.klass);
  19461. $core.addMethod(
  19462. $core.method({
  19463. selector: "sortedClasses:",
  19464. protocol: 'sorting',
  19465. fn: function (classes){
  19466. var self=this;
  19467. var children,others,nodes,expandedClasses;
  19468. return $core.withContext(function($ctx1) {
  19469. var $1,$3,$2;
  19470. children=[];
  19471. others=[];
  19472. $recv(classes)._do_((function(each){
  19473. return $core.withContext(function($ctx2) {
  19474. $1=$recv(classes)._includes_($recv(each)._superclass());
  19475. if($core.assert($1)){
  19476. return $recv(others)._add_(each);
  19477. } else {
  19478. return $recv(children)._add_(each);
  19479. $ctx2.sendIdx["add:"]=1;
  19480. };
  19481. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  19482. }));
  19483. $ctx1.sendIdx["do:"]=1;
  19484. nodes=$recv(children)._collect_((function(each){
  19485. return $core.withContext(function($ctx2) {
  19486. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  19487. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  19488. }));
  19489. nodes=$recv(nodes)._sorted_((function(a,b){
  19490. return $core.withContext(function($ctx2) {
  19491. $3=$recv(a)._theClass();
  19492. $ctx2.sendIdx["theClass"]=1;
  19493. $2=$recv($3)._name();
  19494. $ctx2.sendIdx["name"]=1;
  19495. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  19496. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  19497. }));
  19498. expandedClasses=$recv($globals.Array)._new();
  19499. $recv(nodes)._do_((function(aNode){
  19500. return $core.withContext(function($ctx2) {
  19501. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  19502. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  19503. }));
  19504. return expandedClasses;
  19505. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.klass)});
  19506. },
  19507. args: ["classes"],
  19508. 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",
  19509. referencedClasses: ["ClassSorterNode", "Array"],
  19510. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  19511. }),
  19512. $globals.Package.klass);
  19513. $core.addClass('PackageStateObserver', $globals.Object, [], 'Kernel-Infrastructure');
  19514. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  19515. $core.addMethod(
  19516. $core.method({
  19517. selector: "announcer",
  19518. protocol: 'accessing',
  19519. fn: function (){
  19520. var self=this;
  19521. return $core.withContext(function($ctx1) {
  19522. return $recv($globals.SystemAnnouncer)._current();
  19523. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  19524. },
  19525. args: [],
  19526. source: "announcer\x0a\x09^ SystemAnnouncer current",
  19527. referencedClasses: ["SystemAnnouncer"],
  19528. messageSends: ["current"]
  19529. }),
  19530. $globals.PackageStateObserver);
  19531. $core.addMethod(
  19532. $core.method({
  19533. selector: "observeSystem",
  19534. protocol: 'actions',
  19535. fn: function (){
  19536. var self=this;
  19537. return $core.withContext(function($ctx1) {
  19538. var $1;
  19539. $1=self._announcer();
  19540. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  19541. $ctx1.sendIdx["on:send:to:"]=1;
  19542. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  19543. $ctx1.sendIdx["on:send:to:"]=2;
  19544. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  19545. $ctx1.sendIdx["on:send:to:"]=3;
  19546. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  19547. return self;
  19548. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  19549. },
  19550. args: [],
  19551. 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",
  19552. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  19553. messageSends: ["on:send:to:", "announcer"]
  19554. }),
  19555. $globals.PackageStateObserver);
  19556. $core.addMethod(
  19557. $core.method({
  19558. selector: "onClassModification:",
  19559. protocol: 'reactions',
  19560. fn: function (anAnnouncement){
  19561. var self=this;
  19562. return $core.withContext(function($ctx1) {
  19563. var $1,$receiver;
  19564. $1=$recv(anAnnouncement)._theClass();
  19565. if(($receiver = $1) == null || $receiver.isNil){
  19566. $1;
  19567. } else {
  19568. var theClass;
  19569. theClass=$receiver;
  19570. $recv($recv(theClass)._package())._beDirty();
  19571. };
  19572. return self;
  19573. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19574. },
  19575. args: ["anAnnouncement"],
  19576. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  19577. referencedClasses: [],
  19578. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  19579. }),
  19580. $globals.PackageStateObserver);
  19581. $core.addMethod(
  19582. $core.method({
  19583. selector: "onMethodModification:",
  19584. protocol: 'reactions',
  19585. fn: function (anAnnouncement){
  19586. var self=this;
  19587. return $core.withContext(function($ctx1) {
  19588. var $1,$receiver;
  19589. $1=$recv($recv(anAnnouncement)._method())._package();
  19590. if(($receiver = $1) == null || $receiver.isNil){
  19591. $1;
  19592. } else {
  19593. var package_;
  19594. package_=$receiver;
  19595. $recv(package_)._beDirty();
  19596. };
  19597. return self;
  19598. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19599. },
  19600. args: ["anAnnouncement"],
  19601. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  19602. referencedClasses: [],
  19603. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  19604. }),
  19605. $globals.PackageStateObserver);
  19606. $core.addMethod(
  19607. $core.method({
  19608. selector: "onPackageAdded:",
  19609. protocol: 'reactions',
  19610. fn: function (anAnnouncement){
  19611. var self=this;
  19612. return $core.withContext(function($ctx1) {
  19613. $recv($recv(anAnnouncement)._package())._beDirty();
  19614. return self;
  19615. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19616. },
  19617. args: ["anAnnouncement"],
  19618. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  19619. referencedClasses: [],
  19620. messageSends: ["beDirty", "package"]
  19621. }),
  19622. $globals.PackageStateObserver);
  19623. $core.addMethod(
  19624. $core.method({
  19625. selector: "onProtocolModification:",
  19626. protocol: 'reactions',
  19627. fn: function (anAnnouncement){
  19628. var self=this;
  19629. return $core.withContext(function($ctx1) {
  19630. var $1,$receiver;
  19631. $1=$recv(anAnnouncement)._package();
  19632. if(($receiver = $1) == null || $receiver.isNil){
  19633. $1;
  19634. } else {
  19635. var package_;
  19636. package_=$receiver;
  19637. $recv(package_)._beDirty();
  19638. };
  19639. return self;
  19640. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  19641. },
  19642. args: ["anAnnouncement"],
  19643. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  19644. referencedClasses: [],
  19645. messageSends: ["ifNotNil:", "package", "beDirty"]
  19646. }),
  19647. $globals.PackageStateObserver);
  19648. $globals.PackageStateObserver.klass.iVarNames = ['current'];
  19649. $core.addMethod(
  19650. $core.method({
  19651. selector: "current",
  19652. protocol: 'accessing',
  19653. fn: function (){
  19654. var self=this;
  19655. return $core.withContext(function($ctx1) {
  19656. var $1,$receiver;
  19657. $1=self["@current"];
  19658. if(($receiver = $1) == null || $receiver.isNil){
  19659. self["@current"]=self._new();
  19660. return self["@current"];
  19661. } else {
  19662. return $1;
  19663. };
  19664. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.klass)});
  19665. },
  19666. args: [],
  19667. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  19668. referencedClasses: [],
  19669. messageSends: ["ifNil:", "new"]
  19670. }),
  19671. $globals.PackageStateObserver.klass);
  19672. $core.addMethod(
  19673. $core.method({
  19674. selector: "initialize",
  19675. protocol: 'initialization',
  19676. fn: function (){
  19677. var self=this;
  19678. return $core.withContext(function($ctx1) {
  19679. $recv(self._current())._observeSystem();
  19680. return self;
  19681. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.klass)});
  19682. },
  19683. args: [],
  19684. source: "initialize\x0a\x09self current observeSystem",
  19685. referencedClasses: [],
  19686. messageSends: ["observeSystem", "current"]
  19687. }),
  19688. $globals.PackageStateObserver.klass);
  19689. $core.addClass('ParseError', $globals.Error, [], 'Kernel-Infrastructure');
  19690. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  19691. $core.addClass('RethrowErrorHandler', $globals.Object, [], 'Kernel-Infrastructure');
  19692. $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.";
  19693. $core.addMethod(
  19694. $core.method({
  19695. selector: "basicSignal:",
  19696. protocol: 'error handling',
  19697. fn: function (anError){
  19698. var self=this;
  19699. return $core.withContext(function($ctx1) {
  19700. throw anError;
  19701. return self;
  19702. }, function($ctx1) {$ctx1.fill(self,"basicSignal:",{anError:anError},$globals.RethrowErrorHandler)});
  19703. },
  19704. args: ["anError"],
  19705. source: "basicSignal: anError\x0a <throw anError>",
  19706. referencedClasses: [],
  19707. messageSends: []
  19708. }),
  19709. $globals.RethrowErrorHandler);
  19710. $core.addMethod(
  19711. $core.method({
  19712. selector: "handleError:",
  19713. protocol: 'error handling',
  19714. fn: function (anError){
  19715. var self=this;
  19716. return $core.withContext(function($ctx1) {
  19717. self._basicSignal_(anError);
  19718. return self;
  19719. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.RethrowErrorHandler)});
  19720. },
  19721. args: ["anError"],
  19722. source: "handleError: anError\x0a self basicSignal: anError",
  19723. referencedClasses: [],
  19724. messageSends: ["basicSignal:"]
  19725. }),
  19726. $globals.RethrowErrorHandler);
  19727. $core.addClass('Setting', $globals.Object, ['key', 'value', 'defaultValue'], 'Kernel-Infrastructure');
  19728. $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`";
  19729. $core.addMethod(
  19730. $core.method({
  19731. selector: "defaultValue",
  19732. protocol: 'accessing',
  19733. fn: function (){
  19734. var self=this;
  19735. return self["@defaultValue"];
  19736. },
  19737. args: [],
  19738. source: "defaultValue\x0a\x09^ defaultValue",
  19739. referencedClasses: [],
  19740. messageSends: []
  19741. }),
  19742. $globals.Setting);
  19743. $core.addMethod(
  19744. $core.method({
  19745. selector: "defaultValue:",
  19746. protocol: 'accessing',
  19747. fn: function (aStringifiableObject){
  19748. var self=this;
  19749. self["@defaultValue"]=aStringifiableObject;
  19750. return self;
  19751. },
  19752. args: ["aStringifiableObject"],
  19753. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  19754. referencedClasses: [],
  19755. messageSends: []
  19756. }),
  19757. $globals.Setting);
  19758. $core.addMethod(
  19759. $core.method({
  19760. selector: "key",
  19761. protocol: 'accessing',
  19762. fn: function (){
  19763. var self=this;
  19764. return self["@key"];
  19765. },
  19766. args: [],
  19767. source: "key\x0a\x09^ key",
  19768. referencedClasses: [],
  19769. messageSends: []
  19770. }),
  19771. $globals.Setting);
  19772. $core.addMethod(
  19773. $core.method({
  19774. selector: "key:",
  19775. protocol: 'accessing',
  19776. fn: function (aString){
  19777. var self=this;
  19778. self["@key"]=aString;
  19779. return self;
  19780. },
  19781. args: ["aString"],
  19782. source: "key: aString\x0a\x09key := aString",
  19783. referencedClasses: [],
  19784. messageSends: []
  19785. }),
  19786. $globals.Setting);
  19787. $core.addMethod(
  19788. $core.method({
  19789. selector: "value",
  19790. protocol: 'accessing',
  19791. fn: function (){
  19792. var self=this;
  19793. return $core.withContext(function($ctx1) {
  19794. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_(self._key(),(function(){
  19795. return $core.withContext(function($ctx2) {
  19796. return self._defaultValue();
  19797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19798. }));
  19799. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  19800. },
  19801. args: [],
  19802. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  19803. referencedClasses: ["Smalltalk"],
  19804. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  19805. }),
  19806. $globals.Setting);
  19807. $core.addMethod(
  19808. $core.method({
  19809. selector: "value:",
  19810. protocol: 'accessing',
  19811. fn: function (aStringifiableObject){
  19812. var self=this;
  19813. return $core.withContext(function($ctx1) {
  19814. return $recv($recv($globals.Smalltalk)._settings())._at_put_(self._key(),aStringifiableObject);
  19815. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  19816. },
  19817. args: ["aStringifiableObject"],
  19818. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  19819. referencedClasses: ["Smalltalk"],
  19820. messageSends: ["at:put:", "settings", "key"]
  19821. }),
  19822. $globals.Setting);
  19823. $core.addMethod(
  19824. $core.method({
  19825. selector: "at:ifAbsent:",
  19826. protocol: 'instance creation',
  19827. fn: function (aString,aDefaultValue){
  19828. var self=this;
  19829. return $core.withContext(function($ctx1) {
  19830. var $1;
  19831. $1=(
  19832. $ctx1.supercall = true,
  19833. ($globals.Setting.klass.superclass||$boot.dnu).fn.prototype._new.apply($recv(self), []));
  19834. $ctx1.supercall = false;
  19835. $recv($1)._key_(aString);
  19836. $recv($1)._defaultValue_(aDefaultValue);
  19837. return $recv($1)._yourself();
  19838. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.klass)});
  19839. },
  19840. args: ["aString", "aDefaultValue"],
  19841. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  19842. referencedClasses: [],
  19843. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  19844. }),
  19845. $globals.Setting.klass);
  19846. $core.addMethod(
  19847. $core.method({
  19848. selector: "new",
  19849. protocol: 'instance creation',
  19850. fn: function (){
  19851. var self=this;
  19852. return $core.withContext(function($ctx1) {
  19853. self._shouldNotImplement();
  19854. return self;
  19855. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.klass)});
  19856. },
  19857. args: [],
  19858. source: "new\x0a\x09self shouldNotImplement",
  19859. referencedClasses: [],
  19860. messageSends: ["shouldNotImplement"]
  19861. }),
  19862. $globals.Setting.klass);
  19863. $core.addClass('SmalltalkImage', $globals.Object, [], 'Kernel-Infrastructure');
  19864. $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.";
  19865. $core.addMethod(
  19866. $core.method({
  19867. selector: "addGlobalJsVariable:",
  19868. protocol: 'globals',
  19869. fn: function (aString){
  19870. var self=this;
  19871. return $core.withContext(function($ctx1) {
  19872. $recv(self._globalJsVariables())._add_(aString);
  19873. return self;
  19874. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  19875. },
  19876. args: ["aString"],
  19877. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  19878. referencedClasses: [],
  19879. messageSends: ["add:", "globalJsVariables"]
  19880. }),
  19881. $globals.SmalltalkImage);
  19882. $core.addMethod(
  19883. $core.method({
  19884. selector: "amdRequire",
  19885. protocol: 'accessing amd',
  19886. fn: function (){
  19887. var self=this;
  19888. return $core.withContext(function($ctx1) {
  19889. return $recv(self._core())._at_("amdRequire");
  19890. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  19891. },
  19892. args: [],
  19893. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  19894. referencedClasses: [],
  19895. messageSends: ["at:", "core"]
  19896. }),
  19897. $globals.SmalltalkImage);
  19898. $core.addMethod(
  19899. $core.method({
  19900. selector: "asSmalltalkException:",
  19901. protocol: 'error handling',
  19902. fn: function (anObject){
  19903. var self=this;
  19904. return $core.withContext(function($ctx1) {
  19905. var $1;
  19906. $1=$recv(self._isSmalltalkObject_(anObject))._and_((function(){
  19907. return $core.withContext(function($ctx2) {
  19908. return $recv(anObject)._isKindOf_($globals.Error);
  19909. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19910. }));
  19911. if($core.assert($1)){
  19912. return anObject;
  19913. } else {
  19914. return $recv($globals.JavaScriptException)._on_(anObject);
  19915. };
  19916. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  19917. },
  19918. args: ["anObject"],
  19919. 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 ]",
  19920. referencedClasses: ["Error", "JavaScriptException"],
  19921. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  19922. }),
  19923. $globals.SmalltalkImage);
  19924. $core.addMethod(
  19925. $core.method({
  19926. selector: "basicCreatePackage:",
  19927. protocol: 'private',
  19928. fn: function (packageName){
  19929. var self=this;
  19930. return $core.withContext(function($ctx1) {
  19931. return $core.addPackage(packageName);
  19932. return self;
  19933. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  19934. },
  19935. args: ["packageName"],
  19936. 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)>",
  19937. referencedClasses: [],
  19938. messageSends: []
  19939. }),
  19940. $globals.SmalltalkImage);
  19941. $core.addMethod(
  19942. $core.method({
  19943. selector: "basicParse:",
  19944. protocol: 'private',
  19945. fn: function (aString){
  19946. var self=this;
  19947. return $core.withContext(function($ctx1) {
  19948. return $recv($globals.SmalltalkParser)._parse_(aString);
  19949. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  19950. },
  19951. args: ["aString"],
  19952. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  19953. referencedClasses: ["SmalltalkParser"],
  19954. messageSends: ["parse:"]
  19955. }),
  19956. $globals.SmalltalkImage);
  19957. $core.addMethod(
  19958. $core.method({
  19959. selector: "basicRegisterPackage:",
  19960. protocol: 'private',
  19961. fn: function (aPackage){
  19962. var self=this;
  19963. return $core.withContext(function($ctx1) {
  19964. $core.packages[aPackage.pkgName]=aPackage;
  19965. return self;
  19966. }, function($ctx1) {$ctx1.fill(self,"basicRegisterPackage:",{aPackage:aPackage},$globals.SmalltalkImage)});
  19967. },
  19968. args: ["aPackage"],
  19969. source: "basicRegisterPackage: aPackage\x0a\x09\x22Put aPackage in $core.packages object.\x22\x0a\x09<$core.packages[aPackage.pkgName]=aPackage>",
  19970. referencedClasses: [],
  19971. messageSends: []
  19972. }),
  19973. $globals.SmalltalkImage);
  19974. $core.addMethod(
  19975. $core.method({
  19976. selector: "cancelOptOut:",
  19977. protocol: 'accessing',
  19978. fn: function (anObject){
  19979. var self=this;
  19980. return $core.withContext(function($ctx1) {
  19981. delete anObject.klass;
  19982. return self;
  19983. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  19984. },
  19985. args: ["anObject"],
  19986. 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>",
  19987. referencedClasses: [],
  19988. messageSends: []
  19989. }),
  19990. $globals.SmalltalkImage);
  19991. $core.addMethod(
  19992. $core.method({
  19993. selector: "classes",
  19994. protocol: 'classes',
  19995. fn: function (){
  19996. var self=this;
  19997. return $core.withContext(function($ctx1) {
  19998. return $core.classes();
  19999. return self;
  20000. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  20001. },
  20002. args: [],
  20003. source: "classes\x0a\x09<return $core.classes()>",
  20004. referencedClasses: [],
  20005. messageSends: []
  20006. }),
  20007. $globals.SmalltalkImage);
  20008. $core.addMethod(
  20009. $core.method({
  20010. selector: "core",
  20011. protocol: 'accessing',
  20012. fn: function (){
  20013. var self=this;
  20014. return $core.withContext(function($ctx1) {
  20015. return $core;
  20016. return self;
  20017. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  20018. },
  20019. args: [],
  20020. source: "core\x0a\x09<return $core>",
  20021. referencedClasses: [],
  20022. messageSends: []
  20023. }),
  20024. $globals.SmalltalkImage);
  20025. $core.addMethod(
  20026. $core.method({
  20027. selector: "createPackage:",
  20028. protocol: 'packages',
  20029. fn: function (packageName){
  20030. var self=this;
  20031. var package_,announcement;
  20032. return $core.withContext(function($ctx1) {
  20033. var $1;
  20034. package_=self._basicCreatePackage_(packageName);
  20035. $1=$recv($globals.PackageAdded)._new();
  20036. $recv($1)._package_(package_);
  20037. announcement=$recv($1)._yourself();
  20038. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  20039. return package_;
  20040. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  20041. },
  20042. args: ["packageName"],
  20043. 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",
  20044. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  20045. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  20046. }),
  20047. $globals.SmalltalkImage);
  20048. $core.addMethod(
  20049. $core.method({
  20050. selector: "defaultAmdNamespace",
  20051. protocol: 'accessing amd',
  20052. fn: function (){
  20053. var self=this;
  20054. return $core.withContext(function($ctx1) {
  20055. return "transport.defaultAmdNamespace"._settingValue();
  20056. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  20057. },
  20058. args: [],
  20059. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  20060. referencedClasses: [],
  20061. messageSends: ["settingValue"]
  20062. }),
  20063. $globals.SmalltalkImage);
  20064. $core.addMethod(
  20065. $core.method({
  20066. selector: "defaultAmdNamespace:",
  20067. protocol: 'accessing amd',
  20068. fn: function (aString){
  20069. var self=this;
  20070. return $core.withContext(function($ctx1) {
  20071. "transport.defaultAmdNamespace"._settingValue_(aString);
  20072. return self;
  20073. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  20074. },
  20075. args: ["aString"],
  20076. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  20077. referencedClasses: [],
  20078. messageSends: ["settingValue:"]
  20079. }),
  20080. $globals.SmalltalkImage);
  20081. $core.addMethod(
  20082. $core.method({
  20083. selector: "deleteClass:",
  20084. protocol: 'private',
  20085. fn: function (aClass){
  20086. var self=this;
  20087. return $core.withContext(function($ctx1) {
  20088. $core.removeClass(aClass);
  20089. return self;
  20090. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  20091. },
  20092. args: ["aClass"],
  20093. source: "deleteClass: aClass\x0a\x09\x22Deletes a class by deleting its binding only. Use #removeClass instead\x22\x0a\x09\x0a\x09<$core.removeClass(aClass)>",
  20094. referencedClasses: [],
  20095. messageSends: []
  20096. }),
  20097. $globals.SmalltalkImage);
  20098. $core.addMethod(
  20099. $core.method({
  20100. selector: "deleteGlobalJsVariable:",
  20101. protocol: 'globals',
  20102. fn: function (aString){
  20103. var self=this;
  20104. return $core.withContext(function($ctx1) {
  20105. $recv(self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  20106. }));
  20107. return self;
  20108. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  20109. },
  20110. args: ["aString"],
  20111. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  20112. referencedClasses: [],
  20113. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  20114. }),
  20115. $globals.SmalltalkImage);
  20116. $core.addMethod(
  20117. $core.method({
  20118. selector: "deletePackage:",
  20119. protocol: 'private',
  20120. fn: function (packageName){
  20121. var self=this;
  20122. return $core.withContext(function($ctx1) {
  20123. delete $core.packages[packageName];
  20124. return self;
  20125. }, function($ctx1) {$ctx1.fill(self,"deletePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  20126. },
  20127. args: ["packageName"],
  20128. 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]>",
  20129. referencedClasses: [],
  20130. messageSends: []
  20131. }),
  20132. $globals.SmalltalkImage);
  20133. $core.addMethod(
  20134. $core.method({
  20135. selector: "existsJsGlobal:",
  20136. protocol: 'testing',
  20137. fn: function (aString){
  20138. var self=this;
  20139. return $core.withContext(function($ctx1) {
  20140. return $recv($recv($globals.Platform)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  20141. return true;
  20142. }),(function(){
  20143. return false;
  20144. }));
  20145. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  20146. },
  20147. args: ["aString"],
  20148. source: "existsJsGlobal: aString\x0a\x09^ Platform globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  20149. referencedClasses: ["Platform"],
  20150. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  20151. }),
  20152. $globals.SmalltalkImage);
  20153. $core.addMethod(
  20154. $core.method({
  20155. selector: "globalJsVariables",
  20156. protocol: 'globals',
  20157. fn: function (){
  20158. var self=this;
  20159. return $core.withContext(function($ctx1) {
  20160. return $core.globalJsVariables;
  20161. return self;
  20162. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  20163. },
  20164. args: [],
  20165. source: "globalJsVariables\x0a\x09\x22Array of global JavaScript variables\x22\x0a\x09<return $core.globalJsVariables>",
  20166. referencedClasses: [],
  20167. messageSends: []
  20168. }),
  20169. $globals.SmalltalkImage);
  20170. $core.addMethod(
  20171. $core.method({
  20172. selector: "globals",
  20173. protocol: 'accessing',
  20174. fn: function (){
  20175. var self=this;
  20176. return $core.withContext(function($ctx1) {
  20177. return $globals;
  20178. return self;
  20179. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  20180. },
  20181. args: [],
  20182. source: "globals\x0a\x09<return $globals>",
  20183. referencedClasses: [],
  20184. messageSends: []
  20185. }),
  20186. $globals.SmalltalkImage);
  20187. $core.addMethod(
  20188. $core.method({
  20189. selector: "includesKey:",
  20190. protocol: 'accessing',
  20191. fn: function (aKey){
  20192. var self=this;
  20193. return $core.withContext(function($ctx1) {
  20194. return $core.hasOwnProperty(aKey);
  20195. return self;
  20196. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  20197. },
  20198. args: ["aKey"],
  20199. source: "includesKey: aKey\x0a\x09<return $core.hasOwnProperty(aKey)>",
  20200. referencedClasses: [],
  20201. messageSends: []
  20202. }),
  20203. $globals.SmalltalkImage);
  20204. $core.addMethod(
  20205. $core.method({
  20206. selector: "isSmalltalkObject:",
  20207. protocol: 'testing',
  20208. fn: function (anObject){
  20209. var self=this;
  20210. return $core.withContext(function($ctx1) {
  20211. return anObject.klass != null;
  20212. return self;
  20213. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  20214. },
  20215. args: ["anObject"],
  20216. 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>",
  20217. referencedClasses: [],
  20218. messageSends: []
  20219. }),
  20220. $globals.SmalltalkImage);
  20221. $core.addMethod(
  20222. $core.method({
  20223. selector: "optOut:",
  20224. protocol: 'accessing',
  20225. fn: function (anObject){
  20226. var self=this;
  20227. return $core.withContext(function($ctx1) {
  20228. anObject.klass = null;
  20229. return self;
  20230. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  20231. },
  20232. args: ["anObject"],
  20233. 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>",
  20234. referencedClasses: [],
  20235. messageSends: []
  20236. }),
  20237. $globals.SmalltalkImage);
  20238. $core.addMethod(
  20239. $core.method({
  20240. selector: "packageAt:",
  20241. protocol: 'packages',
  20242. fn: function (packageName){
  20243. var self=this;
  20244. return $core.withContext(function($ctx1) {
  20245. return $core.packages[packageName];
  20246. return self;
  20247. }, function($ctx1) {$ctx1.fill(self,"packageAt:",{packageName:packageName},$globals.SmalltalkImage)});
  20248. },
  20249. args: ["packageName"],
  20250. source: "packageAt: packageName\x0a\x09<return $core.packages[packageName]>",
  20251. referencedClasses: [],
  20252. messageSends: []
  20253. }),
  20254. $globals.SmalltalkImage);
  20255. $core.addMethod(
  20256. $core.method({
  20257. selector: "packageAt:ifAbsent:",
  20258. protocol: 'packages',
  20259. fn: function (packageName,aBlock){
  20260. var self=this;
  20261. return $core.withContext(function($ctx1) {
  20262. var $1;
  20263. $1=self._packageAt_(packageName);
  20264. return $recv($1)._ifNil_(aBlock);
  20265. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  20266. },
  20267. args: ["packageName", "aBlock"],
  20268. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ (self packageAt: packageName) ifNil: aBlock",
  20269. referencedClasses: [],
  20270. messageSends: ["ifNil:", "packageAt:"]
  20271. }),
  20272. $globals.SmalltalkImage);
  20273. $core.addMethod(
  20274. $core.method({
  20275. selector: "packages",
  20276. protocol: 'packages',
  20277. fn: function (){
  20278. var self=this;
  20279. return $core.withContext(function($ctx1) {
  20280. return Object.keys($core.packages).map(function(k) {
  20281. return $core.packages[k];
  20282. })
  20283. ;
  20284. return self;
  20285. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  20286. },
  20287. args: [],
  20288. 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>",
  20289. referencedClasses: [],
  20290. messageSends: []
  20291. }),
  20292. $globals.SmalltalkImage);
  20293. $core.addMethod(
  20294. $core.method({
  20295. selector: "parse:",
  20296. protocol: 'accessing',
  20297. fn: function (aString){
  20298. var self=this;
  20299. var result;
  20300. return $core.withContext(function($ctx1) {
  20301. var $1;
  20302. $recv((function(){
  20303. return $core.withContext(function($ctx2) {
  20304. result=self._basicParse_(aString);
  20305. return result;
  20306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20307. }))._tryCatch_((function(ex){
  20308. return $core.withContext(function($ctx2) {
  20309. return $recv(self._parseError_parsing_(ex,aString))._signal();
  20310. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  20311. }));
  20312. $1=result;
  20313. $recv($1)._source_(aString);
  20314. return $recv($1)._yourself();
  20315. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  20316. },
  20317. args: ["aString"],
  20318. 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",
  20319. referencedClasses: [],
  20320. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  20321. }),
  20322. $globals.SmalltalkImage);
  20323. $core.addMethod(
  20324. $core.method({
  20325. selector: "parseError:parsing:",
  20326. protocol: 'error handling',
  20327. fn: function (anException,aString){
  20328. var self=this;
  20329. return $core.withContext(function($ctx1) {
  20330. var $1,$7,$6,$5,$8,$4,$3,$2;
  20331. $1=$recv($globals.ParseError)._new();
  20332. $7=$recv(anException)._basicAt_("line");
  20333. $ctx1.sendIdx["basicAt:"]=1;
  20334. $6="Parse error on line ".__comma($7);
  20335. $5=$recv($6).__comma(" column ");
  20336. $ctx1.sendIdx[","]=4;
  20337. $8=$recv(anException)._basicAt_("column");
  20338. $ctx1.sendIdx["basicAt:"]=2;
  20339. $4=$recv($5).__comma($8);
  20340. $ctx1.sendIdx[","]=3;
  20341. $3=$recv($4).__comma(" : Unexpected character ");
  20342. $ctx1.sendIdx[","]=2;
  20343. $2=$recv($3).__comma($recv(anException)._basicAt_("found"));
  20344. $ctx1.sendIdx[","]=1;
  20345. return $recv($1)._messageText_($2);
  20346. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  20347. },
  20348. args: ["anException", "aString"],
  20349. 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')",
  20350. referencedClasses: ["ParseError"],
  20351. messageSends: ["messageText:", "new", ",", "basicAt:"]
  20352. }),
  20353. $globals.SmalltalkImage);
  20354. $core.addMethod(
  20355. $core.method({
  20356. selector: "pseudoVariableNames",
  20357. protocol: 'accessing',
  20358. fn: function (){
  20359. var self=this;
  20360. return ["self", "super", "nil", "true", "false", "thisContext"];
  20361. },
  20362. args: [],
  20363. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  20364. referencedClasses: [],
  20365. messageSends: []
  20366. }),
  20367. $globals.SmalltalkImage);
  20368. $core.addMethod(
  20369. $core.method({
  20370. selector: "readJSObject:",
  20371. protocol: 'accessing',
  20372. fn: function (anObject){
  20373. var self=this;
  20374. return $core.withContext(function($ctx1) {
  20375. return $core.readJSObject(anObject);
  20376. return self;
  20377. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  20378. },
  20379. args: ["anObject"],
  20380. source: "readJSObject: anObject\x0a\x09<return $core.readJSObject(anObject)>",
  20381. referencedClasses: [],
  20382. messageSends: []
  20383. }),
  20384. $globals.SmalltalkImage);
  20385. $core.addMethod(
  20386. $core.method({
  20387. selector: "removeClass:",
  20388. protocol: 'classes',
  20389. fn: function (aClass){
  20390. var self=this;
  20391. return $core.withContext(function($ctx1) {
  20392. var $1,$2,$4,$3;
  20393. $1=$recv(aClass)._isMetaclass();
  20394. if($core.assert($1)){
  20395. self._error_($recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!"));
  20396. };
  20397. self._deleteClass_(aClass);
  20398. $2=$recv($globals.SystemAnnouncer)._current();
  20399. $4=$recv($globals.ClassRemoved)._new();
  20400. $recv($4)._theClass_(aClass);
  20401. $3=$recv($4)._yourself();
  20402. $recv($2)._announce_($3);
  20403. return self;
  20404. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  20405. },
  20406. args: ["aClass"],
  20407. 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)",
  20408. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  20409. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "deleteClass:", "announce:", "current", "theClass:", "new", "yourself"]
  20410. }),
  20411. $globals.SmalltalkImage);
  20412. $core.addMethod(
  20413. $core.method({
  20414. selector: "removePackage:",
  20415. protocol: 'packages',
  20416. fn: function (packageName){
  20417. var self=this;
  20418. var pkg;
  20419. return $core.withContext(function($ctx1) {
  20420. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  20421. return $core.withContext(function($ctx2) {
  20422. return self._error_("Missing package: ".__comma(packageName));
  20423. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20424. }));
  20425. $recv($recv(pkg)._classes())._do_((function(each){
  20426. return $core.withContext(function($ctx2) {
  20427. return self._removeClass_(each);
  20428. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  20429. }));
  20430. self._deletePackage_(packageName);
  20431. return self;
  20432. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  20433. },
  20434. args: ["packageName"],
  20435. 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",
  20436. referencedClasses: [],
  20437. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "deletePackage:"]
  20438. }),
  20439. $globals.SmalltalkImage);
  20440. $core.addMethod(
  20441. $core.method({
  20442. selector: "renamePackage:to:",
  20443. protocol: 'packages',
  20444. fn: function (packageName,newName){
  20445. var self=this;
  20446. var pkg;
  20447. return $core.withContext(function($ctx1) {
  20448. var $1,$2,$receiver;
  20449. pkg=self._packageAt_ifAbsent_(packageName,(function(){
  20450. return $core.withContext(function($ctx2) {
  20451. $1="Missing package: ".__comma(packageName);
  20452. $ctx2.sendIdx[","]=1;
  20453. return self._error_($1);
  20454. $ctx2.sendIdx["error:"]=1;
  20455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20456. }));
  20457. $2=self._packageAt_(newName);
  20458. if(($receiver = $2) == null || $receiver.isNil){
  20459. $2;
  20460. } else {
  20461. self._error_("Already exists a package called: ".__comma(newName));
  20462. };
  20463. $recv(pkg)._name_(newName);
  20464. self._basicRegisterPackage_(pkg);
  20465. self._deletePackage_(packageName);
  20466. return self;
  20467. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  20468. },
  20469. args: ["packageName", "newName"],
  20470. 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.",
  20471. referencedClasses: [],
  20472. messageSends: ["packageAt:ifAbsent:", "error:", ",", "ifNotNil:", "packageAt:", "name:", "basicRegisterPackage:", "deletePackage:"]
  20473. }),
  20474. $globals.SmalltalkImage);
  20475. $core.addMethod(
  20476. $core.method({
  20477. selector: "reservedWords",
  20478. protocol: 'accessing',
  20479. fn: function (){
  20480. var self=this;
  20481. return $core.withContext(function($ctx1) {
  20482. return $core.reservedWords;
  20483. return self;
  20484. }, function($ctx1) {$ctx1.fill(self,"reservedWords",{},$globals.SmalltalkImage)});
  20485. },
  20486. args: [],
  20487. source: "reservedWords\x0a\x09\x22JavaScript reserved words\x22\x0a\x09<return $core.reservedWords>",
  20488. referencedClasses: [],
  20489. messageSends: []
  20490. }),
  20491. $globals.SmalltalkImage);
  20492. $core.addMethod(
  20493. $core.method({
  20494. selector: "settings",
  20495. protocol: 'accessing',
  20496. fn: function (){
  20497. var self=this;
  20498. return $globals.SmalltalkSettings;
  20499. },
  20500. args: [],
  20501. source: "settings\x0a\x09^ SmalltalkSettings",
  20502. referencedClasses: ["SmalltalkSettings"],
  20503. messageSends: []
  20504. }),
  20505. $globals.SmalltalkImage);
  20506. $core.addMethod(
  20507. $core.method({
  20508. selector: "version",
  20509. protocol: 'accessing',
  20510. fn: function (){
  20511. var self=this;
  20512. return "0.15.0-pre";
  20513. },
  20514. args: [],
  20515. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.15.0-pre'",
  20516. referencedClasses: [],
  20517. messageSends: []
  20518. }),
  20519. $globals.SmalltalkImage);
  20520. $globals.SmalltalkImage.klass.iVarNames = ['current'];
  20521. $core.addMethod(
  20522. $core.method({
  20523. selector: "current",
  20524. protocol: 'instance creation',
  20525. fn: function (){
  20526. var self=this;
  20527. return $core.withContext(function($ctx1) {
  20528. var $1,$receiver;
  20529. $1=self["@current"];
  20530. if(($receiver = $1) == null || $receiver.isNil){
  20531. self["@current"]=(
  20532. $ctx1.supercall = true,
  20533. ($globals.SmalltalkImage.klass.superclass||$boot.dnu).fn.prototype._new.apply($recv(self), []));
  20534. $ctx1.supercall = false;
  20535. return self["@current"];
  20536. } else {
  20537. self._deprecatedAPI();
  20538. return self["@current"];
  20539. };
  20540. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.klass)});
  20541. },
  20542. args: [],
  20543. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  20544. referencedClasses: [],
  20545. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  20546. }),
  20547. $globals.SmalltalkImage.klass);
  20548. $core.addMethod(
  20549. $core.method({
  20550. selector: "initialize",
  20551. protocol: 'initialization',
  20552. fn: function (){
  20553. var self=this;
  20554. var st;
  20555. return $core.withContext(function($ctx1) {
  20556. st=self._current();
  20557. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  20558. return self;
  20559. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.klass)});
  20560. },
  20561. args: [],
  20562. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  20563. referencedClasses: [],
  20564. messageSends: ["current", "at:put:", "globals"]
  20565. }),
  20566. $globals.SmalltalkImage.klass);
  20567. $core.addMethod(
  20568. $core.method({
  20569. selector: "new",
  20570. protocol: 'instance creation',
  20571. fn: function (){
  20572. var self=this;
  20573. return $core.withContext(function($ctx1) {
  20574. self._shouldNotImplement();
  20575. return self;
  20576. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.klass)});
  20577. },
  20578. args: [],
  20579. source: "new\x0a\x09self shouldNotImplement",
  20580. referencedClasses: [],
  20581. messageSends: ["shouldNotImplement"]
  20582. }),
  20583. $globals.SmalltalkImage.klass);
  20584. $core.addMethod(
  20585. $core.method({
  20586. selector: "importsString",
  20587. protocol: '*Kernel-Infrastructure',
  20588. fn: function (){
  20589. var self=this;
  20590. return $core.withContext(function($ctx1) {
  20591. var $3,$2,$1;
  20592. $3=$recv(self._key())._importsString();
  20593. $ctx1.sendIdx["importsString"]=1;
  20594. $2=$recv($3).__comma(" -> ");
  20595. $1=$recv($2).__comma($recv(self._value())._importsString());
  20596. $ctx1.sendIdx[","]=1;
  20597. return $1;
  20598. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.Association)});
  20599. },
  20600. args: [],
  20601. 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",
  20602. referencedClasses: [],
  20603. messageSends: [",", "importsString", "key", "value"]
  20604. }),
  20605. $globals.Association);
  20606. $core.addMethod(
  20607. $core.method({
  20608. selector: "asJavaScriptPropertyName",
  20609. protocol: '*Kernel-Infrastructure',
  20610. fn: function (){
  20611. var self=this;
  20612. return $core.withContext(function($ctx1) {
  20613. return $core.st2prop(self);
  20614. return self;
  20615. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  20616. },
  20617. args: [],
  20618. source: "asJavaScriptPropertyName\x0a<return $core.st2prop(self)>",
  20619. referencedClasses: [],
  20620. messageSends: []
  20621. }),
  20622. $globals.String);
  20623. $core.addMethod(
  20624. $core.method({
  20625. selector: "asSetting",
  20626. protocol: '*Kernel-Infrastructure',
  20627. fn: function (){
  20628. var self=this;
  20629. return $core.withContext(function($ctx1) {
  20630. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  20631. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  20632. },
  20633. args: [],
  20634. 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",
  20635. referencedClasses: ["Setting"],
  20636. messageSends: ["at:ifAbsent:"]
  20637. }),
  20638. $globals.String);
  20639. $core.addMethod(
  20640. $core.method({
  20641. selector: "asSettingIfAbsent:",
  20642. protocol: '*Kernel-Infrastructure',
  20643. fn: function (aDefaultValue){
  20644. var self=this;
  20645. return $core.withContext(function($ctx1) {
  20646. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  20647. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20648. },
  20649. args: ["aDefaultValue"],
  20650. 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",
  20651. referencedClasses: ["Setting"],
  20652. messageSends: ["at:ifAbsent:"]
  20653. }),
  20654. $globals.String);
  20655. $core.addMethod(
  20656. $core.method({
  20657. selector: "importsString",
  20658. protocol: '*Kernel-Infrastructure',
  20659. fn: function (){
  20660. var self=this;
  20661. return $core.withContext(function($ctx1) {
  20662. var $1;
  20663. $1=$recv("'".__comma(self._replace_with_("'","''"))).__comma("'");
  20664. $ctx1.sendIdx[","]=1;
  20665. return $1;
  20666. }, function($ctx1) {$ctx1.fill(self,"importsString",{},$globals.String)});
  20667. },
  20668. args: [],
  20669. source: "importsString\x0a\x09\x22Answer receiver as Smalltalk expression\x22\x0a\x09^ '''', (self replace: '''' with: ''''''), ''''",
  20670. referencedClasses: [],
  20671. messageSends: [",", "replace:with:"]
  20672. }),
  20673. $globals.String);
  20674. $core.addMethod(
  20675. $core.method({
  20676. selector: "settingValue",
  20677. protocol: '*Kernel-Infrastructure',
  20678. fn: function (){
  20679. var self=this;
  20680. return $core.withContext(function($ctx1) {
  20681. return $recv(self._asSetting())._value();
  20682. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  20683. },
  20684. args: [],
  20685. source: "settingValue\x0a\x09^ self asSetting value",
  20686. referencedClasses: [],
  20687. messageSends: ["value", "asSetting"]
  20688. }),
  20689. $globals.String);
  20690. $core.addMethod(
  20691. $core.method({
  20692. selector: "settingValue:",
  20693. protocol: '*Kernel-Infrastructure',
  20694. fn: function (aValue){
  20695. var self=this;
  20696. return $core.withContext(function($ctx1) {
  20697. return $recv(self._asSetting())._value_(aValue);
  20698. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  20699. },
  20700. args: ["aValue"],
  20701. 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",
  20702. referencedClasses: [],
  20703. messageSends: ["value:", "asSetting"]
  20704. }),
  20705. $globals.String);
  20706. $core.addMethod(
  20707. $core.method({
  20708. selector: "settingValueIfAbsent:",
  20709. protocol: '*Kernel-Infrastructure',
  20710. fn: function (aDefaultValue){
  20711. var self=this;
  20712. return $core.withContext(function($ctx1) {
  20713. return $recv(self._asSettingIfAbsent_(aDefaultValue))._value();
  20714. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  20715. },
  20716. args: ["aDefaultValue"],
  20717. 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",
  20718. referencedClasses: [],
  20719. messageSends: ["value", "asSettingIfAbsent:"]
  20720. }),
  20721. $globals.String);
  20722. });
  20723. define("amber_core/Kernel-Announcements", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20724. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  20725. $core.addPackage('Kernel-Announcements');
  20726. $core.packages["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  20727. $core.packages["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20728. $core.addClass('AnnouncementSubscription', $globals.Object, ['valuable', 'announcementClass'], 'Kernel-Announcements');
  20729. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  20730. $core.addMethod(
  20731. $core.method({
  20732. selector: "announcementClass",
  20733. protocol: 'accessing',
  20734. fn: function (){
  20735. var self=this;
  20736. return self["@announcementClass"];
  20737. },
  20738. args: [],
  20739. source: "announcementClass\x0a\x09^ announcementClass",
  20740. referencedClasses: [],
  20741. messageSends: []
  20742. }),
  20743. $globals.AnnouncementSubscription);
  20744. $core.addMethod(
  20745. $core.method({
  20746. selector: "announcementClass:",
  20747. protocol: 'accessing',
  20748. fn: function (aClass){
  20749. var self=this;
  20750. self["@announcementClass"]=aClass;
  20751. return self;
  20752. },
  20753. args: ["aClass"],
  20754. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  20755. referencedClasses: [],
  20756. messageSends: []
  20757. }),
  20758. $globals.AnnouncementSubscription);
  20759. $core.addMethod(
  20760. $core.method({
  20761. selector: "deliver:",
  20762. protocol: 'announcing',
  20763. fn: function (anAnnouncement){
  20764. var self=this;
  20765. return $core.withContext(function($ctx1) {
  20766. var $1;
  20767. $1=self._handlesAnnouncement_(anAnnouncement);
  20768. if($core.assert($1)){
  20769. $recv(self._valuable())._value_(anAnnouncement);
  20770. };
  20771. return self;
  20772. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  20773. },
  20774. args: ["anAnnouncement"],
  20775. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  20776. referencedClasses: [],
  20777. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  20778. }),
  20779. $globals.AnnouncementSubscription);
  20780. $core.addMethod(
  20781. $core.method({
  20782. selector: "handlesAnnouncement:",
  20783. protocol: 'announcing',
  20784. fn: function (anAnnouncement){
  20785. var self=this;
  20786. return $core.withContext(function($ctx1) {
  20787. var $2,$3,$1,$receiver;
  20788. $2=$recv($globals.Smalltalk)._globals();
  20789. $ctx1.sendIdx["globals"]=1;
  20790. $3=$recv(self._announcementClass())._name();
  20791. $ctx1.sendIdx["name"]=1;
  20792. $1=$recv($2)._at_($3);
  20793. $ctx1.sendIdx["at:"]=1;
  20794. if(($receiver = $1) == null || $receiver.isNil){
  20795. return false;
  20796. } else {
  20797. var class_;
  20798. class_=$receiver;
  20799. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  20800. };
  20801. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  20802. },
  20803. args: ["anAnnouncement"],
  20804. 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 ]",
  20805. referencedClasses: ["Smalltalk"],
  20806. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  20807. }),
  20808. $globals.AnnouncementSubscription);
  20809. $core.addMethod(
  20810. $core.method({
  20811. selector: "receiver",
  20812. protocol: 'accessing',
  20813. fn: function (){
  20814. var self=this;
  20815. return $core.withContext(function($ctx1) {
  20816. return $recv(self._valuable())._receiver();
  20817. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  20818. },
  20819. args: [],
  20820. source: "receiver\x0a\x09^ self valuable receiver",
  20821. referencedClasses: [],
  20822. messageSends: ["receiver", "valuable"]
  20823. }),
  20824. $globals.AnnouncementSubscription);
  20825. $core.addMethod(
  20826. $core.method({
  20827. selector: "valuable",
  20828. protocol: 'accessing',
  20829. fn: function (){
  20830. var self=this;
  20831. return self["@valuable"];
  20832. },
  20833. args: [],
  20834. source: "valuable\x0a\x09^ valuable",
  20835. referencedClasses: [],
  20836. messageSends: []
  20837. }),
  20838. $globals.AnnouncementSubscription);
  20839. $core.addMethod(
  20840. $core.method({
  20841. selector: "valuable:",
  20842. protocol: 'accessing',
  20843. fn: function (aValuable){
  20844. var self=this;
  20845. self["@valuable"]=aValuable;
  20846. return self;
  20847. },
  20848. args: ["aValuable"],
  20849. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  20850. referencedClasses: [],
  20851. messageSends: []
  20852. }),
  20853. $globals.AnnouncementSubscription);
  20854. $core.addClass('AnnouncementValuable', $globals.Object, ['valuable', 'receiver'], 'Kernel-Announcements');
  20855. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  20856. $core.addMethod(
  20857. $core.method({
  20858. selector: "receiver",
  20859. protocol: 'accessing',
  20860. fn: function (){
  20861. var self=this;
  20862. return self["@receiver"];
  20863. },
  20864. args: [],
  20865. source: "receiver\x0a\x09^ receiver",
  20866. referencedClasses: [],
  20867. messageSends: []
  20868. }),
  20869. $globals.AnnouncementValuable);
  20870. $core.addMethod(
  20871. $core.method({
  20872. selector: "receiver:",
  20873. protocol: 'accessing',
  20874. fn: function (anObject){
  20875. var self=this;
  20876. self["@receiver"]=anObject;
  20877. return self;
  20878. },
  20879. args: ["anObject"],
  20880. source: "receiver: anObject\x0a\x09receiver := anObject",
  20881. referencedClasses: [],
  20882. messageSends: []
  20883. }),
  20884. $globals.AnnouncementValuable);
  20885. $core.addMethod(
  20886. $core.method({
  20887. selector: "valuable",
  20888. protocol: 'accessing',
  20889. fn: function (){
  20890. var self=this;
  20891. return self["@valuable"];
  20892. },
  20893. args: [],
  20894. source: "valuable\x0a\x09^ valuable",
  20895. referencedClasses: [],
  20896. messageSends: []
  20897. }),
  20898. $globals.AnnouncementValuable);
  20899. $core.addMethod(
  20900. $core.method({
  20901. selector: "valuable:",
  20902. protocol: 'accessing',
  20903. fn: function (anObject){
  20904. var self=this;
  20905. self["@valuable"]=anObject;
  20906. return self;
  20907. },
  20908. args: ["anObject"],
  20909. source: "valuable: anObject\x0a\x09valuable := anObject",
  20910. referencedClasses: [],
  20911. messageSends: []
  20912. }),
  20913. $globals.AnnouncementValuable);
  20914. $core.addMethod(
  20915. $core.method({
  20916. selector: "value",
  20917. protocol: 'evaluating',
  20918. fn: function (){
  20919. var self=this;
  20920. return $core.withContext(function($ctx1) {
  20921. return $recv(self._valuable())._value();
  20922. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  20923. },
  20924. args: [],
  20925. source: "value\x0a\x09^ self valuable value",
  20926. referencedClasses: [],
  20927. messageSends: ["value", "valuable"]
  20928. }),
  20929. $globals.AnnouncementValuable);
  20930. $core.addMethod(
  20931. $core.method({
  20932. selector: "value:",
  20933. protocol: 'evaluating',
  20934. fn: function (anObject){
  20935. var self=this;
  20936. return $core.withContext(function($ctx1) {
  20937. return $recv(self._valuable())._value_(anObject);
  20938. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  20939. },
  20940. args: ["anObject"],
  20941. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  20942. referencedClasses: [],
  20943. messageSends: ["value:", "valuable"]
  20944. }),
  20945. $globals.AnnouncementValuable);
  20946. $core.addClass('Announcer', $globals.Object, ['registry', 'subscriptions'], 'Kernel-Announcements');
  20947. $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' ].";
  20948. $core.addMethod(
  20949. $core.method({
  20950. selector: "announce:",
  20951. protocol: 'announcing',
  20952. fn: function (anAnnouncement){
  20953. var self=this;
  20954. return $core.withContext(function($ctx1) {
  20955. $recv(self["@subscriptions"])._do_((function(each){
  20956. return $core.withContext(function($ctx2) {
  20957. return $recv(each)._deliver_(anAnnouncement);
  20958. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20959. }));
  20960. return self;
  20961. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  20962. },
  20963. args: ["anAnnouncement"],
  20964. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  20965. referencedClasses: [],
  20966. messageSends: ["do:", "deliver:"]
  20967. }),
  20968. $globals.Announcer);
  20969. $core.addMethod(
  20970. $core.method({
  20971. selector: "initialize",
  20972. protocol: 'initialization',
  20973. fn: function (){
  20974. var self=this;
  20975. return $core.withContext(function($ctx1) {
  20976. (
  20977. $ctx1.supercall = true,
  20978. ($globals.Announcer.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  20979. $ctx1.supercall = false;
  20980. self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  20981. return self;
  20982. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  20983. },
  20984. args: [],
  20985. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  20986. referencedClasses: ["OrderedCollection"],
  20987. messageSends: ["initialize", "new"]
  20988. }),
  20989. $globals.Announcer);
  20990. $core.addMethod(
  20991. $core.method({
  20992. selector: "on:do:",
  20993. protocol: 'subscribing',
  20994. fn: function (aClass,aBlock){
  20995. var self=this;
  20996. return $core.withContext(function($ctx1) {
  20997. self._on_do_for_(aClass,aBlock,nil);
  20998. return self;
  20999. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  21000. },
  21001. args: ["aClass", "aBlock"],
  21002. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  21003. referencedClasses: [],
  21004. messageSends: ["on:do:for:"]
  21005. }),
  21006. $globals.Announcer);
  21007. $core.addMethod(
  21008. $core.method({
  21009. selector: "on:do:for:",
  21010. protocol: 'subscribing',
  21011. fn: function (aClass,aBlock,aReceiver){
  21012. var self=this;
  21013. return $core.withContext(function($ctx1) {
  21014. var $1,$3,$5,$6,$4,$2;
  21015. $1=self["@subscriptions"];
  21016. $3=$recv($globals.AnnouncementSubscription)._new();
  21017. $ctx1.sendIdx["new"]=1;
  21018. $5=$recv($globals.AnnouncementValuable)._new();
  21019. $recv($5)._valuable_(aBlock);
  21020. $recv($5)._receiver_(aReceiver);
  21021. $6=$recv($5)._yourself();
  21022. $ctx1.sendIdx["yourself"]=1;
  21023. $4=$6;
  21024. $recv($3)._valuable_($4);
  21025. $ctx1.sendIdx["valuable:"]=1;
  21026. $recv($3)._announcementClass_(aClass);
  21027. $2=$recv($3)._yourself();
  21028. $recv($1)._add_($2);
  21029. return self;
  21030. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  21031. },
  21032. args: ["aClass", "aBlock", "aReceiver"],
  21033. 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)",
  21034. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  21035. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  21036. }),
  21037. $globals.Announcer);
  21038. $core.addMethod(
  21039. $core.method({
  21040. selector: "on:doOnce:",
  21041. protocol: 'subscribing',
  21042. fn: function (aClass,aBlock){
  21043. var self=this;
  21044. var subscription;
  21045. return $core.withContext(function($ctx1) {
  21046. var $1;
  21047. $1=$recv($globals.AnnouncementSubscription)._new();
  21048. $recv($1)._announcementClass_(aClass);
  21049. subscription=$recv($1)._yourself();
  21050. $recv(subscription)._valuable_((function(ann){
  21051. return $core.withContext(function($ctx2) {
  21052. $recv(self["@subscriptions"])._remove_(subscription);
  21053. return $recv(aBlock)._value_(ann);
  21054. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  21055. }));
  21056. $recv(self["@subscriptions"])._add_(subscription);
  21057. return self;
  21058. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  21059. },
  21060. args: ["aClass", "aBlock"],
  21061. 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",
  21062. referencedClasses: ["AnnouncementSubscription"],
  21063. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  21064. }),
  21065. $globals.Announcer);
  21066. $core.addMethod(
  21067. $core.method({
  21068. selector: "on:send:to:",
  21069. protocol: 'subscribing',
  21070. fn: function (aClass,aSelector,anObject){
  21071. var self=this;
  21072. return $core.withContext(function($ctx1) {
  21073. var $1,$3,$5,$6,$4,$2;
  21074. $1=self["@subscriptions"];
  21075. $3=$recv($globals.AnnouncementSubscription)._new();
  21076. $ctx1.sendIdx["new"]=1;
  21077. $5=$recv($globals.MessageSend)._new();
  21078. $recv($5)._receiver_(anObject);
  21079. $recv($5)._selector_(aSelector);
  21080. $6=$recv($5)._yourself();
  21081. $ctx1.sendIdx["yourself"]=1;
  21082. $4=$6;
  21083. $recv($3)._valuable_($4);
  21084. $recv($3)._announcementClass_(aClass);
  21085. $2=$recv($3)._yourself();
  21086. $recv($1)._add_($2);
  21087. return self;
  21088. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  21089. },
  21090. args: ["aClass", "aSelector", "anObject"],
  21091. 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)",
  21092. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  21093. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  21094. }),
  21095. $globals.Announcer);
  21096. $core.addMethod(
  21097. $core.method({
  21098. selector: "unsubscribe:",
  21099. protocol: 'subscribing',
  21100. fn: function (anObject){
  21101. var self=this;
  21102. return $core.withContext(function($ctx1) {
  21103. self["@subscriptions"]=$recv(self["@subscriptions"])._reject_((function(each){
  21104. return $core.withContext(function($ctx2) {
  21105. return $recv($recv(each)._receiver()).__eq(anObject);
  21106. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21107. }));
  21108. return self;
  21109. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  21110. },
  21111. args: ["anObject"],
  21112. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  21113. referencedClasses: [],
  21114. messageSends: ["reject:", "=", "receiver"]
  21115. }),
  21116. $globals.Announcer);
  21117. $core.addClass('SystemAnnouncer', $globals.Announcer, [], 'Kernel-Announcements');
  21118. $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`";
  21119. $globals.SystemAnnouncer.klass.iVarNames = ['current'];
  21120. $core.addMethod(
  21121. $core.method({
  21122. selector: "current",
  21123. protocol: 'accessing',
  21124. fn: function (){
  21125. var self=this;
  21126. return $core.withContext(function($ctx1) {
  21127. var $1,$receiver;
  21128. $1=self["@current"];
  21129. if(($receiver = $1) == null || $receiver.isNil){
  21130. self["@current"]=(
  21131. $ctx1.supercall = true,
  21132. ($globals.SystemAnnouncer.klass.superclass||$boot.dnu).fn.prototype._new.apply($recv(self), []));
  21133. $ctx1.supercall = false;
  21134. return self["@current"];
  21135. } else {
  21136. return $1;
  21137. };
  21138. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.klass)});
  21139. },
  21140. args: [],
  21141. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  21142. referencedClasses: [],
  21143. messageSends: ["ifNil:", "new"]
  21144. }),
  21145. $globals.SystemAnnouncer.klass);
  21146. $core.addMethod(
  21147. $core.method({
  21148. selector: "new",
  21149. protocol: 'instance creation',
  21150. fn: function (){
  21151. var self=this;
  21152. return $core.withContext(function($ctx1) {
  21153. self._shouldNotImplement();
  21154. return self;
  21155. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.klass)});
  21156. },
  21157. args: [],
  21158. source: "new\x0a\x09self shouldNotImplement",
  21159. referencedClasses: [],
  21160. messageSends: ["shouldNotImplement"]
  21161. }),
  21162. $globals.SystemAnnouncer.klass);
  21163. $core.addClass('SystemAnnouncement', $globals.Object, [], 'Kernel-Announcements');
  21164. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  21165. $core.addMethod(
  21166. $core.method({
  21167. selector: "classTag",
  21168. protocol: 'accessing',
  21169. fn: function (){
  21170. var self=this;
  21171. return "announcement";
  21172. },
  21173. args: [],
  21174. 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'",
  21175. referencedClasses: [],
  21176. messageSends: []
  21177. }),
  21178. $globals.SystemAnnouncement.klass);
  21179. $core.addClass('ClassAnnouncement', $globals.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
  21180. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  21181. $core.addMethod(
  21182. $core.method({
  21183. selector: "theClass",
  21184. protocol: 'accessing',
  21185. fn: function (){
  21186. var self=this;
  21187. return self["@theClass"];
  21188. },
  21189. args: [],
  21190. source: "theClass\x0a\x09^ theClass",
  21191. referencedClasses: [],
  21192. messageSends: []
  21193. }),
  21194. $globals.ClassAnnouncement);
  21195. $core.addMethod(
  21196. $core.method({
  21197. selector: "theClass:",
  21198. protocol: 'accessing',
  21199. fn: function (aClass){
  21200. var self=this;
  21201. self["@theClass"]=aClass;
  21202. return self;
  21203. },
  21204. args: ["aClass"],
  21205. source: "theClass: aClass\x0a\x09theClass := aClass",
  21206. referencedClasses: [],
  21207. messageSends: []
  21208. }),
  21209. $globals.ClassAnnouncement);
  21210. $core.addClass('ClassAdded', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21211. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  21212. $core.addClass('ClassCommentChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21213. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  21214. $core.addClass('ClassDefinitionChanged', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21215. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  21216. $core.addClass('ClassMigrated', $globals.ClassAnnouncement, ['oldClass'], 'Kernel-Announcements');
  21217. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  21218. $core.addMethod(
  21219. $core.method({
  21220. selector: "oldClass",
  21221. protocol: 'accessing',
  21222. fn: function (){
  21223. var self=this;
  21224. return self["@oldClass"];
  21225. },
  21226. args: [],
  21227. source: "oldClass\x0a\x09^ oldClass",
  21228. referencedClasses: [],
  21229. messageSends: []
  21230. }),
  21231. $globals.ClassMigrated);
  21232. $core.addMethod(
  21233. $core.method({
  21234. selector: "oldClass:",
  21235. protocol: 'accessing',
  21236. fn: function (aClass){
  21237. var self=this;
  21238. self["@oldClass"]=aClass;
  21239. return self;
  21240. },
  21241. args: ["aClass"],
  21242. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  21243. referencedClasses: [],
  21244. messageSends: []
  21245. }),
  21246. $globals.ClassMigrated);
  21247. $core.addClass('ClassMoved', $globals.ClassAnnouncement, ['oldPackage'], 'Kernel-Announcements');
  21248. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  21249. $core.addMethod(
  21250. $core.method({
  21251. selector: "oldPackage",
  21252. protocol: 'accessing',
  21253. fn: function (){
  21254. var self=this;
  21255. return self["@oldPackage"];
  21256. },
  21257. args: [],
  21258. source: "oldPackage\x0a\x09^ oldPackage",
  21259. referencedClasses: [],
  21260. messageSends: []
  21261. }),
  21262. $globals.ClassMoved);
  21263. $core.addMethod(
  21264. $core.method({
  21265. selector: "oldPackage:",
  21266. protocol: 'accessing',
  21267. fn: function (aPackage){
  21268. var self=this;
  21269. self["@oldPackage"]=aPackage;
  21270. return self;
  21271. },
  21272. args: ["aPackage"],
  21273. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  21274. referencedClasses: [],
  21275. messageSends: []
  21276. }),
  21277. $globals.ClassMoved);
  21278. $core.addClass('ClassRemoved', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21279. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  21280. $core.addClass('ClassRenamed', $globals.ClassAnnouncement, [], 'Kernel-Announcements');
  21281. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  21282. $core.addClass('MethodAnnouncement', $globals.SystemAnnouncement, ['method'], 'Kernel-Announcements');
  21283. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  21284. $core.addMethod(
  21285. $core.method({
  21286. selector: "method",
  21287. protocol: 'accessing',
  21288. fn: function (){
  21289. var self=this;
  21290. return self["@method"];
  21291. },
  21292. args: [],
  21293. source: "method\x0a\x09^ method",
  21294. referencedClasses: [],
  21295. messageSends: []
  21296. }),
  21297. $globals.MethodAnnouncement);
  21298. $core.addMethod(
  21299. $core.method({
  21300. selector: "method:",
  21301. protocol: 'accessing',
  21302. fn: function (aCompiledMethod){
  21303. var self=this;
  21304. self["@method"]=aCompiledMethod;
  21305. return self;
  21306. },
  21307. args: ["aCompiledMethod"],
  21308. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  21309. referencedClasses: [],
  21310. messageSends: []
  21311. }),
  21312. $globals.MethodAnnouncement);
  21313. $core.addClass('MethodAdded', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21314. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  21315. $core.addClass('MethodModified', $globals.MethodAnnouncement, ['oldMethod'], 'Kernel-Announcements');
  21316. $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.";
  21317. $core.addMethod(
  21318. $core.method({
  21319. selector: "oldMethod",
  21320. protocol: 'accessing',
  21321. fn: function (){
  21322. var self=this;
  21323. return self["@oldMethod"];
  21324. },
  21325. args: [],
  21326. source: "oldMethod\x0a\x09^ oldMethod",
  21327. referencedClasses: [],
  21328. messageSends: []
  21329. }),
  21330. $globals.MethodModified);
  21331. $core.addMethod(
  21332. $core.method({
  21333. selector: "oldMethod:",
  21334. protocol: 'accessing',
  21335. fn: function (aMethod){
  21336. var self=this;
  21337. self["@oldMethod"]=aMethod;
  21338. return self;
  21339. },
  21340. args: ["aMethod"],
  21341. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  21342. referencedClasses: [],
  21343. messageSends: []
  21344. }),
  21345. $globals.MethodModified);
  21346. $core.addClass('MethodMoved', $globals.MethodAnnouncement, ['oldProtocol'], 'Kernel-Announcements');
  21347. $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.";
  21348. $core.addMethod(
  21349. $core.method({
  21350. selector: "oldProtocol",
  21351. protocol: 'accessing',
  21352. fn: function (){
  21353. var self=this;
  21354. return self["@oldProtocol"];
  21355. },
  21356. args: [],
  21357. source: "oldProtocol\x0a\x09^ oldProtocol",
  21358. referencedClasses: [],
  21359. messageSends: []
  21360. }),
  21361. $globals.MethodMoved);
  21362. $core.addMethod(
  21363. $core.method({
  21364. selector: "oldProtocol:",
  21365. protocol: 'accessing',
  21366. fn: function (aString){
  21367. var self=this;
  21368. self["@oldProtocol"]=aString;
  21369. return self;
  21370. },
  21371. args: ["aString"],
  21372. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  21373. referencedClasses: [],
  21374. messageSends: []
  21375. }),
  21376. $globals.MethodMoved);
  21377. $core.addClass('MethodRemoved', $globals.MethodAnnouncement, [], 'Kernel-Announcements');
  21378. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  21379. $core.addClass('PackageAnnouncement', $globals.SystemAnnouncement, ['package'], 'Kernel-Announcements');
  21380. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  21381. $core.addMethod(
  21382. $core.method({
  21383. selector: "package",
  21384. protocol: 'accessing',
  21385. fn: function (){
  21386. var self=this;
  21387. return self["@package"];
  21388. },
  21389. args: [],
  21390. source: "package\x0a\x09^ package",
  21391. referencedClasses: [],
  21392. messageSends: []
  21393. }),
  21394. $globals.PackageAnnouncement);
  21395. $core.addMethod(
  21396. $core.method({
  21397. selector: "package:",
  21398. protocol: 'accessing',
  21399. fn: function (aPackage){
  21400. var self=this;
  21401. self["@package"]=aPackage;
  21402. return self;
  21403. },
  21404. args: ["aPackage"],
  21405. source: "package: aPackage\x0a\x09package := aPackage",
  21406. referencedClasses: [],
  21407. messageSends: []
  21408. }),
  21409. $globals.PackageAnnouncement);
  21410. $core.addClass('PackageAdded', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21411. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  21412. $core.addClass('PackageClean', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21413. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  21414. $core.addClass('PackageDirty', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21415. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  21416. $core.addClass('PackageRemoved', $globals.PackageAnnouncement, [], 'Kernel-Announcements');
  21417. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  21418. $core.addClass('ProtocolAnnouncement', $globals.SystemAnnouncement, ['theClass', 'protocol'], 'Kernel-Announcements');
  21419. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  21420. $core.addMethod(
  21421. $core.method({
  21422. selector: "package",
  21423. protocol: 'accessing',
  21424. fn: function (){
  21425. var self=this;
  21426. return $core.withContext(function($ctx1) {
  21427. var $1,$receiver;
  21428. $1=self._theClass();
  21429. if(($receiver = $1) == null || $receiver.isNil){
  21430. return $1;
  21431. } else {
  21432. var class_;
  21433. class_=$receiver;
  21434. return $recv(class_)._packageOfProtocol_(self._protocol());
  21435. };
  21436. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  21437. },
  21438. args: [],
  21439. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  21440. referencedClasses: [],
  21441. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  21442. }),
  21443. $globals.ProtocolAnnouncement);
  21444. $core.addMethod(
  21445. $core.method({
  21446. selector: "protocol",
  21447. protocol: 'accessing',
  21448. fn: function (){
  21449. var self=this;
  21450. return self["@protocol"];
  21451. },
  21452. args: [],
  21453. source: "protocol\x0a\x09^ protocol",
  21454. referencedClasses: [],
  21455. messageSends: []
  21456. }),
  21457. $globals.ProtocolAnnouncement);
  21458. $core.addMethod(
  21459. $core.method({
  21460. selector: "protocol:",
  21461. protocol: 'accessing',
  21462. fn: function (aString){
  21463. var self=this;
  21464. self["@protocol"]=aString;
  21465. return self;
  21466. },
  21467. args: ["aString"],
  21468. source: "protocol: aString\x0a\x09protocol := aString",
  21469. referencedClasses: [],
  21470. messageSends: []
  21471. }),
  21472. $globals.ProtocolAnnouncement);
  21473. $core.addMethod(
  21474. $core.method({
  21475. selector: "theClass",
  21476. protocol: 'accessing',
  21477. fn: function (){
  21478. var self=this;
  21479. return self["@theClass"];
  21480. },
  21481. args: [],
  21482. source: "theClass\x0a\x09^ theClass",
  21483. referencedClasses: [],
  21484. messageSends: []
  21485. }),
  21486. $globals.ProtocolAnnouncement);
  21487. $core.addMethod(
  21488. $core.method({
  21489. selector: "theClass:",
  21490. protocol: 'accessing',
  21491. fn: function (aClass){
  21492. var self=this;
  21493. self["@theClass"]=aClass;
  21494. return self;
  21495. },
  21496. args: ["aClass"],
  21497. source: "theClass: aClass\x0a\x09theClass := aClass",
  21498. referencedClasses: [],
  21499. messageSends: []
  21500. }),
  21501. $globals.ProtocolAnnouncement);
  21502. $core.addClass('ProtocolAdded', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21503. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  21504. $core.addClass('ProtocolRemoved', $globals.ProtocolAnnouncement, [], 'Kernel-Announcements');
  21505. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  21506. });
  21507. define("amber_core/Platform-Services", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections", "amber_core/Kernel-Methods", "amber_core/Kernel-Infrastructure"], function($boot){"use strict";
  21508. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  21509. $core.addPackage('Platform-Services');
  21510. $core.packages["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  21511. $core.packages["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21512. $core.addClass('ConsoleErrorHandler', $globals.Object, [], 'Platform-Services');
  21513. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  21514. $core.addMethod(
  21515. $core.method({
  21516. selector: "handleError:",
  21517. protocol: 'error handling',
  21518. fn: function (anError){
  21519. var self=this;
  21520. return $core.withContext(function($ctx1) {
  21521. var $1,$receiver;
  21522. $1=$recv(anError)._context();
  21523. $ctx1.sendIdx["context"]=1;
  21524. if(($receiver = $1) == null || $receiver.isNil){
  21525. $1;
  21526. } else {
  21527. self._logErrorContext_($recv(anError)._context());
  21528. };
  21529. self._logError_(anError);
  21530. return self;
  21531. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21532. },
  21533. args: ["anError"],
  21534. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  21535. referencedClasses: [],
  21536. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  21537. }),
  21538. $globals.ConsoleErrorHandler);
  21539. $core.addMethod(
  21540. $core.method({
  21541. selector: "log:",
  21542. protocol: 'private',
  21543. fn: function (aString){
  21544. var self=this;
  21545. return $core.withContext(function($ctx1) {
  21546. $recv(console)._log_(aString);
  21547. return self;
  21548. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  21549. },
  21550. args: ["aString"],
  21551. source: "log: aString\x0a\x09console log: aString",
  21552. referencedClasses: [],
  21553. messageSends: ["log:"]
  21554. }),
  21555. $globals.ConsoleErrorHandler);
  21556. $core.addMethod(
  21557. $core.method({
  21558. selector: "logContext:",
  21559. protocol: 'private',
  21560. fn: function (aContext){
  21561. var self=this;
  21562. return $core.withContext(function($ctx1) {
  21563. var $1,$receiver;
  21564. $1=$recv(aContext)._home();
  21565. $ctx1.sendIdx["home"]=1;
  21566. if(($receiver = $1) == null || $receiver.isNil){
  21567. $1;
  21568. } else {
  21569. self._logContext_($recv(aContext)._home());
  21570. };
  21571. self._log_($recv(aContext)._asString());
  21572. return self;
  21573. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21574. },
  21575. args: ["aContext"],
  21576. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  21577. referencedClasses: [],
  21578. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  21579. }),
  21580. $globals.ConsoleErrorHandler);
  21581. $core.addMethod(
  21582. $core.method({
  21583. selector: "logError:",
  21584. protocol: 'private',
  21585. fn: function (anError){
  21586. var self=this;
  21587. return $core.withContext(function($ctx1) {
  21588. self._log_($recv(anError)._messageText());
  21589. return self;
  21590. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  21591. },
  21592. args: ["anError"],
  21593. source: "logError: anError\x0a\x09self log: anError messageText",
  21594. referencedClasses: [],
  21595. messageSends: ["log:", "messageText"]
  21596. }),
  21597. $globals.ConsoleErrorHandler);
  21598. $core.addMethod(
  21599. $core.method({
  21600. selector: "logErrorContext:",
  21601. protocol: 'private',
  21602. fn: function (aContext){
  21603. var self=this;
  21604. return $core.withContext(function($ctx1) {
  21605. var $1,$receiver;
  21606. if(($receiver = aContext) == null || $receiver.isNil){
  21607. aContext;
  21608. } else {
  21609. $1=$recv(aContext)._home();
  21610. $ctx1.sendIdx["home"]=1;
  21611. if(($receiver = $1) == null || $receiver.isNil){
  21612. $1;
  21613. } else {
  21614. self._logContext_($recv(aContext)._home());
  21615. };
  21616. };
  21617. return self;
  21618. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  21619. },
  21620. args: ["aContext"],
  21621. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  21622. referencedClasses: [],
  21623. messageSends: ["ifNotNil:", "home", "logContext:"]
  21624. }),
  21625. $globals.ConsoleErrorHandler);
  21626. $globals.ConsoleErrorHandler.klass.iVarNames = ['current'];
  21627. $core.addMethod(
  21628. $core.method({
  21629. selector: "initialize",
  21630. protocol: 'initialization',
  21631. fn: function (){
  21632. var self=this;
  21633. return $core.withContext(function($ctx1) {
  21634. $recv($globals.ErrorHandler)._registerIfNone_(self._new());
  21635. return self;
  21636. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.klass)});
  21637. },
  21638. args: [],
  21639. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  21640. referencedClasses: ["ErrorHandler"],
  21641. messageSends: ["registerIfNone:", "new"]
  21642. }),
  21643. $globals.ConsoleErrorHandler.klass);
  21644. $core.addClass('ConsoleTranscript', $globals.Object, ['textarea'], 'Platform-Services');
  21645. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  21646. $core.addMethod(
  21647. $core.method({
  21648. selector: "clear",
  21649. protocol: 'printing',
  21650. fn: function (){
  21651. var self=this;
  21652. return self;
  21653. },
  21654. args: [],
  21655. source: "clear\x0a\x09\x22no op\x22",
  21656. referencedClasses: [],
  21657. messageSends: []
  21658. }),
  21659. $globals.ConsoleTranscript);
  21660. $core.addMethod(
  21661. $core.method({
  21662. selector: "cr",
  21663. protocol: 'printing',
  21664. fn: function (){
  21665. var self=this;
  21666. return self;
  21667. },
  21668. args: [],
  21669. source: "cr\x0a\x09\x22no op\x22",
  21670. referencedClasses: [],
  21671. messageSends: []
  21672. }),
  21673. $globals.ConsoleTranscript);
  21674. $core.addMethod(
  21675. $core.method({
  21676. selector: "open",
  21677. protocol: 'actions',
  21678. fn: function (){
  21679. var self=this;
  21680. return self;
  21681. },
  21682. args: [],
  21683. source: "open",
  21684. referencedClasses: [],
  21685. messageSends: []
  21686. }),
  21687. $globals.ConsoleTranscript);
  21688. $core.addMethod(
  21689. $core.method({
  21690. selector: "show:",
  21691. protocol: 'printing',
  21692. fn: function (anObject){
  21693. var self=this;
  21694. return $core.withContext(function($ctx1) {
  21695. console.log(String($recv(anObject)._asString()));
  21696. return self;
  21697. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  21698. },
  21699. args: ["anObject"],
  21700. 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()))>",
  21701. referencedClasses: [],
  21702. messageSends: []
  21703. }),
  21704. $globals.ConsoleTranscript);
  21705. $core.addMethod(
  21706. $core.method({
  21707. selector: "initialize",
  21708. protocol: 'initialization',
  21709. fn: function (){
  21710. var self=this;
  21711. return $core.withContext(function($ctx1) {
  21712. $recv($globals.Transcript)._registerIfNone_(self._new());
  21713. return self;
  21714. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.klass)});
  21715. },
  21716. args: [],
  21717. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  21718. referencedClasses: ["Transcript"],
  21719. messageSends: ["registerIfNone:", "new"]
  21720. }),
  21721. $globals.ConsoleTranscript.klass);
  21722. $core.addClass('InterfacingObject', $globals.Object, [], 'Platform-Services');
  21723. $globals.InterfacingObject.comment="I am superclass of all object that interface with user or environment. `Widget` and a few other classes are subclasses of me. I delegate all of the above APIs to `PlatformInterface`.\x0a\x0a## API\x0a\x0a self alert: 'Hey, there is a problem'.\x0a self confirm: 'Affirmative?'.\x0a self prompt: 'Your name:'.\x0a\x0a self ajax: #{\x0a 'url' -> '/patch.js'. 'type' -> 'GET'. dataType->'script'\x0a }.";
  21724. $core.addMethod(
  21725. $core.method({
  21726. selector: "ajax:",
  21727. protocol: 'actions',
  21728. fn: function (anObject){
  21729. var self=this;
  21730. return $core.withContext(function($ctx1) {
  21731. self._deprecatedAPI();
  21732. return $recv($globals.PlatformInterface)._ajax_(anObject);
  21733. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.InterfacingObject)});
  21734. },
  21735. args: ["anObject"],
  21736. source: "ajax: anObject\x0a\x09self deprecatedAPI.\x0a\x09^ PlatformInterface ajax: anObject",
  21737. referencedClasses: ["PlatformInterface"],
  21738. messageSends: ["deprecatedAPI", "ajax:"]
  21739. }),
  21740. $globals.InterfacingObject);
  21741. $core.addMethod(
  21742. $core.method({
  21743. selector: "alert:",
  21744. protocol: 'actions',
  21745. fn: function (aString){
  21746. var self=this;
  21747. return $core.withContext(function($ctx1) {
  21748. return $recv($globals.Terminal)._alert_(aString);
  21749. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.InterfacingObject)});
  21750. },
  21751. args: ["aString"],
  21752. source: "alert: aString\x0a\x09^ Terminal alert: aString",
  21753. referencedClasses: ["Terminal"],
  21754. messageSends: ["alert:"]
  21755. }),
  21756. $globals.InterfacingObject);
  21757. $core.addMethod(
  21758. $core.method({
  21759. selector: "confirm:",
  21760. protocol: 'actions',
  21761. fn: function (aString){
  21762. var self=this;
  21763. return $core.withContext(function($ctx1) {
  21764. return $recv($globals.Terminal)._confirm_(aString);
  21765. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.InterfacingObject)});
  21766. },
  21767. args: ["aString"],
  21768. source: "confirm: aString\x0a\x09^ Terminal confirm: aString",
  21769. referencedClasses: ["Terminal"],
  21770. messageSends: ["confirm:"]
  21771. }),
  21772. $globals.InterfacingObject);
  21773. $core.addMethod(
  21774. $core.method({
  21775. selector: "prompt:",
  21776. protocol: 'actions',
  21777. fn: function (aString){
  21778. var self=this;
  21779. return $core.withContext(function($ctx1) {
  21780. return $recv($globals.Terminal)._prompt_(aString);
  21781. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.InterfacingObject)});
  21782. },
  21783. args: ["aString"],
  21784. source: "prompt: aString\x0a\x09^ Terminal prompt: aString",
  21785. referencedClasses: ["Terminal"],
  21786. messageSends: ["prompt:"]
  21787. }),
  21788. $globals.InterfacingObject);
  21789. $core.addMethod(
  21790. $core.method({
  21791. selector: "prompt:default:",
  21792. protocol: 'actions',
  21793. fn: function (aString,defaultString){
  21794. var self=this;
  21795. return $core.withContext(function($ctx1) {
  21796. return $recv($globals.Terminal)._prompt_default_(aString,defaultString);
  21797. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.InterfacingObject)});
  21798. },
  21799. args: ["aString", "defaultString"],
  21800. source: "prompt: aString default: defaultString\x0a\x09^ Terminal prompt: aString default: defaultString",
  21801. referencedClasses: ["Terminal"],
  21802. messageSends: ["prompt:default:"]
  21803. }),
  21804. $globals.InterfacingObject);
  21805. $core.addClass('Environment', $globals.InterfacingObject, [], 'Platform-Services');
  21806. $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.";
  21807. $core.addMethod(
  21808. $core.method({
  21809. selector: "addInstVarNamed:to:",
  21810. protocol: 'compiling',
  21811. fn: function (aString,aClass){
  21812. var self=this;
  21813. return $core.withContext(function($ctx1) {
  21814. var $1,$2,$3,$5,$4;
  21815. $1=self._classBuilder();
  21816. $2=$recv(aClass)._superclass();
  21817. $3=$recv(aClass)._name();
  21818. $ctx1.sendIdx["name"]=1;
  21819. $5=$recv($recv(aClass)._instanceVariableNames())._copy();
  21820. $recv($5)._add_(aString);
  21821. $4=$recv($5)._yourself();
  21822. $recv($1)._addSubclassOf_named_instanceVariableNames_package_($2,$3,$4,$recv($recv(aClass)._package())._name());
  21823. return self;
  21824. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass},$globals.Environment)});
  21825. },
  21826. args: ["aString", "aClass"],
  21827. 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",
  21828. referencedClasses: [],
  21829. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "classBuilder", "superclass", "name", "add:", "copy", "instanceVariableNames", "yourself", "package"]
  21830. }),
  21831. $globals.Environment);
  21832. $core.addMethod(
  21833. $core.method({
  21834. selector: "allSelectors",
  21835. protocol: 'accessing',
  21836. fn: function (){
  21837. var self=this;
  21838. return $core.withContext(function($ctx1) {
  21839. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  21840. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  21841. },
  21842. args: [],
  21843. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  21844. referencedClasses: ["Smalltalk"],
  21845. messageSends: ["allSelectors", "core"]
  21846. }),
  21847. $globals.Environment);
  21848. $core.addMethod(
  21849. $core.method({
  21850. selector: "availableClassNames",
  21851. protocol: 'accessing',
  21852. fn: function (){
  21853. var self=this;
  21854. return $core.withContext(function($ctx1) {
  21855. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  21856. return $core.withContext(function($ctx2) {
  21857. return $recv(each)._name();
  21858. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21859. }));
  21860. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  21861. },
  21862. args: [],
  21863. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  21864. referencedClasses: ["Smalltalk"],
  21865. messageSends: ["collect:", "classes", "name"]
  21866. }),
  21867. $globals.Environment);
  21868. $core.addMethod(
  21869. $core.method({
  21870. selector: "availablePackageNames",
  21871. protocol: 'accessing',
  21872. fn: function (){
  21873. var self=this;
  21874. return $core.withContext(function($ctx1) {
  21875. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  21876. return $core.withContext(function($ctx2) {
  21877. return $recv(each)._name();
  21878. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21879. }));
  21880. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  21881. },
  21882. args: [],
  21883. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  21884. referencedClasses: ["Smalltalk"],
  21885. messageSends: ["collect:", "packages", "name"]
  21886. }),
  21887. $globals.Environment);
  21888. $core.addMethod(
  21889. $core.method({
  21890. selector: "availableProtocolsFor:",
  21891. protocol: 'accessing',
  21892. fn: function (aClass){
  21893. var self=this;
  21894. var protocols;
  21895. return $core.withContext(function($ctx1) {
  21896. var $1,$receiver;
  21897. protocols=$recv(aClass)._protocols();
  21898. $1=$recv(aClass)._superclass();
  21899. $ctx1.sendIdx["superclass"]=1;
  21900. if(($receiver = $1) == null || $receiver.isNil){
  21901. $1;
  21902. } else {
  21903. $recv(protocols)._addAll_(self._availableProtocolsFor_($recv(aClass)._superclass()));
  21904. };
  21905. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  21906. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  21907. },
  21908. args: ["aClass"],
  21909. 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",
  21910. referencedClasses: [],
  21911. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  21912. }),
  21913. $globals.Environment);
  21914. $core.addMethod(
  21915. $core.method({
  21916. selector: "classBuilder",
  21917. protocol: 'accessing',
  21918. fn: function (){
  21919. var self=this;
  21920. return $core.withContext(function($ctx1) {
  21921. return $recv($globals.ClassBuilder)._new();
  21922. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  21923. },
  21924. args: [],
  21925. source: "classBuilder\x0a\x09^ ClassBuilder new",
  21926. referencedClasses: ["ClassBuilder"],
  21927. messageSends: ["new"]
  21928. }),
  21929. $globals.Environment);
  21930. $core.addMethod(
  21931. $core.method({
  21932. selector: "classNamed:",
  21933. protocol: 'accessing',
  21934. fn: function (aString){
  21935. var self=this;
  21936. return $core.withContext(function($ctx1) {
  21937. var $1,$receiver;
  21938. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  21939. if(($receiver = $1) == null || $receiver.isNil){
  21940. return self._error_("Invalid class name");
  21941. } else {
  21942. return $1;
  21943. };
  21944. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  21945. },
  21946. args: ["aString"],
  21947. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  21948. referencedClasses: ["Smalltalk"],
  21949. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  21950. }),
  21951. $globals.Environment);
  21952. $core.addMethod(
  21953. $core.method({
  21954. selector: "classes",
  21955. protocol: 'accessing',
  21956. fn: function (){
  21957. var self=this;
  21958. return $core.withContext(function($ctx1) {
  21959. return $recv($globals.Smalltalk)._classes();
  21960. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  21961. },
  21962. args: [],
  21963. source: "classes\x0a\x09^ Smalltalk classes",
  21964. referencedClasses: ["Smalltalk"],
  21965. messageSends: ["classes"]
  21966. }),
  21967. $globals.Environment);
  21968. $core.addMethod(
  21969. $core.method({
  21970. selector: "commitPackage:onSuccess:onError:",
  21971. protocol: 'actions',
  21972. fn: function (aPackage,aBlock,anotherBlock){
  21973. var self=this;
  21974. return $core.withContext(function($ctx1) {
  21975. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  21976. return self;
  21977. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  21978. },
  21979. args: ["aPackage", "aBlock", "anotherBlock"],
  21980. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  21981. referencedClasses: [],
  21982. messageSends: ["commitOnSuccess:onError:", "transport"]
  21983. }),
  21984. $globals.Environment);
  21985. $core.addMethod(
  21986. $core.method({
  21987. selector: "compileClassComment:for:",
  21988. protocol: 'compiling',
  21989. fn: function (aString,aClass){
  21990. var self=this;
  21991. return $core.withContext(function($ctx1) {
  21992. $recv(aClass)._comment_(aString);
  21993. return self;
  21994. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  21995. },
  21996. args: ["aString", "aClass"],
  21997. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  21998. referencedClasses: [],
  21999. messageSends: ["comment:"]
  22000. }),
  22001. $globals.Environment);
  22002. $core.addMethod(
  22003. $core.method({
  22004. selector: "compileClassDefinition:",
  22005. protocol: 'compiling',
  22006. fn: function (aString){
  22007. var self=this;
  22008. return $core.withContext(function($ctx1) {
  22009. $recv((function(){
  22010. return $core.withContext(function($ctx2) {
  22011. return self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  22012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22013. }))._on_do_($globals.Error,(function(error){
  22014. return $core.withContext(function($ctx2) {
  22015. return self._alert_($recv(error)._messageText());
  22016. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  22017. }));
  22018. return self;
  22019. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  22020. },
  22021. args: ["aString"],
  22022. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | self alert: error messageText ]",
  22023. referencedClasses: ["DoIt", "Error"],
  22024. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  22025. }),
  22026. $globals.Environment);
  22027. $core.addMethod(
  22028. $core.method({
  22029. selector: "compileMethod:for:protocol:",
  22030. protocol: 'compiling',
  22031. fn: function (sourceCode,class_,protocol){
  22032. var self=this;
  22033. return $core.withContext(function($ctx1) {
  22034. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  22035. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  22036. },
  22037. args: ["sourceCode", "class", "protocol"],
  22038. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  22039. referencedClasses: [],
  22040. messageSends: ["compile:protocol:"]
  22041. }),
  22042. $globals.Environment);
  22043. $core.addMethod(
  22044. $core.method({
  22045. selector: "copyClass:to:",
  22046. protocol: 'actions',
  22047. fn: function (aClass,aClassName){
  22048. var self=this;
  22049. return $core.withContext(function($ctx1) {
  22050. var $1,$2,$receiver;
  22051. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  22052. if(($receiver = $1) == null || $receiver.isNil){
  22053. $1;
  22054. } else {
  22055. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22056. $ctx1.sendIdx[","]=1;
  22057. self._error_($2);
  22058. };
  22059. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  22060. return self;
  22061. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22062. },
  22063. args: ["aClass", "aClassName"],
  22064. 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",
  22065. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22066. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  22067. }),
  22068. $globals.Environment);
  22069. $core.addMethod(
  22070. $core.method({
  22071. selector: "doItReceiver",
  22072. protocol: 'accessing',
  22073. fn: function (){
  22074. var self=this;
  22075. return $core.withContext(function($ctx1) {
  22076. return $recv($globals.DoIt)._new();
  22077. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  22078. },
  22079. args: [],
  22080. source: "doItReceiver\x0a\x09^ DoIt new",
  22081. referencedClasses: ["DoIt"],
  22082. messageSends: ["new"]
  22083. }),
  22084. $globals.Environment);
  22085. $core.addMethod(
  22086. $core.method({
  22087. selector: "evaluate:for:",
  22088. protocol: 'evaluating',
  22089. fn: function (aString,anObject){
  22090. var self=this;
  22091. return $core.withContext(function($ctx1) {
  22092. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  22093. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  22094. },
  22095. args: ["aString", "anObject"],
  22096. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  22097. referencedClasses: ["Evaluator"],
  22098. messageSends: ["evaluate:for:"]
  22099. }),
  22100. $globals.Environment);
  22101. $core.addMethod(
  22102. $core.method({
  22103. selector: "evaluate:on:do:",
  22104. protocol: 'error handling',
  22105. fn: function (aBlock,anErrorClass,exceptionBlock){
  22106. var self=this;
  22107. return $core.withContext(function($ctx1) {
  22108. var $1;
  22109. $recv(aBlock)._tryCatch_((function(exception){
  22110. return $core.withContext(function($ctx2) {
  22111. $1=$recv(exception)._isKindOf_(self._classNamed_($recv(anErrorClass)._name()));
  22112. if($core.assert($1)){
  22113. return $recv(exceptionBlock)._value_(exception);
  22114. } else {
  22115. return $recv(exception)._resignal();
  22116. };
  22117. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  22118. }));
  22119. return self;
  22120. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  22121. },
  22122. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  22123. 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 ] ]",
  22124. referencedClasses: [],
  22125. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "resignal"]
  22126. }),
  22127. $globals.Environment);
  22128. $core.addMethod(
  22129. $core.method({
  22130. selector: "inspect:",
  22131. protocol: 'actions',
  22132. fn: function (anObject){
  22133. var self=this;
  22134. return $core.withContext(function($ctx1) {
  22135. $recv($globals.Inspector)._inspect_(anObject);
  22136. return self;
  22137. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  22138. },
  22139. args: ["anObject"],
  22140. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  22141. referencedClasses: ["Inspector"],
  22142. messageSends: ["inspect:"]
  22143. }),
  22144. $globals.Environment);
  22145. $core.addMethod(
  22146. $core.method({
  22147. selector: "moveClass:toPackage:",
  22148. protocol: 'actions',
  22149. fn: function (aClass,aPackageName){
  22150. var self=this;
  22151. var package_;
  22152. return $core.withContext(function($ctx1) {
  22153. var $1,$2,$receiver;
  22154. package_=$recv($globals.Package)._named_(aPackageName);
  22155. $1=package_;
  22156. if(($receiver = $1) == null || $receiver.isNil){
  22157. self._error_("Invalid package name");
  22158. } else {
  22159. $1;
  22160. };
  22161. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  22162. if($core.assert($2)){
  22163. return self;
  22164. };
  22165. $recv(aClass)._package_(package_);
  22166. return self;
  22167. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  22168. },
  22169. args: ["aClass", "aPackageName"],
  22170. 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",
  22171. referencedClasses: ["Package"],
  22172. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:"]
  22173. }),
  22174. $globals.Environment);
  22175. $core.addMethod(
  22176. $core.method({
  22177. selector: "moveMethod:toClass:",
  22178. protocol: 'actions',
  22179. fn: function (aMethod,aClassName){
  22180. var self=this;
  22181. var destinationClass;
  22182. return $core.withContext(function($ctx1) {
  22183. var $2,$3,$1,$5,$4;
  22184. destinationClass=self._classNamed_(aClassName);
  22185. $2=destinationClass;
  22186. $3=$recv(aMethod)._methodClass();
  22187. $ctx1.sendIdx["methodClass"]=1;
  22188. $1=$recv($2).__eq_eq($3);
  22189. if($core.assert($1)){
  22190. return self;
  22191. };
  22192. $5=$recv(aMethod)._methodClass();
  22193. $ctx1.sendIdx["methodClass"]=2;
  22194. $4=$recv($5)._isMetaclass();
  22195. if($core.assert($4)){
  22196. destinationClass=$recv(destinationClass)._class();
  22197. destinationClass;
  22198. };
  22199. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  22200. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22201. return self;
  22202. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  22203. },
  22204. args: ["aMethod", "aClassName"],
  22205. 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",
  22206. referencedClasses: [],
  22207. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "class", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  22208. }),
  22209. $globals.Environment);
  22210. $core.addMethod(
  22211. $core.method({
  22212. selector: "moveMethod:toProtocol:",
  22213. protocol: 'actions',
  22214. fn: function (aMethod,aProtocol){
  22215. var self=this;
  22216. return $core.withContext(function($ctx1) {
  22217. $recv(aMethod)._protocol_(aProtocol);
  22218. return self;
  22219. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  22220. },
  22221. args: ["aMethod", "aProtocol"],
  22222. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol",
  22223. referencedClasses: [],
  22224. messageSends: ["protocol:"]
  22225. }),
  22226. $globals.Environment);
  22227. $core.addMethod(
  22228. $core.method({
  22229. selector: "packages",
  22230. protocol: 'accessing',
  22231. fn: function (){
  22232. var self=this;
  22233. return $core.withContext(function($ctx1) {
  22234. return $recv($globals.Smalltalk)._packages();
  22235. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  22236. },
  22237. args: [],
  22238. source: "packages\x0a\x09^ Smalltalk packages",
  22239. referencedClasses: ["Smalltalk"],
  22240. messageSends: ["packages"]
  22241. }),
  22242. $globals.Environment);
  22243. $core.addMethod(
  22244. $core.method({
  22245. selector: "registerErrorHandler:",
  22246. protocol: 'services',
  22247. fn: function (anErrorHandler){
  22248. var self=this;
  22249. return $core.withContext(function($ctx1) {
  22250. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  22251. return self;
  22252. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  22253. },
  22254. args: ["anErrorHandler"],
  22255. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  22256. referencedClasses: ["ErrorHandler"],
  22257. messageSends: ["register:"]
  22258. }),
  22259. $globals.Environment);
  22260. $core.addMethod(
  22261. $core.method({
  22262. selector: "registerFinder:",
  22263. protocol: 'services',
  22264. fn: function (aFinder){
  22265. var self=this;
  22266. return $core.withContext(function($ctx1) {
  22267. $recv($globals.Finder)._register_(aFinder);
  22268. return self;
  22269. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  22270. },
  22271. args: ["aFinder"],
  22272. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  22273. referencedClasses: ["Finder"],
  22274. messageSends: ["register:"]
  22275. }),
  22276. $globals.Environment);
  22277. $core.addMethod(
  22278. $core.method({
  22279. selector: "registerInspector:",
  22280. protocol: 'services',
  22281. fn: function (anInspector){
  22282. var self=this;
  22283. return $core.withContext(function($ctx1) {
  22284. $recv($globals.Inspector)._register_(anInspector);
  22285. return self;
  22286. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  22287. },
  22288. args: ["anInspector"],
  22289. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  22290. referencedClasses: ["Inspector"],
  22291. messageSends: ["register:"]
  22292. }),
  22293. $globals.Environment);
  22294. $core.addMethod(
  22295. $core.method({
  22296. selector: "registerProgressHandler:",
  22297. protocol: 'services',
  22298. fn: function (aProgressHandler){
  22299. var self=this;
  22300. return $core.withContext(function($ctx1) {
  22301. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  22302. return self;
  22303. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  22304. },
  22305. args: ["aProgressHandler"],
  22306. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  22307. referencedClasses: ["ProgressHandler"],
  22308. messageSends: ["register:"]
  22309. }),
  22310. $globals.Environment);
  22311. $core.addMethod(
  22312. $core.method({
  22313. selector: "registerTranscript:",
  22314. protocol: 'services',
  22315. fn: function (aTranscript){
  22316. var self=this;
  22317. return $core.withContext(function($ctx1) {
  22318. $recv($globals.Transcript)._register_(aTranscript);
  22319. return self;
  22320. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  22321. },
  22322. args: ["aTranscript"],
  22323. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  22324. referencedClasses: ["Transcript"],
  22325. messageSends: ["register:"]
  22326. }),
  22327. $globals.Environment);
  22328. $core.addMethod(
  22329. $core.method({
  22330. selector: "removeClass:",
  22331. protocol: 'actions',
  22332. fn: function (aClass){
  22333. var self=this;
  22334. return $core.withContext(function($ctx1) {
  22335. $recv($globals.Smalltalk)._removeClass_(aClass);
  22336. return self;
  22337. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  22338. },
  22339. args: ["aClass"],
  22340. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  22341. referencedClasses: ["Smalltalk"],
  22342. messageSends: ["removeClass:"]
  22343. }),
  22344. $globals.Environment);
  22345. $core.addMethod(
  22346. $core.method({
  22347. selector: "removeMethod:",
  22348. protocol: 'actions',
  22349. fn: function (aMethod){
  22350. var self=this;
  22351. return $core.withContext(function($ctx1) {
  22352. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  22353. return self;
  22354. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  22355. },
  22356. args: ["aMethod"],
  22357. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  22358. referencedClasses: [],
  22359. messageSends: ["removeCompiledMethod:", "methodClass"]
  22360. }),
  22361. $globals.Environment);
  22362. $core.addMethod(
  22363. $core.method({
  22364. selector: "removeProtocol:from:",
  22365. protocol: 'actions',
  22366. fn: function (aString,aClass){
  22367. var self=this;
  22368. return $core.withContext(function($ctx1) {
  22369. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22370. return $core.withContext(function($ctx2) {
  22371. return $recv(aClass)._removeCompiledMethod_(each);
  22372. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22373. }));
  22374. return self;
  22375. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  22376. },
  22377. args: ["aString", "aClass"],
  22378. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  22379. referencedClasses: [],
  22380. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  22381. }),
  22382. $globals.Environment);
  22383. $core.addMethod(
  22384. $core.method({
  22385. selector: "renameClass:to:",
  22386. protocol: 'actions',
  22387. fn: function (aClass,aClassName){
  22388. var self=this;
  22389. return $core.withContext(function($ctx1) {
  22390. var $1,$2,$receiver;
  22391. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  22392. if(($receiver = $1) == null || $receiver.isNil){
  22393. $1;
  22394. } else {
  22395. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  22396. $ctx1.sendIdx[","]=1;
  22397. self._error_($2);
  22398. };
  22399. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  22400. return self;
  22401. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  22402. },
  22403. args: ["aClass", "aClassName"],
  22404. 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",
  22405. referencedClasses: ["Smalltalk", "ClassBuilder"],
  22406. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  22407. }),
  22408. $globals.Environment);
  22409. $core.addMethod(
  22410. $core.method({
  22411. selector: "renamePackage:to:",
  22412. protocol: 'actions',
  22413. fn: function (aPackageName,aNewPackageName){
  22414. var self=this;
  22415. return $core.withContext(function($ctx1) {
  22416. var $1,$2,$receiver;
  22417. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aNewPackageName);
  22418. if(($receiver = $1) == null || $receiver.isNil){
  22419. $1;
  22420. } else {
  22421. $2=$recv("A package named ".__comma(aNewPackageName)).__comma(" already exists");
  22422. $ctx1.sendIdx[","]=1;
  22423. self._error_($2);
  22424. };
  22425. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  22426. return self;
  22427. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  22428. },
  22429. args: ["aPackageName", "aNewPackageName"],
  22430. 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",
  22431. referencedClasses: ["Smalltalk"],
  22432. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renamePackage:to:"]
  22433. }),
  22434. $globals.Environment);
  22435. $core.addMethod(
  22436. $core.method({
  22437. selector: "renameProtocol:to:in:",
  22438. protocol: 'actions',
  22439. fn: function (aString,anotherString,aClass){
  22440. var self=this;
  22441. return $core.withContext(function($ctx1) {
  22442. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  22443. return $core.withContext(function($ctx2) {
  22444. return $recv(each)._protocol_(anotherString);
  22445. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22446. }));
  22447. return self;
  22448. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  22449. },
  22450. args: ["aString", "anotherString", "aClass"],
  22451. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  22452. referencedClasses: [],
  22453. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  22454. }),
  22455. $globals.Environment);
  22456. $core.addMethod(
  22457. $core.method({
  22458. selector: "setClassCommentOf:to:",
  22459. protocol: 'actions',
  22460. fn: function (aClass,aString){
  22461. var self=this;
  22462. return $core.withContext(function($ctx1) {
  22463. $recv(aClass)._comment_(aString);
  22464. return self;
  22465. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  22466. },
  22467. args: ["aClass", "aString"],
  22468. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  22469. referencedClasses: [],
  22470. messageSends: ["comment:"]
  22471. }),
  22472. $globals.Environment);
  22473. $core.addMethod(
  22474. $core.method({
  22475. selector: "systemAnnouncer",
  22476. protocol: 'accessing',
  22477. fn: function (){
  22478. var self=this;
  22479. return $core.withContext(function($ctx1) {
  22480. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  22481. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  22482. },
  22483. args: [],
  22484. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  22485. referencedClasses: ["Smalltalk"],
  22486. messageSends: ["current", "at:", "globals"]
  22487. }),
  22488. $globals.Environment);
  22489. $core.addClass('NullProgressHandler', $globals.Object, [], 'Platform-Services');
  22490. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  22491. $core.addMethod(
  22492. $core.method({
  22493. selector: "do:on:displaying:",
  22494. protocol: 'progress handling',
  22495. fn: function (aBlock,aCollection,aString){
  22496. var self=this;
  22497. return $core.withContext(function($ctx1) {
  22498. $recv(aCollection)._do_(aBlock);
  22499. return self;
  22500. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  22501. },
  22502. args: ["aBlock", "aCollection", "aString"],
  22503. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  22504. referencedClasses: [],
  22505. messageSends: ["do:"]
  22506. }),
  22507. $globals.NullProgressHandler);
  22508. $globals.NullProgressHandler.klass.iVarNames = ['current'];
  22509. $core.addMethod(
  22510. $core.method({
  22511. selector: "initialize",
  22512. protocol: 'initialization',
  22513. fn: function (){
  22514. var self=this;
  22515. return $core.withContext(function($ctx1) {
  22516. $recv($globals.ProgressHandler)._registerIfNone_(self._new());
  22517. return self;
  22518. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.klass)});
  22519. },
  22520. args: [],
  22521. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  22522. referencedClasses: ["ProgressHandler"],
  22523. messageSends: ["registerIfNone:", "new"]
  22524. }),
  22525. $globals.NullProgressHandler.klass);
  22526. $core.addClass('PlatformInterface', $globals.Object, [], 'Platform-Services');
  22527. $globals.PlatformInterface.comment="Deprecated. Use `Platform` or `Terminal`.";
  22528. $core.addMethod(
  22529. $core.method({
  22530. selector: "ajax:",
  22531. protocol: 'actions',
  22532. fn: function (anObject){
  22533. var self=this;
  22534. return $core.withContext(function($ctx1) {
  22535. var $receiver;
  22536. self._deprecatedAPI_("Use Platform newXhr or dedicated library.");
  22537. if(($receiver = $globals.JQuery) == null || $receiver.isNil){
  22538. return self._error_("JQuery wrapper not loaded, cannot do AJAX.");
  22539. } else {
  22540. return $recv($recv($globals.JQuery)._current())._ajax_(anObject);
  22541. };
  22542. }, function($ctx1) {$ctx1.fill(self,"ajax:",{anObject:anObject},$globals.PlatformInterface.klass)});
  22543. },
  22544. args: ["anObject"],
  22545. source: "ajax: anObject\x0a\x09self deprecatedAPI: 'Use Platform newXhr or dedicated library.'.\x0a\x09^ JQuery\x0a\x09\x09ifNotNil: [ JQuery current ajax: anObject ]\x0a\x09\x09ifNil: [ self error: 'JQuery wrapper not loaded, cannot do AJAX.' ]",
  22546. referencedClasses: ["JQuery"],
  22547. messageSends: ["deprecatedAPI:", "ifNotNil:ifNil:", "ajax:", "current", "error:"]
  22548. }),
  22549. $globals.PlatformInterface.klass);
  22550. $core.addMethod(
  22551. $core.method({
  22552. selector: "alert:",
  22553. protocol: 'actions',
  22554. fn: function (aString){
  22555. var self=this;
  22556. return $core.withContext(function($ctx1) {
  22557. self._deprecatedAPI_("Use Terminal alert:");
  22558. return $recv($globals.Terminal)._alert_(aString);
  22559. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.PlatformInterface.klass)});
  22560. },
  22561. args: ["aString"],
  22562. source: "alert: aString\x0a\x09self deprecatedAPI: 'Use Terminal alert:'.\x0a\x09^ Terminal alert: aString",
  22563. referencedClasses: ["Terminal"],
  22564. messageSends: ["deprecatedAPI:", "alert:"]
  22565. }),
  22566. $globals.PlatformInterface.klass);
  22567. $core.addMethod(
  22568. $core.method({
  22569. selector: "confirm:",
  22570. protocol: 'actions',
  22571. fn: function (aString){
  22572. var self=this;
  22573. return $core.withContext(function($ctx1) {
  22574. self._deprecatedAPI_("Use Terminal confirm:");
  22575. return $recv($globals.Terminal)._confirm_(aString);
  22576. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.PlatformInterface.klass)});
  22577. },
  22578. args: ["aString"],
  22579. source: "confirm: aString\x0a\x09self deprecatedAPI: 'Use Terminal confirm:'.\x0a\x09^ Terminal confirm: aString",
  22580. referencedClasses: ["Terminal"],
  22581. messageSends: ["deprecatedAPI:", "confirm:"]
  22582. }),
  22583. $globals.PlatformInterface.klass);
  22584. $core.addMethod(
  22585. $core.method({
  22586. selector: "existsGlobal:",
  22587. protocol: 'actions',
  22588. fn: function (aString){
  22589. var self=this;
  22590. return $core.withContext(function($ctx1) {
  22591. self._deprecatedAPI_("Use Smalltalk existsJsGlobal:");
  22592. return $recv($recv($globals.PlatformInterface)._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  22593. return true;
  22594. }),(function(){
  22595. return false;
  22596. }));
  22597. }, function($ctx1) {$ctx1.fill(self,"existsGlobal:",{aString:aString},$globals.PlatformInterface.klass)});
  22598. },
  22599. args: ["aString"],
  22600. source: "existsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Smalltalk existsJsGlobal:'.\x0a\x09^ PlatformInterface globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  22601. referencedClasses: ["PlatformInterface"],
  22602. messageSends: ["deprecatedAPI:", "at:ifPresent:ifAbsent:", "globals"]
  22603. }),
  22604. $globals.PlatformInterface.klass);
  22605. $core.addMethod(
  22606. $core.method({
  22607. selector: "globals",
  22608. protocol: 'accessing',
  22609. fn: function (){
  22610. var self=this;
  22611. return $core.withContext(function($ctx1) {
  22612. self._deprecatedAPI_("Use Platform globals");
  22613. return $recv($globals.Platform)._globals();
  22614. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.PlatformInterface.klass)});
  22615. },
  22616. args: [],
  22617. source: "globals\x0a\x09self deprecatedAPI: 'Use Platform globals'.\x0a\x09^ Platform globals",
  22618. referencedClasses: ["Platform"],
  22619. messageSends: ["deprecatedAPI:", "globals"]
  22620. }),
  22621. $globals.PlatformInterface.klass);
  22622. $core.addMethod(
  22623. $core.method({
  22624. selector: "newXhr",
  22625. protocol: 'actions',
  22626. fn: function (){
  22627. var self=this;
  22628. return $core.withContext(function($ctx1) {
  22629. self._deprecatedAPI_("Use Platform newXhr");
  22630. return $recv($globals.Platform)._newXhr();
  22631. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.PlatformInterface.klass)});
  22632. },
  22633. args: [],
  22634. source: "newXhr\x0a\x09self deprecatedAPI: 'Use Platform newXhr'.\x0a\x09^ Platform newXhr",
  22635. referencedClasses: ["Platform"],
  22636. messageSends: ["deprecatedAPI:", "newXhr"]
  22637. }),
  22638. $globals.PlatformInterface.klass);
  22639. $core.addMethod(
  22640. $core.method({
  22641. selector: "prompt:",
  22642. protocol: 'actions',
  22643. fn: function (aString){
  22644. var self=this;
  22645. return $core.withContext(function($ctx1) {
  22646. self._deprecatedAPI_("Use Terminal prompt:");
  22647. return $recv($globals.Terminal)._prompt_(aString);
  22648. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.PlatformInterface.klass)});
  22649. },
  22650. args: ["aString"],
  22651. source: "prompt: aString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:'.\x0a\x09^ Terminal prompt: aString",
  22652. referencedClasses: ["Terminal"],
  22653. messageSends: ["deprecatedAPI:", "prompt:"]
  22654. }),
  22655. $globals.PlatformInterface.klass);
  22656. $core.addMethod(
  22657. $core.method({
  22658. selector: "prompt:default:",
  22659. protocol: 'actions',
  22660. fn: function (aString,defaultString){
  22661. var self=this;
  22662. return $core.withContext(function($ctx1) {
  22663. self._deprecatedAPI_("Use Terminal prompt:default:");
  22664. return $recv($globals.Terminal)._prompt_default_(aString,defaultString);
  22665. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.PlatformInterface.klass)});
  22666. },
  22667. args: ["aString", "defaultString"],
  22668. source: "prompt: aString default: defaultString\x0a\x09self deprecatedAPI: 'Use Terminal prompt:default:'.\x0a\x09^ Terminal prompt: aString default: defaultString",
  22669. referencedClasses: ["Terminal"],
  22670. messageSends: ["deprecatedAPI:", "prompt:default:"]
  22671. }),
  22672. $globals.PlatformInterface.klass);
  22673. $core.addClass('Service', $globals.Object, [], 'Platform-Services');
  22674. $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.";
  22675. $globals.Service.klass.iVarNames = ['current'];
  22676. $core.addMethod(
  22677. $core.method({
  22678. selector: "current",
  22679. protocol: 'accessing',
  22680. fn: function (){
  22681. var self=this;
  22682. return self["@current"];
  22683. },
  22684. args: [],
  22685. source: "current\x0a\x09^ current",
  22686. referencedClasses: [],
  22687. messageSends: []
  22688. }),
  22689. $globals.Service.klass);
  22690. $core.addMethod(
  22691. $core.method({
  22692. selector: "new",
  22693. protocol: 'instance creation',
  22694. fn: function (){
  22695. var self=this;
  22696. return $core.withContext(function($ctx1) {
  22697. self._shouldNotImplement();
  22698. return self;
  22699. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.klass)});
  22700. },
  22701. args: [],
  22702. source: "new\x0a\x09self shouldNotImplement",
  22703. referencedClasses: [],
  22704. messageSends: ["shouldNotImplement"]
  22705. }),
  22706. $globals.Service.klass);
  22707. $core.addMethod(
  22708. $core.method({
  22709. selector: "register:",
  22710. protocol: 'registration',
  22711. fn: function (anObject){
  22712. var self=this;
  22713. self["@current"]=anObject;
  22714. return self;
  22715. },
  22716. args: ["anObject"],
  22717. source: "register: anObject\x0a\x09current := anObject",
  22718. referencedClasses: [],
  22719. messageSends: []
  22720. }),
  22721. $globals.Service.klass);
  22722. $core.addMethod(
  22723. $core.method({
  22724. selector: "registerIfNone:",
  22725. protocol: 'registration',
  22726. fn: function (anObject){
  22727. var self=this;
  22728. return $core.withContext(function($ctx1) {
  22729. var $1,$receiver;
  22730. $1=self._current();
  22731. if(($receiver = $1) == null || $receiver.isNil){
  22732. self._register_(anObject);
  22733. } else {
  22734. $1;
  22735. };
  22736. return self;
  22737. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.klass)});
  22738. },
  22739. args: ["anObject"],
  22740. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  22741. referencedClasses: [],
  22742. messageSends: ["ifNil:", "current", "register:"]
  22743. }),
  22744. $globals.Service.klass);
  22745. $core.addClass('ErrorHandler', $globals.Service, [], 'Platform-Services');
  22746. $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.";
  22747. $core.addMethod(
  22748. $core.method({
  22749. selector: "handleError:",
  22750. protocol: 'error handling',
  22751. fn: function (anError){
  22752. var self=this;
  22753. return $core.withContext(function($ctx1) {
  22754. self._handleUnhandledError_(anError);
  22755. return self;
  22756. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.klass)});
  22757. },
  22758. args: ["anError"],
  22759. source: "handleError: anError\x0a\x09self handleUnhandledError: anError",
  22760. referencedClasses: [],
  22761. messageSends: ["handleUnhandledError:"]
  22762. }),
  22763. $globals.ErrorHandler.klass);
  22764. $core.addMethod(
  22765. $core.method({
  22766. selector: "handleUnhandledError:",
  22767. protocol: 'error handling',
  22768. fn: function (anError){
  22769. var self=this;
  22770. return $core.withContext(function($ctx1) {
  22771. var $1;
  22772. $1=$recv(anError)._wasHandled();
  22773. if($core.assert($1)){
  22774. return self;
  22775. };
  22776. return $recv(self._current())._handleError_(anError);
  22777. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.klass)});
  22778. },
  22779. args: ["anError"],
  22780. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifTrue: [ ^ self ].\x0a\x09\x0a\x09^ self current handleError: anError",
  22781. referencedClasses: [],
  22782. messageSends: ["ifTrue:", "wasHandled", "handleError:", "current"]
  22783. }),
  22784. $globals.ErrorHandler.klass);
  22785. $core.addClass('Finder', $globals.Service, [], 'Platform-Services');
  22786. $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.";
  22787. $core.addMethod(
  22788. $core.method({
  22789. selector: "findClass:",
  22790. protocol: 'finding',
  22791. fn: function (aClass){
  22792. var self=this;
  22793. return $core.withContext(function($ctx1) {
  22794. return $recv(self._current())._findClass_(aClass);
  22795. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.klass)});
  22796. },
  22797. args: ["aClass"],
  22798. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  22799. referencedClasses: [],
  22800. messageSends: ["findClass:", "current"]
  22801. }),
  22802. $globals.Finder.klass);
  22803. $core.addMethod(
  22804. $core.method({
  22805. selector: "findMethod:",
  22806. protocol: 'finding',
  22807. fn: function (aCompiledMethod){
  22808. var self=this;
  22809. return $core.withContext(function($ctx1) {
  22810. return $recv(self._current())._findMethod_(aCompiledMethod);
  22811. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.klass)});
  22812. },
  22813. args: ["aCompiledMethod"],
  22814. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  22815. referencedClasses: [],
  22816. messageSends: ["findMethod:", "current"]
  22817. }),
  22818. $globals.Finder.klass);
  22819. $core.addMethod(
  22820. $core.method({
  22821. selector: "findString:",
  22822. protocol: 'finding',
  22823. fn: function (aString){
  22824. var self=this;
  22825. return $core.withContext(function($ctx1) {
  22826. return $recv(self._current())._findString_(aString);
  22827. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.klass)});
  22828. },
  22829. args: ["aString"],
  22830. source: "findString: aString\x0a\x09^ self current findString: aString",
  22831. referencedClasses: [],
  22832. messageSends: ["findString:", "current"]
  22833. }),
  22834. $globals.Finder.klass);
  22835. $core.addClass('Inspector', $globals.Service, [], 'Platform-Services');
  22836. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  22837. $core.addMethod(
  22838. $core.method({
  22839. selector: "inspect:",
  22840. protocol: 'inspecting',
  22841. fn: function (anObject){
  22842. var self=this;
  22843. return $core.withContext(function($ctx1) {
  22844. return $recv(self._current())._inspect_(anObject);
  22845. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.klass)});
  22846. },
  22847. args: ["anObject"],
  22848. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  22849. referencedClasses: [],
  22850. messageSends: ["inspect:", "current"]
  22851. }),
  22852. $globals.Inspector.klass);
  22853. $core.addClass('Platform', $globals.Service, [], 'Platform-Services');
  22854. $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";
  22855. $core.addMethod(
  22856. $core.method({
  22857. selector: "globals",
  22858. protocol: 'accessing',
  22859. fn: function (){
  22860. var self=this;
  22861. return $core.withContext(function($ctx1) {
  22862. return $recv(self._current())._globals();
  22863. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.klass)});
  22864. },
  22865. args: [],
  22866. source: "globals\x0a\x09^ self current globals",
  22867. referencedClasses: [],
  22868. messageSends: ["globals", "current"]
  22869. }),
  22870. $globals.Platform.klass);
  22871. $core.addMethod(
  22872. $core.method({
  22873. selector: "newXhr",
  22874. protocol: 'accessing',
  22875. fn: function (){
  22876. var self=this;
  22877. return $core.withContext(function($ctx1) {
  22878. return $recv(self._current())._newXhr();
  22879. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.klass)});
  22880. },
  22881. args: [],
  22882. source: "newXhr\x0a\x09^ self current newXhr",
  22883. referencedClasses: [],
  22884. messageSends: ["newXhr", "current"]
  22885. }),
  22886. $globals.Platform.klass);
  22887. $core.addClass('ProgressHandler', $globals.Service, [], 'Platform-Services');
  22888. $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`.";
  22889. $core.addMethod(
  22890. $core.method({
  22891. selector: "do:on:displaying:",
  22892. protocol: 'progress handling',
  22893. fn: function (aBlock,aCollection,aString){
  22894. var self=this;
  22895. return $core.withContext(function($ctx1) {
  22896. $recv(self._current())._do_on_displaying_(aBlock,aCollection,aString);
  22897. return self;
  22898. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.klass)});
  22899. },
  22900. args: ["aBlock", "aCollection", "aString"],
  22901. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  22902. referencedClasses: [],
  22903. messageSends: ["do:on:displaying:", "current"]
  22904. }),
  22905. $globals.ProgressHandler.klass);
  22906. $core.addClass('Terminal', $globals.Service, [], 'Platform-Services');
  22907. $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:'.";
  22908. $core.addMethod(
  22909. $core.method({
  22910. selector: "alert:",
  22911. protocol: 'dialogs',
  22912. fn: function (aString){
  22913. var self=this;
  22914. return $core.withContext(function($ctx1) {
  22915. return $recv(self._current())._alert_(aString);
  22916. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.klass)});
  22917. },
  22918. args: ["aString"],
  22919. source: "alert: aString\x0a\x09^ self current alert: aString",
  22920. referencedClasses: [],
  22921. messageSends: ["alert:", "current"]
  22922. }),
  22923. $globals.Terminal.klass);
  22924. $core.addMethod(
  22925. $core.method({
  22926. selector: "confirm:",
  22927. protocol: 'dialogs',
  22928. fn: function (aString){
  22929. var self=this;
  22930. return $core.withContext(function($ctx1) {
  22931. return $recv(self._current())._confirm_(aString);
  22932. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.klass)});
  22933. },
  22934. args: ["aString"],
  22935. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  22936. referencedClasses: [],
  22937. messageSends: ["confirm:", "current"]
  22938. }),
  22939. $globals.Terminal.klass);
  22940. $core.addMethod(
  22941. $core.method({
  22942. selector: "prompt:",
  22943. protocol: 'dialogs',
  22944. fn: function (aString){
  22945. var self=this;
  22946. return $core.withContext(function($ctx1) {
  22947. return $recv(self._current())._prompt_(aString);
  22948. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.klass)});
  22949. },
  22950. args: ["aString"],
  22951. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  22952. referencedClasses: [],
  22953. messageSends: ["prompt:", "current"]
  22954. }),
  22955. $globals.Terminal.klass);
  22956. $core.addMethod(
  22957. $core.method({
  22958. selector: "prompt:default:",
  22959. protocol: 'dialogs',
  22960. fn: function (aString,defaultString){
  22961. var self=this;
  22962. return $core.withContext(function($ctx1) {
  22963. return $recv(self._current())._prompt_default_(aString,defaultString);
  22964. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.klass)});
  22965. },
  22966. args: ["aString", "defaultString"],
  22967. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  22968. referencedClasses: [],
  22969. messageSends: ["prompt:default:", "current"]
  22970. }),
  22971. $globals.Terminal.klass);
  22972. $core.addClass('Transcript', $globals.Service, [], 'Platform-Services');
  22973. $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.";
  22974. $core.addMethod(
  22975. $core.method({
  22976. selector: "clear",
  22977. protocol: 'printing',
  22978. fn: function (){
  22979. var self=this;
  22980. return $core.withContext(function($ctx1) {
  22981. $recv(self._current())._clear();
  22982. return self;
  22983. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.klass)});
  22984. },
  22985. args: [],
  22986. source: "clear\x0a\x09self current clear",
  22987. referencedClasses: [],
  22988. messageSends: ["clear", "current"]
  22989. }),
  22990. $globals.Transcript.klass);
  22991. $core.addMethod(
  22992. $core.method({
  22993. selector: "cr",
  22994. protocol: 'printing',
  22995. fn: function (){
  22996. var self=this;
  22997. return $core.withContext(function($ctx1) {
  22998. $recv(self._current())._show_($recv($globals.String)._cr());
  22999. return self;
  23000. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.klass)});
  23001. },
  23002. args: [],
  23003. source: "cr\x0a\x09self current show: String cr",
  23004. referencedClasses: ["String"],
  23005. messageSends: ["show:", "current", "cr"]
  23006. }),
  23007. $globals.Transcript.klass);
  23008. $core.addMethod(
  23009. $core.method({
  23010. selector: "inspect:",
  23011. protocol: 'printing',
  23012. fn: function (anObject){
  23013. var self=this;
  23014. return $core.withContext(function($ctx1) {
  23015. self._show_(anObject);
  23016. return self;
  23017. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.klass)});
  23018. },
  23019. args: ["anObject"],
  23020. source: "inspect: anObject\x0a\x09self show: anObject",
  23021. referencedClasses: [],
  23022. messageSends: ["show:"]
  23023. }),
  23024. $globals.Transcript.klass);
  23025. $core.addMethod(
  23026. $core.method({
  23027. selector: "open",
  23028. protocol: 'instance creation',
  23029. fn: function (){
  23030. var self=this;
  23031. return $core.withContext(function($ctx1) {
  23032. $recv(self._current())._open();
  23033. return self;
  23034. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.klass)});
  23035. },
  23036. args: [],
  23037. source: "open\x0a\x09self current open",
  23038. referencedClasses: [],
  23039. messageSends: ["open", "current"]
  23040. }),
  23041. $globals.Transcript.klass);
  23042. $core.addMethod(
  23043. $core.method({
  23044. selector: "show:",
  23045. protocol: 'printing',
  23046. fn: function (anObject){
  23047. var self=this;
  23048. return $core.withContext(function($ctx1) {
  23049. $recv(self._current())._show_(anObject);
  23050. return self;
  23051. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.klass)});
  23052. },
  23053. args: ["anObject"],
  23054. source: "show: anObject\x0a\x09self current show: anObject",
  23055. referencedClasses: [],
  23056. messageSends: ["show:", "current"]
  23057. }),
  23058. $globals.Transcript.klass);
  23059. $core.addMethod(
  23060. $core.method({
  23061. selector: "inspectOn:",
  23062. protocol: '*Platform-Services',
  23063. fn: function (anInspector){
  23064. var self=this;
  23065. var variables;
  23066. return $core.withContext(function($ctx1) {
  23067. variables=$recv($globals.Dictionary)._new();
  23068. $recv(variables)._at_put_("#self",self);
  23069. $ctx1.sendIdx["at:put:"]=1;
  23070. $recv(variables)._at_put_("#keys",self._keys());
  23071. $ctx1.sendIdx["at:put:"]=2;
  23072. self._keysAndValuesDo_((function(key,value){
  23073. return $core.withContext(function($ctx2) {
  23074. return $recv(variables)._at_put_(key,value);
  23075. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23076. }));
  23077. $recv(anInspector)._setLabel_(self._printString());
  23078. $recv(anInspector)._setVariables_(variables);
  23079. return self;
  23080. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  23081. },
  23082. args: ["anInspector"],
  23083. 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",
  23084. referencedClasses: ["Dictionary"],
  23085. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  23086. }),
  23087. $globals.AssociativeCollection);
  23088. $core.addMethod(
  23089. $core.method({
  23090. selector: "inspectOn:",
  23091. protocol: '*Platform-Services',
  23092. fn: function (anInspector){
  23093. var self=this;
  23094. var variables;
  23095. return $core.withContext(function($ctx1) {
  23096. variables=$recv($globals.Dictionary)._new();
  23097. $recv(variables)._at_put_("#self",self);
  23098. $ctx1.sendIdx["at:put:"]=1;
  23099. self._withIndexDo_((function(each,i){
  23100. return $core.withContext(function($ctx2) {
  23101. return $recv(variables)._at_put_(i,each);
  23102. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  23103. }));
  23104. $recv(anInspector)._setLabel_(self._printString());
  23105. $recv(anInspector)._setVariables_(variables);
  23106. return self;
  23107. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  23108. },
  23109. args: ["anInspector"],
  23110. 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",
  23111. referencedClasses: ["Dictionary"],
  23112. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  23113. }),
  23114. $globals.Collection);
  23115. $core.addMethod(
  23116. $core.method({
  23117. selector: "inspectOn:",
  23118. protocol: '*Platform-Services',
  23119. fn: function (anInspector){
  23120. var self=this;
  23121. var variables;
  23122. return $core.withContext(function($ctx1) {
  23123. variables=$recv($globals.Dictionary)._new();
  23124. $recv(variables)._at_put_("#self",self);
  23125. $ctx1.sendIdx["at:put:"]=1;
  23126. $recv(variables)._at_put_("#year",self._year());
  23127. $ctx1.sendIdx["at:put:"]=2;
  23128. $recv(variables)._at_put_("#month",self._month());
  23129. $ctx1.sendIdx["at:put:"]=3;
  23130. $recv(variables)._at_put_("#day",self._day());
  23131. $ctx1.sendIdx["at:put:"]=4;
  23132. $recv(variables)._at_put_("#hours",self._hours());
  23133. $ctx1.sendIdx["at:put:"]=5;
  23134. $recv(variables)._at_put_("#minutes",self._minutes());
  23135. $ctx1.sendIdx["at:put:"]=6;
  23136. $recv(variables)._at_put_("#seconds",self._seconds());
  23137. $ctx1.sendIdx["at:put:"]=7;
  23138. $recv(variables)._at_put_("#milliseconds",self._milliseconds());
  23139. $recv(anInspector)._setLabel_(self._printString());
  23140. $recv(anInspector)._setVariables_(variables);
  23141. return self;
  23142. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  23143. },
  23144. args: ["anInspector"],
  23145. 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",
  23146. referencedClasses: ["Dictionary"],
  23147. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  23148. }),
  23149. $globals.Date);
  23150. $core.addMethod(
  23151. $core.method({
  23152. selector: "inspectOn:",
  23153. protocol: '*Platform-Services',
  23154. fn: function (anInspector){
  23155. var self=this;
  23156. var variables;
  23157. return $core.withContext(function($ctx1) {
  23158. variables=$recv($globals.Dictionary)._new();
  23159. $recv(variables)._at_put_("#self",self._jsObject());
  23160. $recv(anInspector)._setLabel_(self._printString());
  23161. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  23162. $recv(anInspector)._setVariables_(variables);
  23163. return self;
  23164. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  23165. },
  23166. args: ["anInspector"],
  23167. 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",
  23168. referencedClasses: ["Dictionary", "JSObjectProxy"],
  23169. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  23170. }),
  23171. $globals.JSObjectProxy);
  23172. $core.addMethod(
  23173. $core.method({
  23174. selector: "inspectOn:",
  23175. protocol: '*Platform-Services',
  23176. fn: function (anInspector){
  23177. var self=this;
  23178. var variables;
  23179. return $core.withContext(function($ctx1) {
  23180. variables=$recv($globals.Dictionary)._new();
  23181. $recv(variables)._at_put_("#self",self);
  23182. $ctx1.sendIdx["at:put:"]=1;
  23183. $recv(variables)._at_put_("#home",self._home());
  23184. $ctx1.sendIdx["at:put:"]=2;
  23185. $recv(variables)._at_put_("#receiver",self._receiver());
  23186. $ctx1.sendIdx["at:put:"]=3;
  23187. $recv(variables)._at_put_("#selector",self._selector());
  23188. $ctx1.sendIdx["at:put:"]=4;
  23189. $recv(variables)._at_put_("#locals",self._locals());
  23190. $ctx1.sendIdx["at:put:"]=5;
  23191. $recv($recv(self._class())._instanceVariableNames())._do_((function(each){
  23192. return $core.withContext(function($ctx2) {
  23193. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23194. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23195. }));
  23196. $recv(anInspector)._setLabel_(self._printString());
  23197. $recv(anInspector)._setVariables_(variables);
  23198. return self;
  23199. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  23200. },
  23201. args: ["anInspector"],
  23202. 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",
  23203. referencedClasses: ["Dictionary"],
  23204. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23205. }),
  23206. $globals.MethodContext);
  23207. $core.addMethod(
  23208. $core.method({
  23209. selector: "inspectOn:",
  23210. protocol: '*Platform-Services',
  23211. fn: function (anInspector){
  23212. var self=this;
  23213. var variables;
  23214. return $core.withContext(function($ctx1) {
  23215. variables=$recv($globals.Dictionary)._new();
  23216. $recv(variables)._at_put_("#self",self);
  23217. $ctx1.sendIdx["at:put:"]=1;
  23218. $recv($recv(self._class())._allInstanceVariableNames())._do_((function(each){
  23219. return $core.withContext(function($ctx2) {
  23220. return $recv(variables)._at_put_(each,self._instVarAt_(each));
  23221. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23222. }));
  23223. $recv(anInspector)._setLabel_(self._printString());
  23224. $recv(anInspector)._setVariables_(variables);
  23225. return self;
  23226. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  23227. },
  23228. args: ["anInspector"],
  23229. 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",
  23230. referencedClasses: ["Dictionary"],
  23231. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  23232. }),
  23233. $globals.Object);
  23234. $core.addMethod(
  23235. $core.method({
  23236. selector: "do:displayingProgress:",
  23237. protocol: '*Platform-Services',
  23238. fn: function (aBlock,aString){
  23239. var self=this;
  23240. return $core.withContext(function($ctx1) {
  23241. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  23242. return self;
  23243. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  23244. },
  23245. args: ["aBlock", "aString"],
  23246. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  23247. referencedClasses: ["ProgressHandler"],
  23248. messageSends: ["do:on:displaying:"]
  23249. }),
  23250. $globals.SequenceableCollection);
  23251. $core.addMethod(
  23252. $core.method({
  23253. selector: "inspectOn:",
  23254. protocol: '*Platform-Services',
  23255. fn: function (anInspector){
  23256. var self=this;
  23257. var variables,i;
  23258. return $core.withContext(function($ctx1) {
  23259. variables=$recv($globals.Dictionary)._new();
  23260. $recv(variables)._at_put_("#self",self);
  23261. $ctx1.sendIdx["at:put:"]=1;
  23262. i=(1);
  23263. self._do_((function(each){
  23264. return $core.withContext(function($ctx2) {
  23265. $recv(variables)._at_put_(i,each);
  23266. i=$recv(i).__plus((1));
  23267. return i;
  23268. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23269. }));
  23270. $recv(anInspector)._setLabel_(self._printString());
  23271. $recv(anInspector)._setVariables_(variables);
  23272. return self;
  23273. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  23274. },
  23275. args: ["anInspector"],
  23276. 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",
  23277. referencedClasses: ["Dictionary"],
  23278. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  23279. }),
  23280. $globals.Set);
  23281. $core.addMethod(
  23282. $core.method({
  23283. selector: "inspectOn:",
  23284. protocol: '*Platform-Services',
  23285. fn: function (anInspector){
  23286. var self=this;
  23287. var label;
  23288. return $core.withContext(function($ctx1) {
  23289. var $3,$2,$1,$5,$4;
  23290. (
  23291. $ctx1.supercall = true,
  23292. ($globals.String.superclass||$boot.dnu).fn.prototype._inspectOn_.apply($recv(self), [anInspector]));
  23293. $ctx1.supercall = false;
  23294. $3=self._printString();
  23295. $ctx1.sendIdx["printString"]=1;
  23296. $2=$recv($3)._size();
  23297. $1=$recv($2).__gt((30));
  23298. if($core.assert($1)){
  23299. $5=self._printString();
  23300. $ctx1.sendIdx["printString"]=2;
  23301. $4=$recv($5)._copyFrom_to_((1),(30));
  23302. label=$recv($4).__comma("...'");
  23303. label;
  23304. } else {
  23305. label=self._printString();
  23306. label;
  23307. };
  23308. $recv(anInspector)._setLabel_(label);
  23309. return self;
  23310. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  23311. },
  23312. args: ["anInspector"],
  23313. 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",
  23314. referencedClasses: [],
  23315. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  23316. }),
  23317. $globals.String);
  23318. });
  23319. define("amber_core/Platform-Node", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  23320. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  23321. $core.addPackage('Platform-Node');
  23322. $core.packages["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  23323. $core.packages["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  23324. $core.addClass('NodePlatform', $globals.Object, [], 'Platform-Node');
  23325. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  23326. $core.addMethod(
  23327. $core.method({
  23328. selector: "globals",
  23329. protocol: 'accessing',
  23330. fn: function (){
  23331. var self=this;
  23332. return global;
  23333. },
  23334. args: [],
  23335. source: "globals\x0a\x09^ global",
  23336. referencedClasses: [],
  23337. messageSends: []
  23338. }),
  23339. $globals.NodePlatform);
  23340. $core.addMethod(
  23341. $core.method({
  23342. selector: "newXhr",
  23343. protocol: 'accessing',
  23344. fn: function (){
  23345. var self=this;
  23346. return $core.withContext(function($ctx1) {
  23347. var $receiver;
  23348. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.isNil){
  23349. self._error_("XMLHttpRequest not available.");
  23350. } else {
  23351. return $recv($globals.XMLHttpRequest)._new();
  23352. };
  23353. return self;
  23354. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  23355. },
  23356. args: [],
  23357. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  23358. referencedClasses: ["XMLHttpRequest"],
  23359. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  23360. }),
  23361. $globals.NodePlatform);
  23362. $core.addMethod(
  23363. $core.method({
  23364. selector: "initialize",
  23365. protocol: 'testing',
  23366. fn: function (){
  23367. var self=this;
  23368. return $core.withContext(function($ctx1) {
  23369. var $1;
  23370. $1=self._isFeasible();
  23371. if($core.assert($1)){
  23372. $recv($globals.Platform)._registerIfNone_(self._new());
  23373. };
  23374. return self;
  23375. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.klass)});
  23376. },
  23377. args: [],
  23378. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  23379. referencedClasses: ["Platform"],
  23380. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  23381. }),
  23382. $globals.NodePlatform.klass);
  23383. $core.addMethod(
  23384. $core.method({
  23385. selector: "isFeasible",
  23386. protocol: 'testing',
  23387. fn: function (){
  23388. var self=this;
  23389. return $core.withContext(function($ctx1) {
  23390. return typeof global !== "undefined";
  23391. return self;
  23392. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.klass)});
  23393. },
  23394. args: [],
  23395. source: "isFeasible\x0a<return typeof global !== \x22undefined\x22>",
  23396. referencedClasses: [],
  23397. messageSends: []
  23398. }),
  23399. $globals.NodePlatform.klass);
  23400. });
  23401. define('amber/deploy',[
  23402. './helpers',
  23403. // --- packages of the core Amber begin here ---
  23404. 'amber_core/Kernel-Objects',
  23405. 'amber_core/Kernel-Classes',
  23406. 'amber_core/Kernel-Methods',
  23407. 'amber_core/Kernel-Collections',
  23408. 'amber_core/Kernel-Infrastructure',
  23409. 'amber_core/Kernel-Exceptions',
  23410. 'amber_core/Kernel-Announcements',
  23411. 'amber_core/Platform-Services',
  23412. 'amber/Platform'
  23413. // --- packages of the core Amber end here ---
  23414. ], function (amber) { return amber; });
  23415. define('amber/parser',['./boot'], function($boot) {
  23416. var $globals = $boot.globals, nil = $boot.nil;
  23417. $globals.SmalltalkParser = (function() {
  23418. "use strict";
  23419. /*
  23420. * Generated by PEG.js 0.9.0.
  23421. *
  23422. * http://pegjs.org/
  23423. */
  23424. function peg$subclass(child, parent) {
  23425. function ctor() { this.constructor = child; }
  23426. ctor.prototype = parent.prototype;
  23427. child.prototype = new ctor();
  23428. }
  23429. function peg$SyntaxError(message, expected, found, location) {
  23430. this.message = message;
  23431. this.expected = expected;
  23432. this.found = found;
  23433. this.location = location;
  23434. this.name = "SyntaxError";
  23435. if (typeof Error.captureStackTrace === "function") {
  23436. Error.captureStackTrace(this, peg$SyntaxError);
  23437. }
  23438. }
  23439. peg$subclass(peg$SyntaxError, Error);
  23440. function peg$parse(input) {
  23441. var options = arguments.length > 1 ? arguments[1] : {},
  23442. parser = this,
  23443. peg$FAILED = {},
  23444. peg$startRuleFunctions = { start: peg$parsestart },
  23445. peg$startRuleFunction = peg$parsestart,
  23446. peg$c0 = /^[ \t\x0B\f\xA0\uFEFF\n\r\u2028\u2029]/,
  23447. peg$c1 = { type: "class", value: "[ \\t\\v\\f\\u00A0\\uFEFF\\n\\r\\u2028\\u2029]", description: "[ \\t\\v\\f\\u00A0\\uFEFF\\n\\r\\u2028\\u2029]" },
  23448. peg$c2 = "\"",
  23449. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  23450. peg$c4 = /^[^"]/,
  23451. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  23452. peg$c6 = ".",
  23453. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  23454. peg$c8 = /^[a-zA-Z]/,
  23455. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  23456. peg$c10 = /^[a-zA-Z0-9]/,
  23457. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  23458. peg$c12 = function(first, others) {return first + others.join("");},
  23459. peg$c13 = ":",
  23460. peg$c14 = { type: "literal", value: ":", description: "\":\"" },
  23461. peg$c15 = function(first, last) {return first + last;},
  23462. peg$c16 = /^[a-zA-Z0-9:]/,
  23463. peg$c17 = { type: "class", value: "[a-zA-Z0-9\\:]", description: "[a-zA-Z0-9\\:]" },
  23464. peg$c18 = /^[A-Z]/,
  23465. peg$c19 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  23466. peg$c20 = "'",
  23467. peg$c21 = { type: "literal", value: "'", description: "\"'\"" },
  23468. peg$c22 = "''",
  23469. peg$c23 = { type: "literal", value: "''", description: "\"''\"" },
  23470. peg$c24 = function() {return "'";},
  23471. peg$c25 = /^[^']/,
  23472. peg$c26 = { type: "class", value: "[^']", description: "[^']" },
  23473. peg$c27 = function(val) {
  23474. return $globals.ValueNode._new()
  23475. ._location_(location())
  23476. ._source_(text())
  23477. ._value_(val.join(""));
  23478. },
  23479. peg$c28 = "$",
  23480. peg$c29 = { type: "literal", value: "$", description: "\"$\"" },
  23481. peg$c30 = { type: "any", description: "any character" },
  23482. peg$c31 = function(char) {
  23483. return $globals.ValueNode._new()
  23484. ._location_(location())
  23485. ._source_(text())
  23486. ._value_(char);
  23487. },
  23488. peg$c32 = "#",
  23489. peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
  23490. peg$c34 = function(rest) {return rest;},
  23491. peg$c35 = function(node) {return node._value();},
  23492. peg$c36 = function(val) {
  23493. return $globals.ValueNode._new()
  23494. ._location_(location())
  23495. ._source_(text())
  23496. ._value_(val);
  23497. },
  23498. peg$c37 = function(n) {
  23499. return $globals.ValueNode._new()
  23500. ._location_(location())
  23501. ._source_(text())
  23502. ._value_(n);
  23503. },
  23504. peg$c38 = "e",
  23505. peg$c39 = { type: "literal", value: "e", description: "\"e\"" },
  23506. peg$c40 = function(n) {return parseFloat(n.join(""));},
  23507. peg$c41 = "-",
  23508. peg$c42 = { type: "literal", value: "-", description: "\"-\"" },
  23509. peg$c43 = "16r",
  23510. peg$c44 = { type: "literal", value: "16r", description: "\"16r\"" },
  23511. peg$c45 = /^[0-9a-fA-F]/,
  23512. peg$c46 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  23513. peg$c47 = function(neg, num) {return parseInt(((neg || '') + num.join("")), 16);},
  23514. peg$c48 = /^[0-9]/,
  23515. peg$c49 = { type: "class", value: "[0-9]", description: "[0-9]" },
  23516. peg$c50 = function(neg, digits, dec) {return parseFloat(((neg || '') + digits.join("") + "." + dec.join("")), 10);},
  23517. peg$c51 = function(neg, digits) {return (parseInt((neg || '') + digits.join(""), 10));},
  23518. peg$c52 = "#(",
  23519. peg$c53 = { type: "literal", value: "#(", description: "\"#(\"" },
  23520. peg$c54 = ")",
  23521. peg$c55 = { type: "literal", value: ")", description: "\")\"" },
  23522. peg$c56 = function(rest) {
  23523. return rest
  23524. ._location_(location())
  23525. ._source_(text());
  23526. },
  23527. peg$c57 = "(",
  23528. peg$c58 = { type: "literal", value: "(", description: "\"(\"" },
  23529. peg$c59 = function(lit) {return lit._value();},
  23530. peg$c60 = function(lits) {
  23531. return $globals.ValueNode._new()
  23532. ._value_(lits);
  23533. },
  23534. peg$c61 = "{",
  23535. peg$c62 = { type: "literal", value: "{", description: "\"{\"" },
  23536. peg$c63 = "}",
  23537. peg$c64 = { type: "literal", value: "}", description: "\"}\"" },
  23538. peg$c65 = function(expressions) {
  23539. return $globals.DynamicArrayNode._new()
  23540. ._location_(location())
  23541. ._source_(text())
  23542. ._nodes_(expressions || []);
  23543. },
  23544. peg$c66 = "#{",
  23545. peg$c67 = { type: "literal", value: "#{", description: "\"#{\"" },
  23546. peg$c68 = function(expressions) {
  23547. return $globals.DynamicDictionaryNode._new()
  23548. ._location_(location())
  23549. ._source_(text())
  23550. ._nodes_(expressions || []);
  23551. },
  23552. peg$c69 = "true",
  23553. peg$c70 = { type: "literal", value: "true", description: "\"true\"" },
  23554. peg$c71 = function() {return true;},
  23555. peg$c72 = "false",
  23556. peg$c73 = { type: "literal", value: "false", description: "\"false\"" },
  23557. peg$c74 = function() {return false;},
  23558. peg$c75 = "nil",
  23559. peg$c76 = { type: "literal", value: "nil", description: "\"nil\"" },
  23560. peg$c77 = function() {return nil;},
  23561. peg$c78 = function(val) {
  23562. return $globals.ValueNode._new()
  23563. ._location_(location())
  23564. ._source_(text())
  23565. ._value_(val);
  23566. },
  23567. peg$c79 = function(identifier) {
  23568. return $globals.VariableNode._new()
  23569. ._location_(location())
  23570. ._source_(text())
  23571. ._value_(identifier);
  23572. },
  23573. peg$c80 = /^[\\+*\/=><,@%~|&\-]/,
  23574. peg$c81 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  23575. peg$c82 = function(bin) {return bin.join("");},
  23576. peg$c83 = function(key, arg) {return {key:key, arg:arg};},
  23577. peg$c84 = function(pairs) {
  23578. var selector = "";
  23579. var params = [];
  23580. for(var i = 0; i < pairs.length; i++){
  23581. selector += pairs[i].key;
  23582. params.push(pairs[i].arg);
  23583. }
  23584. return [selector, params];
  23585. },
  23586. peg$c85 = function(selector, arg) {return [selector, [arg]];},
  23587. peg$c86 = function(selector) {return [selector, []];},
  23588. peg$c87 = function(expression) {return expression;},
  23589. peg$c88 = function(first, others) { return [first].concat(others); },
  23590. peg$c89 = ":=",
  23591. peg$c90 = { type: "literal", value: ":=", description: "\":=\"" },
  23592. peg$c91 = function(variable, expression) {
  23593. return $globals.AssignmentNode._new()
  23594. ._location_(location())
  23595. ._source_(text())
  23596. ._left_(variable)
  23597. ._right_(expression);
  23598. },
  23599. peg$c92 = "^",
  23600. peg$c93 = { type: "literal", value: "^", description: "\"^\"" },
  23601. peg$c94 = function(expression) {
  23602. return $globals.ReturnNode._new()
  23603. ._location_(location())
  23604. ._source_(text())
  23605. ._nodes_([expression]);
  23606. },
  23607. peg$c95 = "|",
  23608. peg$c96 = { type: "literal", value: "|", description: "\"|\"" },
  23609. peg$c97 = function(variable) {return variable;},
  23610. peg$c98 = function(vars) {return vars;},
  23611. peg$c99 = function(param) {return param;},
  23612. peg$c100 = function(params) {return params;},
  23613. peg$c101 = function(ret) {return [ret];},
  23614. peg$c102 = function(exps, ret) {
  23615. var expressions = exps;
  23616. expressions.push(ret);
  23617. return expressions;
  23618. },
  23619. peg$c103 = function(expressions) {
  23620. return expressions || [];
  23621. },
  23622. peg$c104 = function(js) { return js; },
  23623. peg$c105 = function(temps, statements) {
  23624. return $globals.SequenceNode._new()
  23625. ._location_(location())
  23626. ._source_(text())
  23627. ._temps_(temps || [])
  23628. ._nodes_(statements || []);
  23629. },
  23630. peg$c106 = "[",
  23631. peg$c107 = { type: "literal", value: "[", description: "\"[\"" },
  23632. peg$c108 = "]",
  23633. peg$c109 = { type: "literal", value: "]", description: "\"]\"" },
  23634. peg$c110 = function(params, sequence) {
  23635. return $globals.BlockNode._new()
  23636. ._location_(location())
  23637. ._source_(text())
  23638. ._parameters_(params || [])
  23639. ._nodes_([sequence._asBlockSequenceNode()]);
  23640. },
  23641. peg$c111 = function(selector) {
  23642. return $globals.SendNode._new()
  23643. ._location_(location())
  23644. ._source_(text())
  23645. ._selector_(selector);
  23646. },
  23647. peg$c112 = function(message, tail) {
  23648. if(tail) {
  23649. return tail._valueForReceiver_(message);
  23650. }
  23651. else {
  23652. return message;
  23653. }
  23654. },
  23655. peg$c113 = function(receiver, tail) {
  23656. if(tail) {
  23657. return tail._valueForReceiver_(receiver);
  23658. }
  23659. else {
  23660. return receiver;
  23661. }
  23662. },
  23663. peg$c114 = function(selector, arg) {
  23664. return $globals.SendNode._new()
  23665. ._location_(location())
  23666. ._source_(text())
  23667. ._selector_(selector)
  23668. ._arguments_([arg]);
  23669. },
  23670. peg$c115 = function(message, tail) {
  23671. if(tail) {
  23672. return tail._valueForReceiver_(message);
  23673. }
  23674. else {
  23675. return message;
  23676. }
  23677. },
  23678. peg$c116 = function(pairs) {
  23679. var selector = "";
  23680. var args = [];
  23681. for(var i = 0; i < pairs.length; i++) {
  23682. selector += pairs[i].key;
  23683. args.push(pairs[i].arg);
  23684. }
  23685. return $globals.SendNode._new()
  23686. ._location_(location())
  23687. ._source_(text())
  23688. ._selector_(selector)
  23689. ._arguments_(args);
  23690. },
  23691. peg$c117 = function(send) { return send._isSendNode(); },
  23692. peg$c118 = ";",
  23693. peg$c119 = { type: "literal", value: ";", description: "\";\"" },
  23694. peg$c120 = function(send, mess) {return mess;},
  23695. peg$c121 = function(send, messages) {
  23696. messages.unshift(send);
  23697. return $globals.CascadeNode._new()
  23698. ._location_(location())
  23699. ._source_(text())
  23700. ._nodes_(messages);
  23701. },
  23702. peg$c122 = "<",
  23703. peg$c123 = { type: "literal", value: "<", description: "\"<\"" },
  23704. peg$c124 = ">>",
  23705. peg$c125 = { type: "literal", value: ">>", description: "\">>\"" },
  23706. peg$c126 = function() {return ">";},
  23707. peg$c127 = /^[^>]/,
  23708. peg$c128 = { type: "class", value: "[^>]", description: "[^>]" },
  23709. peg$c129 = ">",
  23710. peg$c130 = { type: "literal", value: ">", description: "\">\"" },
  23711. peg$c131 = function(val) {
  23712. return $globals.JSStatementNode._new()
  23713. ._location_(location())
  23714. ._source_(val.join(""))
  23715. },
  23716. peg$c132 = function(pattern, sequence) {
  23717. return $globals.MethodNode._new()
  23718. ._location_(location())
  23719. ._source_(text())
  23720. ._selector_(pattern[0])
  23721. ._arguments_(pattern[1])
  23722. ._nodes_([sequence]);
  23723. },
  23724. peg$c133 = function(send) { return send._isSendNode() && send._selector() === "->" },
  23725. peg$c134 = function(send) { return [send._receiver(), send._arguments()[0]]; },
  23726. peg$c135 = function(first, others) { return first.concat.apply(first, others); },
  23727. peg$currPos = 0,
  23728. peg$savedPos = 0,
  23729. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  23730. peg$maxFailPos = 0,
  23731. peg$maxFailExpected = [],
  23732. peg$silentFails = 0,
  23733. peg$resultsCache = {},
  23734. peg$result;
  23735. if ("startRule" in options) {
  23736. if (!(options.startRule in peg$startRuleFunctions)) {
  23737. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  23738. }
  23739. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  23740. }
  23741. function text() {
  23742. return input.substring(peg$savedPos, peg$currPos);
  23743. }
  23744. function location() {
  23745. return peg$computeLocation(peg$savedPos, peg$currPos);
  23746. }
  23747. function expected(description) {
  23748. throw peg$buildException(
  23749. null,
  23750. [{ type: "other", description: description }],
  23751. input.substring(peg$savedPos, peg$currPos),
  23752. peg$computeLocation(peg$savedPos, peg$currPos)
  23753. );
  23754. }
  23755. function error(message) {
  23756. throw peg$buildException(
  23757. message,
  23758. null,
  23759. input.substring(peg$savedPos, peg$currPos),
  23760. peg$computeLocation(peg$savedPos, peg$currPos)
  23761. );
  23762. }
  23763. function peg$computePosDetails(pos) {
  23764. var details = peg$posDetailsCache[pos],
  23765. p, ch;
  23766. if (details) {
  23767. return details;
  23768. } else {
  23769. p = pos - 1;
  23770. while (!peg$posDetailsCache[p]) {
  23771. p--;
  23772. }
  23773. details = peg$posDetailsCache[p];
  23774. details = {
  23775. line: details.line,
  23776. column: details.column,
  23777. seenCR: details.seenCR
  23778. };
  23779. while (p < pos) {
  23780. ch = input.charAt(p);
  23781. if (ch === "\n") {
  23782. if (!details.seenCR) { details.line++; }
  23783. details.column = 1;
  23784. details.seenCR = false;
  23785. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  23786. details.line++;
  23787. details.column = 1;
  23788. details.seenCR = true;
  23789. } else {
  23790. details.column++;
  23791. details.seenCR = false;
  23792. }
  23793. p++;
  23794. }
  23795. peg$posDetailsCache[pos] = details;
  23796. return details;
  23797. }
  23798. }
  23799. function peg$computeLocation(startPos, endPos) {
  23800. var startPosDetails = peg$computePosDetails(startPos),
  23801. endPosDetails = peg$computePosDetails(endPos);
  23802. return {
  23803. start: {
  23804. offset: startPos,
  23805. line: startPosDetails.line,
  23806. column: startPosDetails.column
  23807. },
  23808. end: {
  23809. offset: endPos,
  23810. line: endPosDetails.line,
  23811. column: endPosDetails.column
  23812. }
  23813. };
  23814. }
  23815. function peg$fail(expected) {
  23816. if (peg$currPos < peg$maxFailPos) { return; }
  23817. if (peg$currPos > peg$maxFailPos) {
  23818. peg$maxFailPos = peg$currPos;
  23819. peg$maxFailExpected = [];
  23820. }
  23821. peg$maxFailExpected.push(expected);
  23822. }
  23823. function peg$buildException(message, expected, found, location) {
  23824. function cleanupExpected(expected) {
  23825. var i = 1;
  23826. expected.sort(function(a, b) {
  23827. if (a.description < b.description) {
  23828. return -1;
  23829. } else if (a.description > b.description) {
  23830. return 1;
  23831. } else {
  23832. return 0;
  23833. }
  23834. });
  23835. while (i < expected.length) {
  23836. if (expected[i - 1] === expected[i]) {
  23837. expected.splice(i, 1);
  23838. } else {
  23839. i++;
  23840. }
  23841. }
  23842. }
  23843. function buildMessage(expected, found) {
  23844. function stringEscape(s) {
  23845. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  23846. return s
  23847. .replace(/\\/g, '\\\\')
  23848. .replace(/"/g, '\\"')
  23849. .replace(/\x08/g, '\\b')
  23850. .replace(/\t/g, '\\t')
  23851. .replace(/\n/g, '\\n')
  23852. .replace(/\f/g, '\\f')
  23853. .replace(/\r/g, '\\r')
  23854. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  23855. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  23856. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  23857. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  23858. }
  23859. var expectedDescs = new Array(expected.length),
  23860. expectedDesc, foundDesc, i;
  23861. for (i = 0; i < expected.length; i++) {
  23862. expectedDescs[i] = expected[i].description;
  23863. }
  23864. expectedDesc = expected.length > 1
  23865. ? expectedDescs.slice(0, -1).join(", ")
  23866. + " or "
  23867. + expectedDescs[expected.length - 1]
  23868. : expectedDescs[0];
  23869. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  23870. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  23871. }
  23872. if (expected !== null) {
  23873. cleanupExpected(expected);
  23874. }
  23875. return new peg$SyntaxError(
  23876. message !== null ? message : buildMessage(expected, found),
  23877. expected,
  23878. found,
  23879. location
  23880. );
  23881. }
  23882. function peg$parsestart() {
  23883. var s0;
  23884. var key = peg$currPos * 61 + 0,
  23885. cached = peg$resultsCache[key];
  23886. if (cached) {
  23887. peg$currPos = cached.nextPos;
  23888. return cached.result;
  23889. }
  23890. s0 = peg$parsemethod();
  23891. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23892. return s0;
  23893. }
  23894. function peg$parseseparator() {
  23895. var s0, s1;
  23896. var key = peg$currPos * 61 + 1,
  23897. cached = peg$resultsCache[key];
  23898. if (cached) {
  23899. peg$currPos = cached.nextPos;
  23900. return cached.result;
  23901. }
  23902. s0 = [];
  23903. if (peg$c0.test(input.charAt(peg$currPos))) {
  23904. s1 = input.charAt(peg$currPos);
  23905. peg$currPos++;
  23906. } else {
  23907. s1 = peg$FAILED;
  23908. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  23909. }
  23910. if (s1 !== peg$FAILED) {
  23911. while (s1 !== peg$FAILED) {
  23912. s0.push(s1);
  23913. if (peg$c0.test(input.charAt(peg$currPos))) {
  23914. s1 = input.charAt(peg$currPos);
  23915. peg$currPos++;
  23916. } else {
  23917. s1 = peg$FAILED;
  23918. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  23919. }
  23920. }
  23921. } else {
  23922. s0 = peg$FAILED;
  23923. }
  23924. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  23925. return s0;
  23926. }
  23927. function peg$parsecomments() {
  23928. var s0, s1, s2, s3, s4;
  23929. var key = peg$currPos * 61 + 2,
  23930. cached = peg$resultsCache[key];
  23931. if (cached) {
  23932. peg$currPos = cached.nextPos;
  23933. return cached.result;
  23934. }
  23935. s0 = [];
  23936. s1 = peg$currPos;
  23937. if (input.charCodeAt(peg$currPos) === 34) {
  23938. s2 = peg$c2;
  23939. peg$currPos++;
  23940. } else {
  23941. s2 = peg$FAILED;
  23942. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23943. }
  23944. if (s2 !== peg$FAILED) {
  23945. s3 = [];
  23946. if (peg$c4.test(input.charAt(peg$currPos))) {
  23947. s4 = input.charAt(peg$currPos);
  23948. peg$currPos++;
  23949. } else {
  23950. s4 = peg$FAILED;
  23951. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  23952. }
  23953. while (s4 !== peg$FAILED) {
  23954. s3.push(s4);
  23955. if (peg$c4.test(input.charAt(peg$currPos))) {
  23956. s4 = input.charAt(peg$currPos);
  23957. peg$currPos++;
  23958. } else {
  23959. s4 = peg$FAILED;
  23960. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  23961. }
  23962. }
  23963. if (s3 !== peg$FAILED) {
  23964. if (input.charCodeAt(peg$currPos) === 34) {
  23965. s4 = peg$c2;
  23966. peg$currPos++;
  23967. } else {
  23968. s4 = peg$FAILED;
  23969. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23970. }
  23971. if (s4 !== peg$FAILED) {
  23972. s2 = [s2, s3, s4];
  23973. s1 = s2;
  23974. } else {
  23975. peg$currPos = s1;
  23976. s1 = peg$FAILED;
  23977. }
  23978. } else {
  23979. peg$currPos = s1;
  23980. s1 = peg$FAILED;
  23981. }
  23982. } else {
  23983. peg$currPos = s1;
  23984. s1 = peg$FAILED;
  23985. }
  23986. if (s1 !== peg$FAILED) {
  23987. while (s1 !== peg$FAILED) {
  23988. s0.push(s1);
  23989. s1 = peg$currPos;
  23990. if (input.charCodeAt(peg$currPos) === 34) {
  23991. s2 = peg$c2;
  23992. peg$currPos++;
  23993. } else {
  23994. s2 = peg$FAILED;
  23995. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  23996. }
  23997. if (s2 !== peg$FAILED) {
  23998. s3 = [];
  23999. if (peg$c4.test(input.charAt(peg$currPos))) {
  24000. s4 = input.charAt(peg$currPos);
  24001. peg$currPos++;
  24002. } else {
  24003. s4 = peg$FAILED;
  24004. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24005. }
  24006. while (s4 !== peg$FAILED) {
  24007. s3.push(s4);
  24008. if (peg$c4.test(input.charAt(peg$currPos))) {
  24009. s4 = input.charAt(peg$currPos);
  24010. peg$currPos++;
  24011. } else {
  24012. s4 = peg$FAILED;
  24013. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  24014. }
  24015. }
  24016. if (s3 !== peg$FAILED) {
  24017. if (input.charCodeAt(peg$currPos) === 34) {
  24018. s4 = peg$c2;
  24019. peg$currPos++;
  24020. } else {
  24021. s4 = peg$FAILED;
  24022. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  24023. }
  24024. if (s4 !== peg$FAILED) {
  24025. s2 = [s2, s3, s4];
  24026. s1 = s2;
  24027. } else {
  24028. peg$currPos = s1;
  24029. s1 = peg$FAILED;
  24030. }
  24031. } else {
  24032. peg$currPos = s1;
  24033. s1 = peg$FAILED;
  24034. }
  24035. } else {
  24036. peg$currPos = s1;
  24037. s1 = peg$FAILED;
  24038. }
  24039. }
  24040. } else {
  24041. s0 = peg$FAILED;
  24042. }
  24043. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24044. return s0;
  24045. }
  24046. function peg$parsews() {
  24047. var s0, s1;
  24048. var key = peg$currPos * 61 + 3,
  24049. cached = peg$resultsCache[key];
  24050. if (cached) {
  24051. peg$currPos = cached.nextPos;
  24052. return cached.result;
  24053. }
  24054. s0 = [];
  24055. s1 = peg$parseseparator();
  24056. if (s1 === peg$FAILED) {
  24057. s1 = peg$parsecomments();
  24058. }
  24059. while (s1 !== peg$FAILED) {
  24060. s0.push(s1);
  24061. s1 = peg$parseseparator();
  24062. if (s1 === peg$FAILED) {
  24063. s1 = peg$parsecomments();
  24064. }
  24065. }
  24066. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24067. return s0;
  24068. }
  24069. function peg$parsemaybeDotsWs() {
  24070. var s0, s1;
  24071. var key = peg$currPos * 61 + 4,
  24072. cached = peg$resultsCache[key];
  24073. if (cached) {
  24074. peg$currPos = cached.nextPos;
  24075. return cached.result;
  24076. }
  24077. s0 = [];
  24078. if (input.charCodeAt(peg$currPos) === 46) {
  24079. s1 = peg$c6;
  24080. peg$currPos++;
  24081. } else {
  24082. s1 = peg$FAILED;
  24083. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24084. }
  24085. if (s1 === peg$FAILED) {
  24086. s1 = peg$parseseparator();
  24087. if (s1 === peg$FAILED) {
  24088. s1 = peg$parsecomments();
  24089. }
  24090. }
  24091. while (s1 !== peg$FAILED) {
  24092. s0.push(s1);
  24093. if (input.charCodeAt(peg$currPos) === 46) {
  24094. s1 = peg$c6;
  24095. peg$currPos++;
  24096. } else {
  24097. s1 = peg$FAILED;
  24098. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24099. }
  24100. if (s1 === peg$FAILED) {
  24101. s1 = peg$parseseparator();
  24102. if (s1 === peg$FAILED) {
  24103. s1 = peg$parsecomments();
  24104. }
  24105. }
  24106. }
  24107. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24108. return s0;
  24109. }
  24110. function peg$parseidentifier() {
  24111. var s0, s1, s2, s3;
  24112. var key = peg$currPos * 61 + 5,
  24113. cached = peg$resultsCache[key];
  24114. if (cached) {
  24115. peg$currPos = cached.nextPos;
  24116. return cached.result;
  24117. }
  24118. s0 = peg$currPos;
  24119. if (peg$c8.test(input.charAt(peg$currPos))) {
  24120. s1 = input.charAt(peg$currPos);
  24121. peg$currPos++;
  24122. } else {
  24123. s1 = peg$FAILED;
  24124. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24125. }
  24126. if (s1 !== peg$FAILED) {
  24127. s2 = [];
  24128. if (peg$c10.test(input.charAt(peg$currPos))) {
  24129. s3 = input.charAt(peg$currPos);
  24130. peg$currPos++;
  24131. } else {
  24132. s3 = peg$FAILED;
  24133. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24134. }
  24135. while (s3 !== peg$FAILED) {
  24136. s2.push(s3);
  24137. if (peg$c10.test(input.charAt(peg$currPos))) {
  24138. s3 = input.charAt(peg$currPos);
  24139. peg$currPos++;
  24140. } else {
  24141. s3 = peg$FAILED;
  24142. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24143. }
  24144. }
  24145. if (s2 !== peg$FAILED) {
  24146. peg$savedPos = s0;
  24147. s1 = peg$c12(s1, s2);
  24148. s0 = s1;
  24149. } else {
  24150. peg$currPos = s0;
  24151. s0 = peg$FAILED;
  24152. }
  24153. } else {
  24154. peg$currPos = s0;
  24155. s0 = peg$FAILED;
  24156. }
  24157. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24158. return s0;
  24159. }
  24160. function peg$parsekeyword() {
  24161. var s0, s1, s2;
  24162. var key = peg$currPos * 61 + 6,
  24163. cached = peg$resultsCache[key];
  24164. if (cached) {
  24165. peg$currPos = cached.nextPos;
  24166. return cached.result;
  24167. }
  24168. s0 = peg$currPos;
  24169. s1 = peg$parseidentifier();
  24170. if (s1 !== peg$FAILED) {
  24171. if (input.charCodeAt(peg$currPos) === 58) {
  24172. s2 = peg$c13;
  24173. peg$currPos++;
  24174. } else {
  24175. s2 = peg$FAILED;
  24176. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  24177. }
  24178. if (s2 !== peg$FAILED) {
  24179. peg$savedPos = s0;
  24180. s1 = peg$c15(s1, s2);
  24181. s0 = s1;
  24182. } else {
  24183. peg$currPos = s0;
  24184. s0 = peg$FAILED;
  24185. }
  24186. } else {
  24187. peg$currPos = s0;
  24188. s0 = peg$FAILED;
  24189. }
  24190. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24191. return s0;
  24192. }
  24193. function peg$parseselector() {
  24194. var s0, s1, s2, s3;
  24195. var key = peg$currPos * 61 + 7,
  24196. cached = peg$resultsCache[key];
  24197. if (cached) {
  24198. peg$currPos = cached.nextPos;
  24199. return cached.result;
  24200. }
  24201. s0 = peg$currPos;
  24202. if (peg$c8.test(input.charAt(peg$currPos))) {
  24203. s1 = input.charAt(peg$currPos);
  24204. peg$currPos++;
  24205. } else {
  24206. s1 = peg$FAILED;
  24207. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  24208. }
  24209. if (s1 !== peg$FAILED) {
  24210. s2 = [];
  24211. if (peg$c16.test(input.charAt(peg$currPos))) {
  24212. s3 = input.charAt(peg$currPos);
  24213. peg$currPos++;
  24214. } else {
  24215. s3 = peg$FAILED;
  24216. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24217. }
  24218. while (s3 !== peg$FAILED) {
  24219. s2.push(s3);
  24220. if (peg$c16.test(input.charAt(peg$currPos))) {
  24221. s3 = input.charAt(peg$currPos);
  24222. peg$currPos++;
  24223. } else {
  24224. s3 = peg$FAILED;
  24225. if (peg$silentFails === 0) { peg$fail(peg$c17); }
  24226. }
  24227. }
  24228. if (s2 !== peg$FAILED) {
  24229. peg$savedPos = s0;
  24230. s1 = peg$c12(s1, s2);
  24231. s0 = s1;
  24232. } else {
  24233. peg$currPos = s0;
  24234. s0 = peg$FAILED;
  24235. }
  24236. } else {
  24237. peg$currPos = s0;
  24238. s0 = peg$FAILED;
  24239. }
  24240. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24241. return s0;
  24242. }
  24243. function peg$parseclassName() {
  24244. var s0, s1, s2, s3;
  24245. var key = peg$currPos * 61 + 8,
  24246. cached = peg$resultsCache[key];
  24247. if (cached) {
  24248. peg$currPos = cached.nextPos;
  24249. return cached.result;
  24250. }
  24251. s0 = peg$currPos;
  24252. if (peg$c18.test(input.charAt(peg$currPos))) {
  24253. s1 = input.charAt(peg$currPos);
  24254. peg$currPos++;
  24255. } else {
  24256. s1 = peg$FAILED;
  24257. if (peg$silentFails === 0) { peg$fail(peg$c19); }
  24258. }
  24259. if (s1 !== peg$FAILED) {
  24260. s2 = [];
  24261. if (peg$c10.test(input.charAt(peg$currPos))) {
  24262. s3 = input.charAt(peg$currPos);
  24263. peg$currPos++;
  24264. } else {
  24265. s3 = peg$FAILED;
  24266. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24267. }
  24268. while (s3 !== peg$FAILED) {
  24269. s2.push(s3);
  24270. if (peg$c10.test(input.charAt(peg$currPos))) {
  24271. s3 = input.charAt(peg$currPos);
  24272. peg$currPos++;
  24273. } else {
  24274. s3 = peg$FAILED;
  24275. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  24276. }
  24277. }
  24278. if (s2 !== peg$FAILED) {
  24279. peg$savedPos = s0;
  24280. s1 = peg$c12(s1, s2);
  24281. s0 = s1;
  24282. } else {
  24283. peg$currPos = s0;
  24284. s0 = peg$FAILED;
  24285. }
  24286. } else {
  24287. peg$currPos = s0;
  24288. s0 = peg$FAILED;
  24289. }
  24290. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24291. return s0;
  24292. }
  24293. function peg$parsestring() {
  24294. var s0, s1, s2, s3, s4;
  24295. var key = peg$currPos * 61 + 9,
  24296. cached = peg$resultsCache[key];
  24297. if (cached) {
  24298. peg$currPos = cached.nextPos;
  24299. return cached.result;
  24300. }
  24301. s0 = peg$currPos;
  24302. if (input.charCodeAt(peg$currPos) === 39) {
  24303. s1 = peg$c20;
  24304. peg$currPos++;
  24305. } else {
  24306. s1 = peg$FAILED;
  24307. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24308. }
  24309. if (s1 !== peg$FAILED) {
  24310. s2 = [];
  24311. s3 = peg$currPos;
  24312. if (input.substr(peg$currPos, 2) === peg$c22) {
  24313. s4 = peg$c22;
  24314. peg$currPos += 2;
  24315. } else {
  24316. s4 = peg$FAILED;
  24317. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24318. }
  24319. if (s4 !== peg$FAILED) {
  24320. peg$savedPos = s3;
  24321. s4 = peg$c24();
  24322. }
  24323. s3 = s4;
  24324. if (s3 === peg$FAILED) {
  24325. if (peg$c25.test(input.charAt(peg$currPos))) {
  24326. s3 = input.charAt(peg$currPos);
  24327. peg$currPos++;
  24328. } else {
  24329. s3 = peg$FAILED;
  24330. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24331. }
  24332. }
  24333. while (s3 !== peg$FAILED) {
  24334. s2.push(s3);
  24335. s3 = peg$currPos;
  24336. if (input.substr(peg$currPos, 2) === peg$c22) {
  24337. s4 = peg$c22;
  24338. peg$currPos += 2;
  24339. } else {
  24340. s4 = peg$FAILED;
  24341. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  24342. }
  24343. if (s4 !== peg$FAILED) {
  24344. peg$savedPos = s3;
  24345. s4 = peg$c24();
  24346. }
  24347. s3 = s4;
  24348. if (s3 === peg$FAILED) {
  24349. if (peg$c25.test(input.charAt(peg$currPos))) {
  24350. s3 = input.charAt(peg$currPos);
  24351. peg$currPos++;
  24352. } else {
  24353. s3 = peg$FAILED;
  24354. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  24355. }
  24356. }
  24357. }
  24358. if (s2 !== peg$FAILED) {
  24359. if (input.charCodeAt(peg$currPos) === 39) {
  24360. s3 = peg$c20;
  24361. peg$currPos++;
  24362. } else {
  24363. s3 = peg$FAILED;
  24364. if (peg$silentFails === 0) { peg$fail(peg$c21); }
  24365. }
  24366. if (s3 !== peg$FAILED) {
  24367. peg$savedPos = s0;
  24368. s1 = peg$c27(s2);
  24369. s0 = s1;
  24370. } else {
  24371. peg$currPos = s0;
  24372. s0 = peg$FAILED;
  24373. }
  24374. } else {
  24375. peg$currPos = s0;
  24376. s0 = peg$FAILED;
  24377. }
  24378. } else {
  24379. peg$currPos = s0;
  24380. s0 = peg$FAILED;
  24381. }
  24382. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24383. return s0;
  24384. }
  24385. function peg$parsecharacter() {
  24386. var s0, s1, s2;
  24387. var key = peg$currPos * 61 + 10,
  24388. cached = peg$resultsCache[key];
  24389. if (cached) {
  24390. peg$currPos = cached.nextPos;
  24391. return cached.result;
  24392. }
  24393. s0 = peg$currPos;
  24394. if (input.charCodeAt(peg$currPos) === 36) {
  24395. s1 = peg$c28;
  24396. peg$currPos++;
  24397. } else {
  24398. s1 = peg$FAILED;
  24399. if (peg$silentFails === 0) { peg$fail(peg$c29); }
  24400. }
  24401. if (s1 !== peg$FAILED) {
  24402. if (input.length > peg$currPos) {
  24403. s2 = input.charAt(peg$currPos);
  24404. peg$currPos++;
  24405. } else {
  24406. s2 = peg$FAILED;
  24407. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  24408. }
  24409. if (s2 !== peg$FAILED) {
  24410. peg$savedPos = s0;
  24411. s1 = peg$c31(s2);
  24412. s0 = s1;
  24413. } else {
  24414. peg$currPos = s0;
  24415. s0 = peg$FAILED;
  24416. }
  24417. } else {
  24418. peg$currPos = s0;
  24419. s0 = peg$FAILED;
  24420. }
  24421. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24422. return s0;
  24423. }
  24424. function peg$parsesymbol() {
  24425. var s0, s1, s2;
  24426. var key = peg$currPos * 61 + 11,
  24427. cached = peg$resultsCache[key];
  24428. if (cached) {
  24429. peg$currPos = cached.nextPos;
  24430. return cached.result;
  24431. }
  24432. s0 = peg$currPos;
  24433. if (input.charCodeAt(peg$currPos) === 35) {
  24434. s1 = peg$c32;
  24435. peg$currPos++;
  24436. } else {
  24437. s1 = peg$FAILED;
  24438. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  24439. }
  24440. if (s1 !== peg$FAILED) {
  24441. s2 = peg$parsebareSymbol();
  24442. if (s2 !== peg$FAILED) {
  24443. peg$savedPos = s0;
  24444. s1 = peg$c34(s2);
  24445. s0 = s1;
  24446. } else {
  24447. peg$currPos = s0;
  24448. s0 = peg$FAILED;
  24449. }
  24450. } else {
  24451. peg$currPos = s0;
  24452. s0 = peg$FAILED;
  24453. }
  24454. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24455. return s0;
  24456. }
  24457. function peg$parsebareSymbol() {
  24458. var s0, s1, s2;
  24459. var key = peg$currPos * 61 + 12,
  24460. cached = peg$resultsCache[key];
  24461. if (cached) {
  24462. peg$currPos = cached.nextPos;
  24463. return cached.result;
  24464. }
  24465. s0 = peg$currPos;
  24466. s1 = peg$parseselector();
  24467. if (s1 === peg$FAILED) {
  24468. s1 = peg$parsebinarySelector();
  24469. if (s1 === peg$FAILED) {
  24470. s1 = peg$currPos;
  24471. s2 = peg$parsestring();
  24472. if (s2 !== peg$FAILED) {
  24473. peg$savedPos = s1;
  24474. s2 = peg$c35(s2);
  24475. }
  24476. s1 = s2;
  24477. }
  24478. }
  24479. if (s1 !== peg$FAILED) {
  24480. peg$savedPos = s0;
  24481. s1 = peg$c36(s1);
  24482. }
  24483. s0 = s1;
  24484. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24485. return s0;
  24486. }
  24487. function peg$parsenumber() {
  24488. var s0, s1;
  24489. var key = peg$currPos * 61 + 13,
  24490. cached = peg$resultsCache[key];
  24491. if (cached) {
  24492. peg$currPos = cached.nextPos;
  24493. return cached.result;
  24494. }
  24495. s0 = peg$currPos;
  24496. s1 = peg$parsenumberExp();
  24497. if (s1 === peg$FAILED) {
  24498. s1 = peg$parsehex();
  24499. if (s1 === peg$FAILED) {
  24500. s1 = peg$parsefloat();
  24501. if (s1 === peg$FAILED) {
  24502. s1 = peg$parseinteger();
  24503. }
  24504. }
  24505. }
  24506. if (s1 !== peg$FAILED) {
  24507. peg$savedPos = s0;
  24508. s1 = peg$c37(s1);
  24509. }
  24510. s0 = s1;
  24511. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24512. return s0;
  24513. }
  24514. function peg$parsenumberExp() {
  24515. var s0, s1, s2, s3, s4;
  24516. var key = peg$currPos * 61 + 14,
  24517. cached = peg$resultsCache[key];
  24518. if (cached) {
  24519. peg$currPos = cached.nextPos;
  24520. return cached.result;
  24521. }
  24522. s0 = peg$currPos;
  24523. s1 = peg$currPos;
  24524. s2 = peg$parsefloat();
  24525. if (s2 === peg$FAILED) {
  24526. s2 = peg$parseinteger();
  24527. }
  24528. if (s2 !== peg$FAILED) {
  24529. if (input.charCodeAt(peg$currPos) === 101) {
  24530. s3 = peg$c38;
  24531. peg$currPos++;
  24532. } else {
  24533. s3 = peg$FAILED;
  24534. if (peg$silentFails === 0) { peg$fail(peg$c39); }
  24535. }
  24536. if (s3 !== peg$FAILED) {
  24537. s4 = peg$parseinteger();
  24538. if (s4 !== peg$FAILED) {
  24539. s2 = [s2, s3, s4];
  24540. s1 = s2;
  24541. } else {
  24542. peg$currPos = s1;
  24543. s1 = peg$FAILED;
  24544. }
  24545. } else {
  24546. peg$currPos = s1;
  24547. s1 = peg$FAILED;
  24548. }
  24549. } else {
  24550. peg$currPos = s1;
  24551. s1 = peg$FAILED;
  24552. }
  24553. if (s1 !== peg$FAILED) {
  24554. peg$savedPos = s0;
  24555. s1 = peg$c40(s1);
  24556. }
  24557. s0 = s1;
  24558. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24559. return s0;
  24560. }
  24561. function peg$parsehex() {
  24562. var s0, s1, s2, s3, s4;
  24563. var key = peg$currPos * 61 + 15,
  24564. cached = peg$resultsCache[key];
  24565. if (cached) {
  24566. peg$currPos = cached.nextPos;
  24567. return cached.result;
  24568. }
  24569. s0 = peg$currPos;
  24570. if (input.charCodeAt(peg$currPos) === 45) {
  24571. s1 = peg$c41;
  24572. peg$currPos++;
  24573. } else {
  24574. s1 = peg$FAILED;
  24575. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  24576. }
  24577. if (s1 === peg$FAILED) {
  24578. s1 = null;
  24579. }
  24580. if (s1 !== peg$FAILED) {
  24581. if (input.substr(peg$currPos, 3) === peg$c43) {
  24582. s2 = peg$c43;
  24583. peg$currPos += 3;
  24584. } else {
  24585. s2 = peg$FAILED;
  24586. if (peg$silentFails === 0) { peg$fail(peg$c44); }
  24587. }
  24588. if (s2 !== peg$FAILED) {
  24589. s3 = [];
  24590. if (peg$c45.test(input.charAt(peg$currPos))) {
  24591. s4 = input.charAt(peg$currPos);
  24592. peg$currPos++;
  24593. } else {
  24594. s4 = peg$FAILED;
  24595. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  24596. }
  24597. if (s4 !== peg$FAILED) {
  24598. while (s4 !== peg$FAILED) {
  24599. s3.push(s4);
  24600. if (peg$c45.test(input.charAt(peg$currPos))) {
  24601. s4 = input.charAt(peg$currPos);
  24602. peg$currPos++;
  24603. } else {
  24604. s4 = peg$FAILED;
  24605. if (peg$silentFails === 0) { peg$fail(peg$c46); }
  24606. }
  24607. }
  24608. } else {
  24609. s3 = peg$FAILED;
  24610. }
  24611. if (s3 !== peg$FAILED) {
  24612. peg$savedPos = s0;
  24613. s1 = peg$c47(s1, s3);
  24614. s0 = s1;
  24615. } else {
  24616. peg$currPos = s0;
  24617. s0 = peg$FAILED;
  24618. }
  24619. } else {
  24620. peg$currPos = s0;
  24621. s0 = peg$FAILED;
  24622. }
  24623. } else {
  24624. peg$currPos = s0;
  24625. s0 = peg$FAILED;
  24626. }
  24627. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24628. return s0;
  24629. }
  24630. function peg$parsefloat() {
  24631. var s0, s1, s2, s3, s4, s5;
  24632. var key = peg$currPos * 61 + 16,
  24633. cached = peg$resultsCache[key];
  24634. if (cached) {
  24635. peg$currPos = cached.nextPos;
  24636. return cached.result;
  24637. }
  24638. s0 = peg$currPos;
  24639. if (input.charCodeAt(peg$currPos) === 45) {
  24640. s1 = peg$c41;
  24641. peg$currPos++;
  24642. } else {
  24643. s1 = peg$FAILED;
  24644. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  24645. }
  24646. if (s1 === peg$FAILED) {
  24647. s1 = null;
  24648. }
  24649. if (s1 !== peg$FAILED) {
  24650. s2 = [];
  24651. if (peg$c48.test(input.charAt(peg$currPos))) {
  24652. s3 = input.charAt(peg$currPos);
  24653. peg$currPos++;
  24654. } else {
  24655. s3 = peg$FAILED;
  24656. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24657. }
  24658. if (s3 !== peg$FAILED) {
  24659. while (s3 !== peg$FAILED) {
  24660. s2.push(s3);
  24661. if (peg$c48.test(input.charAt(peg$currPos))) {
  24662. s3 = input.charAt(peg$currPos);
  24663. peg$currPos++;
  24664. } else {
  24665. s3 = peg$FAILED;
  24666. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24667. }
  24668. }
  24669. } else {
  24670. s2 = peg$FAILED;
  24671. }
  24672. if (s2 !== peg$FAILED) {
  24673. if (input.charCodeAt(peg$currPos) === 46) {
  24674. s3 = peg$c6;
  24675. peg$currPos++;
  24676. } else {
  24677. s3 = peg$FAILED;
  24678. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  24679. }
  24680. if (s3 !== peg$FAILED) {
  24681. s4 = [];
  24682. if (peg$c48.test(input.charAt(peg$currPos))) {
  24683. s5 = input.charAt(peg$currPos);
  24684. peg$currPos++;
  24685. } else {
  24686. s5 = peg$FAILED;
  24687. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24688. }
  24689. if (s5 !== peg$FAILED) {
  24690. while (s5 !== peg$FAILED) {
  24691. s4.push(s5);
  24692. if (peg$c48.test(input.charAt(peg$currPos))) {
  24693. s5 = input.charAt(peg$currPos);
  24694. peg$currPos++;
  24695. } else {
  24696. s5 = peg$FAILED;
  24697. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24698. }
  24699. }
  24700. } else {
  24701. s4 = peg$FAILED;
  24702. }
  24703. if (s4 !== peg$FAILED) {
  24704. peg$savedPos = s0;
  24705. s1 = peg$c50(s1, s2, s4);
  24706. s0 = s1;
  24707. } else {
  24708. peg$currPos = s0;
  24709. s0 = peg$FAILED;
  24710. }
  24711. } else {
  24712. peg$currPos = s0;
  24713. s0 = peg$FAILED;
  24714. }
  24715. } else {
  24716. peg$currPos = s0;
  24717. s0 = peg$FAILED;
  24718. }
  24719. } else {
  24720. peg$currPos = s0;
  24721. s0 = peg$FAILED;
  24722. }
  24723. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24724. return s0;
  24725. }
  24726. function peg$parseinteger() {
  24727. var s0, s1, s2, s3;
  24728. var key = peg$currPos * 61 + 17,
  24729. cached = peg$resultsCache[key];
  24730. if (cached) {
  24731. peg$currPos = cached.nextPos;
  24732. return cached.result;
  24733. }
  24734. s0 = peg$currPos;
  24735. if (input.charCodeAt(peg$currPos) === 45) {
  24736. s1 = peg$c41;
  24737. peg$currPos++;
  24738. } else {
  24739. s1 = peg$FAILED;
  24740. if (peg$silentFails === 0) { peg$fail(peg$c42); }
  24741. }
  24742. if (s1 === peg$FAILED) {
  24743. s1 = null;
  24744. }
  24745. if (s1 !== peg$FAILED) {
  24746. s2 = [];
  24747. if (peg$c48.test(input.charAt(peg$currPos))) {
  24748. s3 = input.charAt(peg$currPos);
  24749. peg$currPos++;
  24750. } else {
  24751. s3 = peg$FAILED;
  24752. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24753. }
  24754. if (s3 !== peg$FAILED) {
  24755. while (s3 !== peg$FAILED) {
  24756. s2.push(s3);
  24757. if (peg$c48.test(input.charAt(peg$currPos))) {
  24758. s3 = input.charAt(peg$currPos);
  24759. peg$currPos++;
  24760. } else {
  24761. s3 = peg$FAILED;
  24762. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  24763. }
  24764. }
  24765. } else {
  24766. s2 = peg$FAILED;
  24767. }
  24768. if (s2 !== peg$FAILED) {
  24769. peg$savedPos = s0;
  24770. s1 = peg$c51(s1, s2);
  24771. s0 = s1;
  24772. } else {
  24773. peg$currPos = s0;
  24774. s0 = peg$FAILED;
  24775. }
  24776. } else {
  24777. peg$currPos = s0;
  24778. s0 = peg$FAILED;
  24779. }
  24780. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24781. return s0;
  24782. }
  24783. function peg$parseliteralArray() {
  24784. var s0, s1, s2, s3, s4;
  24785. var key = peg$currPos * 61 + 18,
  24786. cached = peg$resultsCache[key];
  24787. if (cached) {
  24788. peg$currPos = cached.nextPos;
  24789. return cached.result;
  24790. }
  24791. s0 = peg$currPos;
  24792. if (input.substr(peg$currPos, 2) === peg$c52) {
  24793. s1 = peg$c52;
  24794. peg$currPos += 2;
  24795. } else {
  24796. s1 = peg$FAILED;
  24797. if (peg$silentFails === 0) { peg$fail(peg$c53); }
  24798. }
  24799. if (s1 !== peg$FAILED) {
  24800. s2 = peg$parsewsLiteralArrayContents();
  24801. if (s2 !== peg$FAILED) {
  24802. s3 = peg$parsews();
  24803. if (s3 !== peg$FAILED) {
  24804. if (input.charCodeAt(peg$currPos) === 41) {
  24805. s4 = peg$c54;
  24806. peg$currPos++;
  24807. } else {
  24808. s4 = peg$FAILED;
  24809. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  24810. }
  24811. if (s4 !== peg$FAILED) {
  24812. peg$savedPos = s0;
  24813. s1 = peg$c56(s2);
  24814. s0 = s1;
  24815. } else {
  24816. peg$currPos = s0;
  24817. s0 = peg$FAILED;
  24818. }
  24819. } else {
  24820. peg$currPos = s0;
  24821. s0 = peg$FAILED;
  24822. }
  24823. } else {
  24824. peg$currPos = s0;
  24825. s0 = peg$FAILED;
  24826. }
  24827. } else {
  24828. peg$currPos = s0;
  24829. s0 = peg$FAILED;
  24830. }
  24831. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24832. return s0;
  24833. }
  24834. function peg$parsebareLiteralArray() {
  24835. var s0, s1, s2, s3, s4;
  24836. var key = peg$currPos * 61 + 19,
  24837. cached = peg$resultsCache[key];
  24838. if (cached) {
  24839. peg$currPos = cached.nextPos;
  24840. return cached.result;
  24841. }
  24842. s0 = peg$currPos;
  24843. if (input.charCodeAt(peg$currPos) === 40) {
  24844. s1 = peg$c57;
  24845. peg$currPos++;
  24846. } else {
  24847. s1 = peg$FAILED;
  24848. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  24849. }
  24850. if (s1 !== peg$FAILED) {
  24851. s2 = peg$parsewsLiteralArrayContents();
  24852. if (s2 !== peg$FAILED) {
  24853. s3 = peg$parsews();
  24854. if (s3 !== peg$FAILED) {
  24855. if (input.charCodeAt(peg$currPos) === 41) {
  24856. s4 = peg$c54;
  24857. peg$currPos++;
  24858. } else {
  24859. s4 = peg$FAILED;
  24860. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  24861. }
  24862. if (s4 !== peg$FAILED) {
  24863. peg$savedPos = s0;
  24864. s1 = peg$c56(s2);
  24865. s0 = s1;
  24866. } else {
  24867. peg$currPos = s0;
  24868. s0 = peg$FAILED;
  24869. }
  24870. } else {
  24871. peg$currPos = s0;
  24872. s0 = peg$FAILED;
  24873. }
  24874. } else {
  24875. peg$currPos = s0;
  24876. s0 = peg$FAILED;
  24877. }
  24878. } else {
  24879. peg$currPos = s0;
  24880. s0 = peg$FAILED;
  24881. }
  24882. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24883. return s0;
  24884. }
  24885. function peg$parseliteralArrayElement() {
  24886. var s0;
  24887. var key = peg$currPos * 61 + 20,
  24888. cached = peg$resultsCache[key];
  24889. if (cached) {
  24890. peg$currPos = cached.nextPos;
  24891. return cached.result;
  24892. }
  24893. s0 = peg$parseparseTimeLiteral();
  24894. if (s0 === peg$FAILED) {
  24895. s0 = peg$parsebareLiteralArray();
  24896. if (s0 === peg$FAILED) {
  24897. s0 = peg$parsebareSymbol();
  24898. }
  24899. }
  24900. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24901. return s0;
  24902. }
  24903. function peg$parsewsLiteralArrayContents() {
  24904. var s0, s1, s2, s3, s4;
  24905. var key = peg$currPos * 61 + 21,
  24906. cached = peg$resultsCache[key];
  24907. if (cached) {
  24908. peg$currPos = cached.nextPos;
  24909. return cached.result;
  24910. }
  24911. s0 = peg$currPos;
  24912. s1 = [];
  24913. s2 = peg$currPos;
  24914. s3 = peg$parsews();
  24915. if (s3 !== peg$FAILED) {
  24916. s4 = peg$parseliteralArrayElement();
  24917. if (s4 !== peg$FAILED) {
  24918. peg$savedPos = s2;
  24919. s3 = peg$c59(s4);
  24920. s2 = s3;
  24921. } else {
  24922. peg$currPos = s2;
  24923. s2 = peg$FAILED;
  24924. }
  24925. } else {
  24926. peg$currPos = s2;
  24927. s2 = peg$FAILED;
  24928. }
  24929. while (s2 !== peg$FAILED) {
  24930. s1.push(s2);
  24931. s2 = peg$currPos;
  24932. s3 = peg$parsews();
  24933. if (s3 !== peg$FAILED) {
  24934. s4 = peg$parseliteralArrayElement();
  24935. if (s4 !== peg$FAILED) {
  24936. peg$savedPos = s2;
  24937. s3 = peg$c59(s4);
  24938. s2 = s3;
  24939. } else {
  24940. peg$currPos = s2;
  24941. s2 = peg$FAILED;
  24942. }
  24943. } else {
  24944. peg$currPos = s2;
  24945. s2 = peg$FAILED;
  24946. }
  24947. }
  24948. if (s1 !== peg$FAILED) {
  24949. peg$savedPos = s0;
  24950. s1 = peg$c60(s1);
  24951. }
  24952. s0 = s1;
  24953. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  24954. return s0;
  24955. }
  24956. function peg$parsedynamicArray() {
  24957. var s0, s1, s2, s3, s4, s5;
  24958. var key = peg$currPos * 61 + 22,
  24959. cached = peg$resultsCache[key];
  24960. if (cached) {
  24961. peg$currPos = cached.nextPos;
  24962. return cached.result;
  24963. }
  24964. s0 = peg$currPos;
  24965. if (input.charCodeAt(peg$currPos) === 123) {
  24966. s1 = peg$c61;
  24967. peg$currPos++;
  24968. } else {
  24969. s1 = peg$FAILED;
  24970. if (peg$silentFails === 0) { peg$fail(peg$c62); }
  24971. }
  24972. if (s1 !== peg$FAILED) {
  24973. s2 = peg$parsews();
  24974. if (s2 !== peg$FAILED) {
  24975. s3 = peg$parseexpressions();
  24976. if (s3 === peg$FAILED) {
  24977. s3 = null;
  24978. }
  24979. if (s3 !== peg$FAILED) {
  24980. s4 = peg$parsemaybeDotsWs();
  24981. if (s4 !== peg$FAILED) {
  24982. if (input.charCodeAt(peg$currPos) === 125) {
  24983. s5 = peg$c63;
  24984. peg$currPos++;
  24985. } else {
  24986. s5 = peg$FAILED;
  24987. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  24988. }
  24989. if (s5 !== peg$FAILED) {
  24990. peg$savedPos = s0;
  24991. s1 = peg$c65(s3);
  24992. s0 = s1;
  24993. } else {
  24994. peg$currPos = s0;
  24995. s0 = peg$FAILED;
  24996. }
  24997. } else {
  24998. peg$currPos = s0;
  24999. s0 = peg$FAILED;
  25000. }
  25001. } else {
  25002. peg$currPos = s0;
  25003. s0 = peg$FAILED;
  25004. }
  25005. } else {
  25006. peg$currPos = s0;
  25007. s0 = peg$FAILED;
  25008. }
  25009. } else {
  25010. peg$currPos = s0;
  25011. s0 = peg$FAILED;
  25012. }
  25013. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25014. return s0;
  25015. }
  25016. function peg$parsedynamicDictionary() {
  25017. var s0, s1, s2, s3, s4, s5;
  25018. var key = peg$currPos * 61 + 23,
  25019. cached = peg$resultsCache[key];
  25020. if (cached) {
  25021. peg$currPos = cached.nextPos;
  25022. return cached.result;
  25023. }
  25024. s0 = peg$currPos;
  25025. if (input.substr(peg$currPos, 2) === peg$c66) {
  25026. s1 = peg$c66;
  25027. peg$currPos += 2;
  25028. } else {
  25029. s1 = peg$FAILED;
  25030. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  25031. }
  25032. if (s1 !== peg$FAILED) {
  25033. s2 = peg$parsews();
  25034. if (s2 !== peg$FAILED) {
  25035. s3 = peg$parseassociations();
  25036. if (s3 === peg$FAILED) {
  25037. s3 = null;
  25038. }
  25039. if (s3 !== peg$FAILED) {
  25040. s4 = peg$parsemaybeDotsWs();
  25041. if (s4 !== peg$FAILED) {
  25042. if (input.charCodeAt(peg$currPos) === 125) {
  25043. s5 = peg$c63;
  25044. peg$currPos++;
  25045. } else {
  25046. s5 = peg$FAILED;
  25047. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  25048. }
  25049. if (s5 !== peg$FAILED) {
  25050. peg$savedPos = s0;
  25051. s1 = peg$c68(s3);
  25052. s0 = s1;
  25053. } else {
  25054. peg$currPos = s0;
  25055. s0 = peg$FAILED;
  25056. }
  25057. } else {
  25058. peg$currPos = s0;
  25059. s0 = peg$FAILED;
  25060. }
  25061. } else {
  25062. peg$currPos = s0;
  25063. s0 = peg$FAILED;
  25064. }
  25065. } else {
  25066. peg$currPos = s0;
  25067. s0 = peg$FAILED;
  25068. }
  25069. } else {
  25070. peg$currPos = s0;
  25071. s0 = peg$FAILED;
  25072. }
  25073. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25074. return s0;
  25075. }
  25076. function peg$parsepseudoVariable() {
  25077. var s0, s1, s2;
  25078. var key = peg$currPos * 61 + 24,
  25079. cached = peg$resultsCache[key];
  25080. if (cached) {
  25081. peg$currPos = cached.nextPos;
  25082. return cached.result;
  25083. }
  25084. s0 = peg$currPos;
  25085. s1 = peg$currPos;
  25086. if (input.substr(peg$currPos, 4) === peg$c69) {
  25087. s2 = peg$c69;
  25088. peg$currPos += 4;
  25089. } else {
  25090. s2 = peg$FAILED;
  25091. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  25092. }
  25093. if (s2 !== peg$FAILED) {
  25094. peg$savedPos = s1;
  25095. s2 = peg$c71();
  25096. }
  25097. s1 = s2;
  25098. if (s1 === peg$FAILED) {
  25099. s1 = peg$currPos;
  25100. if (input.substr(peg$currPos, 5) === peg$c72) {
  25101. s2 = peg$c72;
  25102. peg$currPos += 5;
  25103. } else {
  25104. s2 = peg$FAILED;
  25105. if (peg$silentFails === 0) { peg$fail(peg$c73); }
  25106. }
  25107. if (s2 !== peg$FAILED) {
  25108. peg$savedPos = s1;
  25109. s2 = peg$c74();
  25110. }
  25111. s1 = s2;
  25112. if (s1 === peg$FAILED) {
  25113. s1 = peg$currPos;
  25114. if (input.substr(peg$currPos, 3) === peg$c75) {
  25115. s2 = peg$c75;
  25116. peg$currPos += 3;
  25117. } else {
  25118. s2 = peg$FAILED;
  25119. if (peg$silentFails === 0) { peg$fail(peg$c76); }
  25120. }
  25121. if (s2 !== peg$FAILED) {
  25122. peg$savedPos = s1;
  25123. s2 = peg$c77();
  25124. }
  25125. s1 = s2;
  25126. }
  25127. }
  25128. if (s1 !== peg$FAILED) {
  25129. peg$savedPos = s0;
  25130. s1 = peg$c78(s1);
  25131. }
  25132. s0 = s1;
  25133. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25134. return s0;
  25135. }
  25136. function peg$parseparseTimeLiteral() {
  25137. var s0;
  25138. var key = peg$currPos * 61 + 25,
  25139. cached = peg$resultsCache[key];
  25140. if (cached) {
  25141. peg$currPos = cached.nextPos;
  25142. return cached.result;
  25143. }
  25144. s0 = peg$parsepseudoVariable();
  25145. if (s0 === peg$FAILED) {
  25146. s0 = peg$parsenumber();
  25147. if (s0 === peg$FAILED) {
  25148. s0 = peg$parseliteralArray();
  25149. if (s0 === peg$FAILED) {
  25150. s0 = peg$parsestring();
  25151. if (s0 === peg$FAILED) {
  25152. s0 = peg$parsesymbol();
  25153. if (s0 === peg$FAILED) {
  25154. s0 = peg$parsecharacter();
  25155. }
  25156. }
  25157. }
  25158. }
  25159. }
  25160. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25161. return s0;
  25162. }
  25163. function peg$parseruntimeLiteral() {
  25164. var s0;
  25165. var key = peg$currPos * 61 + 26,
  25166. cached = peg$resultsCache[key];
  25167. if (cached) {
  25168. peg$currPos = cached.nextPos;
  25169. return cached.result;
  25170. }
  25171. s0 = peg$parsedynamicDictionary();
  25172. if (s0 === peg$FAILED) {
  25173. s0 = peg$parsedynamicArray();
  25174. if (s0 === peg$FAILED) {
  25175. s0 = peg$parseblock();
  25176. }
  25177. }
  25178. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25179. return s0;
  25180. }
  25181. function peg$parseliteral() {
  25182. var s0;
  25183. var key = peg$currPos * 61 + 27,
  25184. cached = peg$resultsCache[key];
  25185. if (cached) {
  25186. peg$currPos = cached.nextPos;
  25187. return cached.result;
  25188. }
  25189. s0 = peg$parseruntimeLiteral();
  25190. if (s0 === peg$FAILED) {
  25191. s0 = peg$parseparseTimeLiteral();
  25192. }
  25193. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25194. return s0;
  25195. }
  25196. function peg$parsevariable() {
  25197. var s0, s1;
  25198. var key = peg$currPos * 61 + 28,
  25199. cached = peg$resultsCache[key];
  25200. if (cached) {
  25201. peg$currPos = cached.nextPos;
  25202. return cached.result;
  25203. }
  25204. s0 = peg$currPos;
  25205. s1 = peg$parseidentifier();
  25206. if (s1 !== peg$FAILED) {
  25207. peg$savedPos = s0;
  25208. s1 = peg$c79(s1);
  25209. }
  25210. s0 = s1;
  25211. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25212. return s0;
  25213. }
  25214. function peg$parsebinarySelector() {
  25215. var s0, s1, s2;
  25216. var key = peg$currPos * 61 + 29,
  25217. cached = peg$resultsCache[key];
  25218. if (cached) {
  25219. peg$currPos = cached.nextPos;
  25220. return cached.result;
  25221. }
  25222. s0 = peg$currPos;
  25223. s1 = [];
  25224. if (peg$c80.test(input.charAt(peg$currPos))) {
  25225. s2 = input.charAt(peg$currPos);
  25226. peg$currPos++;
  25227. } else {
  25228. s2 = peg$FAILED;
  25229. if (peg$silentFails === 0) { peg$fail(peg$c81); }
  25230. }
  25231. if (s2 !== peg$FAILED) {
  25232. while (s2 !== peg$FAILED) {
  25233. s1.push(s2);
  25234. if (peg$c80.test(input.charAt(peg$currPos))) {
  25235. s2 = input.charAt(peg$currPos);
  25236. peg$currPos++;
  25237. } else {
  25238. s2 = peg$FAILED;
  25239. if (peg$silentFails === 0) { peg$fail(peg$c81); }
  25240. }
  25241. }
  25242. } else {
  25243. s1 = peg$FAILED;
  25244. }
  25245. if (s1 !== peg$FAILED) {
  25246. peg$savedPos = s0;
  25247. s1 = peg$c82(s1);
  25248. }
  25249. s0 = s1;
  25250. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25251. return s0;
  25252. }
  25253. function peg$parsewsKeywordPattern() {
  25254. var s0, s1, s2, s3, s4, s5, s6;
  25255. var key = peg$currPos * 61 + 30,
  25256. cached = peg$resultsCache[key];
  25257. if (cached) {
  25258. peg$currPos = cached.nextPos;
  25259. return cached.result;
  25260. }
  25261. s0 = peg$currPos;
  25262. s1 = [];
  25263. s2 = peg$currPos;
  25264. s3 = peg$parsews();
  25265. if (s3 !== peg$FAILED) {
  25266. s4 = peg$parsekeyword();
  25267. if (s4 !== peg$FAILED) {
  25268. s5 = peg$parsews();
  25269. if (s5 !== peg$FAILED) {
  25270. s6 = peg$parseidentifier();
  25271. if (s6 !== peg$FAILED) {
  25272. peg$savedPos = s2;
  25273. s3 = peg$c83(s4, s6);
  25274. s2 = s3;
  25275. } else {
  25276. peg$currPos = s2;
  25277. s2 = peg$FAILED;
  25278. }
  25279. } else {
  25280. peg$currPos = s2;
  25281. s2 = peg$FAILED;
  25282. }
  25283. } else {
  25284. peg$currPos = s2;
  25285. s2 = peg$FAILED;
  25286. }
  25287. } else {
  25288. peg$currPos = s2;
  25289. s2 = peg$FAILED;
  25290. }
  25291. if (s2 !== peg$FAILED) {
  25292. while (s2 !== peg$FAILED) {
  25293. s1.push(s2);
  25294. s2 = peg$currPos;
  25295. s3 = peg$parsews();
  25296. if (s3 !== peg$FAILED) {
  25297. s4 = peg$parsekeyword();
  25298. if (s4 !== peg$FAILED) {
  25299. s5 = peg$parsews();
  25300. if (s5 !== peg$FAILED) {
  25301. s6 = peg$parseidentifier();
  25302. if (s6 !== peg$FAILED) {
  25303. peg$savedPos = s2;
  25304. s3 = peg$c83(s4, s6);
  25305. s2 = s3;
  25306. } else {
  25307. peg$currPos = s2;
  25308. s2 = peg$FAILED;
  25309. }
  25310. } else {
  25311. peg$currPos = s2;
  25312. s2 = peg$FAILED;
  25313. }
  25314. } else {
  25315. peg$currPos = s2;
  25316. s2 = peg$FAILED;
  25317. }
  25318. } else {
  25319. peg$currPos = s2;
  25320. s2 = peg$FAILED;
  25321. }
  25322. }
  25323. } else {
  25324. s1 = peg$FAILED;
  25325. }
  25326. if (s1 !== peg$FAILED) {
  25327. peg$savedPos = s0;
  25328. s1 = peg$c84(s1);
  25329. }
  25330. s0 = s1;
  25331. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25332. return s0;
  25333. }
  25334. function peg$parsewsBinaryPattern() {
  25335. var s0, s1, s2, s3, s4;
  25336. var key = peg$currPos * 61 + 31,
  25337. cached = peg$resultsCache[key];
  25338. if (cached) {
  25339. peg$currPos = cached.nextPos;
  25340. return cached.result;
  25341. }
  25342. s0 = peg$currPos;
  25343. s1 = peg$parsews();
  25344. if (s1 !== peg$FAILED) {
  25345. s2 = peg$parsebinarySelector();
  25346. if (s2 !== peg$FAILED) {
  25347. s3 = peg$parsews();
  25348. if (s3 !== peg$FAILED) {
  25349. s4 = peg$parseidentifier();
  25350. if (s4 !== peg$FAILED) {
  25351. peg$savedPos = s0;
  25352. s1 = peg$c85(s2, s4);
  25353. s0 = s1;
  25354. } else {
  25355. peg$currPos = s0;
  25356. s0 = peg$FAILED;
  25357. }
  25358. } else {
  25359. peg$currPos = s0;
  25360. s0 = peg$FAILED;
  25361. }
  25362. } else {
  25363. peg$currPos = s0;
  25364. s0 = peg$FAILED;
  25365. }
  25366. } else {
  25367. peg$currPos = s0;
  25368. s0 = peg$FAILED;
  25369. }
  25370. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25371. return s0;
  25372. }
  25373. function peg$parsewsUnaryPattern() {
  25374. var s0, s1, s2;
  25375. var key = peg$currPos * 61 + 32,
  25376. cached = peg$resultsCache[key];
  25377. if (cached) {
  25378. peg$currPos = cached.nextPos;
  25379. return cached.result;
  25380. }
  25381. s0 = peg$currPos;
  25382. s1 = peg$parsews();
  25383. if (s1 !== peg$FAILED) {
  25384. s2 = peg$parseidentifier();
  25385. if (s2 !== peg$FAILED) {
  25386. peg$savedPos = s0;
  25387. s1 = peg$c86(s2);
  25388. s0 = s1;
  25389. } else {
  25390. peg$currPos = s0;
  25391. s0 = peg$FAILED;
  25392. }
  25393. } else {
  25394. peg$currPos = s0;
  25395. s0 = peg$FAILED;
  25396. }
  25397. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25398. return s0;
  25399. }
  25400. function peg$parseexpression() {
  25401. var s0;
  25402. var key = peg$currPos * 61 + 33,
  25403. cached = peg$resultsCache[key];
  25404. if (cached) {
  25405. peg$currPos = cached.nextPos;
  25406. return cached.result;
  25407. }
  25408. s0 = peg$parseassignment();
  25409. if (s0 === peg$FAILED) {
  25410. s0 = peg$parsecascade();
  25411. if (s0 === peg$FAILED) {
  25412. s0 = peg$parsekeywordSend();
  25413. }
  25414. }
  25415. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25416. return s0;
  25417. }
  25418. function peg$parsewsExpressionsRest() {
  25419. var s0, s1, s2, s3, s4;
  25420. var key = peg$currPos * 61 + 34,
  25421. cached = peg$resultsCache[key];
  25422. if (cached) {
  25423. peg$currPos = cached.nextPos;
  25424. return cached.result;
  25425. }
  25426. s0 = peg$currPos;
  25427. s1 = peg$parsews();
  25428. if (s1 !== peg$FAILED) {
  25429. if (input.charCodeAt(peg$currPos) === 46) {
  25430. s2 = peg$c6;
  25431. peg$currPos++;
  25432. } else {
  25433. s2 = peg$FAILED;
  25434. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  25435. }
  25436. if (s2 !== peg$FAILED) {
  25437. s3 = peg$parsemaybeDotsWs();
  25438. if (s3 !== peg$FAILED) {
  25439. s4 = peg$parseexpression();
  25440. if (s4 !== peg$FAILED) {
  25441. peg$savedPos = s0;
  25442. s1 = peg$c87(s4);
  25443. s0 = s1;
  25444. } else {
  25445. peg$currPos = s0;
  25446. s0 = peg$FAILED;
  25447. }
  25448. } else {
  25449. peg$currPos = s0;
  25450. s0 = peg$FAILED;
  25451. }
  25452. } else {
  25453. peg$currPos = s0;
  25454. s0 = peg$FAILED;
  25455. }
  25456. } else {
  25457. peg$currPos = s0;
  25458. s0 = peg$FAILED;
  25459. }
  25460. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25461. return s0;
  25462. }
  25463. function peg$parseexpressions() {
  25464. var s0, s1, s2, s3;
  25465. var key = peg$currPos * 61 + 35,
  25466. cached = peg$resultsCache[key];
  25467. if (cached) {
  25468. peg$currPos = cached.nextPos;
  25469. return cached.result;
  25470. }
  25471. s0 = peg$currPos;
  25472. s1 = peg$parseexpression();
  25473. if (s1 !== peg$FAILED) {
  25474. s2 = [];
  25475. s3 = peg$parsewsExpressionsRest();
  25476. while (s3 !== peg$FAILED) {
  25477. s2.push(s3);
  25478. s3 = peg$parsewsExpressionsRest();
  25479. }
  25480. if (s2 !== peg$FAILED) {
  25481. peg$savedPos = s0;
  25482. s1 = peg$c88(s1, s2);
  25483. s0 = s1;
  25484. } else {
  25485. peg$currPos = s0;
  25486. s0 = peg$FAILED;
  25487. }
  25488. } else {
  25489. peg$currPos = s0;
  25490. s0 = peg$FAILED;
  25491. }
  25492. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25493. return s0;
  25494. }
  25495. function peg$parseassignment() {
  25496. var s0, s1, s2, s3, s4, s5;
  25497. var key = peg$currPos * 61 + 36,
  25498. cached = peg$resultsCache[key];
  25499. if (cached) {
  25500. peg$currPos = cached.nextPos;
  25501. return cached.result;
  25502. }
  25503. s0 = peg$currPos;
  25504. s1 = peg$parsevariable();
  25505. if (s1 !== peg$FAILED) {
  25506. s2 = peg$parsews();
  25507. if (s2 !== peg$FAILED) {
  25508. if (input.substr(peg$currPos, 2) === peg$c89) {
  25509. s3 = peg$c89;
  25510. peg$currPos += 2;
  25511. } else {
  25512. s3 = peg$FAILED;
  25513. if (peg$silentFails === 0) { peg$fail(peg$c90); }
  25514. }
  25515. if (s3 !== peg$FAILED) {
  25516. s4 = peg$parsews();
  25517. if (s4 !== peg$FAILED) {
  25518. s5 = peg$parseexpression();
  25519. if (s5 !== peg$FAILED) {
  25520. peg$savedPos = s0;
  25521. s1 = peg$c91(s1, s5);
  25522. s0 = s1;
  25523. } else {
  25524. peg$currPos = s0;
  25525. s0 = peg$FAILED;
  25526. }
  25527. } else {
  25528. peg$currPos = s0;
  25529. s0 = peg$FAILED;
  25530. }
  25531. } else {
  25532. peg$currPos = s0;
  25533. s0 = peg$FAILED;
  25534. }
  25535. } else {
  25536. peg$currPos = s0;
  25537. s0 = peg$FAILED;
  25538. }
  25539. } else {
  25540. peg$currPos = s0;
  25541. s0 = peg$FAILED;
  25542. }
  25543. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25544. return s0;
  25545. }
  25546. function peg$parseret() {
  25547. var s0, s1, s2, s3;
  25548. var key = peg$currPos * 61 + 37,
  25549. cached = peg$resultsCache[key];
  25550. if (cached) {
  25551. peg$currPos = cached.nextPos;
  25552. return cached.result;
  25553. }
  25554. s0 = peg$currPos;
  25555. if (input.charCodeAt(peg$currPos) === 94) {
  25556. s1 = peg$c92;
  25557. peg$currPos++;
  25558. } else {
  25559. s1 = peg$FAILED;
  25560. if (peg$silentFails === 0) { peg$fail(peg$c93); }
  25561. }
  25562. if (s1 !== peg$FAILED) {
  25563. s2 = peg$parsews();
  25564. if (s2 !== peg$FAILED) {
  25565. s3 = peg$parseexpression();
  25566. if (s3 !== peg$FAILED) {
  25567. peg$savedPos = s0;
  25568. s1 = peg$c94(s3);
  25569. s0 = s1;
  25570. } else {
  25571. peg$currPos = s0;
  25572. s0 = peg$FAILED;
  25573. }
  25574. } else {
  25575. peg$currPos = s0;
  25576. s0 = peg$FAILED;
  25577. }
  25578. } else {
  25579. peg$currPos = s0;
  25580. s0 = peg$FAILED;
  25581. }
  25582. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25583. return s0;
  25584. }
  25585. function peg$parsetemps() {
  25586. var s0, s1, s2, s3, s4, s5;
  25587. var key = peg$currPos * 61 + 38,
  25588. cached = peg$resultsCache[key];
  25589. if (cached) {
  25590. peg$currPos = cached.nextPos;
  25591. return cached.result;
  25592. }
  25593. s0 = peg$currPos;
  25594. if (input.charCodeAt(peg$currPos) === 124) {
  25595. s1 = peg$c95;
  25596. peg$currPos++;
  25597. } else {
  25598. s1 = peg$FAILED;
  25599. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  25600. }
  25601. if (s1 !== peg$FAILED) {
  25602. s2 = [];
  25603. s3 = peg$currPos;
  25604. s4 = peg$parsews();
  25605. if (s4 !== peg$FAILED) {
  25606. s5 = peg$parseidentifier();
  25607. if (s5 !== peg$FAILED) {
  25608. peg$savedPos = s3;
  25609. s4 = peg$c97(s5);
  25610. s3 = s4;
  25611. } else {
  25612. peg$currPos = s3;
  25613. s3 = peg$FAILED;
  25614. }
  25615. } else {
  25616. peg$currPos = s3;
  25617. s3 = peg$FAILED;
  25618. }
  25619. while (s3 !== peg$FAILED) {
  25620. s2.push(s3);
  25621. s3 = peg$currPos;
  25622. s4 = peg$parsews();
  25623. if (s4 !== peg$FAILED) {
  25624. s5 = peg$parseidentifier();
  25625. if (s5 !== peg$FAILED) {
  25626. peg$savedPos = s3;
  25627. s4 = peg$c97(s5);
  25628. s3 = s4;
  25629. } else {
  25630. peg$currPos = s3;
  25631. s3 = peg$FAILED;
  25632. }
  25633. } else {
  25634. peg$currPos = s3;
  25635. s3 = peg$FAILED;
  25636. }
  25637. }
  25638. if (s2 !== peg$FAILED) {
  25639. s3 = peg$parsews();
  25640. if (s3 !== peg$FAILED) {
  25641. if (input.charCodeAt(peg$currPos) === 124) {
  25642. s4 = peg$c95;
  25643. peg$currPos++;
  25644. } else {
  25645. s4 = peg$FAILED;
  25646. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  25647. }
  25648. if (s4 !== peg$FAILED) {
  25649. peg$savedPos = s0;
  25650. s1 = peg$c98(s2);
  25651. s0 = s1;
  25652. } else {
  25653. peg$currPos = s0;
  25654. s0 = peg$FAILED;
  25655. }
  25656. } else {
  25657. peg$currPos = s0;
  25658. s0 = peg$FAILED;
  25659. }
  25660. } else {
  25661. peg$currPos = s0;
  25662. s0 = peg$FAILED;
  25663. }
  25664. } else {
  25665. peg$currPos = s0;
  25666. s0 = peg$FAILED;
  25667. }
  25668. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25669. return s0;
  25670. }
  25671. function peg$parsewsBlockParamList() {
  25672. var s0, s1, s2, s3, s4, s5, s6;
  25673. var key = peg$currPos * 61 + 39,
  25674. cached = peg$resultsCache[key];
  25675. if (cached) {
  25676. peg$currPos = cached.nextPos;
  25677. return cached.result;
  25678. }
  25679. s0 = peg$currPos;
  25680. s1 = [];
  25681. s2 = peg$currPos;
  25682. s3 = peg$parsews();
  25683. if (s3 !== peg$FAILED) {
  25684. if (input.charCodeAt(peg$currPos) === 58) {
  25685. s4 = peg$c13;
  25686. peg$currPos++;
  25687. } else {
  25688. s4 = peg$FAILED;
  25689. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25690. }
  25691. if (s4 !== peg$FAILED) {
  25692. s5 = peg$parsews();
  25693. if (s5 !== peg$FAILED) {
  25694. s6 = peg$parseidentifier();
  25695. if (s6 !== peg$FAILED) {
  25696. peg$savedPos = s2;
  25697. s3 = peg$c99(s6);
  25698. s2 = s3;
  25699. } else {
  25700. peg$currPos = s2;
  25701. s2 = peg$FAILED;
  25702. }
  25703. } else {
  25704. peg$currPos = s2;
  25705. s2 = peg$FAILED;
  25706. }
  25707. } else {
  25708. peg$currPos = s2;
  25709. s2 = peg$FAILED;
  25710. }
  25711. } else {
  25712. peg$currPos = s2;
  25713. s2 = peg$FAILED;
  25714. }
  25715. if (s2 !== peg$FAILED) {
  25716. while (s2 !== peg$FAILED) {
  25717. s1.push(s2);
  25718. s2 = peg$currPos;
  25719. s3 = peg$parsews();
  25720. if (s3 !== peg$FAILED) {
  25721. if (input.charCodeAt(peg$currPos) === 58) {
  25722. s4 = peg$c13;
  25723. peg$currPos++;
  25724. } else {
  25725. s4 = peg$FAILED;
  25726. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  25727. }
  25728. if (s4 !== peg$FAILED) {
  25729. s5 = peg$parsews();
  25730. if (s5 !== peg$FAILED) {
  25731. s6 = peg$parseidentifier();
  25732. if (s6 !== peg$FAILED) {
  25733. peg$savedPos = s2;
  25734. s3 = peg$c99(s6);
  25735. s2 = s3;
  25736. } else {
  25737. peg$currPos = s2;
  25738. s2 = peg$FAILED;
  25739. }
  25740. } else {
  25741. peg$currPos = s2;
  25742. s2 = peg$FAILED;
  25743. }
  25744. } else {
  25745. peg$currPos = s2;
  25746. s2 = peg$FAILED;
  25747. }
  25748. } else {
  25749. peg$currPos = s2;
  25750. s2 = peg$FAILED;
  25751. }
  25752. }
  25753. } else {
  25754. s1 = peg$FAILED;
  25755. }
  25756. if (s1 !== peg$FAILED) {
  25757. s2 = peg$parsews();
  25758. if (s2 !== peg$FAILED) {
  25759. if (input.charCodeAt(peg$currPos) === 124) {
  25760. s3 = peg$c95;
  25761. peg$currPos++;
  25762. } else {
  25763. s3 = peg$FAILED;
  25764. if (peg$silentFails === 0) { peg$fail(peg$c96); }
  25765. }
  25766. if (s3 !== peg$FAILED) {
  25767. peg$savedPos = s0;
  25768. s1 = peg$c100(s1);
  25769. s0 = s1;
  25770. } else {
  25771. peg$currPos = s0;
  25772. s0 = peg$FAILED;
  25773. }
  25774. } else {
  25775. peg$currPos = s0;
  25776. s0 = peg$FAILED;
  25777. }
  25778. } else {
  25779. peg$currPos = s0;
  25780. s0 = peg$FAILED;
  25781. }
  25782. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25783. return s0;
  25784. }
  25785. function peg$parsesubexpression() {
  25786. var s0, s1, s2, s3, s4, s5;
  25787. var key = peg$currPos * 61 + 40,
  25788. cached = peg$resultsCache[key];
  25789. if (cached) {
  25790. peg$currPos = cached.nextPos;
  25791. return cached.result;
  25792. }
  25793. s0 = peg$currPos;
  25794. if (input.charCodeAt(peg$currPos) === 40) {
  25795. s1 = peg$c57;
  25796. peg$currPos++;
  25797. } else {
  25798. s1 = peg$FAILED;
  25799. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  25800. }
  25801. if (s1 !== peg$FAILED) {
  25802. s2 = peg$parsews();
  25803. if (s2 !== peg$FAILED) {
  25804. s3 = peg$parseexpression();
  25805. if (s3 !== peg$FAILED) {
  25806. s4 = peg$parsews();
  25807. if (s4 !== peg$FAILED) {
  25808. if (input.charCodeAt(peg$currPos) === 41) {
  25809. s5 = peg$c54;
  25810. peg$currPos++;
  25811. } else {
  25812. s5 = peg$FAILED;
  25813. if (peg$silentFails === 0) { peg$fail(peg$c55); }
  25814. }
  25815. if (s5 !== peg$FAILED) {
  25816. peg$savedPos = s0;
  25817. s1 = peg$c87(s3);
  25818. s0 = s1;
  25819. } else {
  25820. peg$currPos = s0;
  25821. s0 = peg$FAILED;
  25822. }
  25823. } else {
  25824. peg$currPos = s0;
  25825. s0 = peg$FAILED;
  25826. }
  25827. } else {
  25828. peg$currPos = s0;
  25829. s0 = peg$FAILED;
  25830. }
  25831. } else {
  25832. peg$currPos = s0;
  25833. s0 = peg$FAILED;
  25834. }
  25835. } else {
  25836. peg$currPos = s0;
  25837. s0 = peg$FAILED;
  25838. }
  25839. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25840. return s0;
  25841. }
  25842. function peg$parsestatementsWs() {
  25843. var s0, s1, s2, s3, s4, s5, s6;
  25844. var key = peg$currPos * 61 + 41,
  25845. cached = peg$resultsCache[key];
  25846. if (cached) {
  25847. peg$currPos = cached.nextPos;
  25848. return cached.result;
  25849. }
  25850. s0 = peg$currPos;
  25851. s1 = peg$parseret();
  25852. if (s1 !== peg$FAILED) {
  25853. s2 = peg$parsemaybeDotsWs();
  25854. if (s2 !== peg$FAILED) {
  25855. peg$savedPos = s0;
  25856. s1 = peg$c101(s1);
  25857. s0 = s1;
  25858. } else {
  25859. peg$currPos = s0;
  25860. s0 = peg$FAILED;
  25861. }
  25862. } else {
  25863. peg$currPos = s0;
  25864. s0 = peg$FAILED;
  25865. }
  25866. if (s0 === peg$FAILED) {
  25867. s0 = peg$currPos;
  25868. s1 = peg$parseexpressions();
  25869. if (s1 !== peg$FAILED) {
  25870. s2 = peg$parsews();
  25871. if (s2 !== peg$FAILED) {
  25872. if (input.charCodeAt(peg$currPos) === 46) {
  25873. s3 = peg$c6;
  25874. peg$currPos++;
  25875. } else {
  25876. s3 = peg$FAILED;
  25877. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  25878. }
  25879. if (s3 !== peg$FAILED) {
  25880. s4 = peg$parsemaybeDotsWs();
  25881. if (s4 !== peg$FAILED) {
  25882. s5 = peg$parseret();
  25883. if (s5 !== peg$FAILED) {
  25884. s6 = peg$parsemaybeDotsWs();
  25885. if (s6 !== peg$FAILED) {
  25886. peg$savedPos = s0;
  25887. s1 = peg$c102(s1, s5);
  25888. s0 = s1;
  25889. } else {
  25890. peg$currPos = s0;
  25891. s0 = peg$FAILED;
  25892. }
  25893. } else {
  25894. peg$currPos = s0;
  25895. s0 = peg$FAILED;
  25896. }
  25897. } else {
  25898. peg$currPos = s0;
  25899. s0 = peg$FAILED;
  25900. }
  25901. } else {
  25902. peg$currPos = s0;
  25903. s0 = peg$FAILED;
  25904. }
  25905. } else {
  25906. peg$currPos = s0;
  25907. s0 = peg$FAILED;
  25908. }
  25909. } else {
  25910. peg$currPos = s0;
  25911. s0 = peg$FAILED;
  25912. }
  25913. if (s0 === peg$FAILED) {
  25914. s0 = peg$currPos;
  25915. s1 = peg$parseexpressions();
  25916. if (s1 === peg$FAILED) {
  25917. s1 = null;
  25918. }
  25919. if (s1 !== peg$FAILED) {
  25920. s2 = peg$parsemaybeDotsWs();
  25921. if (s2 !== peg$FAILED) {
  25922. peg$savedPos = s0;
  25923. s1 = peg$c103(s1);
  25924. s0 = s1;
  25925. } else {
  25926. peg$currPos = s0;
  25927. s0 = peg$FAILED;
  25928. }
  25929. } else {
  25930. peg$currPos = s0;
  25931. s0 = peg$FAILED;
  25932. }
  25933. }
  25934. }
  25935. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25936. return s0;
  25937. }
  25938. function peg$parsewsSequenceWs() {
  25939. var s0, s1, s2, s3;
  25940. var key = peg$currPos * 61 + 42,
  25941. cached = peg$resultsCache[key];
  25942. if (cached) {
  25943. peg$currPos = cached.nextPos;
  25944. return cached.result;
  25945. }
  25946. s0 = peg$currPos;
  25947. s1 = peg$parsews();
  25948. if (s1 !== peg$FAILED) {
  25949. s2 = peg$parsejsStatement();
  25950. if (s2 !== peg$FAILED) {
  25951. s3 = peg$parsews();
  25952. if (s3 !== peg$FAILED) {
  25953. peg$savedPos = s0;
  25954. s1 = peg$c104(s2);
  25955. s0 = s1;
  25956. } else {
  25957. peg$currPos = s0;
  25958. s0 = peg$FAILED;
  25959. }
  25960. } else {
  25961. peg$currPos = s0;
  25962. s0 = peg$FAILED;
  25963. }
  25964. } else {
  25965. peg$currPos = s0;
  25966. s0 = peg$FAILED;
  25967. }
  25968. if (s0 === peg$FAILED) {
  25969. s0 = peg$parsewsStSequenceWs();
  25970. }
  25971. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  25972. return s0;
  25973. }
  25974. function peg$parsewsStSequenceWs() {
  25975. var s0, s1, s2, s3, s4;
  25976. var key = peg$currPos * 61 + 43,
  25977. cached = peg$resultsCache[key];
  25978. if (cached) {
  25979. peg$currPos = cached.nextPos;
  25980. return cached.result;
  25981. }
  25982. s0 = peg$currPos;
  25983. s1 = peg$parsews();
  25984. if (s1 !== peg$FAILED) {
  25985. s2 = peg$parsetemps();
  25986. if (s2 === peg$FAILED) {
  25987. s2 = null;
  25988. }
  25989. if (s2 !== peg$FAILED) {
  25990. s3 = peg$parsemaybeDotsWs();
  25991. if (s3 !== peg$FAILED) {
  25992. s4 = peg$parsestatementsWs();
  25993. if (s4 === peg$FAILED) {
  25994. s4 = null;
  25995. }
  25996. if (s4 !== peg$FAILED) {
  25997. peg$savedPos = s0;
  25998. s1 = peg$c105(s2, s4);
  25999. s0 = s1;
  26000. } else {
  26001. peg$currPos = s0;
  26002. s0 = peg$FAILED;
  26003. }
  26004. } else {
  26005. peg$currPos = s0;
  26006. s0 = peg$FAILED;
  26007. }
  26008. } else {
  26009. peg$currPos = s0;
  26010. s0 = peg$FAILED;
  26011. }
  26012. } else {
  26013. peg$currPos = s0;
  26014. s0 = peg$FAILED;
  26015. }
  26016. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26017. return s0;
  26018. }
  26019. function peg$parseblock() {
  26020. var s0, s1, s2, s3, s4;
  26021. var key = peg$currPos * 61 + 44,
  26022. cached = peg$resultsCache[key];
  26023. if (cached) {
  26024. peg$currPos = cached.nextPos;
  26025. return cached.result;
  26026. }
  26027. s0 = peg$currPos;
  26028. if (input.charCodeAt(peg$currPos) === 91) {
  26029. s1 = peg$c106;
  26030. peg$currPos++;
  26031. } else {
  26032. s1 = peg$FAILED;
  26033. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  26034. }
  26035. if (s1 !== peg$FAILED) {
  26036. s2 = peg$parsewsBlockParamList();
  26037. if (s2 === peg$FAILED) {
  26038. s2 = null;
  26039. }
  26040. if (s2 !== peg$FAILED) {
  26041. s3 = peg$parsewsSequenceWs();
  26042. if (s3 === peg$FAILED) {
  26043. s3 = null;
  26044. }
  26045. if (s3 !== peg$FAILED) {
  26046. if (input.charCodeAt(peg$currPos) === 93) {
  26047. s4 = peg$c108;
  26048. peg$currPos++;
  26049. } else {
  26050. s4 = peg$FAILED;
  26051. if (peg$silentFails === 0) { peg$fail(peg$c109); }
  26052. }
  26053. if (s4 !== peg$FAILED) {
  26054. peg$savedPos = s0;
  26055. s1 = peg$c110(s2, s3);
  26056. s0 = s1;
  26057. } else {
  26058. peg$currPos = s0;
  26059. s0 = peg$FAILED;
  26060. }
  26061. } else {
  26062. peg$currPos = s0;
  26063. s0 = peg$FAILED;
  26064. }
  26065. } else {
  26066. peg$currPos = s0;
  26067. s0 = peg$FAILED;
  26068. }
  26069. } else {
  26070. peg$currPos = s0;
  26071. s0 = peg$FAILED;
  26072. }
  26073. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26074. return s0;
  26075. }
  26076. function peg$parseoperand() {
  26077. var s0;
  26078. var key = peg$currPos * 61 + 45,
  26079. cached = peg$resultsCache[key];
  26080. if (cached) {
  26081. peg$currPos = cached.nextPos;
  26082. return cached.result;
  26083. }
  26084. s0 = peg$parseliteral();
  26085. if (s0 === peg$FAILED) {
  26086. s0 = peg$parsevariable();
  26087. if (s0 === peg$FAILED) {
  26088. s0 = peg$parsesubexpression();
  26089. }
  26090. }
  26091. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26092. return s0;
  26093. }
  26094. function peg$parsewsUnaryMessage() {
  26095. var s0, s1, s2, s3, s4;
  26096. var key = peg$currPos * 61 + 46,
  26097. cached = peg$resultsCache[key];
  26098. if (cached) {
  26099. peg$currPos = cached.nextPos;
  26100. return cached.result;
  26101. }
  26102. s0 = peg$currPos;
  26103. s1 = peg$parsews();
  26104. if (s1 !== peg$FAILED) {
  26105. s2 = peg$parseidentifier();
  26106. if (s2 !== peg$FAILED) {
  26107. s3 = peg$currPos;
  26108. peg$silentFails++;
  26109. if (input.charCodeAt(peg$currPos) === 58) {
  26110. s4 = peg$c13;
  26111. peg$currPos++;
  26112. } else {
  26113. s4 = peg$FAILED;
  26114. if (peg$silentFails === 0) { peg$fail(peg$c14); }
  26115. }
  26116. peg$silentFails--;
  26117. if (s4 === peg$FAILED) {
  26118. s3 = void 0;
  26119. } else {
  26120. peg$currPos = s3;
  26121. s3 = peg$FAILED;
  26122. }
  26123. if (s3 !== peg$FAILED) {
  26124. peg$savedPos = s0;
  26125. s1 = peg$c111(s2);
  26126. s0 = s1;
  26127. } else {
  26128. peg$currPos = s0;
  26129. s0 = peg$FAILED;
  26130. }
  26131. } else {
  26132. peg$currPos = s0;
  26133. s0 = peg$FAILED;
  26134. }
  26135. } else {
  26136. peg$currPos = s0;
  26137. s0 = peg$FAILED;
  26138. }
  26139. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26140. return s0;
  26141. }
  26142. function peg$parsewsUnaryTail() {
  26143. var s0, s1, s2;
  26144. var key = peg$currPos * 61 + 47,
  26145. cached = peg$resultsCache[key];
  26146. if (cached) {
  26147. peg$currPos = cached.nextPos;
  26148. return cached.result;
  26149. }
  26150. s0 = peg$currPos;
  26151. s1 = peg$parsewsUnaryMessage();
  26152. if (s1 !== peg$FAILED) {
  26153. s2 = peg$parsewsUnaryTail();
  26154. if (s2 === peg$FAILED) {
  26155. s2 = null;
  26156. }
  26157. if (s2 !== peg$FAILED) {
  26158. peg$savedPos = s0;
  26159. s1 = peg$c112(s1, s2);
  26160. s0 = s1;
  26161. } else {
  26162. peg$currPos = s0;
  26163. s0 = peg$FAILED;
  26164. }
  26165. } else {
  26166. peg$currPos = s0;
  26167. s0 = peg$FAILED;
  26168. }
  26169. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26170. return s0;
  26171. }
  26172. function peg$parseunarySend() {
  26173. var s0, s1, s2;
  26174. var key = peg$currPos * 61 + 48,
  26175. cached = peg$resultsCache[key];
  26176. if (cached) {
  26177. peg$currPos = cached.nextPos;
  26178. return cached.result;
  26179. }
  26180. s0 = peg$currPos;
  26181. s1 = peg$parseoperand();
  26182. if (s1 !== peg$FAILED) {
  26183. s2 = peg$parsewsUnaryTail();
  26184. if (s2 === peg$FAILED) {
  26185. s2 = null;
  26186. }
  26187. if (s2 !== peg$FAILED) {
  26188. peg$savedPos = s0;
  26189. s1 = peg$c113(s1, s2);
  26190. s0 = s1;
  26191. } else {
  26192. peg$currPos = s0;
  26193. s0 = peg$FAILED;
  26194. }
  26195. } else {
  26196. peg$currPos = s0;
  26197. s0 = peg$FAILED;
  26198. }
  26199. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26200. return s0;
  26201. }
  26202. function peg$parsewsBinaryMessage() {
  26203. var s0, s1, s2, s3, s4;
  26204. var key = peg$currPos * 61 + 49,
  26205. cached = peg$resultsCache[key];
  26206. if (cached) {
  26207. peg$currPos = cached.nextPos;
  26208. return cached.result;
  26209. }
  26210. s0 = peg$currPos;
  26211. s1 = peg$parsews();
  26212. if (s1 !== peg$FAILED) {
  26213. s2 = peg$parsebinarySelector();
  26214. if (s2 !== peg$FAILED) {
  26215. s3 = peg$parsews();
  26216. if (s3 !== peg$FAILED) {
  26217. s4 = peg$parseunarySend();
  26218. if (s4 !== peg$FAILED) {
  26219. peg$savedPos = s0;
  26220. s1 = peg$c114(s2, s4);
  26221. s0 = s1;
  26222. } else {
  26223. peg$currPos = s0;
  26224. s0 = peg$FAILED;
  26225. }
  26226. } else {
  26227. peg$currPos = s0;
  26228. s0 = peg$FAILED;
  26229. }
  26230. } else {
  26231. peg$currPos = s0;
  26232. s0 = peg$FAILED;
  26233. }
  26234. } else {
  26235. peg$currPos = s0;
  26236. s0 = peg$FAILED;
  26237. }
  26238. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26239. return s0;
  26240. }
  26241. function peg$parsewsBinaryTail() {
  26242. var s0, s1, s2;
  26243. var key = peg$currPos * 61 + 50,
  26244. cached = peg$resultsCache[key];
  26245. if (cached) {
  26246. peg$currPos = cached.nextPos;
  26247. return cached.result;
  26248. }
  26249. s0 = peg$currPos;
  26250. s1 = peg$parsewsBinaryMessage();
  26251. if (s1 !== peg$FAILED) {
  26252. s2 = peg$parsewsBinaryTail();
  26253. if (s2 === peg$FAILED) {
  26254. s2 = null;
  26255. }
  26256. if (s2 !== peg$FAILED) {
  26257. peg$savedPos = s0;
  26258. s1 = peg$c115(s1, s2);
  26259. s0 = s1;
  26260. } else {
  26261. peg$currPos = s0;
  26262. s0 = peg$FAILED;
  26263. }
  26264. } else {
  26265. peg$currPos = s0;
  26266. s0 = peg$FAILED;
  26267. }
  26268. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26269. return s0;
  26270. }
  26271. function peg$parsebinarySend() {
  26272. var s0, s1, s2;
  26273. var key = peg$currPos * 61 + 51,
  26274. cached = peg$resultsCache[key];
  26275. if (cached) {
  26276. peg$currPos = cached.nextPos;
  26277. return cached.result;
  26278. }
  26279. s0 = peg$currPos;
  26280. s1 = peg$parseunarySend();
  26281. if (s1 !== peg$FAILED) {
  26282. s2 = peg$parsewsBinaryTail();
  26283. if (s2 === peg$FAILED) {
  26284. s2 = null;
  26285. }
  26286. if (s2 !== peg$FAILED) {
  26287. peg$savedPos = s0;
  26288. s1 = peg$c113(s1, s2);
  26289. s0 = s1;
  26290. } else {
  26291. peg$currPos = s0;
  26292. s0 = peg$FAILED;
  26293. }
  26294. } else {
  26295. peg$currPos = s0;
  26296. s0 = peg$FAILED;
  26297. }
  26298. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26299. return s0;
  26300. }
  26301. function peg$parsewsKeywordMessage() {
  26302. var s0, s1, s2, s3, s4, s5, s6;
  26303. var key = peg$currPos * 61 + 52,
  26304. cached = peg$resultsCache[key];
  26305. if (cached) {
  26306. peg$currPos = cached.nextPos;
  26307. return cached.result;
  26308. }
  26309. s0 = peg$currPos;
  26310. s1 = [];
  26311. s2 = peg$currPos;
  26312. s3 = peg$parsews();
  26313. if (s3 !== peg$FAILED) {
  26314. s4 = peg$parsekeyword();
  26315. if (s4 !== peg$FAILED) {
  26316. s5 = peg$parsews();
  26317. if (s5 !== peg$FAILED) {
  26318. s6 = peg$parsebinarySend();
  26319. if (s6 !== peg$FAILED) {
  26320. peg$savedPos = s2;
  26321. s3 = peg$c83(s4, s6);
  26322. s2 = s3;
  26323. } else {
  26324. peg$currPos = s2;
  26325. s2 = peg$FAILED;
  26326. }
  26327. } else {
  26328. peg$currPos = s2;
  26329. s2 = peg$FAILED;
  26330. }
  26331. } else {
  26332. peg$currPos = s2;
  26333. s2 = peg$FAILED;
  26334. }
  26335. } else {
  26336. peg$currPos = s2;
  26337. s2 = peg$FAILED;
  26338. }
  26339. if (s2 !== peg$FAILED) {
  26340. while (s2 !== peg$FAILED) {
  26341. s1.push(s2);
  26342. s2 = peg$currPos;
  26343. s3 = peg$parsews();
  26344. if (s3 !== peg$FAILED) {
  26345. s4 = peg$parsekeyword();
  26346. if (s4 !== peg$FAILED) {
  26347. s5 = peg$parsews();
  26348. if (s5 !== peg$FAILED) {
  26349. s6 = peg$parsebinarySend();
  26350. if (s6 !== peg$FAILED) {
  26351. peg$savedPos = s2;
  26352. s3 = peg$c83(s4, s6);
  26353. s2 = s3;
  26354. } else {
  26355. peg$currPos = s2;
  26356. s2 = peg$FAILED;
  26357. }
  26358. } else {
  26359. peg$currPos = s2;
  26360. s2 = peg$FAILED;
  26361. }
  26362. } else {
  26363. peg$currPos = s2;
  26364. s2 = peg$FAILED;
  26365. }
  26366. } else {
  26367. peg$currPos = s2;
  26368. s2 = peg$FAILED;
  26369. }
  26370. }
  26371. } else {
  26372. s1 = peg$FAILED;
  26373. }
  26374. if (s1 !== peg$FAILED) {
  26375. peg$savedPos = s0;
  26376. s1 = peg$c116(s1);
  26377. }
  26378. s0 = s1;
  26379. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26380. return s0;
  26381. }
  26382. function peg$parsekeywordSend() {
  26383. var s0, s1, s2;
  26384. var key = peg$currPos * 61 + 53,
  26385. cached = peg$resultsCache[key];
  26386. if (cached) {
  26387. peg$currPos = cached.nextPos;
  26388. return cached.result;
  26389. }
  26390. s0 = peg$currPos;
  26391. s1 = peg$parsebinarySend();
  26392. if (s1 !== peg$FAILED) {
  26393. s2 = peg$parsewsKeywordMessage();
  26394. if (s2 === peg$FAILED) {
  26395. s2 = null;
  26396. }
  26397. if (s2 !== peg$FAILED) {
  26398. peg$savedPos = s0;
  26399. s1 = peg$c113(s1, s2);
  26400. s0 = s1;
  26401. } else {
  26402. peg$currPos = s0;
  26403. s0 = peg$FAILED;
  26404. }
  26405. } else {
  26406. peg$currPos = s0;
  26407. s0 = peg$FAILED;
  26408. }
  26409. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26410. return s0;
  26411. }
  26412. function peg$parsewsMessage() {
  26413. var s0;
  26414. var key = peg$currPos * 61 + 54,
  26415. cached = peg$resultsCache[key];
  26416. if (cached) {
  26417. peg$currPos = cached.nextPos;
  26418. return cached.result;
  26419. }
  26420. s0 = peg$parsewsBinaryMessage();
  26421. if (s0 === peg$FAILED) {
  26422. s0 = peg$parsewsUnaryMessage();
  26423. if (s0 === peg$FAILED) {
  26424. s0 = peg$parsewsKeywordMessage();
  26425. }
  26426. }
  26427. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26428. return s0;
  26429. }
  26430. function peg$parsecascade() {
  26431. var s0, s1, s2, s3, s4, s5, s6, s7;
  26432. var key = peg$currPos * 61 + 55,
  26433. cached = peg$resultsCache[key];
  26434. if (cached) {
  26435. peg$currPos = cached.nextPos;
  26436. return cached.result;
  26437. }
  26438. s0 = peg$currPos;
  26439. s1 = peg$parsekeywordSend();
  26440. if (s1 !== peg$FAILED) {
  26441. peg$savedPos = peg$currPos;
  26442. s2 = peg$c117(s1);
  26443. if (s2) {
  26444. s2 = void 0;
  26445. } else {
  26446. s2 = peg$FAILED;
  26447. }
  26448. if (s2 !== peg$FAILED) {
  26449. s3 = [];
  26450. s4 = peg$currPos;
  26451. s5 = peg$parsews();
  26452. if (s5 !== peg$FAILED) {
  26453. if (input.charCodeAt(peg$currPos) === 59) {
  26454. s6 = peg$c118;
  26455. peg$currPos++;
  26456. } else {
  26457. s6 = peg$FAILED;
  26458. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  26459. }
  26460. if (s6 !== peg$FAILED) {
  26461. s7 = peg$parsewsMessage();
  26462. if (s7 !== peg$FAILED) {
  26463. peg$savedPos = s4;
  26464. s5 = peg$c120(s1, s7);
  26465. s4 = s5;
  26466. } else {
  26467. peg$currPos = s4;
  26468. s4 = peg$FAILED;
  26469. }
  26470. } else {
  26471. peg$currPos = s4;
  26472. s4 = peg$FAILED;
  26473. }
  26474. } else {
  26475. peg$currPos = s4;
  26476. s4 = peg$FAILED;
  26477. }
  26478. if (s4 !== peg$FAILED) {
  26479. while (s4 !== peg$FAILED) {
  26480. s3.push(s4);
  26481. s4 = peg$currPos;
  26482. s5 = peg$parsews();
  26483. if (s5 !== peg$FAILED) {
  26484. if (input.charCodeAt(peg$currPos) === 59) {
  26485. s6 = peg$c118;
  26486. peg$currPos++;
  26487. } else {
  26488. s6 = peg$FAILED;
  26489. if (peg$silentFails === 0) { peg$fail(peg$c119); }
  26490. }
  26491. if (s6 !== peg$FAILED) {
  26492. s7 = peg$parsewsMessage();
  26493. if (s7 !== peg$FAILED) {
  26494. peg$savedPos = s4;
  26495. s5 = peg$c120(s1, s7);
  26496. s4 = s5;
  26497. } else {
  26498. peg$currPos = s4;
  26499. s4 = peg$FAILED;
  26500. }
  26501. } else {
  26502. peg$currPos = s4;
  26503. s4 = peg$FAILED;
  26504. }
  26505. } else {
  26506. peg$currPos = s4;
  26507. s4 = peg$FAILED;
  26508. }
  26509. }
  26510. } else {
  26511. s3 = peg$FAILED;
  26512. }
  26513. if (s3 !== peg$FAILED) {
  26514. peg$savedPos = s0;
  26515. s1 = peg$c121(s1, s3);
  26516. s0 = s1;
  26517. } else {
  26518. peg$currPos = s0;
  26519. s0 = peg$FAILED;
  26520. }
  26521. } else {
  26522. peg$currPos = s0;
  26523. s0 = peg$FAILED;
  26524. }
  26525. } else {
  26526. peg$currPos = s0;
  26527. s0 = peg$FAILED;
  26528. }
  26529. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26530. return s0;
  26531. }
  26532. function peg$parsejsStatement() {
  26533. var s0, s1, s2, s3, s4;
  26534. var key = peg$currPos * 61 + 56,
  26535. cached = peg$resultsCache[key];
  26536. if (cached) {
  26537. peg$currPos = cached.nextPos;
  26538. return cached.result;
  26539. }
  26540. s0 = peg$currPos;
  26541. if (input.charCodeAt(peg$currPos) === 60) {
  26542. s1 = peg$c122;
  26543. peg$currPos++;
  26544. } else {
  26545. s1 = peg$FAILED;
  26546. if (peg$silentFails === 0) { peg$fail(peg$c123); }
  26547. }
  26548. if (s1 !== peg$FAILED) {
  26549. s2 = [];
  26550. s3 = peg$currPos;
  26551. if (input.substr(peg$currPos, 2) === peg$c124) {
  26552. s4 = peg$c124;
  26553. peg$currPos += 2;
  26554. } else {
  26555. s4 = peg$FAILED;
  26556. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  26557. }
  26558. if (s4 !== peg$FAILED) {
  26559. peg$savedPos = s3;
  26560. s4 = peg$c126();
  26561. }
  26562. s3 = s4;
  26563. if (s3 === peg$FAILED) {
  26564. if (peg$c127.test(input.charAt(peg$currPos))) {
  26565. s3 = input.charAt(peg$currPos);
  26566. peg$currPos++;
  26567. } else {
  26568. s3 = peg$FAILED;
  26569. if (peg$silentFails === 0) { peg$fail(peg$c128); }
  26570. }
  26571. }
  26572. while (s3 !== peg$FAILED) {
  26573. s2.push(s3);
  26574. s3 = peg$currPos;
  26575. if (input.substr(peg$currPos, 2) === peg$c124) {
  26576. s4 = peg$c124;
  26577. peg$currPos += 2;
  26578. } else {
  26579. s4 = peg$FAILED;
  26580. if (peg$silentFails === 0) { peg$fail(peg$c125); }
  26581. }
  26582. if (s4 !== peg$FAILED) {
  26583. peg$savedPos = s3;
  26584. s4 = peg$c126();
  26585. }
  26586. s3 = s4;
  26587. if (s3 === peg$FAILED) {
  26588. if (peg$c127.test(input.charAt(peg$currPos))) {
  26589. s3 = input.charAt(peg$currPos);
  26590. peg$currPos++;
  26591. } else {
  26592. s3 = peg$FAILED;
  26593. if (peg$silentFails === 0) { peg$fail(peg$c128); }
  26594. }
  26595. }
  26596. }
  26597. if (s2 !== peg$FAILED) {
  26598. if (input.charCodeAt(peg$currPos) === 62) {
  26599. s3 = peg$c129;
  26600. peg$currPos++;
  26601. } else {
  26602. s3 = peg$FAILED;
  26603. if (peg$silentFails === 0) { peg$fail(peg$c130); }
  26604. }
  26605. if (s3 !== peg$FAILED) {
  26606. peg$savedPos = s0;
  26607. s1 = peg$c131(s2);
  26608. s0 = s1;
  26609. } else {
  26610. peg$currPos = s0;
  26611. s0 = peg$FAILED;
  26612. }
  26613. } else {
  26614. peg$currPos = s0;
  26615. s0 = peg$FAILED;
  26616. }
  26617. } else {
  26618. peg$currPos = s0;
  26619. s0 = peg$FAILED;
  26620. }
  26621. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26622. return s0;
  26623. }
  26624. function peg$parsemethod() {
  26625. var s0, s1, s2;
  26626. var key = peg$currPos * 61 + 57,
  26627. cached = peg$resultsCache[key];
  26628. if (cached) {
  26629. peg$currPos = cached.nextPos;
  26630. return cached.result;
  26631. }
  26632. s0 = peg$currPos;
  26633. s1 = peg$parsewsKeywordPattern();
  26634. if (s1 === peg$FAILED) {
  26635. s1 = peg$parsewsBinaryPattern();
  26636. if (s1 === peg$FAILED) {
  26637. s1 = peg$parsewsUnaryPattern();
  26638. }
  26639. }
  26640. if (s1 !== peg$FAILED) {
  26641. s2 = peg$parsewsSequenceWs();
  26642. if (s2 === peg$FAILED) {
  26643. s2 = null;
  26644. }
  26645. if (s2 !== peg$FAILED) {
  26646. peg$savedPos = s0;
  26647. s1 = peg$c132(s1, s2);
  26648. s0 = s1;
  26649. } else {
  26650. peg$currPos = s0;
  26651. s0 = peg$FAILED;
  26652. }
  26653. } else {
  26654. peg$currPos = s0;
  26655. s0 = peg$FAILED;
  26656. }
  26657. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26658. return s0;
  26659. }
  26660. function peg$parseassociationSend() {
  26661. var s0, s1, s2;
  26662. var key = peg$currPos * 61 + 58,
  26663. cached = peg$resultsCache[key];
  26664. if (cached) {
  26665. peg$currPos = cached.nextPos;
  26666. return cached.result;
  26667. }
  26668. s0 = peg$currPos;
  26669. s1 = peg$parsebinarySend();
  26670. if (s1 !== peg$FAILED) {
  26671. peg$savedPos = peg$currPos;
  26672. s2 = peg$c133(s1);
  26673. if (s2) {
  26674. s2 = void 0;
  26675. } else {
  26676. s2 = peg$FAILED;
  26677. }
  26678. if (s2 !== peg$FAILED) {
  26679. peg$savedPos = s0;
  26680. s1 = peg$c134(s1);
  26681. s0 = s1;
  26682. } else {
  26683. peg$currPos = s0;
  26684. s0 = peg$FAILED;
  26685. }
  26686. } else {
  26687. peg$currPos = s0;
  26688. s0 = peg$FAILED;
  26689. }
  26690. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26691. return s0;
  26692. }
  26693. function peg$parsewsAssociationsRest() {
  26694. var s0, s1, s2, s3, s4;
  26695. var key = peg$currPos * 61 + 59,
  26696. cached = peg$resultsCache[key];
  26697. if (cached) {
  26698. peg$currPos = cached.nextPos;
  26699. return cached.result;
  26700. }
  26701. s0 = peg$currPos;
  26702. s1 = peg$parsews();
  26703. if (s1 !== peg$FAILED) {
  26704. if (input.charCodeAt(peg$currPos) === 46) {
  26705. s2 = peg$c6;
  26706. peg$currPos++;
  26707. } else {
  26708. s2 = peg$FAILED;
  26709. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  26710. }
  26711. if (s2 !== peg$FAILED) {
  26712. s3 = peg$parsemaybeDotsWs();
  26713. if (s3 !== peg$FAILED) {
  26714. s4 = peg$parseassociationSend();
  26715. if (s4 !== peg$FAILED) {
  26716. peg$savedPos = s0;
  26717. s1 = peg$c87(s4);
  26718. s0 = s1;
  26719. } else {
  26720. peg$currPos = s0;
  26721. s0 = peg$FAILED;
  26722. }
  26723. } else {
  26724. peg$currPos = s0;
  26725. s0 = peg$FAILED;
  26726. }
  26727. } else {
  26728. peg$currPos = s0;
  26729. s0 = peg$FAILED;
  26730. }
  26731. } else {
  26732. peg$currPos = s0;
  26733. s0 = peg$FAILED;
  26734. }
  26735. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26736. return s0;
  26737. }
  26738. function peg$parseassociations() {
  26739. var s0, s1, s2, s3;
  26740. var key = peg$currPos * 61 + 60,
  26741. cached = peg$resultsCache[key];
  26742. if (cached) {
  26743. peg$currPos = cached.nextPos;
  26744. return cached.result;
  26745. }
  26746. s0 = peg$currPos;
  26747. s1 = peg$parseassociationSend();
  26748. if (s1 !== peg$FAILED) {
  26749. s2 = [];
  26750. s3 = peg$parsewsAssociationsRest();
  26751. while (s3 !== peg$FAILED) {
  26752. s2.push(s3);
  26753. s3 = peg$parsewsAssociationsRest();
  26754. }
  26755. if (s2 !== peg$FAILED) {
  26756. peg$savedPos = s0;
  26757. s1 = peg$c135(s1, s2);
  26758. s0 = s1;
  26759. } else {
  26760. peg$currPos = s0;
  26761. s0 = peg$FAILED;
  26762. }
  26763. } else {
  26764. peg$currPos = s0;
  26765. s0 = peg$FAILED;
  26766. }
  26767. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  26768. return s0;
  26769. }
  26770. peg$result = peg$startRuleFunction();
  26771. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  26772. return peg$result;
  26773. } else {
  26774. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  26775. peg$fail({ type: "end", description: "end of input" });
  26776. }
  26777. throw peg$buildException(
  26778. null,
  26779. peg$maxFailExpected,
  26780. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  26781. peg$maxFailPos < input.length
  26782. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  26783. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  26784. );
  26785. }
  26786. }
  26787. return {
  26788. SyntaxError: peg$SyntaxError,
  26789. parse: peg$parse
  26790. };
  26791. })();
  26792. });
  26793. define("amber_core/Platform-ImportExport", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Platform-Services", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Classes"], function($boot){"use strict";
  26794. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  26795. $core.addPackage('Platform-ImportExport');
  26796. $core.packages["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  26797. $core.packages["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  26798. $core.addClass('AbstractExporter', $globals.Object, [], 'Platform-ImportExport');
  26799. $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.";
  26800. $core.addMethod(
  26801. $core.method({
  26802. selector: "classNameFor:",
  26803. protocol: 'convenience',
  26804. fn: function (aClass){
  26805. var self=this;
  26806. return $core.withContext(function($ctx1) {
  26807. var $2,$3,$4,$1;
  26808. $2=$recv(aClass)._isMetaclass();
  26809. if($core.assert($2)){
  26810. $3=$recv($recv(aClass)._instanceClass())._name();
  26811. $ctx1.sendIdx["name"]=1;
  26812. $1=$recv($3).__comma(" class");
  26813. } else {
  26814. $4=$recv(aClass)._isNil();
  26815. if($core.assert($4)){
  26816. $1="nil";
  26817. } else {
  26818. $1=$recv(aClass)._name();
  26819. };
  26820. };
  26821. return $1;
  26822. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractExporter)});
  26823. },
  26824. args: ["aClass"],
  26825. source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, ' class' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09aClass isNil\x0a\x09\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09\x09ifFalse: [ aClass name ] ]",
  26826. referencedClasses: [],
  26827. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  26828. }),
  26829. $globals.AbstractExporter);
  26830. $core.addMethod(
  26831. $core.method({
  26832. selector: "exportPackage:on:",
  26833. protocol: 'output',
  26834. fn: function (aPackage,aStream){
  26835. var self=this;
  26836. return $core.withContext(function($ctx1) {
  26837. self._subclassResponsibility();
  26838. return self;
  26839. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  26840. },
  26841. args: ["aPackage", "aStream"],
  26842. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  26843. referencedClasses: [],
  26844. messageSends: ["subclassResponsibility"]
  26845. }),
  26846. $globals.AbstractExporter);
  26847. $core.addMethod(
  26848. $core.method({
  26849. selector: "extensionMethodsOfPackage:",
  26850. protocol: 'accessing',
  26851. fn: function (aPackage){
  26852. var self=this;
  26853. var result;
  26854. return $core.withContext(function($ctx1) {
  26855. result=$recv($globals.OrderedCollection)._new();
  26856. $recv(self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  26857. return $core.withContext(function($ctx2) {
  26858. return $recv(result)._addAll_($recv(each)._methods());
  26859. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26860. }));
  26861. return result;
  26862. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  26863. },
  26864. args: ["aPackage"],
  26865. 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",
  26866. referencedClasses: ["OrderedCollection"],
  26867. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "methods"]
  26868. }),
  26869. $globals.AbstractExporter);
  26870. $core.addMethod(
  26871. $core.method({
  26872. selector: "extensionProtocolsOfPackage:",
  26873. protocol: 'accessing',
  26874. fn: function (aPackage){
  26875. var self=this;
  26876. var extensionName,result;
  26877. return $core.withContext(function($ctx1) {
  26878. var $1,$2,$3;
  26879. $1=$recv(aPackage)._name();
  26880. $ctx1.sendIdx["name"]=1;
  26881. extensionName="*".__comma($1);
  26882. result=$recv($globals.OrderedCollection)._new();
  26883. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  26884. return $core.withContext(function($ctx2) {
  26885. $2=$recv(a)._name();
  26886. $ctx2.sendIdx["name"]=2;
  26887. return $recv($2).__lt($recv(b)._name());
  26888. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  26889. })))._do_((function(each){
  26890. return $core.withContext(function($ctx2) {
  26891. return $recv([each,$recv(each)._class()])._do_((function(behavior){
  26892. return $core.withContext(function($ctx3) {
  26893. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  26894. if($core.assert($3)){
  26895. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  26896. };
  26897. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  26898. }));
  26899. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  26900. }));
  26901. $ctx1.sendIdx["do:"]=1;
  26902. return result;
  26903. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  26904. },
  26905. args: ["aPackage"],
  26906. 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",
  26907. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  26908. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "class", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  26909. }),
  26910. $globals.AbstractExporter);
  26911. $core.addClass('ChunkExporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  26912. $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.";
  26913. $core.addMethod(
  26914. $core.method({
  26915. selector: "chunkEscape:",
  26916. protocol: 'convenience',
  26917. fn: function (aString){
  26918. var self=this;
  26919. return $core.withContext(function($ctx1) {
  26920. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  26921. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  26922. },
  26923. args: ["aString"],
  26924. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  26925. referencedClasses: [],
  26926. messageSends: ["trimBoth", "replace:with:"]
  26927. }),
  26928. $globals.ChunkExporter);
  26929. $core.addMethod(
  26930. $core.method({
  26931. selector: "exportCategoryEpilogueOf:on:",
  26932. protocol: 'output',
  26933. fn: function (aCategory,aStream){
  26934. var self=this;
  26935. return $core.withContext(function($ctx1) {
  26936. $recv(aStream)._nextPutAll_(" !");
  26937. $recv(aStream)._lf();
  26938. $ctx1.sendIdx["lf"]=1;
  26939. $recv(aStream)._lf();
  26940. return self;
  26941. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  26942. },
  26943. args: ["aCategory", "aStream"],
  26944. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  26945. referencedClasses: [],
  26946. messageSends: ["nextPutAll:", "lf"]
  26947. }),
  26948. $globals.ChunkExporter);
  26949. $core.addMethod(
  26950. $core.method({
  26951. selector: "exportCategoryPrologueOf:on:",
  26952. protocol: 'output',
  26953. fn: function (aCategory,aStream){
  26954. var self=this;
  26955. return $core.withContext(function($ctx1) {
  26956. var $1,$2;
  26957. $1="!".__comma(self._classNameFor_($recv(aCategory)._theClass()));
  26958. $ctx1.sendIdx[","]=1;
  26959. $recv(aStream)._nextPutAll_($1);
  26960. $ctx1.sendIdx["nextPutAll:"]=1;
  26961. $2=$recv(" methodsFor: '".__comma($recv(aCategory)._name())).__comma("'!");
  26962. $ctx1.sendIdx[","]=2;
  26963. $recv(aStream)._nextPutAll_($2);
  26964. return self;
  26965. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  26966. },
  26967. args: ["aCategory", "aStream"],
  26968. source: "exportCategoryPrologueOf: aCategory on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aCategory theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aCategory name, '''!'",
  26969. referencedClasses: [],
  26970. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  26971. }),
  26972. $globals.ChunkExporter);
  26973. $core.addMethod(
  26974. $core.method({
  26975. selector: "exportDefinitionOf:on:",
  26976. protocol: 'output',
  26977. fn: function (aClass,aStream){
  26978. var self=this;
  26979. return $core.withContext(function($ctx1) {
  26980. var $1,$3,$2,$4,$6,$5,$7,$9,$8,$11,$10,$12;
  26981. $1=self._classNameFor_($recv(aClass)._superclass());
  26982. $ctx1.sendIdx["classNameFor:"]=1;
  26983. $recv(aStream)._nextPutAll_($1);
  26984. $ctx1.sendIdx["nextPutAll:"]=1;
  26985. $3=self._classNameFor_(aClass);
  26986. $ctx1.sendIdx["classNameFor:"]=2;
  26987. $2=" subclass: #".__comma($3);
  26988. $ctx1.sendIdx[","]=1;
  26989. $recv(aStream)._nextPutAll_($2);
  26990. $ctx1.sendIdx["nextPutAll:"]=2;
  26991. $recv(aStream)._lf();
  26992. $ctx1.sendIdx["lf"]=1;
  26993. $recv(aStream)._tab();
  26994. $ctx1.sendIdx["tab"]=1;
  26995. $4=$recv(aStream)._nextPutAll_("instanceVariableNames: '");
  26996. $ctx1.sendIdx["nextPutAll:"]=3;
  26997. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  26998. return $core.withContext(function($ctx2) {
  26999. return $recv(aStream)._nextPutAll_(each);
  27000. $ctx2.sendIdx["nextPutAll:"]=4;
  27001. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27002. }),(function(){
  27003. return $core.withContext(function($ctx2) {
  27004. return $recv(aStream)._nextPutAll_(" ");
  27005. $ctx2.sendIdx["nextPutAll:"]=5;
  27006. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27007. }));
  27008. $recv(aStream)._nextPutAll_("'");
  27009. $ctx1.sendIdx["nextPutAll:"]=6;
  27010. $recv(aStream)._lf();
  27011. $ctx1.sendIdx["lf"]=2;
  27012. $recv(aStream)._tab();
  27013. $6="package: '".__comma($recv(aClass)._category());
  27014. $ctx1.sendIdx[","]=3;
  27015. $5=$recv($6).__comma("'!");
  27016. $ctx1.sendIdx[","]=2;
  27017. $recv(aStream)._nextPutAll_($5);
  27018. $ctx1.sendIdx["nextPutAll:"]=7;
  27019. $7=$recv(aStream)._lf();
  27020. $ctx1.sendIdx["lf"]=3;
  27021. $9=$recv(aClass)._comment();
  27022. $ctx1.sendIdx["comment"]=1;
  27023. $8=$recv($9)._notEmpty();
  27024. if($core.assert($8)){
  27025. $11="!".__comma(self._classNameFor_(aClass));
  27026. $ctx1.sendIdx[","]=5;
  27027. $10=$recv($11).__comma(" commentStamp!");
  27028. $ctx1.sendIdx[","]=4;
  27029. $recv(aStream)._nextPutAll_($10);
  27030. $ctx1.sendIdx["nextPutAll:"]=8;
  27031. $recv(aStream)._lf();
  27032. $ctx1.sendIdx["lf"]=4;
  27033. $recv(aStream)._nextPutAll_($recv(self._chunkEscape_($recv(aClass)._comment())).__comma("!"));
  27034. $12=$recv(aStream)._lf();
  27035. $ctx1.sendIdx["lf"]=5;
  27036. $12;
  27037. };
  27038. $recv(aStream)._lf();
  27039. return self;
  27040. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27041. },
  27042. args: ["aClass", "aStream"],
  27043. 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 notEmpty ifTrue: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aClass), ' commentStamp!';lf;\x0a\x09\x09nextPutAll: (self chunkEscape: aClass comment), '!';lf ].\x0a\x09aStream lf",
  27044. referencedClasses: [],
  27045. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "chunkEscape:"]
  27046. }),
  27047. $globals.ChunkExporter);
  27048. $core.addMethod(
  27049. $core.method({
  27050. selector: "exportMetaDefinitionOf:on:",
  27051. protocol: 'output',
  27052. fn: function (aClass,aStream){
  27053. var self=this;
  27054. return $core.withContext(function($ctx1) {
  27055. var $3,$2,$1,$5,$4,$6;
  27056. $3=$recv(aClass)._class();
  27057. $ctx1.sendIdx["class"]=1;
  27058. $2=$recv($3)._instanceVariableNames();
  27059. $ctx1.sendIdx["instanceVariableNames"]=1;
  27060. $1=$recv($2)._isEmpty();
  27061. if(!$core.assert($1)){
  27062. $5=$recv(aClass)._class();
  27063. $ctx1.sendIdx["class"]=2;
  27064. $4=self._classNameFor_($5);
  27065. $recv(aStream)._nextPutAll_($4);
  27066. $ctx1.sendIdx["nextPutAll:"]=1;
  27067. $6=$recv(aStream)._nextPutAll_(" instanceVariableNames: '");
  27068. $ctx1.sendIdx["nextPutAll:"]=2;
  27069. $6;
  27070. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  27071. return $core.withContext(function($ctx2) {
  27072. return $recv(aStream)._nextPutAll_(each);
  27073. $ctx2.sendIdx["nextPutAll:"]=3;
  27074. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27075. }),(function(){
  27076. return $core.withContext(function($ctx2) {
  27077. return $recv(aStream)._nextPutAll_(" ");
  27078. $ctx2.sendIdx["nextPutAll:"]=4;
  27079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27080. }));
  27081. $recv(aStream)._nextPutAll_("'!");
  27082. $recv(aStream)._lf();
  27083. $ctx1.sendIdx["lf"]=1;
  27084. $recv(aStream)._lf();
  27085. };
  27086. return self;
  27087. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  27088. },
  27089. args: ["aClass", "aStream"],
  27090. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: (self classNameFor: aClass class);\x0a\x09\x09\x09nextPutAll: ' instanceVariableNames: '''.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09\x09do: [ :each | aStream nextPutAll: each ]\x0a\x09\x09\x09separatedBy: [ aStream nextPutAll: ' ' ].\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: '''!'; lf; lf ]",
  27091. referencedClasses: [],
  27092. messageSends: ["ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "classNameFor:", "do:separatedBy:", "lf"]
  27093. }),
  27094. $globals.ChunkExporter);
  27095. $core.addMethod(
  27096. $core.method({
  27097. selector: "exportMethod:on:",
  27098. protocol: 'output',
  27099. fn: function (aMethod,aStream){
  27100. var self=this;
  27101. return $core.withContext(function($ctx1) {
  27102. $recv(aStream)._lf();
  27103. $ctx1.sendIdx["lf"]=1;
  27104. $recv(aStream)._lf();
  27105. $ctx1.sendIdx["lf"]=2;
  27106. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aMethod)._source()));
  27107. $ctx1.sendIdx["nextPutAll:"]=1;
  27108. $recv(aStream)._lf();
  27109. $recv(aStream)._nextPutAll_("!");
  27110. return self;
  27111. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  27112. },
  27113. args: ["aMethod", "aStream"],
  27114. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; nextPutAll: (self chunkEscape: aMethod source); lf;\x0a\x09\x09nextPutAll: '!'",
  27115. referencedClasses: [],
  27116. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]
  27117. }),
  27118. $globals.ChunkExporter);
  27119. $core.addMethod(
  27120. $core.method({
  27121. selector: "exportPackage:on:",
  27122. protocol: 'output',
  27123. fn: function (aPackage,aStream){
  27124. var self=this;
  27125. return $core.withContext(function($ctx1) {
  27126. var $1;
  27127. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27128. self._exportPackageImportsOf_on_(aPackage,aStream);
  27129. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27130. return $core.withContext(function($ctx2) {
  27131. self._exportDefinitionOf_on_(each,aStream);
  27132. $1=self._ownMethodProtocolsOfClass_(each);
  27133. $ctx2.sendIdx["ownMethodProtocolsOfClass:"]=1;
  27134. self._exportProtocols_on_($1,aStream);
  27135. $ctx2.sendIdx["exportProtocols:on:"]=1;
  27136. self._exportMetaDefinitionOf_on_(each,aStream);
  27137. return self._exportProtocols_on_(self._ownMethodProtocolsOfClass_($recv(each)._class()),aStream);
  27138. $ctx2.sendIdx["exportProtocols:on:"]=2;
  27139. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27140. }));
  27141. self._exportProtocols_on_(self._extensionProtocolsOfPackage_(aPackage),aStream);
  27142. return self;
  27143. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27144. },
  27145. args: ["aPackage", "aStream"],
  27146. 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",
  27147. referencedClasses: [],
  27148. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "exportProtocols:on:", "ownMethodProtocolsOfClass:", "exportMetaDefinitionOf:on:", "class", "extensionProtocolsOfPackage:"]
  27149. }),
  27150. $globals.ChunkExporter);
  27151. $core.addMethod(
  27152. $core.method({
  27153. selector: "exportPackageDefinitionOf:on:",
  27154. protocol: 'output',
  27155. fn: function (aPackage,aStream){
  27156. var self=this;
  27157. return $core.withContext(function($ctx1) {
  27158. var $1;
  27159. $1=$recv("Smalltalk createPackage: '".__comma($recv(aPackage)._name())).__comma("'!");
  27160. $ctx1.sendIdx[","]=1;
  27161. $recv(aStream)._nextPutAll_($1);
  27162. $recv(aStream)._lf();
  27163. return self;
  27164. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27165. },
  27166. args: ["aPackage", "aStream"],
  27167. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'Smalltalk createPackage: ''', aPackage name, '''!';\x0a\x09\x09lf",
  27168. referencedClasses: [],
  27169. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27170. }),
  27171. $globals.ChunkExporter);
  27172. $core.addMethod(
  27173. $core.method({
  27174. selector: "exportPackageImportsOf:on:",
  27175. protocol: 'output',
  27176. fn: function (aPackage,aStream){
  27177. var self=this;
  27178. return $core.withContext(function($ctx1) {
  27179. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  27180. return $core.withContext(function($ctx2) {
  27181. $recv(aStream)._nextPutAll_("(Smalltalk packageAt: '");
  27182. $ctx2.sendIdx["nextPutAll:"]=1;
  27183. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  27184. $ctx2.sendIdx["nextPutAll:"]=2;
  27185. $recv(aStream)._nextPutAll_("') imports: ");
  27186. $ctx2.sendIdx["nextPutAll:"]=3;
  27187. $recv(aStream)._nextPutAll_(self._chunkEscape_($recv(aPackage)._importsDefinition()));
  27188. $ctx2.sendIdx["nextPutAll:"]=4;
  27189. $recv(aStream)._nextPutAll_("!");
  27190. return $recv(aStream)._lf();
  27191. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27192. }));
  27193. return self;
  27194. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  27195. },
  27196. args: ["aPackage", "aStream"],
  27197. 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 ]",
  27198. referencedClasses: [],
  27199. messageSends: ["ifNotEmpty:", "imports", "nextPutAll:", "name", "chunkEscape:", "importsDefinition", "lf"]
  27200. }),
  27201. $globals.ChunkExporter);
  27202. $core.addMethod(
  27203. $core.method({
  27204. selector: "exportProtocol:on:",
  27205. protocol: 'output',
  27206. fn: function (aProtocol,aStream){
  27207. var self=this;
  27208. return $core.withContext(function($ctx1) {
  27209. self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  27210. $recv($recv(aProtocol)._methods())._do_((function(method){
  27211. return $core.withContext(function($ctx2) {
  27212. return self._exportMethod_on_(method,aStream);
  27213. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  27214. }));
  27215. self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  27216. return self;
  27217. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27218. },
  27219. args: ["aProtocol", "aStream"],
  27220. 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",
  27221. referencedClasses: [],
  27222. messageSends: ["exportProtocolPrologueOf:on:", "do:", "methods", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  27223. }),
  27224. $globals.ChunkExporter);
  27225. $core.addMethod(
  27226. $core.method({
  27227. selector: "exportProtocolEpilogueOf:on:",
  27228. protocol: 'output',
  27229. fn: function (aProtocol,aStream){
  27230. var self=this;
  27231. return $core.withContext(function($ctx1) {
  27232. $recv(aStream)._nextPutAll_(" !");
  27233. $recv(aStream)._lf();
  27234. $ctx1.sendIdx["lf"]=1;
  27235. $recv(aStream)._lf();
  27236. return self;
  27237. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27238. },
  27239. args: ["aProtocol", "aStream"],
  27240. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream nextPutAll: ' !'; lf; lf",
  27241. referencedClasses: [],
  27242. messageSends: ["nextPutAll:", "lf"]
  27243. }),
  27244. $globals.ChunkExporter);
  27245. $core.addMethod(
  27246. $core.method({
  27247. selector: "exportProtocolPrologueOf:on:",
  27248. protocol: 'output',
  27249. fn: function (aProtocol,aStream){
  27250. var self=this;
  27251. return $core.withContext(function($ctx1) {
  27252. var $1,$2;
  27253. $1="!".__comma(self._classNameFor_($recv(aProtocol)._theClass()));
  27254. $ctx1.sendIdx[","]=1;
  27255. $recv(aStream)._nextPutAll_($1);
  27256. $ctx1.sendIdx["nextPutAll:"]=1;
  27257. $2=$recv(" methodsFor: '".__comma($recv(aProtocol)._name())).__comma("'!");
  27258. $ctx1.sendIdx[","]=2;
  27259. $recv(aStream)._nextPutAll_($2);
  27260. return self;
  27261. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  27262. },
  27263. args: ["aProtocol", "aStream"],
  27264. source: "exportProtocolPrologueOf: aProtocol on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '!', (self classNameFor: aProtocol theClass);\x0a\x09\x09nextPutAll: ' methodsFor: ''', aProtocol name, '''!'",
  27265. referencedClasses: [],
  27266. messageSends: ["nextPutAll:", ",", "classNameFor:", "theClass", "name"]
  27267. }),
  27268. $globals.ChunkExporter);
  27269. $core.addMethod(
  27270. $core.method({
  27271. selector: "exportProtocols:on:",
  27272. protocol: 'output',
  27273. fn: function (aCollection,aStream){
  27274. var self=this;
  27275. return $core.withContext(function($ctx1) {
  27276. $recv(aCollection)._do_((function(each){
  27277. return $core.withContext(function($ctx2) {
  27278. return self._exportProtocol_on_(each,aStream);
  27279. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27280. }));
  27281. return self;
  27282. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  27283. },
  27284. args: ["aCollection", "aStream"],
  27285. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  27286. referencedClasses: [],
  27287. messageSends: ["do:", "exportProtocol:on:"]
  27288. }),
  27289. $globals.ChunkExporter);
  27290. $core.addMethod(
  27291. $core.method({
  27292. selector: "extensionCategoriesOfPackage:",
  27293. protocol: 'accessing',
  27294. fn: function (aPackage){
  27295. var self=this;
  27296. var name,map,result;
  27297. return $core.withContext(function($ctx1) {
  27298. var $1;
  27299. name=$recv(aPackage)._name();
  27300. result=$recv($globals.OrderedCollection)._new();
  27301. $ctx1.sendIdx["new"]=1;
  27302. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  27303. return $core.withContext(function($ctx2) {
  27304. return $recv([each,$recv(each)._class()])._do_((function(aClass){
  27305. return $core.withContext(function($ctx3) {
  27306. map=$recv($globals.Dictionary)._new();
  27307. map;
  27308. $recv(aClass)._protocolsDo_((function(category,methods){
  27309. return $core.withContext(function($ctx4) {
  27310. $1=$recv(category).__eq("*".__comma(name));
  27311. if($core.assert($1)){
  27312. return $recv(map)._at_put_(category,methods);
  27313. };
  27314. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  27315. }));
  27316. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27317. return $core.withContext(function($ctx4) {
  27318. return $recv(a).__lt_eq(b);
  27319. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  27320. })))._collect_((function(category){
  27321. return $core.withContext(function($ctx4) {
  27322. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  27323. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  27324. })));
  27325. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  27326. }));
  27327. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27328. }));
  27329. $ctx1.sendIdx["do:"]=1;
  27330. return result;
  27331. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  27332. },
  27333. args: ["aPackage"],
  27334. 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",
  27335. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  27336. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "class", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27337. }),
  27338. $globals.ChunkExporter);
  27339. $core.addMethod(
  27340. $core.method({
  27341. selector: "ownCategoriesOfClass:",
  27342. protocol: 'accessing',
  27343. fn: function (aClass){
  27344. var self=this;
  27345. var map;
  27346. return $core.withContext(function($ctx1) {
  27347. var $1;
  27348. map=$recv($globals.Dictionary)._new();
  27349. $recv(aClass)._protocolsDo_((function(each,methods){
  27350. return $core.withContext(function($ctx2) {
  27351. $1=$recv(each)._match_("^\x5c*");
  27352. if(!$core.assert($1)){
  27353. return $recv(map)._at_put_(each,methods);
  27354. };
  27355. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  27356. }));
  27357. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  27358. return $core.withContext(function($ctx2) {
  27359. return $recv(a).__lt_eq(b);
  27360. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  27361. })))._collect_((function(each){
  27362. return $core.withContext(function($ctx2) {
  27363. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  27364. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27365. }));
  27366. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  27367. },
  27368. args: ["aClass"],
  27369. 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) ]",
  27370. referencedClasses: ["Dictionary", "MethodCategory"],
  27371. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  27372. }),
  27373. $globals.ChunkExporter);
  27374. $core.addMethod(
  27375. $core.method({
  27376. selector: "ownCategoriesOfMetaClass:",
  27377. protocol: 'accessing',
  27378. fn: function (aClass){
  27379. var self=this;
  27380. return $core.withContext(function($ctx1) {
  27381. return self._ownCategoriesOfClass_($recv(aClass)._class());
  27382. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  27383. },
  27384. args: ["aClass"],
  27385. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass class",
  27386. referencedClasses: [],
  27387. messageSends: ["ownCategoriesOfClass:", "class"]
  27388. }),
  27389. $globals.ChunkExporter);
  27390. $core.addMethod(
  27391. $core.method({
  27392. selector: "ownMethodProtocolsOfClass:",
  27393. protocol: 'accessing',
  27394. fn: function (aClass){
  27395. var self=this;
  27396. return $core.withContext(function($ctx1) {
  27397. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  27398. return $core.withContext(function($ctx2) {
  27399. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  27400. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27401. }));
  27402. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  27403. },
  27404. args: ["aClass"],
  27405. 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 ]",
  27406. referencedClasses: ["ExportMethodProtocol"],
  27407. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  27408. }),
  27409. $globals.ChunkExporter);
  27410. $core.addClass('Exporter', $globals.AbstractExporter, [], 'Platform-ImportExport');
  27411. $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.).";
  27412. $core.addMethod(
  27413. $core.method({
  27414. selector: "exportDefinitionOf:on:",
  27415. protocol: 'output',
  27416. fn: function (aClass,aStream){
  27417. var self=this;
  27418. return $core.withContext(function($ctx1) {
  27419. var $2,$1,$3,$4,$6,$5,$7,$9,$8;
  27420. $recv(aStream)._lf();
  27421. $ctx1.sendIdx["lf"]=1;
  27422. $recv(aStream)._nextPutAll_("$core.addClass(");
  27423. $ctx1.sendIdx["nextPutAll:"]=1;
  27424. $2="'".__comma(self._classNameFor_(aClass));
  27425. $ctx1.sendIdx[","]=2;
  27426. $1=$recv($2).__comma("', ");
  27427. $ctx1.sendIdx[","]=1;
  27428. $recv(aStream)._nextPutAll_($1);
  27429. $ctx1.sendIdx["nextPutAll:"]=2;
  27430. $3=self._jsClassNameFor_($recv(aClass)._superclass());
  27431. $ctx1.sendIdx["jsClassNameFor:"]=1;
  27432. $recv(aStream)._nextPutAll_($3);
  27433. $ctx1.sendIdx["nextPutAll:"]=3;
  27434. $4=$recv(aStream)._nextPutAll_(", [");
  27435. $ctx1.sendIdx["nextPutAll:"]=4;
  27436. $recv($recv(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  27437. return $core.withContext(function($ctx2) {
  27438. $6="'".__comma(each);
  27439. $ctx2.sendIdx[","]=4;
  27440. $5=$recv($6).__comma("'");
  27441. $ctx2.sendIdx[","]=3;
  27442. return $recv(aStream)._nextPutAll_($5);
  27443. $ctx2.sendIdx["nextPutAll:"]=5;
  27444. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27445. }),(function(){
  27446. return $core.withContext(function($ctx2) {
  27447. return $recv(aStream)._nextPutAll_(", ");
  27448. $ctx2.sendIdx["nextPutAll:"]=6;
  27449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  27450. }));
  27451. $recv(aStream)._nextPutAll_("], '");
  27452. $ctx1.sendIdx["nextPutAll:"]=7;
  27453. $recv(aStream)._nextPutAll_($recv($recv(aClass)._category()).__comma("'"));
  27454. $ctx1.sendIdx["nextPutAll:"]=8;
  27455. $7=$recv(aStream)._nextPutAll_(");");
  27456. $ctx1.sendIdx["nextPutAll:"]=9;
  27457. $9=$recv(aClass)._comment();
  27458. $ctx1.sendIdx["comment"]=1;
  27459. $8=$recv($9)._notEmpty();
  27460. if($core.assert($8)){
  27461. $recv(aStream)._lf();
  27462. $ctx1.sendIdx["lf"]=2;
  27463. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27464. $ctx1.sendIdx["nextPutAll:"]=10;
  27465. $recv(aStream)._lf();
  27466. $ctx1.sendIdx["lf"]=3;
  27467. $recv(aStream)._nextPutAll_(self._jsClassNameFor_(aClass));
  27468. $ctx1.sendIdx["nextPutAll:"]=11;
  27469. $recv(aStream)._nextPutAll_(".comment=");
  27470. $ctx1.sendIdx["nextPutAll:"]=12;
  27471. $recv(aStream)._nextPutAll_($recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavascript());
  27472. $ctx1.sendIdx["nextPutAll:"]=13;
  27473. $recv(aStream)._nextPutAll_(";");
  27474. $ctx1.sendIdx["nextPutAll:"]=14;
  27475. $recv(aStream)._lf();
  27476. $ctx1.sendIdx["lf"]=4;
  27477. $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27478. };
  27479. $recv(aStream)._lf();
  27480. return self;
  27481. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27482. },
  27483. args: ["aClass", "aStream"],
  27484. 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 notEmpty ifTrue: [\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",
  27485. referencedClasses: [],
  27486. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "jsClassNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "notEmpty", "comment", "asJavascript", "crlfSanitized"]
  27487. }),
  27488. $globals.Exporter);
  27489. $core.addMethod(
  27490. $core.method({
  27491. selector: "exportMetaDefinitionOf:on:",
  27492. protocol: 'output',
  27493. fn: function (aClass,aStream){
  27494. var self=this;
  27495. return $core.withContext(function($ctx1) {
  27496. var $3,$2,$1,$5,$4,$6,$8,$7;
  27497. $recv(aStream)._lf();
  27498. $ctx1.sendIdx["lf"]=1;
  27499. $3=$recv(aClass)._class();
  27500. $ctx1.sendIdx["class"]=1;
  27501. $2=$recv($3)._instanceVariableNames();
  27502. $ctx1.sendIdx["instanceVariableNames"]=1;
  27503. $1=$recv($2)._isEmpty();
  27504. if(!$core.assert($1)){
  27505. $5=$recv(aClass)._class();
  27506. $ctx1.sendIdx["class"]=2;
  27507. $4=self._jsClassNameFor_($5);
  27508. $recv(aStream)._nextPutAll_($4);
  27509. $ctx1.sendIdx["nextPutAll:"]=1;
  27510. $6=$recv(aStream)._nextPutAll_(".iVarNames = [");
  27511. $ctx1.sendIdx["nextPutAll:"]=2;
  27512. $6;
  27513. $recv($recv($recv(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  27514. return $core.withContext(function($ctx2) {
  27515. $8="'".__comma(each);
  27516. $ctx2.sendIdx[","]=2;
  27517. $7=$recv($8).__comma("'");
  27518. $ctx2.sendIdx[","]=1;
  27519. return $recv(aStream)._nextPutAll_($7);
  27520. $ctx2.sendIdx["nextPutAll:"]=3;
  27521. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27522. }),(function(){
  27523. return $core.withContext(function($ctx2) {
  27524. return $recv(aStream)._nextPutAll_(",");
  27525. $ctx2.sendIdx["nextPutAll:"]=4;
  27526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  27527. }));
  27528. $recv(aStream)._nextPutAll_("];".__comma($recv($globals.String)._lf()));
  27529. };
  27530. return self;
  27531. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  27532. },
  27533. args: ["aClass", "aStream"],
  27534. source: "exportMetaDefinitionOf: aClass on: aStream\x0a\x09aStream lf.\x0a\x09aClass class instanceVariableNames isEmpty ifFalse: [\x0a\x09\x09aStream\x0a\x09\x09nextPutAll: (self jsClassNameFor: aClass class);\x0a\x09\x09nextPutAll: '.iVarNames = ['.\x0a\x09\x09aClass class instanceVariableNames\x0a\x09\x09do: [ :each | aStream nextPutAll: '''', each, '''' ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ',' ].\x0a\x09\x09aStream nextPutAll: '];', String lf ]",
  27535. referencedClasses: ["String"],
  27536. messageSends: ["lf", "ifFalse:", "isEmpty", "instanceVariableNames", "class", "nextPutAll:", "jsClassNameFor:", "do:separatedBy:", ","]
  27537. }),
  27538. $globals.Exporter);
  27539. $core.addMethod(
  27540. $core.method({
  27541. selector: "exportMethod:on:",
  27542. protocol: 'output',
  27543. fn: function (aMethod,aStream){
  27544. var self=this;
  27545. return $core.withContext(function($ctx1) {
  27546. var $3,$2,$1,$5,$4,$7,$6,$10,$9,$8,$13,$12,$11,$16,$15,$14;
  27547. $recv(aStream)._nextPutAll_("$core.addMethod(");
  27548. $ctx1.sendIdx["nextPutAll:"]=1;
  27549. $recv(aStream)._lf();
  27550. $ctx1.sendIdx["lf"]=1;
  27551. $recv(aStream)._nextPutAll_("$core.method({");
  27552. $ctx1.sendIdx["nextPutAll:"]=2;
  27553. $recv(aStream)._lf();
  27554. $ctx1.sendIdx["lf"]=2;
  27555. $3=$recv($recv(aMethod)._selector())._asJavascript();
  27556. $ctx1.sendIdx["asJavascript"]=1;
  27557. $2="selector: ".__comma($3);
  27558. $ctx1.sendIdx[","]=2;
  27559. $1=$recv($2).__comma(",");
  27560. $ctx1.sendIdx[","]=1;
  27561. $recv(aStream)._nextPutAll_($1);
  27562. $ctx1.sendIdx["nextPutAll:"]=3;
  27563. $recv(aStream)._lf();
  27564. $ctx1.sendIdx["lf"]=3;
  27565. $5="protocol: '".__comma($recv(aMethod)._protocol());
  27566. $ctx1.sendIdx[","]=4;
  27567. $4=$recv($5).__comma("',");
  27568. $ctx1.sendIdx[","]=3;
  27569. $recv(aStream)._nextPutAll_($4);
  27570. $ctx1.sendIdx["nextPutAll:"]=4;
  27571. $recv(aStream)._lf();
  27572. $ctx1.sendIdx["lf"]=4;
  27573. $7="fn: ".__comma($recv($recv(aMethod)._fn())._compiledSource());
  27574. $ctx1.sendIdx[","]=6;
  27575. $6=$recv($7).__comma(",");
  27576. $ctx1.sendIdx[","]=5;
  27577. $recv(aStream)._nextPutAll_($6);
  27578. $ctx1.sendIdx["nextPutAll:"]=5;
  27579. $recv(aStream)._lf();
  27580. $ctx1.sendIdx["lf"]=5;
  27581. $recv(aStream)._nextPutAll_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  27582. $ctx1.sendIdx["nextPutAll:"]=6;
  27583. $recv(aStream)._lf();
  27584. $ctx1.sendIdx["lf"]=6;
  27585. $10=$recv($recv(aMethod)._arguments())._asJavascript();
  27586. $ctx1.sendIdx["asJavascript"]=2;
  27587. $9="args: ".__comma($10);
  27588. $ctx1.sendIdx[","]=8;
  27589. $8=$recv($9).__comma(",");
  27590. $ctx1.sendIdx[","]=7;
  27591. $recv(aStream)._nextPutAll_($8);
  27592. $ctx1.sendIdx["nextPutAll:"]=7;
  27593. $recv(aStream)._lf();
  27594. $ctx1.sendIdx["lf"]=7;
  27595. $13=$recv($recv(aMethod)._source())._asJavascript();
  27596. $ctx1.sendIdx["asJavascript"]=3;
  27597. $12="source: ".__comma($13);
  27598. $ctx1.sendIdx[","]=10;
  27599. $11=$recv($12).__comma(",");
  27600. $ctx1.sendIdx[","]=9;
  27601. $recv(aStream)._nextPutAll_($11);
  27602. $ctx1.sendIdx["nextPutAll:"]=8;
  27603. $recv(aStream)._lf();
  27604. $ctx1.sendIdx["lf"]=8;
  27605. $16=$recv($recv(aMethod)._referencedClasses())._asJavascript();
  27606. $ctx1.sendIdx["asJavascript"]=4;
  27607. $15="referencedClasses: ".__comma($16);
  27608. $ctx1.sendIdx[","]=12;
  27609. $14=$recv($15).__comma(",");
  27610. $ctx1.sendIdx[","]=11;
  27611. $recv(aStream)._nextPutAll_($14);
  27612. $ctx1.sendIdx["nextPutAll:"]=9;
  27613. $recv(aStream)._lf();
  27614. $ctx1.sendIdx["lf"]=9;
  27615. $recv(aStream)._nextPutAll_("//>>excludeEnd(\x22ide\x22);");
  27616. $ctx1.sendIdx["nextPutAll:"]=10;
  27617. $recv(aStream)._lf();
  27618. $ctx1.sendIdx["lf"]=10;
  27619. $recv(aStream)._nextPutAll_("messageSends: ".__comma($recv($recv(aMethod)._messageSends())._asJavascript()));
  27620. $ctx1.sendIdx["nextPutAll:"]=11;
  27621. $recv(aStream)._lf();
  27622. $ctx1.sendIdx["lf"]=11;
  27623. $recv(aStream)._nextPutAll_("}),");
  27624. $ctx1.sendIdx["nextPutAll:"]=12;
  27625. $recv(aStream)._lf();
  27626. $ctx1.sendIdx["lf"]=12;
  27627. $recv(aStream)._nextPutAll_(self._jsClassNameFor_($recv(aMethod)._methodClass()));
  27628. $ctx1.sendIdx["nextPutAll:"]=13;
  27629. $recv(aStream)._nextPutAll_(");");
  27630. $recv(aStream)._lf();
  27631. $ctx1.sendIdx["lf"]=13;
  27632. $recv(aStream)._lf();
  27633. return self;
  27634. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  27635. },
  27636. args: ["aMethod", "aStream"],
  27637. 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",
  27638. referencedClasses: [],
  27639. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "jsClassNameFor:", "methodClass"]
  27640. }),
  27641. $globals.Exporter);
  27642. $core.addMethod(
  27643. $core.method({
  27644. selector: "exportPackage:on:",
  27645. protocol: 'output',
  27646. fn: function (aPackage,aStream){
  27647. var self=this;
  27648. return $core.withContext(function($ctx1) {
  27649. var $1;
  27650. self._exportPackagePrologueOf_on_(aPackage,aStream);
  27651. self._exportPackageDefinitionOf_on_(aPackage,aStream);
  27652. self._exportPackageContextOf_on_(aPackage,aStream);
  27653. self._exportPackageImportsOf_on_(aPackage,aStream);
  27654. self._exportPackageTransportOf_on_(aPackage,aStream);
  27655. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  27656. return $core.withContext(function($ctx2) {
  27657. self._exportDefinitionOf_on_(each,aStream);
  27658. $1=$recv(each)._ownMethods();
  27659. $ctx2.sendIdx["ownMethods"]=1;
  27660. $recv($1)._do_((function(method){
  27661. return $core.withContext(function($ctx3) {
  27662. return self._exportMethod_on_(method,aStream);
  27663. $ctx3.sendIdx["exportMethod:on:"]=1;
  27664. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  27665. }));
  27666. $ctx2.sendIdx["do:"]=2;
  27667. self._exportMetaDefinitionOf_on_(each,aStream);
  27668. return $recv($recv($recv(each)._class())._ownMethods())._do_((function(method){
  27669. return $core.withContext(function($ctx3) {
  27670. return self._exportMethod_on_(method,aStream);
  27671. $ctx3.sendIdx["exportMethod:on:"]=2;
  27672. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,3)});
  27673. }));
  27674. $ctx2.sendIdx["do:"]=3;
  27675. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27676. }));
  27677. $ctx1.sendIdx["do:"]=1;
  27678. $recv(self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  27679. return $core.withContext(function($ctx2) {
  27680. return self._exportMethod_on_(each,aStream);
  27681. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  27682. }));
  27683. self._exportPackageEpilogueOf_on_(aPackage,aStream);
  27684. return self;
  27685. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27686. },
  27687. args: ["aPackage", "aStream"],
  27688. 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",
  27689. referencedClasses: [],
  27690. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportDefinitionOf:on:", "ownMethods", "exportMethod:on:", "exportMetaDefinitionOf:on:", "class", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"]
  27691. }),
  27692. $globals.Exporter);
  27693. $core.addMethod(
  27694. $core.method({
  27695. selector: "exportPackageContextOf:on:",
  27696. protocol: 'output',
  27697. fn: function (aPackage,aStream){
  27698. var self=this;
  27699. return $core.withContext(function($ctx1) {
  27700. $recv(aStream)._nextPutAll_("$core.packages[");
  27701. $ctx1.sendIdx["nextPutAll:"]=1;
  27702. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27703. $ctx1.sendIdx["nextPutAll:"]=2;
  27704. $recv(aStream)._nextPutAll_("].innerEval = ");
  27705. $ctx1.sendIdx["nextPutAll:"]=3;
  27706. $recv(aStream)._nextPutAll_("function (expr) { return eval(expr); }");
  27707. $ctx1.sendIdx["nextPutAll:"]=4;
  27708. $recv(aStream)._nextPutAll_(";");
  27709. $recv(aStream)._lf();
  27710. return self;
  27711. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27712. },
  27713. args: ["aPackage", "aStream"],
  27714. 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",
  27715. referencedClasses: [],
  27716. messageSends: ["nextPutAll:", "asJavascript", "name", "lf"]
  27717. }),
  27718. $globals.Exporter);
  27719. $core.addMethod(
  27720. $core.method({
  27721. selector: "exportPackageDefinitionOf:on:",
  27722. protocol: 'output',
  27723. fn: function (aPackage,aStream){
  27724. var self=this;
  27725. return $core.withContext(function($ctx1) {
  27726. var $1;
  27727. $recv(aStream)._nextPutAll_("$core.addPackage(");
  27728. $ctx1.sendIdx["nextPutAll:"]=1;
  27729. $1=$recv("'".__comma($recv(aPackage)._name())).__comma("');");
  27730. $ctx1.sendIdx[","]=1;
  27731. $recv(aStream)._nextPutAll_($1);
  27732. $recv(aStream)._lf();
  27733. return self;
  27734. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27735. },
  27736. args: ["aPackage", "aStream"],
  27737. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '$core.addPackage(';\x0a\x09\x09nextPutAll: '''', aPackage name, ''');';\x0a\x09\x09lf",
  27738. referencedClasses: [],
  27739. messageSends: ["nextPutAll:", ",", "name", "lf"]
  27740. }),
  27741. $globals.Exporter);
  27742. $core.addMethod(
  27743. $core.method({
  27744. selector: "exportPackageEpilogueOf:on:",
  27745. protocol: 'output',
  27746. fn: function (aPackage,aStream){
  27747. var self=this;
  27748. return $core.withContext(function($ctx1) {
  27749. self._subclassResponsibility();
  27750. return self;
  27751. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27752. },
  27753. args: ["aPackage", "aStream"],
  27754. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27755. referencedClasses: [],
  27756. messageSends: ["subclassResponsibility"]
  27757. }),
  27758. $globals.Exporter);
  27759. $core.addMethod(
  27760. $core.method({
  27761. selector: "exportPackageImportsOf:on:",
  27762. protocol: 'output',
  27763. fn: function (aPackage,aStream){
  27764. var self=this;
  27765. return $core.withContext(function($ctx1) {
  27766. var $1;
  27767. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  27768. return $core.withContext(function($ctx2) {
  27769. $recv(aStream)._nextPutAll_("$core.packages[");
  27770. $ctx2.sendIdx["nextPutAll:"]=1;
  27771. $1=$recv($recv(aPackage)._name())._asJavascript();
  27772. $ctx2.sendIdx["asJavascript"]=1;
  27773. $recv(aStream)._nextPutAll_($1);
  27774. $ctx2.sendIdx["nextPutAll:"]=2;
  27775. $recv(aStream)._nextPutAll_("].imports = ");
  27776. $ctx2.sendIdx["nextPutAll:"]=3;
  27777. $recv(aStream)._nextPutAll_($recv(imports)._asJavascript());
  27778. $ctx2.sendIdx["nextPutAll:"]=4;
  27779. $recv(aStream)._nextPutAll_(";");
  27780. return $recv(aStream)._lf();
  27781. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  27782. }));
  27783. return self;
  27784. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27785. },
  27786. args: ["aPackage", "aStream"],
  27787. 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 ]",
  27788. referencedClasses: [],
  27789. messageSends: ["ifNotEmpty:", "importsAsJson", "nextPutAll:", "asJavascript", "name", "lf"]
  27790. }),
  27791. $globals.Exporter);
  27792. $core.addMethod(
  27793. $core.method({
  27794. selector: "exportPackagePrologueOf:on:",
  27795. protocol: 'output',
  27796. fn: function (aPackage,aStream){
  27797. var self=this;
  27798. return $core.withContext(function($ctx1) {
  27799. self._subclassResponsibility();
  27800. return self;
  27801. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27802. },
  27803. args: ["aPackage", "aStream"],
  27804. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  27805. referencedClasses: [],
  27806. messageSends: ["subclassResponsibility"]
  27807. }),
  27808. $globals.Exporter);
  27809. $core.addMethod(
  27810. $core.method({
  27811. selector: "exportPackageTransportOf:on:",
  27812. protocol: 'output',
  27813. fn: function (aPackage,aStream){
  27814. var self=this;
  27815. return $core.withContext(function($ctx1) {
  27816. $recv(aStream)._nextPutAll_("$core.packages[");
  27817. $ctx1.sendIdx["nextPutAll:"]=1;
  27818. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._name())._asJavascript());
  27819. $ctx1.sendIdx["nextPutAll:"]=2;
  27820. $recv(aStream)._nextPutAll_("].transport = ");
  27821. $ctx1.sendIdx["nextPutAll:"]=3;
  27822. $recv(aStream)._nextPutAll_($recv($recv(aPackage)._transport())._asJSONString());
  27823. $ctx1.sendIdx["nextPutAll:"]=4;
  27824. $recv(aStream)._nextPutAll_(";");
  27825. $recv(aStream)._lf();
  27826. return self;
  27827. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  27828. },
  27829. args: ["aPackage", "aStream"],
  27830. 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",
  27831. referencedClasses: [],
  27832. messageSends: ["nextPutAll:", "asJavascript", "name", "asJSONString", "transport", "lf"]
  27833. }),
  27834. $globals.Exporter);
  27835. $core.addMethod(
  27836. $core.method({
  27837. selector: "jsClassNameFor:",
  27838. protocol: 'convenience',
  27839. fn: function (aClass){
  27840. var self=this;
  27841. return $core.withContext(function($ctx1) {
  27842. var $1,$receiver;
  27843. $1=$recv(aClass)._isMetaclass();
  27844. if($core.assert($1)){
  27845. return $recv(self._jsClassNameFor_($recv(aClass)._instanceClass())).__comma(".klass");
  27846. $ctx1.sendIdx[","]=1;
  27847. } else {
  27848. if(($receiver = aClass) == null || $receiver.isNil){
  27849. return "null";
  27850. } else {
  27851. return "$globals.".__comma($recv(aClass)._name());
  27852. };
  27853. };
  27854. }, function($ctx1) {$ctx1.fill(self,"jsClassNameFor:",{aClass:aClass},$globals.Exporter)});
  27855. },
  27856. args: ["aClass"],
  27857. 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 ] ]",
  27858. referencedClasses: [],
  27859. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "jsClassNameFor:", "instanceClass", "ifNil:ifNotNil:", "name"]
  27860. }),
  27861. $globals.Exporter);
  27862. $core.addMethod(
  27863. $core.method({
  27864. selector: "ownMethodsOfClass:",
  27865. protocol: 'accessing',
  27866. fn: function (aClass){
  27867. var self=this;
  27868. return $core.withContext(function($ctx1) {
  27869. var $1;
  27870. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  27871. return $core.withContext(function($ctx2) {
  27872. $1=$recv(a)._selector();
  27873. $ctx2.sendIdx["selector"]=1;
  27874. return $recv($1).__lt_eq($recv(b)._selector());
  27875. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  27876. })))._reject_((function(each){
  27877. return $core.withContext(function($ctx2) {
  27878. return $recv($recv(each)._protocol())._match_("^\x5c*");
  27879. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27880. }));
  27881. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  27882. },
  27883. args: ["aClass"],
  27884. 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*') ]",
  27885. referencedClasses: [],
  27886. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  27887. }),
  27888. $globals.Exporter);
  27889. $core.addMethod(
  27890. $core.method({
  27891. selector: "ownMethodsOfMetaClass:",
  27892. protocol: 'accessing',
  27893. fn: function (aClass){
  27894. var self=this;
  27895. return $core.withContext(function($ctx1) {
  27896. return self._ownMethodsOfClass_($recv(aClass)._class());
  27897. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  27898. },
  27899. args: ["aClass"],
  27900. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass class",
  27901. referencedClasses: [],
  27902. messageSends: ["ownMethodsOfClass:", "class"]
  27903. }),
  27904. $globals.Exporter);
  27905. $core.addClass('AmdExporter', $globals.Exporter, ['namespace'], 'Platform-ImportExport');
  27906. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  27907. $core.addMethod(
  27908. $core.method({
  27909. selector: "amdNamesOfPackages:",
  27910. protocol: 'private',
  27911. fn: function (anArray){
  27912. var self=this;
  27913. return $core.withContext(function($ctx1) {
  27914. var $1;
  27915. return $recv($recv(anArray)._select_((function(each){
  27916. return $core.withContext(function($ctx2) {
  27917. $1=self._amdNamespaceOfPackage_(each);
  27918. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  27919. return $recv($1)._notNil();
  27920. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  27921. })))._collect_((function(each){
  27922. return $core.withContext(function($ctx2) {
  27923. return $recv($recv(self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  27924. $ctx2.sendIdx[","]=1;
  27925. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  27926. }));
  27927. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  27928. },
  27929. args: ["anArray"],
  27930. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  27931. referencedClasses: [],
  27932. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  27933. }),
  27934. $globals.AmdExporter);
  27935. $core.addMethod(
  27936. $core.method({
  27937. selector: "amdNamespaceOfPackage:",
  27938. protocol: 'private',
  27939. fn: function (aPackage){
  27940. var self=this;
  27941. return $core.withContext(function($ctx1) {
  27942. var $3,$2,$1;
  27943. $3=$recv(aPackage)._transport();
  27944. $ctx1.sendIdx["transport"]=1;
  27945. $2=$recv($3)._type();
  27946. $1=$recv($2).__eq("amd");
  27947. if($core.assert($1)){
  27948. return $recv($recv(aPackage)._transport())._namespace();
  27949. } else {
  27950. return nil;
  27951. };
  27952. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  27953. },
  27954. args: ["aPackage"],
  27955. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  27956. referencedClasses: [],
  27957. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  27958. }),
  27959. $globals.AmdExporter);
  27960. $core.addMethod(
  27961. $core.method({
  27962. selector: "exportPackageEpilogueOf:on:",
  27963. protocol: 'output',
  27964. fn: function (aPackage,aStream){
  27965. var self=this;
  27966. return $core.withContext(function($ctx1) {
  27967. $recv(aStream)._nextPutAll_("});");
  27968. $recv(aStream)._lf();
  27969. return self;
  27970. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  27971. },
  27972. args: ["aPackage", "aStream"],
  27973. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: '});';\x0a\x09\x09lf",
  27974. referencedClasses: [],
  27975. messageSends: ["nextPutAll:", "lf"]
  27976. }),
  27977. $globals.AmdExporter);
  27978. $core.addMethod(
  27979. $core.method({
  27980. selector: "exportPackagePrologueOf:on:",
  27981. protocol: 'output',
  27982. fn: function (aPackage,aStream){
  27983. var self=this;
  27984. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  27985. return $core.withContext(function($ctx1) {
  27986. var $1,$3,$2,$4,$6,$5,$7,$13,$12,$11,$10,$9,$8,$17,$16,$15,$14;
  27987. pragmaStart="";
  27988. pragmaEnd="";
  27989. importsForOutput=self._importsForOutput_(aPackage);
  27990. loadDependencies=self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  27991. $1=$recv(importsForOutput)._value();
  27992. $ctx1.sendIdx["value"]=1;
  27993. $recv($1)._ifNotEmpty_((function(){
  27994. return $core.withContext(function($ctx2) {
  27995. $3=$recv($globals.String)._lf();
  27996. $ctx2.sendIdx["lf"]=1;
  27997. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  27998. $ctx2.sendIdx[","]=2;
  27999. $4=$recv($globals.String)._lf();
  28000. $ctx2.sendIdx["lf"]=2;
  28001. pragmaStart=$recv($2).__comma($4);
  28002. $ctx2.sendIdx[","]=1;
  28003. pragmaStart;
  28004. $6=$recv($globals.String)._lf();
  28005. $ctx2.sendIdx["lf"]=3;
  28006. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  28007. $ctx2.sendIdx[","]=4;
  28008. $7=$recv($globals.String)._lf();
  28009. $ctx2.sendIdx["lf"]=4;
  28010. pragmaEnd=$recv($5).__comma($7);
  28011. $ctx2.sendIdx[","]=3;
  28012. return pragmaEnd;
  28013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28014. }));
  28015. $recv(aStream)._nextPutAll_("define(\x22");
  28016. $ctx1.sendIdx["nextPutAll:"]=1;
  28017. $recv(aStream)._nextPutAll_(self._amdNamespaceOfPackage_(aPackage));
  28018. $ctx1.sendIdx["nextPutAll:"]=2;
  28019. $recv(aStream)._nextPutAll_("/");
  28020. $ctx1.sendIdx["nextPutAll:"]=3;
  28021. $recv(aStream)._nextPutAll_($recv(aPackage)._name());
  28022. $ctx1.sendIdx["nextPutAll:"]=4;
  28023. $recv(aStream)._nextPutAll_("\x22, ");
  28024. $ctx1.sendIdx["nextPutAll:"]=5;
  28025. $13=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  28026. $ctx1.sendIdx[","]=7;
  28027. $12=$recv($13).__comma([":2:"]);
  28028. $ctx1.sendIdx[","]=6;
  28029. $11=$recv($12).__comma(loadDependencies);
  28030. $ctx1.sendIdx[","]=5;
  28031. $10=$recv($11)._asJavascript();
  28032. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  28033. $ctx1.sendIdx["replace:with:"]=2;
  28034. $8=$recv($9)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  28035. $ctx1.sendIdx["replace:with:"]=1;
  28036. $recv(aStream)._nextPutAll_($8);
  28037. $ctx1.sendIdx["nextPutAll:"]=6;
  28038. $recv(aStream)._nextPutAll_(", function(");
  28039. $ctx1.sendIdx["nextPutAll:"]=7;
  28040. $17=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  28041. $ctx1.sendIdx[","]=8;
  28042. $16=$recv($17)._join_(",");
  28043. $15=$recv($16)._replace_with_(",\x5cs*:1:",pragmaStart);
  28044. $14=$recv($15)._replace_with_(",\x5cs*:2:",pragmaEnd);
  28045. $ctx1.sendIdx["replace:with:"]=3;
  28046. $recv(aStream)._nextPutAll_($14);
  28047. $ctx1.sendIdx["nextPutAll:"]=8;
  28048. $recv(aStream)._nextPutAll_("){\x22use strict\x22;");
  28049. $ctx1.sendIdx["nextPutAll:"]=9;
  28050. $recv(aStream)._lf();
  28051. $ctx1.sendIdx["lf"]=5;
  28052. $recv(aStream)._nextPutAll_("var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;");
  28053. $recv(aStream)._lf();
  28054. return self;
  28055. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  28056. },
  28057. args: ["aPackage", "aStream"],
  28058. 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(\x22';\x0a\x09\x09nextPutAll: (self amdNamespaceOfPackage: aPackage);\x0a\x09\x09nextPutAll: '/'; \x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, ';\x0a\x09\x09nextPutAll: (((\x0a\x09\x09\x09(#('amber/boot' ':1:'), importsForOutput value, #(':2:'), loadDependencies) 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\x09\x09nextPutAll: 'var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;';\x0a\x09\x09lf",
  28059. referencedClasses: ["String"],
  28060. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "nextPutAll:", "amdNamespaceOfPackage:", "name", "replace:with:", "asJavascript", "join:", "key"]
  28061. }),
  28062. $globals.AmdExporter);
  28063. $core.addMethod(
  28064. $core.method({
  28065. selector: "importsForOutput:",
  28066. protocol: 'private',
  28067. fn: function (aPackage){
  28068. var self=this;
  28069. var namedImports,anonImports,importVarNames;
  28070. return $core.withContext(function($ctx1) {
  28071. var $1;
  28072. namedImports=[];
  28073. anonImports=[];
  28074. importVarNames=[];
  28075. $recv($recv(aPackage)._imports())._do_((function(each){
  28076. return $core.withContext(function($ctx2) {
  28077. $1=$recv(each)._isString();
  28078. if($core.assert($1)){
  28079. return $recv(anonImports)._add_(each);
  28080. $ctx2.sendIdx["add:"]=1;
  28081. } else {
  28082. $recv(namedImports)._add_($recv(each)._value());
  28083. $ctx2.sendIdx["add:"]=2;
  28084. return $recv(importVarNames)._add_($recv(each)._key());
  28085. };
  28086. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  28087. }));
  28088. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  28089. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  28090. },
  28091. args: ["aPackage"],
  28092. 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)",
  28093. referencedClasses: [],
  28094. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  28095. }),
  28096. $globals.AmdExporter);
  28097. $core.addClass('ChunkParser', $globals.Object, ['stream', 'last'], 'Platform-ImportExport');
  28098. $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";
  28099. $core.addMethod(
  28100. $core.method({
  28101. selector: "last",
  28102. protocol: 'accessing',
  28103. fn: function (){
  28104. var self=this;
  28105. return self["@last"];
  28106. },
  28107. args: [],
  28108. source: "last\x0a\x09^ last",
  28109. referencedClasses: [],
  28110. messageSends: []
  28111. }),
  28112. $globals.ChunkParser);
  28113. $core.addMethod(
  28114. $core.method({
  28115. selector: "nextChunk",
  28116. protocol: 'reading',
  28117. fn: function (){
  28118. var self=this;
  28119. var char,result,chunk;
  28120. return $core.withContext(function($ctx1) {
  28121. var $1,$2,$3,$4;
  28122. var $early={};
  28123. try {
  28124. result=""._writeStream();
  28125. $recv((function(){
  28126. return $core.withContext(function($ctx2) {
  28127. char=$recv(self["@stream"])._next();
  28128. $ctx2.sendIdx["next"]=1;
  28129. char;
  28130. return $recv(char)._notNil();
  28131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28132. }))._whileTrue_((function(){
  28133. return $core.withContext(function($ctx2) {
  28134. $1=$recv(char).__eq("!");
  28135. $ctx2.sendIdx["="]=1;
  28136. if($core.assert($1)){
  28137. $2=$recv($recv(self["@stream"])._peek()).__eq("!");
  28138. if($core.assert($2)){
  28139. $recv(self["@stream"])._next();
  28140. } else {
  28141. self["@last"]=$recv($recv(result)._contents())._trimBoth();
  28142. $3=self["@last"];
  28143. throw $early=[$3];
  28144. };
  28145. };
  28146. return $recv(result)._nextPut_(char);
  28147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28148. }));
  28149. self["@last"]=nil;
  28150. $4=self["@last"];
  28151. return $4;
  28152. }
  28153. catch(e) {if(e===$early)return e[0]; throw e}
  28154. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  28155. },
  28156. args: [],
  28157. 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",
  28158. referencedClasses: [],
  28159. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  28160. }),
  28161. $globals.ChunkParser);
  28162. $core.addMethod(
  28163. $core.method({
  28164. selector: "stream:",
  28165. protocol: 'accessing',
  28166. fn: function (aStream){
  28167. var self=this;
  28168. self["@stream"]=aStream;
  28169. return self;
  28170. },
  28171. args: ["aStream"],
  28172. source: "stream: aStream\x0a\x09stream := aStream",
  28173. referencedClasses: [],
  28174. messageSends: []
  28175. }),
  28176. $globals.ChunkParser);
  28177. $core.addMethod(
  28178. $core.method({
  28179. selector: "on:",
  28180. protocol: 'instance creation',
  28181. fn: function (aStream){
  28182. var self=this;
  28183. return $core.withContext(function($ctx1) {
  28184. return $recv(self._new())._stream_(aStream);
  28185. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.klass)});
  28186. },
  28187. args: ["aStream"],
  28188. source: "on: aStream\x0a\x09^ self new stream: aStream",
  28189. referencedClasses: [],
  28190. messageSends: ["stream:", "new"]
  28191. }),
  28192. $globals.ChunkParser.klass);
  28193. $core.addClass('ClassCommentReader', $globals.Object, ['class'], 'Platform-ImportExport');
  28194. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  28195. $core.addMethod(
  28196. $core.method({
  28197. selector: "class:",
  28198. protocol: 'accessing',
  28199. fn: function (aClass){
  28200. var self=this;
  28201. self["@class"]=aClass;
  28202. return self;
  28203. },
  28204. args: ["aClass"],
  28205. source: "class: aClass\x0a\x09class := aClass",
  28206. referencedClasses: [],
  28207. messageSends: []
  28208. }),
  28209. $globals.ClassCommentReader);
  28210. $core.addMethod(
  28211. $core.method({
  28212. selector: "initialize",
  28213. protocol: 'initialization',
  28214. fn: function (){
  28215. var self=this;
  28216. return $core.withContext(function($ctx1) {
  28217. (
  28218. $ctx1.supercall = true,
  28219. ($globals.ClassCommentReader.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  28220. $ctx1.supercall = false;
  28221. return self;
  28222. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  28223. },
  28224. args: [],
  28225. source: "initialize\x0a\x09super initialize.",
  28226. referencedClasses: [],
  28227. messageSends: ["initialize"]
  28228. }),
  28229. $globals.ClassCommentReader);
  28230. $core.addMethod(
  28231. $core.method({
  28232. selector: "scanFrom:",
  28233. protocol: 'fileIn',
  28234. fn: function (aChunkParser){
  28235. var self=this;
  28236. var chunk;
  28237. return $core.withContext(function($ctx1) {
  28238. var $1;
  28239. chunk=$recv(aChunkParser)._nextChunk();
  28240. $1=$recv(chunk)._isEmpty();
  28241. if(!$core.assert($1)){
  28242. self._setComment_(chunk);
  28243. };
  28244. return self;
  28245. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  28246. },
  28247. args: ["aChunkParser"],
  28248. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ifFalse: [\x0a\x09\x09self setComment: chunk ].",
  28249. referencedClasses: [],
  28250. messageSends: ["nextChunk", "ifFalse:", "isEmpty", "setComment:"]
  28251. }),
  28252. $globals.ClassCommentReader);
  28253. $core.addMethod(
  28254. $core.method({
  28255. selector: "setComment:",
  28256. protocol: 'private',
  28257. fn: function (aString){
  28258. var self=this;
  28259. return $core.withContext(function($ctx1) {
  28260. $recv(self["@class"])._comment_(aString);
  28261. return self;
  28262. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  28263. },
  28264. args: ["aString"],
  28265. source: "setComment: aString\x0a\x09class comment: aString",
  28266. referencedClasses: [],
  28267. messageSends: ["comment:"]
  28268. }),
  28269. $globals.ClassCommentReader);
  28270. $core.addClass('ClassProtocolReader', $globals.Object, ['class', 'category'], 'Platform-ImportExport');
  28271. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  28272. $core.addMethod(
  28273. $core.method({
  28274. selector: "class:category:",
  28275. protocol: 'accessing',
  28276. fn: function (aClass,aString){
  28277. var self=this;
  28278. self["@class"]=aClass;
  28279. self["@category"]=aString;
  28280. return self;
  28281. },
  28282. args: ["aClass", "aString"],
  28283. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  28284. referencedClasses: [],
  28285. messageSends: []
  28286. }),
  28287. $globals.ClassProtocolReader);
  28288. $core.addMethod(
  28289. $core.method({
  28290. selector: "compileMethod:",
  28291. protocol: 'private',
  28292. fn: function (aString){
  28293. var self=this;
  28294. return $core.withContext(function($ctx1) {
  28295. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self["@class"],self["@category"]);
  28296. return self;
  28297. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  28298. },
  28299. args: ["aString"],
  28300. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  28301. referencedClasses: ["Compiler"],
  28302. messageSends: ["install:forClass:protocol:", "new"]
  28303. }),
  28304. $globals.ClassProtocolReader);
  28305. $core.addMethod(
  28306. $core.method({
  28307. selector: "initialize",
  28308. protocol: 'initialization',
  28309. fn: function (){
  28310. var self=this;
  28311. return $core.withContext(function($ctx1) {
  28312. (
  28313. $ctx1.supercall = true,
  28314. ($globals.ClassProtocolReader.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  28315. $ctx1.supercall = false;
  28316. return self;
  28317. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  28318. },
  28319. args: [],
  28320. source: "initialize\x0a\x09super initialize.",
  28321. referencedClasses: [],
  28322. messageSends: ["initialize"]
  28323. }),
  28324. $globals.ClassProtocolReader);
  28325. $core.addMethod(
  28326. $core.method({
  28327. selector: "scanFrom:",
  28328. protocol: 'fileIn',
  28329. fn: function (aChunkParser){
  28330. var self=this;
  28331. var chunk;
  28332. return $core.withContext(function($ctx1) {
  28333. $recv((function(){
  28334. return $core.withContext(function($ctx2) {
  28335. chunk=$recv(aChunkParser)._nextChunk();
  28336. chunk;
  28337. return $recv(chunk)._isEmpty();
  28338. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28339. }))._whileFalse_((function(){
  28340. return $core.withContext(function($ctx2) {
  28341. return self._compileMethod_(chunk);
  28342. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  28343. }));
  28344. $recv($recv($globals.ClassBuilder)._new())._setupClass_(self["@class"]);
  28345. return self;
  28346. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  28347. },
  28348. args: ["aChunkParser"],
  28349. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ].\x0a\x09ClassBuilder new setupClass: class",
  28350. referencedClasses: ["ClassBuilder"],
  28351. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:", "setupClass:", "new"]
  28352. }),
  28353. $globals.ClassProtocolReader);
  28354. $core.addClass('ExportMethodProtocol', $globals.Object, ['name', 'theClass'], 'Platform-ImportExport');
  28355. $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.";
  28356. $core.addMethod(
  28357. $core.method({
  28358. selector: "methods",
  28359. protocol: 'accessing',
  28360. fn: function (){
  28361. var self=this;
  28362. return $core.withContext(function($ctx1) {
  28363. var $1;
  28364. return $recv($recv(self._theClass())._methodsInProtocol_(self._name()))._sorted_((function(a,b){
  28365. return $core.withContext(function($ctx2) {
  28366. $1=$recv(a)._selector();
  28367. $ctx2.sendIdx["selector"]=1;
  28368. return $recv($1).__lt_eq($recv(b)._selector());
  28369. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  28370. }));
  28371. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  28372. },
  28373. args: [],
  28374. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  28375. referencedClasses: [],
  28376. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  28377. }),
  28378. $globals.ExportMethodProtocol);
  28379. $core.addMethod(
  28380. $core.method({
  28381. selector: "name",
  28382. protocol: 'accessing',
  28383. fn: function (){
  28384. var self=this;
  28385. return self["@name"];
  28386. },
  28387. args: [],
  28388. source: "name\x0a\x09^ name",
  28389. referencedClasses: [],
  28390. messageSends: []
  28391. }),
  28392. $globals.ExportMethodProtocol);
  28393. $core.addMethod(
  28394. $core.method({
  28395. selector: "name:",
  28396. protocol: 'accessing',
  28397. fn: function (aString){
  28398. var self=this;
  28399. self["@name"]=aString;
  28400. return self;
  28401. },
  28402. args: ["aString"],
  28403. source: "name: aString\x0a\x09name := aString",
  28404. referencedClasses: [],
  28405. messageSends: []
  28406. }),
  28407. $globals.ExportMethodProtocol);
  28408. $core.addMethod(
  28409. $core.method({
  28410. selector: "theClass",
  28411. protocol: 'accessing',
  28412. fn: function (){
  28413. var self=this;
  28414. return self["@theClass"];
  28415. },
  28416. args: [],
  28417. source: "theClass\x0a\x09^ theClass",
  28418. referencedClasses: [],
  28419. messageSends: []
  28420. }),
  28421. $globals.ExportMethodProtocol);
  28422. $core.addMethod(
  28423. $core.method({
  28424. selector: "theClass:",
  28425. protocol: 'accessing',
  28426. fn: function (aClass){
  28427. var self=this;
  28428. self["@theClass"]=aClass;
  28429. return self;
  28430. },
  28431. args: ["aClass"],
  28432. source: "theClass: aClass\x0a\x09theClass := aClass",
  28433. referencedClasses: [],
  28434. messageSends: []
  28435. }),
  28436. $globals.ExportMethodProtocol);
  28437. $core.addMethod(
  28438. $core.method({
  28439. selector: "name:theClass:",
  28440. protocol: 'instance creation',
  28441. fn: function (aString,aClass){
  28442. var self=this;
  28443. return $core.withContext(function($ctx1) {
  28444. var $1;
  28445. $1=self._new();
  28446. $recv($1)._name_(aString);
  28447. $recv($1)._theClass_(aClass);
  28448. return $recv($1)._yourself();
  28449. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.klass)});
  28450. },
  28451. args: ["aString", "aClass"],
  28452. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  28453. referencedClasses: [],
  28454. messageSends: ["name:", "new", "theClass:", "yourself"]
  28455. }),
  28456. $globals.ExportMethodProtocol.klass);
  28457. $core.addClass('Importer', $globals.Object, ['lastSection', 'lastChunk'], 'Platform-ImportExport');
  28458. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  28459. $core.addMethod(
  28460. $core.method({
  28461. selector: "import:",
  28462. protocol: 'fileIn',
  28463. fn: function (aStream){
  28464. var self=this;
  28465. var chunk,result,parser,lastEmpty;
  28466. return $core.withContext(function($ctx1) {
  28467. var $1,$2;
  28468. parser=$recv($globals.ChunkParser)._on_(aStream);
  28469. lastEmpty=false;
  28470. self["@lastSection"]="n/a, not started";
  28471. self["@lastChunk"]=nil;
  28472. $recv((function(){
  28473. return $core.withContext(function($ctx2) {
  28474. $recv((function(){
  28475. return $core.withContext(function($ctx3) {
  28476. chunk=$recv(parser)._nextChunk();
  28477. chunk;
  28478. return $recv(chunk)._isNil();
  28479. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28480. }))._whileFalse_((function(){
  28481. return $core.withContext(function($ctx3) {
  28482. $1=$recv(chunk)._isEmpty();
  28483. if($core.assert($1)){
  28484. lastEmpty=true;
  28485. return lastEmpty;
  28486. } else {
  28487. self["@lastSection"]=chunk;
  28488. self["@lastSection"];
  28489. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  28490. result;
  28491. $2=lastEmpty;
  28492. if($core.assert($2)){
  28493. lastEmpty=false;
  28494. lastEmpty;
  28495. return $recv(result)._scanFrom_(parser);
  28496. };
  28497. };
  28498. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28499. }));
  28500. self["@lastSection"]="n/a, finished";
  28501. return self["@lastSection"];
  28502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28503. }))._on_do_($globals.Error,(function(e){
  28504. return $core.withContext(function($ctx2) {
  28505. self["@lastChunk"]=$recv(parser)._last();
  28506. self["@lastChunk"];
  28507. return $recv(e)._resignal();
  28508. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  28509. }));
  28510. return self;
  28511. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  28512. },
  28513. args: ["aStream"],
  28514. 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 isEmpty\x0a\x09\x09\x09ifTrue: [ lastEmpty := true ]\x0a\x09\x09\x09ifFalse: [\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 ].",
  28515. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  28516. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifTrue:ifFalse:", "isEmpty", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "resignal"]
  28517. }),
  28518. $globals.Importer);
  28519. $core.addMethod(
  28520. $core.method({
  28521. selector: "lastChunk",
  28522. protocol: 'accessing',
  28523. fn: function (){
  28524. var self=this;
  28525. return self["@lastChunk"];
  28526. },
  28527. args: [],
  28528. source: "lastChunk\x0a\x09^ lastChunk",
  28529. referencedClasses: [],
  28530. messageSends: []
  28531. }),
  28532. $globals.Importer);
  28533. $core.addMethod(
  28534. $core.method({
  28535. selector: "lastSection",
  28536. protocol: 'accessing',
  28537. fn: function (){
  28538. var self=this;
  28539. return self["@lastSection"];
  28540. },
  28541. args: [],
  28542. source: "lastSection\x0a\x09^ lastSection",
  28543. referencedClasses: [],
  28544. messageSends: []
  28545. }),
  28546. $globals.Importer);
  28547. $core.addClass('PackageCommitError', $globals.Error, [], 'Platform-ImportExport');
  28548. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  28549. $core.addClass('PackageHandler', $globals.InterfacingObject, [], 'Platform-ImportExport');
  28550. $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.";
  28551. $core.addMethod(
  28552. $core.method({
  28553. selector: "ajaxPutAt:data:onSuccess:onError:",
  28554. protocol: 'private',
  28555. fn: function (aURL,aString,aBlock,anotherBlock){
  28556. var self=this;
  28557. var xhr;
  28558. return $core.withContext(function($ctx1) {
  28559. var $1,$4,$3,$2;
  28560. xhr=$recv($globals.Platform)._newXhr();
  28561. $recv(xhr)._open_url_async_("PUT",aURL,true);
  28562. $recv(xhr)._onreadystatechange_((function(){
  28563. return $core.withContext(function($ctx2) {
  28564. $1=$recv($recv(xhr)._readyState()).__eq((4));
  28565. if($core.assert($1)){
  28566. $4=$recv(xhr)._status();
  28567. $ctx2.sendIdx["status"]=1;
  28568. $3=$recv($4).__gt_eq((200));
  28569. $2=$recv($3)._and_((function(){
  28570. return $core.withContext(function($ctx3) {
  28571. return $recv($recv(xhr)._status()).__lt((300));
  28572. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  28573. }));
  28574. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  28575. };
  28576. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28577. }));
  28578. $recv(xhr)._send_(aString);
  28579. return self;
  28580. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  28581. },
  28582. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  28583. 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",
  28584. referencedClasses: ["Platform"],
  28585. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  28586. }),
  28587. $globals.PackageHandler);
  28588. $core.addMethod(
  28589. $core.method({
  28590. selector: "chunkContentsFor:",
  28591. protocol: 'accessing',
  28592. fn: function (aPackage){
  28593. var self=this;
  28594. return $core.withContext(function($ctx1) {
  28595. return $recv($globals.String)._streamContents_((function(str){
  28596. return $core.withContext(function($ctx2) {
  28597. return $recv(self._chunkExporter())._exportPackage_on_(aPackage,str);
  28598. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28599. }));
  28600. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28601. },
  28602. args: ["aPackage"],
  28603. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  28604. referencedClasses: ["String"],
  28605. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  28606. }),
  28607. $globals.PackageHandler);
  28608. $core.addMethod(
  28609. $core.method({
  28610. selector: "chunkExporter",
  28611. protocol: 'factory',
  28612. fn: function (){
  28613. var self=this;
  28614. return $core.withContext(function($ctx1) {
  28615. return $recv(self._chunkExporterClass())._new();
  28616. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  28617. },
  28618. args: [],
  28619. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  28620. referencedClasses: [],
  28621. messageSends: ["new", "chunkExporterClass"]
  28622. }),
  28623. $globals.PackageHandler);
  28624. $core.addMethod(
  28625. $core.method({
  28626. selector: "chunkExporterClass",
  28627. protocol: 'accessing',
  28628. fn: function (){
  28629. var self=this;
  28630. return $globals.ChunkExporter;
  28631. },
  28632. args: [],
  28633. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  28634. referencedClasses: ["ChunkExporter"],
  28635. messageSends: []
  28636. }),
  28637. $globals.PackageHandler);
  28638. $core.addMethod(
  28639. $core.method({
  28640. selector: "commit:",
  28641. protocol: 'committing',
  28642. fn: function (aPackage){
  28643. var self=this;
  28644. return $core.withContext(function($ctx1) {
  28645. var $1,$2;
  28646. self._commit_onSuccess_onError_(aPackage,(function(){
  28647. }),(function(error){
  28648. return $core.withContext(function($ctx2) {
  28649. $1=$recv($globals.PackageCommitError)._new();
  28650. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  28651. $ctx2.sendIdx[","]=1;
  28652. $recv($1)._messageText_($2);
  28653. return $recv($1)._signal();
  28654. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  28655. }));
  28656. return self;
  28657. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  28658. },
  28659. args: ["aPackage"],
  28660. 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 ]",
  28661. referencedClasses: ["PackageCommitError"],
  28662. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  28663. }),
  28664. $globals.PackageHandler);
  28665. $core.addMethod(
  28666. $core.method({
  28667. selector: "commit:onSuccess:onError:",
  28668. protocol: 'committing',
  28669. fn: function (aPackage,aBlock,anotherBlock){
  28670. var self=this;
  28671. return $core.withContext(function($ctx1) {
  28672. self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  28673. return $core.withContext(function($ctx2) {
  28674. return self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  28675. return $core.withContext(function($ctx3) {
  28676. $recv(aPackage)._beClean();
  28677. return $recv(aBlock)._value();
  28678. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  28679. }),anotherBlock);
  28680. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  28681. }),anotherBlock);
  28682. return self;
  28683. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28684. },
  28685. args: ["aPackage", "aBlock", "anotherBlock"],
  28686. 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",
  28687. referencedClasses: [],
  28688. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  28689. }),
  28690. $globals.PackageHandler);
  28691. $core.addMethod(
  28692. $core.method({
  28693. selector: "commitJsFileFor:onSuccess:onError:",
  28694. protocol: 'committing',
  28695. fn: function (aPackage,aBlock,anotherBlock){
  28696. var self=this;
  28697. return $core.withContext(function($ctx1) {
  28698. var $2,$1;
  28699. $2=$recv($recv(self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28700. $ctx1.sendIdx[","]=2;
  28701. $1=$recv($2).__comma(".js");
  28702. $ctx1.sendIdx[","]=1;
  28703. self._ajaxPutAt_data_onSuccess_onError_($1,self._contentsFor_(aPackage),aBlock,anotherBlock);
  28704. return self;
  28705. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28706. },
  28707. args: ["aPackage", "aBlock", "anotherBlock"],
  28708. 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",
  28709. referencedClasses: [],
  28710. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  28711. }),
  28712. $globals.PackageHandler);
  28713. $core.addMethod(
  28714. $core.method({
  28715. selector: "commitPathJsFor:",
  28716. protocol: 'accessing',
  28717. fn: function (aPackage){
  28718. var self=this;
  28719. return $core.withContext(function($ctx1) {
  28720. self._subclassResponsibility();
  28721. return self;
  28722. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28723. },
  28724. args: ["aPackage"],
  28725. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  28726. referencedClasses: [],
  28727. messageSends: ["subclassResponsibility"]
  28728. }),
  28729. $globals.PackageHandler);
  28730. $core.addMethod(
  28731. $core.method({
  28732. selector: "commitPathStFor:",
  28733. protocol: 'accessing',
  28734. fn: function (aPackage){
  28735. var self=this;
  28736. return $core.withContext(function($ctx1) {
  28737. self._subclassResponsibility();
  28738. return self;
  28739. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28740. },
  28741. args: ["aPackage"],
  28742. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  28743. referencedClasses: [],
  28744. messageSends: ["subclassResponsibility"]
  28745. }),
  28746. $globals.PackageHandler);
  28747. $core.addMethod(
  28748. $core.method({
  28749. selector: "commitStFileFor:onSuccess:onError:",
  28750. protocol: 'committing',
  28751. fn: function (aPackage,aBlock,anotherBlock){
  28752. var self=this;
  28753. return $core.withContext(function($ctx1) {
  28754. var $2,$1;
  28755. $2=$recv($recv(self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28756. $ctx1.sendIdx[","]=2;
  28757. $1=$recv($2).__comma(".st");
  28758. $ctx1.sendIdx[","]=1;
  28759. self._ajaxPutAt_data_onSuccess_onError_($1,self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  28760. return self;
  28761. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  28762. },
  28763. args: ["aPackage", "aBlock", "anotherBlock"],
  28764. 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",
  28765. referencedClasses: [],
  28766. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  28767. }),
  28768. $globals.PackageHandler);
  28769. $core.addMethod(
  28770. $core.method({
  28771. selector: "contentsFor:",
  28772. protocol: 'accessing',
  28773. fn: function (aPackage){
  28774. var self=this;
  28775. return $core.withContext(function($ctx1) {
  28776. return $recv($globals.String)._streamContents_((function(str){
  28777. return $core.withContext(function($ctx2) {
  28778. return $recv(self._exporter())._exportPackage_on_(aPackage,str);
  28779. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  28780. }));
  28781. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  28782. },
  28783. args: ["aPackage"],
  28784. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  28785. referencedClasses: ["String"],
  28786. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  28787. }),
  28788. $globals.PackageHandler);
  28789. $core.addMethod(
  28790. $core.method({
  28791. selector: "exporter",
  28792. protocol: 'factory',
  28793. fn: function (){
  28794. var self=this;
  28795. return $core.withContext(function($ctx1) {
  28796. return $recv(self._exporterClass())._new();
  28797. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  28798. },
  28799. args: [],
  28800. source: "exporter\x0a\x09^ self exporterClass new",
  28801. referencedClasses: [],
  28802. messageSends: ["new", "exporterClass"]
  28803. }),
  28804. $globals.PackageHandler);
  28805. $core.addMethod(
  28806. $core.method({
  28807. selector: "exporterClass",
  28808. protocol: 'accessing',
  28809. fn: function (){
  28810. var self=this;
  28811. return $core.withContext(function($ctx1) {
  28812. self._subclassResponsibility();
  28813. return self;
  28814. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  28815. },
  28816. args: [],
  28817. source: "exporterClass\x0a\x09self subclassResponsibility",
  28818. referencedClasses: [],
  28819. messageSends: ["subclassResponsibility"]
  28820. }),
  28821. $globals.PackageHandler);
  28822. $core.addMethod(
  28823. $core.method({
  28824. selector: "load:",
  28825. protocol: 'loading',
  28826. fn: function (aPackage){
  28827. var self=this;
  28828. return $core.withContext(function($ctx1) {
  28829. self._subclassResponsibility();
  28830. return self;
  28831. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  28832. },
  28833. args: ["aPackage"],
  28834. source: "load: aPackage\x0a\x09self subclassResponsibility",
  28835. referencedClasses: [],
  28836. messageSends: ["subclassResponsibility"]
  28837. }),
  28838. $globals.PackageHandler);
  28839. $core.addMethod(
  28840. $core.method({
  28841. selector: "onCommitError:",
  28842. protocol: 'error handling',
  28843. fn: function (anError){
  28844. var self=this;
  28845. return $core.withContext(function($ctx1) {
  28846. var $1,$2;
  28847. $1=$recv($globals.PackageCommitError)._new();
  28848. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  28849. $ctx1.sendIdx[","]=1;
  28850. $recv($1)._messageText_($2);
  28851. $recv($1)._signal();
  28852. return self;
  28853. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  28854. },
  28855. args: ["anError"],
  28856. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  28857. referencedClasses: ["PackageCommitError"],
  28858. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  28859. }),
  28860. $globals.PackageHandler);
  28861. $core.addClass('AmdPackageHandler', $globals.PackageHandler, [], 'Platform-ImportExport');
  28862. $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.";
  28863. $core.addMethod(
  28864. $core.method({
  28865. selector: "commitPathJsFor:",
  28866. protocol: 'accessing',
  28867. fn: function (aPackage){
  28868. var self=this;
  28869. return $core.withContext(function($ctx1) {
  28870. return self._toUrl_(self._namespaceFor_(aPackage));
  28871. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  28872. },
  28873. args: ["aPackage"],
  28874. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  28875. referencedClasses: [],
  28876. messageSends: ["toUrl:", "namespaceFor:"]
  28877. }),
  28878. $globals.AmdPackageHandler);
  28879. $core.addMethod(
  28880. $core.method({
  28881. selector: "commitPathStFor:",
  28882. protocol: 'accessing',
  28883. fn: function (aPackage){
  28884. var self=this;
  28885. var path,pathWithout;
  28886. return $core.withContext(function($ctx1) {
  28887. var $1,$2;
  28888. $1=$recv(self._namespaceFor_(aPackage)).__comma("/_source");
  28889. $ctx1.sendIdx[","]=1;
  28890. path=self._toUrl_($1);
  28891. pathWithout=self._commitPathJsFor_(aPackage);
  28892. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  28893. if($core.assert($2)){
  28894. return pathWithout;
  28895. } else {
  28896. return path;
  28897. };
  28898. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  28899. },
  28900. args: ["aPackage"],
  28901. 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 ]",
  28902. referencedClasses: [],
  28903. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  28904. }),
  28905. $globals.AmdPackageHandler);
  28906. $core.addMethod(
  28907. $core.method({
  28908. selector: "exporterClass",
  28909. protocol: 'accessing',
  28910. fn: function (){
  28911. var self=this;
  28912. return $globals.AmdExporter;
  28913. },
  28914. args: [],
  28915. source: "exporterClass\x0a\x09^ AmdExporter",
  28916. referencedClasses: ["AmdExporter"],
  28917. messageSends: []
  28918. }),
  28919. $globals.AmdPackageHandler);
  28920. $core.addMethod(
  28921. $core.method({
  28922. selector: "load:",
  28923. protocol: 'loading',
  28924. fn: function (aPackage){
  28925. var self=this;
  28926. return $core.withContext(function($ctx1) {
  28927. var $1,$3,$2,$receiver;
  28928. $1=$recv($globals.Smalltalk)._amdRequire();
  28929. if(($receiver = $1) == null || $receiver.isNil){
  28930. self._error_("AMD loader not present");
  28931. } else {
  28932. var require;
  28933. require=$receiver;
  28934. $3=$recv($recv(self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  28935. $ctx1.sendIdx[","]=1;
  28936. $2=$recv($globals.Array)._with_($3);
  28937. $recv(require)._value_($2);
  28938. };
  28939. return self;
  28940. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  28941. },
  28942. args: ["aPackage"],
  28943. 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 ) ]",
  28944. referencedClasses: ["Smalltalk", "Array"],
  28945. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "with:", ",", "namespaceFor:", "name"]
  28946. }),
  28947. $globals.AmdPackageHandler);
  28948. $core.addMethod(
  28949. $core.method({
  28950. selector: "namespaceFor:",
  28951. protocol: 'committing',
  28952. fn: function (aPackage){
  28953. var self=this;
  28954. return $core.withContext(function($ctx1) {
  28955. return $recv($recv(aPackage)._transport())._namespace();
  28956. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  28957. },
  28958. args: ["aPackage"],
  28959. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  28960. referencedClasses: [],
  28961. messageSends: ["namespace", "transport"]
  28962. }),
  28963. $globals.AmdPackageHandler);
  28964. $core.addMethod(
  28965. $core.method({
  28966. selector: "toUrl:",
  28967. protocol: 'private',
  28968. fn: function (aString){
  28969. var self=this;
  28970. return $core.withContext(function($ctx1) {
  28971. var $1,$receiver;
  28972. $1=$recv($globals.Smalltalk)._amdRequire();
  28973. if(($receiver = $1) == null || $receiver.isNil){
  28974. return self._error_("AMD loader not present");
  28975. } else {
  28976. var require;
  28977. require=$receiver;
  28978. return $recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  28979. };
  28980. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  28981. },
  28982. args: ["aString"],
  28983. 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 ]",
  28984. referencedClasses: ["Smalltalk"],
  28985. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  28986. }),
  28987. $globals.AmdPackageHandler);
  28988. $core.addMethod(
  28989. $core.method({
  28990. selector: "defaultNamespace",
  28991. protocol: 'commit paths',
  28992. fn: function (){
  28993. var self=this;
  28994. return $core.withContext(function($ctx1) {
  28995. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  28996. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.klass)});
  28997. },
  28998. args: [],
  28999. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29000. referencedClasses: ["Smalltalk"],
  29001. messageSends: ["defaultAmdNamespace"]
  29002. }),
  29003. $globals.AmdPackageHandler.klass);
  29004. $core.addMethod(
  29005. $core.method({
  29006. selector: "defaultNamespace:",
  29007. protocol: 'commit paths',
  29008. fn: function (aString){
  29009. var self=this;
  29010. return $core.withContext(function($ctx1) {
  29011. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  29012. return self;
  29013. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.klass)});
  29014. },
  29015. args: ["aString"],
  29016. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  29017. referencedClasses: ["Smalltalk"],
  29018. messageSends: ["defaultAmdNamespace:"]
  29019. }),
  29020. $globals.AmdPackageHandler.klass);
  29021. $core.addClass('PackageTransport', $globals.Object, ['package'], 'Platform-ImportExport');
  29022. $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.";
  29023. $core.addMethod(
  29024. $core.method({
  29025. selector: "asJSON",
  29026. protocol: 'converting',
  29027. fn: function (){
  29028. var self=this;
  29029. return $core.withContext(function($ctx1) {
  29030. return $globals.HashedCollection._newFromPairs_(["type",self._type()]);
  29031. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.PackageTransport)});
  29032. },
  29033. args: [],
  29034. source: "asJSON\x0a\x09^ #{ 'type' -> self type }",
  29035. referencedClasses: [],
  29036. messageSends: ["type"]
  29037. }),
  29038. $globals.PackageTransport);
  29039. $core.addMethod(
  29040. $core.method({
  29041. selector: "commit",
  29042. protocol: 'committing',
  29043. fn: function (){
  29044. var self=this;
  29045. return $core.withContext(function($ctx1) {
  29046. $recv(self._commitHandler())._commit_(self._package());
  29047. return self;
  29048. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  29049. },
  29050. args: [],
  29051. source: "commit\x0a\x09self commitHandler commit: self package",
  29052. referencedClasses: [],
  29053. messageSends: ["commit:", "commitHandler", "package"]
  29054. }),
  29055. $globals.PackageTransport);
  29056. $core.addMethod(
  29057. $core.method({
  29058. selector: "commitHandler",
  29059. protocol: 'factory',
  29060. fn: function (){
  29061. var self=this;
  29062. return $core.withContext(function($ctx1) {
  29063. return $recv(self._commitHandlerClass())._new();
  29064. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  29065. },
  29066. args: [],
  29067. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  29068. referencedClasses: [],
  29069. messageSends: ["new", "commitHandlerClass"]
  29070. }),
  29071. $globals.PackageTransport);
  29072. $core.addMethod(
  29073. $core.method({
  29074. selector: "commitHandlerClass",
  29075. protocol: 'accessing',
  29076. fn: function (){
  29077. var self=this;
  29078. return $core.withContext(function($ctx1) {
  29079. self._subclassResponsibility();
  29080. return self;
  29081. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  29082. },
  29083. args: [],
  29084. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  29085. referencedClasses: [],
  29086. messageSends: ["subclassResponsibility"]
  29087. }),
  29088. $globals.PackageTransport);
  29089. $core.addMethod(
  29090. $core.method({
  29091. selector: "commitOnSuccess:onError:",
  29092. protocol: 'committing',
  29093. fn: function (aBlock,anotherBlock){
  29094. var self=this;
  29095. return $core.withContext(function($ctx1) {
  29096. $recv(self._commitHandler())._commit_onSuccess_onError_(self._package(),aBlock,anotherBlock);
  29097. return self;
  29098. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  29099. },
  29100. args: ["aBlock", "anotherBlock"],
  29101. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  29102. referencedClasses: [],
  29103. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  29104. }),
  29105. $globals.PackageTransport);
  29106. $core.addMethod(
  29107. $core.method({
  29108. selector: "definition",
  29109. protocol: 'accessing',
  29110. fn: function (){
  29111. var self=this;
  29112. return "";
  29113. },
  29114. args: [],
  29115. source: "definition\x0a\x09^ ''",
  29116. referencedClasses: [],
  29117. messageSends: []
  29118. }),
  29119. $globals.PackageTransport);
  29120. $core.addMethod(
  29121. $core.method({
  29122. selector: "load",
  29123. protocol: 'loading',
  29124. fn: function (){
  29125. var self=this;
  29126. return $core.withContext(function($ctx1) {
  29127. $recv(self._commitHandler())._load_(self._package());
  29128. return self;
  29129. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  29130. },
  29131. args: [],
  29132. source: "load\x0a\x09self commitHandler load: self package",
  29133. referencedClasses: [],
  29134. messageSends: ["load:", "commitHandler", "package"]
  29135. }),
  29136. $globals.PackageTransport);
  29137. $core.addMethod(
  29138. $core.method({
  29139. selector: "package",
  29140. protocol: 'accessing',
  29141. fn: function (){
  29142. var self=this;
  29143. return self["@package"];
  29144. },
  29145. args: [],
  29146. source: "package\x0a\x09^ package",
  29147. referencedClasses: [],
  29148. messageSends: []
  29149. }),
  29150. $globals.PackageTransport);
  29151. $core.addMethod(
  29152. $core.method({
  29153. selector: "package:",
  29154. protocol: 'accessing',
  29155. fn: function (aPackage){
  29156. var self=this;
  29157. self["@package"]=aPackage;
  29158. return self;
  29159. },
  29160. args: ["aPackage"],
  29161. source: "package: aPackage\x0a\x09package := aPackage",
  29162. referencedClasses: [],
  29163. messageSends: []
  29164. }),
  29165. $globals.PackageTransport);
  29166. $core.addMethod(
  29167. $core.method({
  29168. selector: "setupFromJson:",
  29169. protocol: 'initialization',
  29170. fn: function (anObject){
  29171. var self=this;
  29172. return self;
  29173. },
  29174. args: ["anObject"],
  29175. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  29176. referencedClasses: [],
  29177. messageSends: []
  29178. }),
  29179. $globals.PackageTransport);
  29180. $core.addMethod(
  29181. $core.method({
  29182. selector: "type",
  29183. protocol: 'accessing',
  29184. fn: function (){
  29185. var self=this;
  29186. return $core.withContext(function($ctx1) {
  29187. return $recv(self._class())._type();
  29188. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  29189. },
  29190. args: [],
  29191. source: "type\x0a\x09^ self class type",
  29192. referencedClasses: [],
  29193. messageSends: ["type", "class"]
  29194. }),
  29195. $globals.PackageTransport);
  29196. $globals.PackageTransport.klass.iVarNames = ['registry'];
  29197. $core.addMethod(
  29198. $core.method({
  29199. selector: "classRegisteredFor:",
  29200. protocol: 'accessing',
  29201. fn: function (aString){
  29202. var self=this;
  29203. return $core.withContext(function($ctx1) {
  29204. return $recv(self["@registry"])._at_(aString);
  29205. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.klass)});
  29206. },
  29207. args: ["aString"],
  29208. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  29209. referencedClasses: [],
  29210. messageSends: ["at:"]
  29211. }),
  29212. $globals.PackageTransport.klass);
  29213. $core.addMethod(
  29214. $core.method({
  29215. selector: "defaultType",
  29216. protocol: 'accessing',
  29217. fn: function (){
  29218. var self=this;
  29219. return $core.withContext(function($ctx1) {
  29220. return $recv($globals.AmdPackageTransport)._type();
  29221. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.klass)});
  29222. },
  29223. args: [],
  29224. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  29225. referencedClasses: ["AmdPackageTransport"],
  29226. messageSends: ["type"]
  29227. }),
  29228. $globals.PackageTransport.klass);
  29229. $core.addMethod(
  29230. $core.method({
  29231. selector: "for:",
  29232. protocol: 'instance creation',
  29233. fn: function (aString){
  29234. var self=this;
  29235. return $core.withContext(function($ctx1) {
  29236. return $recv(self._classRegisteredFor_(aString))._new();
  29237. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.klass)});
  29238. },
  29239. args: ["aString"],
  29240. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  29241. referencedClasses: [],
  29242. messageSends: ["new", "classRegisteredFor:"]
  29243. }),
  29244. $globals.PackageTransport.klass);
  29245. $core.addMethod(
  29246. $core.method({
  29247. selector: "fromJson:",
  29248. protocol: 'instance creation',
  29249. fn: function (anObject){
  29250. var self=this;
  29251. return $core.withContext(function($ctx1) {
  29252. var $1,$2,$receiver;
  29253. if(($receiver = anObject) == null || $receiver.isNil){
  29254. $1=self._for_(self._defaultType());
  29255. $ctx1.sendIdx["for:"]=1;
  29256. return $1;
  29257. } else {
  29258. anObject;
  29259. };
  29260. $2=self._for_($recv(anObject)._type());
  29261. $recv($2)._setupFromJson_(anObject);
  29262. return $recv($2)._yourself();
  29263. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.klass)});
  29264. },
  29265. args: ["anObject"],
  29266. 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",
  29267. referencedClasses: [],
  29268. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  29269. }),
  29270. $globals.PackageTransport.klass);
  29271. $core.addMethod(
  29272. $core.method({
  29273. selector: "initialize",
  29274. protocol: 'initialization',
  29275. fn: function (){
  29276. var self=this;
  29277. return $core.withContext(function($ctx1) {
  29278. var $1;
  29279. (
  29280. $ctx1.supercall = true,
  29281. ($globals.PackageTransport.klass.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  29282. $ctx1.supercall = false;
  29283. $1=self.__eq_eq($globals.PackageTransport);
  29284. if($core.assert($1)){
  29285. self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  29286. self["@registry"];
  29287. } else {
  29288. self._register();
  29289. };
  29290. return self;
  29291. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.klass)});
  29292. },
  29293. args: [],
  29294. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  29295. referencedClasses: ["PackageTransport"],
  29296. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  29297. }),
  29298. $globals.PackageTransport.klass);
  29299. $core.addMethod(
  29300. $core.method({
  29301. selector: "register",
  29302. protocol: 'registration',
  29303. fn: function (){
  29304. var self=this;
  29305. return $core.withContext(function($ctx1) {
  29306. $recv($globals.PackageTransport)._register_(self);
  29307. return self;
  29308. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.klass)});
  29309. },
  29310. args: [],
  29311. source: "register\x0a\x09PackageTransport register: self",
  29312. referencedClasses: ["PackageTransport"],
  29313. messageSends: ["register:"]
  29314. }),
  29315. $globals.PackageTransport.klass);
  29316. $core.addMethod(
  29317. $core.method({
  29318. selector: "register:",
  29319. protocol: 'registration',
  29320. fn: function (aClass){
  29321. var self=this;
  29322. return $core.withContext(function($ctx1) {
  29323. var $1,$receiver;
  29324. $1=$recv(aClass)._type();
  29325. $ctx1.sendIdx["type"]=1;
  29326. if(($receiver = $1) == null || $receiver.isNil){
  29327. $1;
  29328. } else {
  29329. $recv(self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  29330. };
  29331. return self;
  29332. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.klass)});
  29333. },
  29334. args: ["aClass"],
  29335. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  29336. referencedClasses: [],
  29337. messageSends: ["ifNotNil:", "type", "at:put:"]
  29338. }),
  29339. $globals.PackageTransport.klass);
  29340. $core.addMethod(
  29341. $core.method({
  29342. selector: "type",
  29343. protocol: 'accessing',
  29344. fn: function (){
  29345. var self=this;
  29346. return nil;
  29347. },
  29348. args: [],
  29349. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  29350. referencedClasses: [],
  29351. messageSends: []
  29352. }),
  29353. $globals.PackageTransport.klass);
  29354. $core.addClass('AmdPackageTransport', $globals.PackageTransport, ['namespace'], 'Platform-ImportExport');
  29355. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  29356. $core.addMethod(
  29357. $core.method({
  29358. selector: "asJSON",
  29359. protocol: 'converting',
  29360. fn: function (){
  29361. var self=this;
  29362. return $core.withContext(function($ctx1) {
  29363. var $1;
  29364. $1=(
  29365. $ctx1.supercall = true,
  29366. ($globals.AmdPackageTransport.superclass||$boot.dnu).fn.prototype._asJSON.apply($recv(self), []));
  29367. $ctx1.supercall = false;
  29368. $recv($1)._at_put_("amdNamespace",self._namespace());
  29369. return $recv($1)._yourself();
  29370. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.AmdPackageTransport)});
  29371. },
  29372. args: [],
  29373. source: "asJSON\x0a\x09^ super asJSON\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  29374. referencedClasses: [],
  29375. messageSends: ["at:put:", "asJSON", "namespace", "yourself"]
  29376. }),
  29377. $globals.AmdPackageTransport);
  29378. $core.addMethod(
  29379. $core.method({
  29380. selector: "commitHandlerClass",
  29381. protocol: 'accessing',
  29382. fn: function (){
  29383. var self=this;
  29384. return $globals.AmdPackageHandler;
  29385. },
  29386. args: [],
  29387. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  29388. referencedClasses: ["AmdPackageHandler"],
  29389. messageSends: []
  29390. }),
  29391. $globals.AmdPackageTransport);
  29392. $core.addMethod(
  29393. $core.method({
  29394. selector: "defaultNamespace",
  29395. protocol: 'defaults',
  29396. fn: function (){
  29397. var self=this;
  29398. return $core.withContext(function($ctx1) {
  29399. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  29400. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  29401. },
  29402. args: [],
  29403. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  29404. referencedClasses: ["Smalltalk"],
  29405. messageSends: ["defaultAmdNamespace"]
  29406. }),
  29407. $globals.AmdPackageTransport);
  29408. $core.addMethod(
  29409. $core.method({
  29410. selector: "definition",
  29411. protocol: 'accessing',
  29412. fn: function (){
  29413. var self=this;
  29414. return $core.withContext(function($ctx1) {
  29415. var $1;
  29416. return $recv($globals.String)._streamContents_((function(stream){
  29417. return $core.withContext(function($ctx2) {
  29418. $recv(stream)._nextPutAll_($recv(self._class())._name());
  29419. $ctx2.sendIdx["nextPutAll:"]=1;
  29420. $recv(stream)._nextPutAll_(" namespace: ");
  29421. $ctx2.sendIdx["nextPutAll:"]=2;
  29422. $1=$recv("'".__comma(self._namespace())).__comma("'");
  29423. $ctx2.sendIdx[","]=1;
  29424. return $recv(stream)._nextPutAll_($1);
  29425. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  29426. }));
  29427. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  29428. },
  29429. args: [],
  29430. 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, '''' ]",
  29431. referencedClasses: ["String"],
  29432. messageSends: ["streamContents:", "nextPutAll:", "name", "class", ",", "namespace"]
  29433. }),
  29434. $globals.AmdPackageTransport);
  29435. $core.addMethod(
  29436. $core.method({
  29437. selector: "namespace",
  29438. protocol: 'accessing',
  29439. fn: function (){
  29440. var self=this;
  29441. return $core.withContext(function($ctx1) {
  29442. var $1,$receiver;
  29443. $1=self["@namespace"];
  29444. if(($receiver = $1) == null || $receiver.isNil){
  29445. return self._defaultNamespace();
  29446. } else {
  29447. return $1;
  29448. };
  29449. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  29450. },
  29451. args: [],
  29452. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  29453. referencedClasses: [],
  29454. messageSends: ["ifNil:", "defaultNamespace"]
  29455. }),
  29456. $globals.AmdPackageTransport);
  29457. $core.addMethod(
  29458. $core.method({
  29459. selector: "namespace:",
  29460. protocol: 'accessing',
  29461. fn: function (aString){
  29462. var self=this;
  29463. self["@namespace"]=aString;
  29464. return self;
  29465. },
  29466. args: ["aString"],
  29467. source: "namespace: aString\x0a\x09namespace := aString",
  29468. referencedClasses: [],
  29469. messageSends: []
  29470. }),
  29471. $globals.AmdPackageTransport);
  29472. $core.addMethod(
  29473. $core.method({
  29474. selector: "printOn:",
  29475. protocol: 'printing',
  29476. fn: function (aStream){
  29477. var self=this;
  29478. return $core.withContext(function($ctx1) {
  29479. (
  29480. $ctx1.supercall = true,
  29481. ($globals.AmdPackageTransport.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  29482. $ctx1.supercall = false;
  29483. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  29484. $ctx1.sendIdx["nextPutAll:"]=1;
  29485. $recv(aStream)._nextPutAll_(self._namespace());
  29486. $ctx1.sendIdx["nextPutAll:"]=2;
  29487. $recv(aStream)._nextPutAll_(")");
  29488. return self;
  29489. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  29490. },
  29491. args: ["aStream"],
  29492. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  29493. referencedClasses: [],
  29494. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  29495. }),
  29496. $globals.AmdPackageTransport);
  29497. $core.addMethod(
  29498. $core.method({
  29499. selector: "setPath:",
  29500. protocol: 'actions',
  29501. fn: function (aString){
  29502. var self=this;
  29503. return $core.withContext(function($ctx1) {
  29504. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([self._namespace(),aString])]));
  29505. return self;
  29506. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  29507. },
  29508. args: ["aString"],
  29509. 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}.",
  29510. referencedClasses: [],
  29511. messageSends: ["value:", "basicAt:", "namespace"]
  29512. }),
  29513. $globals.AmdPackageTransport);
  29514. $core.addMethod(
  29515. $core.method({
  29516. selector: "setupFromJson:",
  29517. protocol: 'initialization',
  29518. fn: function (anObject){
  29519. var self=this;
  29520. return $core.withContext(function($ctx1) {
  29521. self._namespace_($recv(anObject)._at_("amdNamespace"));
  29522. return self;
  29523. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  29524. },
  29525. args: ["anObject"],
  29526. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  29527. referencedClasses: [],
  29528. messageSends: ["namespace:", "at:"]
  29529. }),
  29530. $globals.AmdPackageTransport);
  29531. $core.addMethod(
  29532. $core.method({
  29533. selector: "namespace:",
  29534. protocol: 'instance creation',
  29535. fn: function (aString){
  29536. var self=this;
  29537. return $core.withContext(function($ctx1) {
  29538. var $1;
  29539. $1=self._new();
  29540. $recv($1)._namespace_(aString);
  29541. return $recv($1)._yourself();
  29542. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.klass)});
  29543. },
  29544. args: ["aString"],
  29545. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  29546. referencedClasses: [],
  29547. messageSends: ["namespace:", "new", "yourself"]
  29548. }),
  29549. $globals.AmdPackageTransport.klass);
  29550. $core.addMethod(
  29551. $core.method({
  29552. selector: "type",
  29553. protocol: 'accessing',
  29554. fn: function (){
  29555. var self=this;
  29556. return "amd";
  29557. },
  29558. args: [],
  29559. source: "type\x0a\x09^ 'amd'",
  29560. referencedClasses: [],
  29561. messageSends: []
  29562. }),
  29563. $globals.AmdPackageTransport.klass);
  29564. $core.addMethod(
  29565. $core.method({
  29566. selector: "commentStamp",
  29567. protocol: '*Platform-ImportExport',
  29568. fn: function (){
  29569. var self=this;
  29570. return $core.withContext(function($ctx1) {
  29571. var $1;
  29572. $1=$recv($globals.ClassCommentReader)._new();
  29573. $recv($1)._class_(self);
  29574. return $recv($1)._yourself();
  29575. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.Behavior)});
  29576. },
  29577. args: [],
  29578. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  29579. referencedClasses: ["ClassCommentReader"],
  29580. messageSends: ["class:", "new", "yourself"]
  29581. }),
  29582. $globals.Behavior);
  29583. $core.addMethod(
  29584. $core.method({
  29585. selector: "commentStamp:prior:",
  29586. protocol: '*Platform-ImportExport',
  29587. fn: function (aStamp,prior){
  29588. var self=this;
  29589. return $core.withContext(function($ctx1) {
  29590. return self._commentStamp();
  29591. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.Behavior)});
  29592. },
  29593. args: ["aStamp", "prior"],
  29594. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  29595. referencedClasses: [],
  29596. messageSends: ["commentStamp"]
  29597. }),
  29598. $globals.Behavior);
  29599. $core.addMethod(
  29600. $core.method({
  29601. selector: "methodsFor:",
  29602. protocol: '*Platform-ImportExport',
  29603. fn: function (aString){
  29604. var self=this;
  29605. return $core.withContext(function($ctx1) {
  29606. var $1;
  29607. $1=$recv($globals.ClassProtocolReader)._new();
  29608. $recv($1)._class_category_(self,aString);
  29609. return $recv($1)._yourself();
  29610. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.Behavior)});
  29611. },
  29612. args: ["aString"],
  29613. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  29614. referencedClasses: ["ClassProtocolReader"],
  29615. messageSends: ["class:category:", "new", "yourself"]
  29616. }),
  29617. $globals.Behavior);
  29618. $core.addMethod(
  29619. $core.method({
  29620. selector: "methodsFor:stamp:",
  29621. protocol: '*Platform-ImportExport',
  29622. fn: function (aString,aStamp){
  29623. var self=this;
  29624. return $core.withContext(function($ctx1) {
  29625. return self._methodsFor_(aString);
  29626. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.Behavior)});
  29627. },
  29628. args: ["aString", "aStamp"],
  29629. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  29630. referencedClasses: [],
  29631. messageSends: ["methodsFor:"]
  29632. }),
  29633. $globals.Behavior);
  29634. $core.addMethod(
  29635. $core.method({
  29636. selector: "commit",
  29637. protocol: '*Platform-ImportExport',
  29638. fn: function (){
  29639. var self=this;
  29640. return $core.withContext(function($ctx1) {
  29641. return $recv(self._transport())._commit();
  29642. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  29643. },
  29644. args: [],
  29645. source: "commit\x0a\x09^ self transport commit",
  29646. referencedClasses: [],
  29647. messageSends: ["commit", "transport"]
  29648. }),
  29649. $globals.Package);
  29650. $core.addMethod(
  29651. $core.method({
  29652. selector: "load",
  29653. protocol: '*Platform-ImportExport',
  29654. fn: function (){
  29655. var self=this;
  29656. return $core.withContext(function($ctx1) {
  29657. return $recv(self._transport())._load();
  29658. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  29659. },
  29660. args: [],
  29661. source: "load\x0a\x09^ self transport load",
  29662. referencedClasses: [],
  29663. messageSends: ["load", "transport"]
  29664. }),
  29665. $globals.Package);
  29666. $core.addMethod(
  29667. $core.method({
  29668. selector: "loadFromNamespace:",
  29669. protocol: '*Platform-ImportExport',
  29670. fn: function (aString){
  29671. var self=this;
  29672. return $core.withContext(function($ctx1) {
  29673. var $1;
  29674. $1=self._transport();
  29675. $recv($1)._namespace_(aString);
  29676. return $recv($1)._load();
  29677. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  29678. },
  29679. args: ["aString"],
  29680. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  29681. referencedClasses: [],
  29682. messageSends: ["namespace:", "transport", "load"]
  29683. }),
  29684. $globals.Package);
  29685. $core.addMethod(
  29686. $core.method({
  29687. selector: "load:",
  29688. protocol: '*Platform-ImportExport',
  29689. fn: function (aPackageName){
  29690. var self=this;
  29691. return $core.withContext(function($ctx1) {
  29692. $recv(self._named_(aPackageName))._load();
  29693. return self;
  29694. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.klass)});
  29695. },
  29696. args: ["aPackageName"],
  29697. source: "load: aPackageName\x0a\x09(self named: aPackageName) load",
  29698. referencedClasses: [],
  29699. messageSends: ["load", "named:"]
  29700. }),
  29701. $globals.Package.klass);
  29702. $core.addMethod(
  29703. $core.method({
  29704. selector: "load:fromNamespace:",
  29705. protocol: '*Platform-ImportExport',
  29706. fn: function (aPackageName,aString){
  29707. var self=this;
  29708. return $core.withContext(function($ctx1) {
  29709. $recv(self._named_(aPackageName))._loadFromNamespace_(aString);
  29710. return self;
  29711. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.klass)});
  29712. },
  29713. args: ["aPackageName", "aString"],
  29714. source: "load: aPackageName fromNamespace: aString\x0a\x09(self named: aPackageName) loadFromNamespace: aString",
  29715. referencedClasses: [],
  29716. messageSends: ["loadFromNamespace:", "named:"]
  29717. }),
  29718. $globals.Package.klass);
  29719. });
  29720. define("amber_core/Compiler-Core", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Platform-Services", "amber_core/Kernel-Collections"], function($boot){"use strict";
  29721. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  29722. $core.addPackage('Compiler-Core');
  29723. $core.packages["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  29724. $core.packages["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  29725. $core.addClass('AbstractCodeGenerator', $globals.Object, ['currentClass', 'currentPackage', 'source'], 'Compiler-Core');
  29726. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  29727. $core.addMethod(
  29728. $core.method({
  29729. selector: "classNameFor:",
  29730. protocol: 'accessing',
  29731. fn: function (aClass){
  29732. var self=this;
  29733. return $core.withContext(function($ctx1) {
  29734. var $2,$3,$4,$1;
  29735. $2=$recv(aClass)._isMetaclass();
  29736. if($core.assert($2)){
  29737. $3=$recv($recv(aClass)._instanceClass())._name();
  29738. $ctx1.sendIdx["name"]=1;
  29739. $1=$recv($3).__comma(".klass");
  29740. } else {
  29741. $4=$recv(aClass)._isNil();
  29742. if($core.assert($4)){
  29743. $1="nil";
  29744. } else {
  29745. $1=$recv(aClass)._name();
  29746. };
  29747. };
  29748. return $1;
  29749. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},$globals.AbstractCodeGenerator)});
  29750. },
  29751. args: ["aClass"],
  29752. source: "classNameFor: aClass\x0a\x09^ aClass isMetaclass\x0a\x09\x09ifTrue: [ aClass instanceClass name, '.klass' ]\x0a\x09\x09ifFalse: [\x0a\x09\x09aClass isNil\x0a\x09\x09\x09ifTrue: [ 'nil' ]\x0a\x09\x09\x09ifFalse: [ aClass name ]]",
  29753. referencedClasses: [],
  29754. messageSends: ["ifTrue:ifFalse:", "isMetaclass", ",", "name", "instanceClass", "isNil"]
  29755. }),
  29756. $globals.AbstractCodeGenerator);
  29757. $core.addMethod(
  29758. $core.method({
  29759. selector: "compileNode:",
  29760. protocol: 'compiling',
  29761. fn: function (aNode){
  29762. var self=this;
  29763. return $core.withContext(function($ctx1) {
  29764. self._subclassResponsibility();
  29765. return self;
  29766. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  29767. },
  29768. args: ["aNode"],
  29769. source: "compileNode: aNode\x0a\x09self subclassResponsibility",
  29770. referencedClasses: [],
  29771. messageSends: ["subclassResponsibility"]
  29772. }),
  29773. $globals.AbstractCodeGenerator);
  29774. $core.addMethod(
  29775. $core.method({
  29776. selector: "currentClass",
  29777. protocol: 'accessing',
  29778. fn: function (){
  29779. var self=this;
  29780. return self["@currentClass"];
  29781. },
  29782. args: [],
  29783. source: "currentClass\x0a\x09^ currentClass",
  29784. referencedClasses: [],
  29785. messageSends: []
  29786. }),
  29787. $globals.AbstractCodeGenerator);
  29788. $core.addMethod(
  29789. $core.method({
  29790. selector: "currentClass:",
  29791. protocol: 'accessing',
  29792. fn: function (aClass){
  29793. var self=this;
  29794. self["@currentClass"]=aClass;
  29795. return self;
  29796. },
  29797. args: ["aClass"],
  29798. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  29799. referencedClasses: [],
  29800. messageSends: []
  29801. }),
  29802. $globals.AbstractCodeGenerator);
  29803. $core.addMethod(
  29804. $core.method({
  29805. selector: "currentPackage",
  29806. protocol: 'accessing',
  29807. fn: function (){
  29808. var self=this;
  29809. return self["@currentPackage"];
  29810. },
  29811. args: [],
  29812. source: "currentPackage\x0a\x09^ currentPackage",
  29813. referencedClasses: [],
  29814. messageSends: []
  29815. }),
  29816. $globals.AbstractCodeGenerator);
  29817. $core.addMethod(
  29818. $core.method({
  29819. selector: "currentPackage:",
  29820. protocol: 'accessing',
  29821. fn: function (anObject){
  29822. var self=this;
  29823. self["@currentPackage"]=anObject;
  29824. return self;
  29825. },
  29826. args: ["anObject"],
  29827. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  29828. referencedClasses: [],
  29829. messageSends: []
  29830. }),
  29831. $globals.AbstractCodeGenerator);
  29832. $core.addMethod(
  29833. $core.method({
  29834. selector: "pseudoVariables",
  29835. protocol: 'accessing',
  29836. fn: function (){
  29837. var self=this;
  29838. return $core.withContext(function($ctx1) {
  29839. return $recv($globals.Smalltalk)._pseudoVariableNames();
  29840. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  29841. },
  29842. args: [],
  29843. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  29844. referencedClasses: ["Smalltalk"],
  29845. messageSends: ["pseudoVariableNames"]
  29846. }),
  29847. $globals.AbstractCodeGenerator);
  29848. $core.addMethod(
  29849. $core.method({
  29850. selector: "source",
  29851. protocol: 'accessing',
  29852. fn: function (){
  29853. var self=this;
  29854. return $core.withContext(function($ctx1) {
  29855. var $1,$receiver;
  29856. $1=self["@source"];
  29857. if(($receiver = $1) == null || $receiver.isNil){
  29858. return "";
  29859. } else {
  29860. return $1;
  29861. };
  29862. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  29863. },
  29864. args: [],
  29865. source: "source\x0a\x09^ source ifNil: [ '' ]",
  29866. referencedClasses: [],
  29867. messageSends: ["ifNil:"]
  29868. }),
  29869. $globals.AbstractCodeGenerator);
  29870. $core.addMethod(
  29871. $core.method({
  29872. selector: "source:",
  29873. protocol: 'accessing',
  29874. fn: function (aString){
  29875. var self=this;
  29876. self["@source"]=aString;
  29877. return self;
  29878. },
  29879. args: ["aString"],
  29880. source: "source: aString\x0a\x09source := aString",
  29881. referencedClasses: [],
  29882. messageSends: []
  29883. }),
  29884. $globals.AbstractCodeGenerator);
  29885. $core.addClass('CodeGenerator', $globals.AbstractCodeGenerator, [], 'Compiler-Core');
  29886. $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.";
  29887. $core.addMethod(
  29888. $core.method({
  29889. selector: "compileNode:",
  29890. protocol: 'compiling',
  29891. fn: function (aNode){
  29892. var self=this;
  29893. var ir,stream;
  29894. return $core.withContext(function($ctx1) {
  29895. var $1;
  29896. $recv(self._semanticAnalyzer())._visit_(aNode);
  29897. $ctx1.sendIdx["visit:"]=1;
  29898. ir=$recv(self._translator())._visit_(aNode);
  29899. $ctx1.sendIdx["visit:"]=2;
  29900. $1=self._irTranslator();
  29901. $recv($1)._currentClass_(self._currentClass());
  29902. $recv($1)._visit_(ir);
  29903. return $recv($1)._contents();
  29904. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.CodeGenerator)});
  29905. },
  29906. args: ["aNode"],
  29907. 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",
  29908. referencedClasses: [],
  29909. messageSends: ["visit:", "semanticAnalyzer", "translator", "currentClass:", "irTranslator", "currentClass", "contents"]
  29910. }),
  29911. $globals.CodeGenerator);
  29912. $core.addMethod(
  29913. $core.method({
  29914. selector: "irTranslator",
  29915. protocol: 'compiling',
  29916. fn: function (){
  29917. var self=this;
  29918. return $core.withContext(function($ctx1) {
  29919. return $recv($globals.IRJSTranslator)._new();
  29920. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  29921. },
  29922. args: [],
  29923. source: "irTranslator\x0a\x09^ IRJSTranslator new",
  29924. referencedClasses: ["IRJSTranslator"],
  29925. messageSends: ["new"]
  29926. }),
  29927. $globals.CodeGenerator);
  29928. $core.addMethod(
  29929. $core.method({
  29930. selector: "semanticAnalyzer",
  29931. protocol: 'compiling',
  29932. fn: function (){
  29933. var self=this;
  29934. return $core.withContext(function($ctx1) {
  29935. var $1;
  29936. $1=$recv($globals.SemanticAnalyzer)._on_(self._currentClass());
  29937. $recv($1)._thePackage_(self._currentPackage());
  29938. return $recv($1)._yourself();
  29939. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  29940. },
  29941. args: [],
  29942. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  29943. referencedClasses: ["SemanticAnalyzer"],
  29944. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  29945. }),
  29946. $globals.CodeGenerator);
  29947. $core.addMethod(
  29948. $core.method({
  29949. selector: "translator",
  29950. protocol: 'compiling',
  29951. fn: function (){
  29952. var self=this;
  29953. return $core.withContext(function($ctx1) {
  29954. var $1;
  29955. $1=$recv($globals.IRASTTranslator)._new();
  29956. $recv($1)._source_(self._source());
  29957. $recv($1)._theClass_(self._currentClass());
  29958. return $recv($1)._yourself();
  29959. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  29960. },
  29961. args: [],
  29962. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  29963. referencedClasses: ["IRASTTranslator"],
  29964. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  29965. }),
  29966. $globals.CodeGenerator);
  29967. $core.addClass('Compiler', $globals.Object, ['currentClass', 'currentPackage', 'source', 'unknownVariables', 'codeGeneratorClass'], 'Compiler-Core');
  29968. $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`";
  29969. $core.addMethod(
  29970. $core.method({
  29971. selector: "codeGeneratorClass",
  29972. protocol: 'accessing',
  29973. fn: function (){
  29974. var self=this;
  29975. return $core.withContext(function($ctx1) {
  29976. var $1,$receiver;
  29977. $1=self["@codeGeneratorClass"];
  29978. if(($receiver = $1) == null || $receiver.isNil){
  29979. return $globals.InliningCodeGenerator;
  29980. } else {
  29981. return $1;
  29982. };
  29983. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  29984. },
  29985. args: [],
  29986. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  29987. referencedClasses: ["InliningCodeGenerator"],
  29988. messageSends: ["ifNil:"]
  29989. }),
  29990. $globals.Compiler);
  29991. $core.addMethod(
  29992. $core.method({
  29993. selector: "codeGeneratorClass:",
  29994. protocol: 'accessing',
  29995. fn: function (aClass){
  29996. var self=this;
  29997. self["@codeGeneratorClass"]=aClass;
  29998. return self;
  29999. },
  30000. args: ["aClass"],
  30001. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  30002. referencedClasses: [],
  30003. messageSends: []
  30004. }),
  30005. $globals.Compiler);
  30006. $core.addMethod(
  30007. $core.method({
  30008. selector: "compile:forClass:protocol:",
  30009. protocol: 'compiling',
  30010. fn: function (aString,aClass,anotherString){
  30011. var self=this;
  30012. return $core.withContext(function($ctx1) {
  30013. self._source_(aString);
  30014. return self._compileNode_forClass_package_(self._parse_(aString),aClass,$recv(aClass)._packageOfProtocol_(anotherString));
  30015. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  30016. },
  30017. args: ["aString", "aClass", "anotherString"],
  30018. 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)",
  30019. referencedClasses: [],
  30020. messageSends: ["source:", "compileNode:forClass:package:", "parse:", "packageOfProtocol:"]
  30021. }),
  30022. $globals.Compiler);
  30023. $core.addMethod(
  30024. $core.method({
  30025. selector: "compileExpression:on:",
  30026. protocol: 'compiling',
  30027. fn: function (aString,anObject){
  30028. var self=this;
  30029. return $core.withContext(function($ctx1) {
  30030. var $1;
  30031. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  30032. $ctx1.sendIdx[","]=1;
  30033. return self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  30034. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  30035. },
  30036. args: ["aString", "anObject"],
  30037. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  30038. referencedClasses: [],
  30039. messageSends: ["compile:forClass:protocol:", ",", "class"]
  30040. }),
  30041. $globals.Compiler);
  30042. $core.addMethod(
  30043. $core.method({
  30044. selector: "compileNode:",
  30045. protocol: 'compiling',
  30046. fn: function (aNode){
  30047. var self=this;
  30048. var generator,result;
  30049. return $core.withContext(function($ctx1) {
  30050. var $1;
  30051. generator=$recv(self._codeGeneratorClass())._new();
  30052. $1=generator;
  30053. $recv($1)._source_(self._source());
  30054. $recv($1)._currentClass_(self._currentClass());
  30055. $recv($1)._currentPackage_(self._currentPackage());
  30056. result=$recv(generator)._compileNode_(aNode);
  30057. self._unknownVariables_([]);
  30058. return result;
  30059. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,generator:generator,result:result},$globals.Compiler)});
  30060. },
  30061. args: ["aNode"],
  30062. 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",
  30063. referencedClasses: [],
  30064. messageSends: ["new", "codeGeneratorClass", "source:", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "compileNode:", "unknownVariables:"]
  30065. }),
  30066. $globals.Compiler);
  30067. $core.addMethod(
  30068. $core.method({
  30069. selector: "compileNode:forClass:package:",
  30070. protocol: 'compiling',
  30071. fn: function (aNode,aClass,aPackage){
  30072. var self=this;
  30073. return $core.withContext(function($ctx1) {
  30074. self._currentClass_(aClass);
  30075. self._currentPackage_(aPackage);
  30076. return self._compileNode_(aNode);
  30077. }, function($ctx1) {$ctx1.fill(self,"compileNode:forClass:package:",{aNode:aNode,aClass:aClass,aPackage:aPackage},$globals.Compiler)});
  30078. },
  30079. args: ["aNode", "aClass", "aPackage"],
  30080. source: "compileNode: aNode forClass: aClass package: aPackage\x0a\x09^ self\x0a\x09\x09currentClass: aClass;\x0a\x09\x09currentPackage: aPackage;\x0a\x09\x09compileNode: aNode",
  30081. referencedClasses: [],
  30082. messageSends: ["currentClass:", "currentPackage:", "compileNode:"]
  30083. }),
  30084. $globals.Compiler);
  30085. $core.addMethod(
  30086. $core.method({
  30087. selector: "currentClass",
  30088. protocol: 'accessing',
  30089. fn: function (){
  30090. var self=this;
  30091. return self["@currentClass"];
  30092. },
  30093. args: [],
  30094. source: "currentClass\x0a\x09^ currentClass",
  30095. referencedClasses: [],
  30096. messageSends: []
  30097. }),
  30098. $globals.Compiler);
  30099. $core.addMethod(
  30100. $core.method({
  30101. selector: "currentClass:",
  30102. protocol: 'accessing',
  30103. fn: function (aClass){
  30104. var self=this;
  30105. self["@currentClass"]=aClass;
  30106. return self;
  30107. },
  30108. args: ["aClass"],
  30109. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  30110. referencedClasses: [],
  30111. messageSends: []
  30112. }),
  30113. $globals.Compiler);
  30114. $core.addMethod(
  30115. $core.method({
  30116. selector: "currentPackage",
  30117. protocol: 'accessing',
  30118. fn: function (){
  30119. var self=this;
  30120. return self["@currentPackage"];
  30121. },
  30122. args: [],
  30123. source: "currentPackage\x0a\x09^ currentPackage",
  30124. referencedClasses: [],
  30125. messageSends: []
  30126. }),
  30127. $globals.Compiler);
  30128. $core.addMethod(
  30129. $core.method({
  30130. selector: "currentPackage:",
  30131. protocol: 'accessing',
  30132. fn: function (anObject){
  30133. var self=this;
  30134. self["@currentPackage"]=anObject;
  30135. return self;
  30136. },
  30137. args: ["anObject"],
  30138. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  30139. referencedClasses: [],
  30140. messageSends: []
  30141. }),
  30142. $globals.Compiler);
  30143. $core.addMethod(
  30144. $core.method({
  30145. selector: "eval:",
  30146. protocol: 'compiling',
  30147. fn: function (aString){
  30148. var self=this;
  30149. return $core.withContext(function($ctx1) {
  30150. return eval(aString);
  30151. return self;
  30152. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  30153. },
  30154. args: ["aString"],
  30155. source: "eval: aString\x0a\x09<return eval(aString)>",
  30156. referencedClasses: [],
  30157. messageSends: []
  30158. }),
  30159. $globals.Compiler);
  30160. $core.addMethod(
  30161. $core.method({
  30162. selector: "eval:forPackage:",
  30163. protocol: 'compiling',
  30164. fn: function (aString,aPackage){
  30165. var self=this;
  30166. return $core.withContext(function($ctx1) {
  30167. return aPackage && aPackage.innerEval
  30168. ? aPackage.innerEval(aString)
  30169. : eval(aString);
  30170. return self;
  30171. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  30172. },
  30173. args: ["aString", "aPackage"],
  30174. source: "eval: aString forPackage: aPackage\x0a\x09<return aPackage && aPackage.innerEval\x0a\x09\x09? aPackage.innerEval(aString)\x0a\x09\x09: eval(aString)>",
  30175. referencedClasses: [],
  30176. messageSends: []
  30177. }),
  30178. $globals.Compiler);
  30179. $core.addMethod(
  30180. $core.method({
  30181. selector: "evaluateExpression:",
  30182. protocol: 'compiling',
  30183. fn: function (aString){
  30184. var self=this;
  30185. return $core.withContext(function($ctx1) {
  30186. return self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  30187. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  30188. },
  30189. args: ["aString"],
  30190. 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",
  30191. referencedClasses: ["DoIt"],
  30192. messageSends: ["evaluateExpression:on:", "new"]
  30193. }),
  30194. $globals.Compiler);
  30195. $core.addMethod(
  30196. $core.method({
  30197. selector: "evaluateExpression:on:",
  30198. protocol: 'compiling',
  30199. fn: function (aString,anObject){
  30200. var self=this;
  30201. var result,method;
  30202. return $core.withContext(function($ctx1) {
  30203. var $1;
  30204. method=self._eval_(self._compileExpression_on_(aString,anObject));
  30205. $recv(method)._protocol_("**xxxDoIt");
  30206. $1=$recv(anObject)._class();
  30207. $ctx1.sendIdx["class"]=1;
  30208. $recv($1)._addCompiledMethod_(method);
  30209. result=$recv(anObject)._xxxDoIt();
  30210. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  30211. return result;
  30212. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  30213. },
  30214. args: ["aString", "anObject"],
  30215. 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",
  30216. referencedClasses: [],
  30217. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  30218. }),
  30219. $globals.Compiler);
  30220. $core.addMethod(
  30221. $core.method({
  30222. selector: "install:forClass:protocol:",
  30223. protocol: 'compiling',
  30224. fn: function (aString,aBehavior,anotherString){
  30225. var self=this;
  30226. var compiledMethod;
  30227. return $core.withContext(function($ctx1) {
  30228. compiledMethod=self._eval_forPackage_(self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  30229. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  30230. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  30231. },
  30232. args: ["aString", "aBehavior", "anotherString"],
  30233. 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",
  30234. referencedClasses: ["ClassBuilder"],
  30235. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  30236. }),
  30237. $globals.Compiler);
  30238. $core.addMethod(
  30239. $core.method({
  30240. selector: "parse:",
  30241. protocol: 'compiling',
  30242. fn: function (aString){
  30243. var self=this;
  30244. return $core.withContext(function($ctx1) {
  30245. return $recv($globals.Smalltalk)._parse_(aString);
  30246. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  30247. },
  30248. args: ["aString"],
  30249. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  30250. referencedClasses: ["Smalltalk"],
  30251. messageSends: ["parse:"]
  30252. }),
  30253. $globals.Compiler);
  30254. $core.addMethod(
  30255. $core.method({
  30256. selector: "parseExpression:",
  30257. protocol: 'compiling',
  30258. fn: function (aString){
  30259. var self=this;
  30260. return $core.withContext(function($ctx1) {
  30261. var $1;
  30262. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  30263. $ctx1.sendIdx[","]=1;
  30264. return self._parse_($1);
  30265. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  30266. },
  30267. args: ["aString"],
  30268. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  30269. referencedClasses: [],
  30270. messageSends: ["parse:", ","]
  30271. }),
  30272. $globals.Compiler);
  30273. $core.addMethod(
  30274. $core.method({
  30275. selector: "recompile:",
  30276. protocol: 'compiling',
  30277. fn: function (aClass){
  30278. var self=this;
  30279. return $core.withContext(function($ctx1) {
  30280. var $1;
  30281. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  30282. return $core.withContext(function($ctx2) {
  30283. return self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  30284. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30285. }),"Recompiling ".__comma($recv(aClass)._name()));
  30286. $1=$recv(aClass)._isMetaclass();
  30287. if(!$core.assert($1)){
  30288. self._recompile_($recv(aClass)._class());
  30289. };
  30290. return self;
  30291. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  30292. },
  30293. args: ["aClass"],
  30294. 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 ]",
  30295. referencedClasses: [],
  30296. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifFalse:", "isMetaclass", "recompile:", "class"]
  30297. }),
  30298. $globals.Compiler);
  30299. $core.addMethod(
  30300. $core.method({
  30301. selector: "recompileAll",
  30302. protocol: 'compiling',
  30303. fn: function (){
  30304. var self=this;
  30305. return $core.withContext(function($ctx1) {
  30306. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  30307. return $core.withContext(function($ctx2) {
  30308. return self._recompile_(each);
  30309. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30310. }),"Compiling all classes...");
  30311. return self;
  30312. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  30313. },
  30314. args: [],
  30315. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  30316. referencedClasses: ["Smalltalk"],
  30317. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  30318. }),
  30319. $globals.Compiler);
  30320. $core.addMethod(
  30321. $core.method({
  30322. selector: "source",
  30323. protocol: 'accessing',
  30324. fn: function (){
  30325. var self=this;
  30326. return $core.withContext(function($ctx1) {
  30327. var $1,$receiver;
  30328. $1=self["@source"];
  30329. if(($receiver = $1) == null || $receiver.isNil){
  30330. return "";
  30331. } else {
  30332. return $1;
  30333. };
  30334. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  30335. },
  30336. args: [],
  30337. source: "source\x0a\x09^ source ifNil: [ '' ]",
  30338. referencedClasses: [],
  30339. messageSends: ["ifNil:"]
  30340. }),
  30341. $globals.Compiler);
  30342. $core.addMethod(
  30343. $core.method({
  30344. selector: "source:",
  30345. protocol: 'accessing',
  30346. fn: function (aString){
  30347. var self=this;
  30348. self["@source"]=aString;
  30349. return self;
  30350. },
  30351. args: ["aString"],
  30352. source: "source: aString\x0a\x09source := aString",
  30353. referencedClasses: [],
  30354. messageSends: []
  30355. }),
  30356. $globals.Compiler);
  30357. $core.addMethod(
  30358. $core.method({
  30359. selector: "unknownVariables",
  30360. protocol: 'accessing',
  30361. fn: function (){
  30362. var self=this;
  30363. return self["@unknownVariables"];
  30364. },
  30365. args: [],
  30366. source: "unknownVariables\x0a\x09^ unknownVariables",
  30367. referencedClasses: [],
  30368. messageSends: []
  30369. }),
  30370. $globals.Compiler);
  30371. $core.addMethod(
  30372. $core.method({
  30373. selector: "unknownVariables:",
  30374. protocol: 'accessing',
  30375. fn: function (aCollection){
  30376. var self=this;
  30377. self["@unknownVariables"]=aCollection;
  30378. return self;
  30379. },
  30380. args: ["aCollection"],
  30381. source: "unknownVariables: aCollection\x0a\x09unknownVariables := aCollection",
  30382. referencedClasses: [],
  30383. messageSends: []
  30384. }),
  30385. $globals.Compiler);
  30386. $core.addMethod(
  30387. $core.method({
  30388. selector: "recompile:",
  30389. protocol: 'compiling',
  30390. fn: function (aClass){
  30391. var self=this;
  30392. return $core.withContext(function($ctx1) {
  30393. $recv(self._new())._recompile_(aClass);
  30394. return self;
  30395. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.klass)});
  30396. },
  30397. args: ["aClass"],
  30398. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  30399. referencedClasses: [],
  30400. messageSends: ["recompile:", "new"]
  30401. }),
  30402. $globals.Compiler.klass);
  30403. $core.addMethod(
  30404. $core.method({
  30405. selector: "recompileAll",
  30406. protocol: 'compiling',
  30407. fn: function (){
  30408. var self=this;
  30409. return $core.withContext(function($ctx1) {
  30410. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  30411. return $core.withContext(function($ctx2) {
  30412. return self._recompile_(each);
  30413. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30414. }));
  30415. return self;
  30416. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.klass)});
  30417. },
  30418. args: [],
  30419. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  30420. referencedClasses: ["Smalltalk"],
  30421. messageSends: ["do:", "classes", "recompile:"]
  30422. }),
  30423. $globals.Compiler.klass);
  30424. $core.addClass('CompilerError', $globals.Error, [], 'Compiler-Core');
  30425. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  30426. $core.addClass('DoIt', $globals.Object, [], 'Compiler-Core');
  30427. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  30428. $core.addClass('Evaluator', $globals.InterfacingObject, [], 'Compiler-Core');
  30429. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  30430. $core.addMethod(
  30431. $core.method({
  30432. selector: "evaluate:context:",
  30433. protocol: 'evaluating',
  30434. fn: function (aString,aContext){
  30435. var self=this;
  30436. var compiler,ast;
  30437. return $core.withContext(function($ctx1) {
  30438. var $1;
  30439. var $early={};
  30440. try {
  30441. compiler=$recv($globals.Compiler)._new();
  30442. $recv((function(){
  30443. return $core.withContext(function($ctx2) {
  30444. ast=$recv(compiler)._parseExpression_(aString);
  30445. return ast;
  30446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30447. }))._on_do_($globals.Error,(function(ex){
  30448. return $core.withContext(function($ctx2) {
  30449. throw $early=[self._alert_($recv(ex)._messageText())];
  30450. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30451. }));
  30452. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  30453. $recv($1)._context_(aContext);
  30454. $recv($1)._visit_(ast);
  30455. return $recv(aContext)._evaluateNode_(ast);
  30456. }
  30457. catch(e) {if(e===$early)return e[0]; throw e}
  30458. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  30459. },
  30460. args: ["aString", "aContext"],
  30461. 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 | ^ self 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",
  30462. referencedClasses: ["Compiler", "Error", "AISemanticAnalyzer"],
  30463. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  30464. }),
  30465. $globals.Evaluator);
  30466. $core.addMethod(
  30467. $core.method({
  30468. selector: "evaluate:for:",
  30469. protocol: 'evaluating',
  30470. fn: function (aString,anObject){
  30471. var self=this;
  30472. return $core.withContext(function($ctx1) {
  30473. return $recv(anObject)._evaluate_on_(aString,self);
  30474. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  30475. },
  30476. args: ["aString", "anObject"],
  30477. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  30478. referencedClasses: [],
  30479. messageSends: ["evaluate:on:"]
  30480. }),
  30481. $globals.Evaluator);
  30482. $core.addMethod(
  30483. $core.method({
  30484. selector: "evaluate:receiver:",
  30485. protocol: 'evaluating',
  30486. fn: function (aString,anObject){
  30487. var self=this;
  30488. var compiler;
  30489. return $core.withContext(function($ctx1) {
  30490. var $early={};
  30491. try {
  30492. compiler=$recv($globals.Compiler)._new();
  30493. $recv((function(){
  30494. return $core.withContext(function($ctx2) {
  30495. return $recv(compiler)._parseExpression_(aString);
  30496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30497. }))._on_do_($globals.Error,(function(ex){
  30498. return $core.withContext(function($ctx2) {
  30499. throw $early=[self._alert_($recv(ex)._messageText())];
  30500. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  30501. }));
  30502. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  30503. }
  30504. catch(e) {if(e===$early)return e[0]; throw e}
  30505. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  30506. },
  30507. args: ["aString", "anObject"],
  30508. 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 | ^ self alert: ex messageText ].\x0a\x0a\x09^ compiler evaluateExpression: aString on: anObject",
  30509. referencedClasses: ["Compiler", "Error"],
  30510. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  30511. }),
  30512. $globals.Evaluator);
  30513. $core.addMethod(
  30514. $core.method({
  30515. selector: "evaluate:for:",
  30516. protocol: 'instance creation',
  30517. fn: function (aString,anObject){
  30518. var self=this;
  30519. return $core.withContext(function($ctx1) {
  30520. return $recv(self._new())._evaluate_for_(aString,anObject);
  30521. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.klass)});
  30522. },
  30523. args: ["aString", "anObject"],
  30524. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  30525. referencedClasses: [],
  30526. messageSends: ["evaluate:for:", "new"]
  30527. }),
  30528. $globals.Evaluator.klass);
  30529. $core.addMethod(
  30530. $core.method({
  30531. selector: "asVariableName",
  30532. protocol: '*Compiler-Core',
  30533. fn: function (){
  30534. var self=this;
  30535. return $core.withContext(function($ctx1) {
  30536. var $1;
  30537. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  30538. if($core.assert($1)){
  30539. return self.__comma("_");
  30540. } else {
  30541. return self;
  30542. };
  30543. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  30544. },
  30545. args: [],
  30546. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  30547. referencedClasses: ["Smalltalk"],
  30548. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  30549. }),
  30550. $globals.String);
  30551. });
  30552. define("amber_core/Compiler-AST", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
  30553. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  30554. $core.addPackage('Compiler-AST');
  30555. $core.packages["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  30556. $core.packages["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30557. $core.addClass('Node', $globals.Object, ['parent', 'position', 'source', 'nodes', 'shouldBeInlined', 'shouldBeAliased'], 'Compiler-AST');
  30558. $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.";
  30559. $core.addMethod(
  30560. $core.method({
  30561. selector: "accept:",
  30562. protocol: 'visiting',
  30563. fn: function (aVisitor){
  30564. var self=this;
  30565. return $core.withContext(function($ctx1) {
  30566. return $recv(aVisitor)._visitNode_(self);
  30567. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.Node)});
  30568. },
  30569. args: ["aVisitor"],
  30570. source: "accept: aVisitor\x0a\x09^ aVisitor visitNode: self",
  30571. referencedClasses: [],
  30572. messageSends: ["visitNode:"]
  30573. }),
  30574. $globals.Node);
  30575. $core.addMethod(
  30576. $core.method({
  30577. selector: "addNode:",
  30578. protocol: 'accessing',
  30579. fn: function (aNode){
  30580. var self=this;
  30581. return $core.withContext(function($ctx1) {
  30582. $recv(self._nodes())._add_(aNode);
  30583. $recv(aNode)._parent_(self);
  30584. return self;
  30585. }, function($ctx1) {$ctx1.fill(self,"addNode:",{aNode:aNode},$globals.Node)});
  30586. },
  30587. args: ["aNode"],
  30588. source: "addNode: aNode\x0a\x09self nodes add: aNode.\x0a\x09aNode parent: self",
  30589. referencedClasses: [],
  30590. messageSends: ["add:", "nodes", "parent:"]
  30591. }),
  30592. $globals.Node);
  30593. $core.addMethod(
  30594. $core.method({
  30595. selector: "allNodes",
  30596. protocol: 'accessing',
  30597. fn: function (){
  30598. var self=this;
  30599. var allNodes;
  30600. return $core.withContext(function($ctx1) {
  30601. var $1;
  30602. $1=self._nodes();
  30603. $ctx1.sendIdx["nodes"]=1;
  30604. allNodes=$recv($1)._asSet();
  30605. $recv(self._nodes())._do_((function(each){
  30606. return $core.withContext(function($ctx2) {
  30607. return $recv(allNodes)._addAll_($recv(each)._allNodes());
  30608. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30609. }));
  30610. return allNodes;
  30611. }, function($ctx1) {$ctx1.fill(self,"allNodes",{allNodes:allNodes},$globals.Node)});
  30612. },
  30613. args: [],
  30614. 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",
  30615. referencedClasses: [],
  30616. messageSends: ["asSet", "nodes", "do:", "addAll:", "allNodes"]
  30617. }),
  30618. $globals.Node);
  30619. $core.addMethod(
  30620. $core.method({
  30621. selector: "inPosition:",
  30622. protocol: 'testing',
  30623. fn: function (aPoint){
  30624. var self=this;
  30625. return $core.withContext(function($ctx1) {
  30626. return $recv($recv(self._positionStart()).__lt_eq(aPoint))._and_((function(){
  30627. return $core.withContext(function($ctx2) {
  30628. return $recv(self._positionEnd()).__gt_eq(aPoint);
  30629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30630. }));
  30631. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.Node)});
  30632. },
  30633. args: ["aPoint"],
  30634. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  30635. referencedClasses: [],
  30636. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  30637. }),
  30638. $globals.Node);
  30639. $core.addMethod(
  30640. $core.method({
  30641. selector: "isAssignmentNode",
  30642. protocol: 'testing',
  30643. fn: function (){
  30644. var self=this;
  30645. return false;
  30646. },
  30647. args: [],
  30648. source: "isAssignmentNode\x0a\x09^ false",
  30649. referencedClasses: [],
  30650. messageSends: []
  30651. }),
  30652. $globals.Node);
  30653. $core.addMethod(
  30654. $core.method({
  30655. selector: "isBlockNode",
  30656. protocol: 'testing',
  30657. fn: function (){
  30658. var self=this;
  30659. return false;
  30660. },
  30661. args: [],
  30662. source: "isBlockNode\x0a\x09^ false",
  30663. referencedClasses: [],
  30664. messageSends: []
  30665. }),
  30666. $globals.Node);
  30667. $core.addMethod(
  30668. $core.method({
  30669. selector: "isBlockSequenceNode",
  30670. protocol: 'testing',
  30671. fn: function (){
  30672. var self=this;
  30673. return false;
  30674. },
  30675. args: [],
  30676. source: "isBlockSequenceNode\x0a\x09^ false",
  30677. referencedClasses: [],
  30678. messageSends: []
  30679. }),
  30680. $globals.Node);
  30681. $core.addMethod(
  30682. $core.method({
  30683. selector: "isCascadeNode",
  30684. protocol: 'testing',
  30685. fn: function (){
  30686. var self=this;
  30687. return false;
  30688. },
  30689. args: [],
  30690. source: "isCascadeNode\x0a\x09^ false",
  30691. referencedClasses: [],
  30692. messageSends: []
  30693. }),
  30694. $globals.Node);
  30695. $core.addMethod(
  30696. $core.method({
  30697. selector: "isImmutable",
  30698. protocol: 'testing',
  30699. fn: function (){
  30700. var self=this;
  30701. return false;
  30702. },
  30703. args: [],
  30704. source: "isImmutable\x0a\x09^ false",
  30705. referencedClasses: [],
  30706. messageSends: []
  30707. }),
  30708. $globals.Node);
  30709. $core.addMethod(
  30710. $core.method({
  30711. selector: "isJSStatementNode",
  30712. protocol: 'testing',
  30713. fn: function (){
  30714. var self=this;
  30715. return false;
  30716. },
  30717. args: [],
  30718. source: "isJSStatementNode\x0a\x09^ false",
  30719. referencedClasses: [],
  30720. messageSends: []
  30721. }),
  30722. $globals.Node);
  30723. $core.addMethod(
  30724. $core.method({
  30725. selector: "isLastChild",
  30726. protocol: 'testing',
  30727. fn: function (){
  30728. var self=this;
  30729. return $core.withContext(function($ctx1) {
  30730. return $recv($recv($recv(self._parent())._nodes())._last()).__eq(self);
  30731. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.Node)});
  30732. },
  30733. args: [],
  30734. source: "isLastChild\x0a\x09^ self parent nodes last = self",
  30735. referencedClasses: [],
  30736. messageSends: ["=", "last", "nodes", "parent"]
  30737. }),
  30738. $globals.Node);
  30739. $core.addMethod(
  30740. $core.method({
  30741. selector: "isNavigationNode",
  30742. protocol: 'testing',
  30743. fn: function (){
  30744. var self=this;
  30745. return false;
  30746. },
  30747. args: [],
  30748. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  30749. referencedClasses: [],
  30750. messageSends: []
  30751. }),
  30752. $globals.Node);
  30753. $core.addMethod(
  30754. $core.method({
  30755. selector: "isNode",
  30756. protocol: 'testing',
  30757. fn: function (){
  30758. var self=this;
  30759. return true;
  30760. },
  30761. args: [],
  30762. source: "isNode\x0a\x09^ true",
  30763. referencedClasses: [],
  30764. messageSends: []
  30765. }),
  30766. $globals.Node);
  30767. $core.addMethod(
  30768. $core.method({
  30769. selector: "isReferenced",
  30770. protocol: 'testing',
  30771. fn: function (){
  30772. var self=this;
  30773. return $core.withContext(function($ctx1) {
  30774. var $3,$2,$1;
  30775. $3=self._parent();
  30776. $ctx1.sendIdx["parent"]=1;
  30777. $2=$recv($3)._isSequenceNode();
  30778. $1=$recv($2)._or_((function(){
  30779. return $core.withContext(function($ctx2) {
  30780. return $recv(self._parent())._isAssignmentNode();
  30781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30782. }));
  30783. return $recv($1)._not();
  30784. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.Node)});
  30785. },
  30786. args: [],
  30787. 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",
  30788. referencedClasses: [],
  30789. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  30790. }),
  30791. $globals.Node);
  30792. $core.addMethod(
  30793. $core.method({
  30794. selector: "isReturnNode",
  30795. protocol: 'testing',
  30796. fn: function (){
  30797. var self=this;
  30798. return false;
  30799. },
  30800. args: [],
  30801. source: "isReturnNode\x0a\x09^ false",
  30802. referencedClasses: [],
  30803. messageSends: []
  30804. }),
  30805. $globals.Node);
  30806. $core.addMethod(
  30807. $core.method({
  30808. selector: "isSendNode",
  30809. protocol: 'testing',
  30810. fn: function (){
  30811. var self=this;
  30812. return false;
  30813. },
  30814. args: [],
  30815. source: "isSendNode\x0a\x09^ false",
  30816. referencedClasses: [],
  30817. messageSends: []
  30818. }),
  30819. $globals.Node);
  30820. $core.addMethod(
  30821. $core.method({
  30822. selector: "isSequenceNode",
  30823. protocol: 'testing',
  30824. fn: function (){
  30825. var self=this;
  30826. return false;
  30827. },
  30828. args: [],
  30829. source: "isSequenceNode\x0a\x09^ false",
  30830. referencedClasses: [],
  30831. messageSends: []
  30832. }),
  30833. $globals.Node);
  30834. $core.addMethod(
  30835. $core.method({
  30836. selector: "isValueNode",
  30837. protocol: 'testing',
  30838. fn: function (){
  30839. var self=this;
  30840. return false;
  30841. },
  30842. args: [],
  30843. source: "isValueNode\x0a\x09^ false",
  30844. referencedClasses: [],
  30845. messageSends: []
  30846. }),
  30847. $globals.Node);
  30848. $core.addMethod(
  30849. $core.method({
  30850. selector: "isVariableNode",
  30851. protocol: 'testing',
  30852. fn: function (){
  30853. var self=this;
  30854. return false;
  30855. },
  30856. args: [],
  30857. source: "isVariableNode\x0a\x09^ false",
  30858. referencedClasses: [],
  30859. messageSends: []
  30860. }),
  30861. $globals.Node);
  30862. $core.addMethod(
  30863. $core.method({
  30864. selector: "location:",
  30865. protocol: 'accessing',
  30866. fn: function (aLocation){
  30867. var self=this;
  30868. return $core.withContext(function($ctx1) {
  30869. var $3,$2,$1;
  30870. $3=$recv(aLocation)._start();
  30871. $ctx1.sendIdx["start"]=1;
  30872. $2=$recv($3)._line();
  30873. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  30874. self._position_($1);
  30875. return self;
  30876. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.Node)});
  30877. },
  30878. args: ["aLocation"],
  30879. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  30880. referencedClasses: [],
  30881. messageSends: ["position:", "@", "line", "start", "column"]
  30882. }),
  30883. $globals.Node);
  30884. $core.addMethod(
  30885. $core.method({
  30886. selector: "method",
  30887. protocol: 'accessing',
  30888. fn: function (){
  30889. var self=this;
  30890. return $core.withContext(function($ctx1) {
  30891. var $1,$receiver;
  30892. $1=self._parent();
  30893. if(($receiver = $1) == null || $receiver.isNil){
  30894. return $1;
  30895. } else {
  30896. var node;
  30897. node=$receiver;
  30898. return $recv(node)._method();
  30899. };
  30900. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.Node)});
  30901. },
  30902. args: [],
  30903. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  30904. referencedClasses: [],
  30905. messageSends: ["ifNotNil:", "parent", "method"]
  30906. }),
  30907. $globals.Node);
  30908. $core.addMethod(
  30909. $core.method({
  30910. selector: "navigationNodeAt:ifAbsent:",
  30911. protocol: 'accessing',
  30912. fn: function (aPoint,aBlock){
  30913. var self=this;
  30914. var children;
  30915. return $core.withContext(function($ctx1) {
  30916. var $2,$1;
  30917. var $early={};
  30918. try {
  30919. children=$recv(self._allNodes())._select_((function(each){
  30920. return $core.withContext(function($ctx2) {
  30921. return $recv($recv(each)._isNavigationNode())._and_((function(){
  30922. return $core.withContext(function($ctx3) {
  30923. return $recv(each)._inPosition_(aPoint);
  30924. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  30925. }));
  30926. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30927. }));
  30928. $recv(children)._ifEmpty_((function(){
  30929. return $core.withContext(function($ctx2) {
  30930. throw $early=[$recv(aBlock)._value()];
  30931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  30932. }));
  30933. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  30934. return $core.withContext(function($ctx2) {
  30935. $2=$recv(a)._positionStart();
  30936. $ctx2.sendIdx["positionStart"]=1;
  30937. $1=$recv($2)._dist_(aPoint);
  30938. $ctx2.sendIdx["dist:"]=1;
  30939. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  30940. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  30941. })))._first();
  30942. }
  30943. catch(e) {if(e===$early)return e[0]; throw e}
  30944. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.Node)});
  30945. },
  30946. args: ["aPoint", "aBlock"],
  30947. 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",
  30948. referencedClasses: [],
  30949. messageSends: ["select:", "allNodes", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  30950. }),
  30951. $globals.Node);
  30952. $core.addMethod(
  30953. $core.method({
  30954. selector: "nodes",
  30955. protocol: 'accessing',
  30956. fn: function (){
  30957. var self=this;
  30958. return $core.withContext(function($ctx1) {
  30959. var $1,$receiver;
  30960. $1=self["@nodes"];
  30961. if(($receiver = $1) == null || $receiver.isNil){
  30962. self["@nodes"]=$recv($globals.Array)._new();
  30963. return self["@nodes"];
  30964. } else {
  30965. return $1;
  30966. };
  30967. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.Node)});
  30968. },
  30969. args: [],
  30970. source: "nodes\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  30971. referencedClasses: ["Array"],
  30972. messageSends: ["ifNil:", "new"]
  30973. }),
  30974. $globals.Node);
  30975. $core.addMethod(
  30976. $core.method({
  30977. selector: "nodes:",
  30978. protocol: 'building',
  30979. fn: function (aCollection){
  30980. var self=this;
  30981. return $core.withContext(function($ctx1) {
  30982. self["@nodes"]=aCollection;
  30983. $recv(aCollection)._do_((function(each){
  30984. return $core.withContext(function($ctx2) {
  30985. return $recv(each)._parent_(self);
  30986. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30987. }));
  30988. return self;
  30989. }, function($ctx1) {$ctx1.fill(self,"nodes:",{aCollection:aCollection},$globals.Node)});
  30990. },
  30991. args: ["aCollection"],
  30992. source: "nodes: aCollection\x0a\x09nodes := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  30993. referencedClasses: [],
  30994. messageSends: ["do:", "parent:"]
  30995. }),
  30996. $globals.Node);
  30997. $core.addMethod(
  30998. $core.method({
  30999. selector: "parent",
  31000. protocol: 'accessing',
  31001. fn: function (){
  31002. var self=this;
  31003. return self["@parent"];
  31004. },
  31005. args: [],
  31006. source: "parent\x0a\x09^ parent",
  31007. referencedClasses: [],
  31008. messageSends: []
  31009. }),
  31010. $globals.Node);
  31011. $core.addMethod(
  31012. $core.method({
  31013. selector: "parent:",
  31014. protocol: 'accessing',
  31015. fn: function (aNode){
  31016. var self=this;
  31017. self["@parent"]=aNode;
  31018. return self;
  31019. },
  31020. args: ["aNode"],
  31021. source: "parent: aNode\x0a\x09parent := aNode",
  31022. referencedClasses: [],
  31023. messageSends: []
  31024. }),
  31025. $globals.Node);
  31026. $core.addMethod(
  31027. $core.method({
  31028. selector: "position",
  31029. protocol: 'accessing',
  31030. fn: function (){
  31031. var self=this;
  31032. return $core.withContext(function($ctx1) {
  31033. var $1,$2,$receiver;
  31034. $1=self["@position"];
  31035. if(($receiver = $1) == null || $receiver.isNil){
  31036. $2=self._parent();
  31037. if(($receiver = $2) == null || $receiver.isNil){
  31038. return $2;
  31039. } else {
  31040. var node;
  31041. node=$receiver;
  31042. return $recv(node)._position();
  31043. };
  31044. } else {
  31045. return $1;
  31046. };
  31047. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Node)});
  31048. },
  31049. args: [],
  31050. 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 ] ]",
  31051. referencedClasses: [],
  31052. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  31053. }),
  31054. $globals.Node);
  31055. $core.addMethod(
  31056. $core.method({
  31057. selector: "position:",
  31058. protocol: 'accessing',
  31059. fn: function (aPosition){
  31060. var self=this;
  31061. self["@position"]=aPosition;
  31062. return self;
  31063. },
  31064. args: ["aPosition"],
  31065. source: "position: aPosition\x0a\x09position := aPosition",
  31066. referencedClasses: [],
  31067. messageSends: []
  31068. }),
  31069. $globals.Node);
  31070. $core.addMethod(
  31071. $core.method({
  31072. selector: "positionEnd",
  31073. protocol: 'accessing',
  31074. fn: function (){
  31075. var self=this;
  31076. return $core.withContext(function($ctx1) {
  31077. var $1,$6,$5,$4,$3,$2;
  31078. $1=self._positionStart();
  31079. $6=self._source();
  31080. $ctx1.sendIdx["source"]=1;
  31081. $5=$recv($6)._lines();
  31082. $ctx1.sendIdx["lines"]=1;
  31083. $4=$recv($5)._size();
  31084. $ctx1.sendIdx["size"]=1;
  31085. $3=$recv($4).__minus((1));
  31086. $ctx1.sendIdx["-"]=1;
  31087. $2=$recv($3).__at($recv($recv($recv($recv(self._source())._lines())._last())._size()).__minus((1)));
  31088. return $recv($1).__plus($2);
  31089. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.Node)});
  31090. },
  31091. args: [],
  31092. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  31093. referencedClasses: [],
  31094. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  31095. }),
  31096. $globals.Node);
  31097. $core.addMethod(
  31098. $core.method({
  31099. selector: "positionStart",
  31100. protocol: 'accessing',
  31101. fn: function (){
  31102. var self=this;
  31103. return $core.withContext(function($ctx1) {
  31104. return self._position();
  31105. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.Node)});
  31106. },
  31107. args: [],
  31108. source: "positionStart\x0a\x09^ self position",
  31109. referencedClasses: [],
  31110. messageSends: ["position"]
  31111. }),
  31112. $globals.Node);
  31113. $core.addMethod(
  31114. $core.method({
  31115. selector: "postCopy",
  31116. protocol: 'copying',
  31117. fn: function (){
  31118. var self=this;
  31119. return $core.withContext(function($ctx1) {
  31120. (
  31121. $ctx1.supercall = true,
  31122. ($globals.Node.superclass||$boot.dnu).fn.prototype._postCopy.apply($recv(self), []));
  31123. $ctx1.supercall = false;
  31124. $recv(self._nodes())._do_((function(each){
  31125. return $core.withContext(function($ctx2) {
  31126. return $recv(each)._parent_(self);
  31127. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31128. }));
  31129. return self;
  31130. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.Node)});
  31131. },
  31132. args: [],
  31133. source: "postCopy\x0a\x09super postCopy.\x0a\x09self nodes do: [ :each | each parent: self ]",
  31134. referencedClasses: [],
  31135. messageSends: ["postCopy", "do:", "nodes", "parent:"]
  31136. }),
  31137. $globals.Node);
  31138. $core.addMethod(
  31139. $core.method({
  31140. selector: "requiresSmalltalkContext",
  31141. protocol: 'testing',
  31142. fn: function (){
  31143. var self=this;
  31144. return $core.withContext(function($ctx1) {
  31145. return $recv($recv(self._nodes())._detect_ifNone_((function(each){
  31146. return $core.withContext(function($ctx2) {
  31147. return $recv(each)._requiresSmalltalkContext();
  31148. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31149. }),(function(){
  31150. return nil;
  31151. })))._notNil();
  31152. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.Node)});
  31153. },
  31154. args: [],
  31155. 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",
  31156. referencedClasses: [],
  31157. messageSends: ["notNil", "detect:ifNone:", "nodes", "requiresSmalltalkContext"]
  31158. }),
  31159. $globals.Node);
  31160. $core.addMethod(
  31161. $core.method({
  31162. selector: "shouldBeAliased",
  31163. protocol: 'accessing',
  31164. fn: function (){
  31165. var self=this;
  31166. return $core.withContext(function($ctx1) {
  31167. var $1,$receiver;
  31168. $1=self["@shouldBeAliased"];
  31169. if(($receiver = $1) == null || $receiver.isNil){
  31170. return false;
  31171. } else {
  31172. return $1;
  31173. };
  31174. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.Node)});
  31175. },
  31176. args: [],
  31177. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  31178. referencedClasses: [],
  31179. messageSends: ["ifNil:"]
  31180. }),
  31181. $globals.Node);
  31182. $core.addMethod(
  31183. $core.method({
  31184. selector: "shouldBeAliased:",
  31185. protocol: 'accessing',
  31186. fn: function (aBoolean){
  31187. var self=this;
  31188. self["@shouldBeAliased"]=aBoolean;
  31189. return self;
  31190. },
  31191. args: ["aBoolean"],
  31192. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  31193. referencedClasses: [],
  31194. messageSends: []
  31195. }),
  31196. $globals.Node);
  31197. $core.addMethod(
  31198. $core.method({
  31199. selector: "shouldBeInlined",
  31200. protocol: 'accessing',
  31201. fn: function (){
  31202. var self=this;
  31203. return $core.withContext(function($ctx1) {
  31204. var $1,$receiver;
  31205. $1=self["@shouldBeInlined"];
  31206. if(($receiver = $1) == null || $receiver.isNil){
  31207. return false;
  31208. } else {
  31209. return $1;
  31210. };
  31211. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.Node)});
  31212. },
  31213. args: [],
  31214. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  31215. referencedClasses: [],
  31216. messageSends: ["ifNil:"]
  31217. }),
  31218. $globals.Node);
  31219. $core.addMethod(
  31220. $core.method({
  31221. selector: "shouldBeInlined:",
  31222. protocol: 'accessing',
  31223. fn: function (aBoolean){
  31224. var self=this;
  31225. self["@shouldBeInlined"]=aBoolean;
  31226. return self;
  31227. },
  31228. args: ["aBoolean"],
  31229. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  31230. referencedClasses: [],
  31231. messageSends: []
  31232. }),
  31233. $globals.Node);
  31234. $core.addMethod(
  31235. $core.method({
  31236. selector: "size",
  31237. protocol: 'accessing',
  31238. fn: function (){
  31239. var self=this;
  31240. return $core.withContext(function($ctx1) {
  31241. return $recv(self._source())._size();
  31242. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Node)});
  31243. },
  31244. args: [],
  31245. source: "size\x0a\x09^ self source size",
  31246. referencedClasses: [],
  31247. messageSends: ["size", "source"]
  31248. }),
  31249. $globals.Node);
  31250. $core.addMethod(
  31251. $core.method({
  31252. selector: "source",
  31253. protocol: 'accessing',
  31254. fn: function (){
  31255. var self=this;
  31256. return $core.withContext(function($ctx1) {
  31257. var $1,$receiver;
  31258. $1=self["@source"];
  31259. if(($receiver = $1) == null || $receiver.isNil){
  31260. return "";
  31261. } else {
  31262. return $1;
  31263. };
  31264. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Node)});
  31265. },
  31266. args: [],
  31267. source: "source\x0a\x09^ source ifNil: [ '' ]",
  31268. referencedClasses: [],
  31269. messageSends: ["ifNil:"]
  31270. }),
  31271. $globals.Node);
  31272. $core.addMethod(
  31273. $core.method({
  31274. selector: "source:",
  31275. protocol: 'accessing',
  31276. fn: function (aString){
  31277. var self=this;
  31278. self["@source"]=aString;
  31279. return self;
  31280. },
  31281. args: ["aString"],
  31282. source: "source: aString\x0a\x09source := aString",
  31283. referencedClasses: [],
  31284. messageSends: []
  31285. }),
  31286. $globals.Node);
  31287. $core.addMethod(
  31288. $core.method({
  31289. selector: "subtreeNeedsAliasing",
  31290. protocol: 'testing',
  31291. fn: function (){
  31292. var self=this;
  31293. return $core.withContext(function($ctx1) {
  31294. var $1;
  31295. $1=$recv($recv(self._shouldBeAliased())._or_((function(){
  31296. return $core.withContext(function($ctx2) {
  31297. return self._shouldBeInlined();
  31298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31299. })))._or_((function(){
  31300. return $core.withContext(function($ctx2) {
  31301. return $recv(self._nodes())._anySatisfy_((function(each){
  31302. return $core.withContext(function($ctx3) {
  31303. return $recv(each)._subtreeNeedsAliasing();
  31304. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)});
  31305. }));
  31306. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31307. }));
  31308. $ctx1.sendIdx["or:"]=1;
  31309. return $1;
  31310. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.Node)});
  31311. },
  31312. args: [],
  31313. source: "subtreeNeedsAliasing\x0a\x09^ (self shouldBeAliased or: [ self shouldBeInlined ]) or: [\x0a\x09\x09self nodes anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  31314. referencedClasses: [],
  31315. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined", "anySatisfy:", "nodes", "subtreeNeedsAliasing"]
  31316. }),
  31317. $globals.Node);
  31318. $core.addClass('AssignmentNode', $globals.Node, ['left', 'right'], 'Compiler-AST');
  31319. $globals.AssignmentNode.comment="I represent an assignment node.";
  31320. $core.addMethod(
  31321. $core.method({
  31322. selector: "accept:",
  31323. protocol: 'visiting',
  31324. fn: function (aVisitor){
  31325. var self=this;
  31326. return $core.withContext(function($ctx1) {
  31327. return $recv(aVisitor)._visitAssignmentNode_(self);
  31328. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  31329. },
  31330. args: ["aVisitor"],
  31331. source: "accept: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  31332. referencedClasses: [],
  31333. messageSends: ["visitAssignmentNode:"]
  31334. }),
  31335. $globals.AssignmentNode);
  31336. $core.addMethod(
  31337. $core.method({
  31338. selector: "isAssignmentNode",
  31339. protocol: 'testing',
  31340. fn: function (){
  31341. var self=this;
  31342. return true;
  31343. },
  31344. args: [],
  31345. source: "isAssignmentNode\x0a\x09^ true",
  31346. referencedClasses: [],
  31347. messageSends: []
  31348. }),
  31349. $globals.AssignmentNode);
  31350. $core.addMethod(
  31351. $core.method({
  31352. selector: "left",
  31353. protocol: 'accessing',
  31354. fn: function (){
  31355. var self=this;
  31356. return self["@left"];
  31357. },
  31358. args: [],
  31359. source: "left\x0a\x09^ left",
  31360. referencedClasses: [],
  31361. messageSends: []
  31362. }),
  31363. $globals.AssignmentNode);
  31364. $core.addMethod(
  31365. $core.method({
  31366. selector: "left:",
  31367. protocol: 'accessing',
  31368. fn: function (aNode){
  31369. var self=this;
  31370. return $core.withContext(function($ctx1) {
  31371. self["@left"]=aNode;
  31372. $recv(aNode)._parent_(self);
  31373. return self;
  31374. }, function($ctx1) {$ctx1.fill(self,"left:",{aNode:aNode},$globals.AssignmentNode)});
  31375. },
  31376. args: ["aNode"],
  31377. source: "left: aNode\x0a\x09left := aNode.\x0a\x09aNode parent: self",
  31378. referencedClasses: [],
  31379. messageSends: ["parent:"]
  31380. }),
  31381. $globals.AssignmentNode);
  31382. $core.addMethod(
  31383. $core.method({
  31384. selector: "nodes",
  31385. protocol: 'accessing',
  31386. fn: function (){
  31387. var self=this;
  31388. return $core.withContext(function($ctx1) {
  31389. return $recv($globals.Array)._with_with_(self._left(),self._right());
  31390. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.AssignmentNode)});
  31391. },
  31392. args: [],
  31393. source: "nodes\x0a\x09^ Array with: self left with: self right",
  31394. referencedClasses: ["Array"],
  31395. messageSends: ["with:with:", "left", "right"]
  31396. }),
  31397. $globals.AssignmentNode);
  31398. $core.addMethod(
  31399. $core.method({
  31400. selector: "right",
  31401. protocol: 'accessing',
  31402. fn: function (){
  31403. var self=this;
  31404. return self["@right"];
  31405. },
  31406. args: [],
  31407. source: "right\x0a\x09^ right",
  31408. referencedClasses: [],
  31409. messageSends: []
  31410. }),
  31411. $globals.AssignmentNode);
  31412. $core.addMethod(
  31413. $core.method({
  31414. selector: "right:",
  31415. protocol: 'accessing',
  31416. fn: function (aNode){
  31417. var self=this;
  31418. return $core.withContext(function($ctx1) {
  31419. self["@right"]=aNode;
  31420. $recv(aNode)._parent_(self);
  31421. return self;
  31422. }, function($ctx1) {$ctx1.fill(self,"right:",{aNode:aNode},$globals.AssignmentNode)});
  31423. },
  31424. args: ["aNode"],
  31425. source: "right: aNode\x0a\x09right := aNode.\x0a\x09aNode parent: self",
  31426. referencedClasses: [],
  31427. messageSends: ["parent:"]
  31428. }),
  31429. $globals.AssignmentNode);
  31430. $core.addMethod(
  31431. $core.method({
  31432. selector: "shouldBeAliased",
  31433. protocol: 'testing',
  31434. fn: function (){
  31435. var self=this;
  31436. return $core.withContext(function($ctx1) {
  31437. var $1;
  31438. $1=(
  31439. $ctx1.supercall = true,
  31440. ($globals.AssignmentNode.superclass||$boot.dnu).fn.prototype._shouldBeAliased.apply($recv(self), []));
  31441. $ctx1.supercall = false;
  31442. return $recv($1)._or_((function(){
  31443. return $core.withContext(function($ctx2) {
  31444. return self._isReferenced();
  31445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31446. }));
  31447. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  31448. },
  31449. args: [],
  31450. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  31451. referencedClasses: [],
  31452. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  31453. }),
  31454. $globals.AssignmentNode);
  31455. $core.addClass('BlockNode', $globals.Node, ['parameters', 'scope'], 'Compiler-AST');
  31456. $globals.BlockNode.comment="I represent an block closure node.";
  31457. $core.addMethod(
  31458. $core.method({
  31459. selector: "accept:",
  31460. protocol: 'visiting',
  31461. fn: function (aVisitor){
  31462. var self=this;
  31463. return $core.withContext(function($ctx1) {
  31464. return $recv(aVisitor)._visitBlockNode_(self);
  31465. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockNode)});
  31466. },
  31467. args: ["aVisitor"],
  31468. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  31469. referencedClasses: [],
  31470. messageSends: ["visitBlockNode:"]
  31471. }),
  31472. $globals.BlockNode);
  31473. $core.addMethod(
  31474. $core.method({
  31475. selector: "isBlockNode",
  31476. protocol: 'testing',
  31477. fn: function (){
  31478. var self=this;
  31479. return true;
  31480. },
  31481. args: [],
  31482. source: "isBlockNode\x0a\x09^ true",
  31483. referencedClasses: [],
  31484. messageSends: []
  31485. }),
  31486. $globals.BlockNode);
  31487. $core.addMethod(
  31488. $core.method({
  31489. selector: "parameters",
  31490. protocol: 'accessing',
  31491. fn: function (){
  31492. var self=this;
  31493. return $core.withContext(function($ctx1) {
  31494. var $1,$receiver;
  31495. $1=self["@parameters"];
  31496. if(($receiver = $1) == null || $receiver.isNil){
  31497. self["@parameters"]=$recv($globals.Array)._new();
  31498. return self["@parameters"];
  31499. } else {
  31500. return $1;
  31501. };
  31502. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  31503. },
  31504. args: [],
  31505. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  31506. referencedClasses: ["Array"],
  31507. messageSends: ["ifNil:", "new"]
  31508. }),
  31509. $globals.BlockNode);
  31510. $core.addMethod(
  31511. $core.method({
  31512. selector: "parameters:",
  31513. protocol: 'accessing',
  31514. fn: function (aCollection){
  31515. var self=this;
  31516. self["@parameters"]=aCollection;
  31517. return self;
  31518. },
  31519. args: ["aCollection"],
  31520. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  31521. referencedClasses: [],
  31522. messageSends: []
  31523. }),
  31524. $globals.BlockNode);
  31525. $core.addMethod(
  31526. $core.method({
  31527. selector: "scope",
  31528. protocol: 'accessing',
  31529. fn: function (){
  31530. var self=this;
  31531. return self["@scope"];
  31532. },
  31533. args: [],
  31534. source: "scope\x0a\x09^ scope",
  31535. referencedClasses: [],
  31536. messageSends: []
  31537. }),
  31538. $globals.BlockNode);
  31539. $core.addMethod(
  31540. $core.method({
  31541. selector: "scope:",
  31542. protocol: 'accessing',
  31543. fn: function (aLexicalScope){
  31544. var self=this;
  31545. self["@scope"]=aLexicalScope;
  31546. return self;
  31547. },
  31548. args: ["aLexicalScope"],
  31549. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  31550. referencedClasses: [],
  31551. messageSends: []
  31552. }),
  31553. $globals.BlockNode);
  31554. $core.addMethod(
  31555. $core.method({
  31556. selector: "subtreeNeedsAliasing",
  31557. protocol: 'testing',
  31558. fn: function (){
  31559. var self=this;
  31560. return $core.withContext(function($ctx1) {
  31561. return $recv(self._shouldBeAliased())._or_((function(){
  31562. return $core.withContext(function($ctx2) {
  31563. return self._shouldBeInlined();
  31564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31565. }));
  31566. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  31567. },
  31568. args: [],
  31569. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [ self shouldBeInlined ]",
  31570. referencedClasses: [],
  31571. messageSends: ["or:", "shouldBeAliased", "shouldBeInlined"]
  31572. }),
  31573. $globals.BlockNode);
  31574. $core.addClass('CascadeNode', $globals.Node, ['receiver'], 'Compiler-AST');
  31575. $globals.CascadeNode.comment="I represent an cascade node.";
  31576. $core.addMethod(
  31577. $core.method({
  31578. selector: "accept:",
  31579. protocol: 'visiting',
  31580. fn: function (aVisitor){
  31581. var self=this;
  31582. return $core.withContext(function($ctx1) {
  31583. return $recv(aVisitor)._visitCascadeNode_(self);
  31584. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.CascadeNode)});
  31585. },
  31586. args: ["aVisitor"],
  31587. source: "accept: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  31588. referencedClasses: [],
  31589. messageSends: ["visitCascadeNode:"]
  31590. }),
  31591. $globals.CascadeNode);
  31592. $core.addMethod(
  31593. $core.method({
  31594. selector: "isCascadeNode",
  31595. protocol: 'testing',
  31596. fn: function (){
  31597. var self=this;
  31598. return true;
  31599. },
  31600. args: [],
  31601. source: "isCascadeNode\x0a\x09^ true",
  31602. referencedClasses: [],
  31603. messageSends: []
  31604. }),
  31605. $globals.CascadeNode);
  31606. $core.addMethod(
  31607. $core.method({
  31608. selector: "receiver",
  31609. protocol: 'accessing',
  31610. fn: function (){
  31611. var self=this;
  31612. return self["@receiver"];
  31613. },
  31614. args: [],
  31615. source: "receiver\x0a\x09^ receiver",
  31616. referencedClasses: [],
  31617. messageSends: []
  31618. }),
  31619. $globals.CascadeNode);
  31620. $core.addMethod(
  31621. $core.method({
  31622. selector: "receiver:",
  31623. protocol: 'accessing',
  31624. fn: function (aNode){
  31625. var self=this;
  31626. self["@receiver"]=aNode;
  31627. return self;
  31628. },
  31629. args: ["aNode"],
  31630. source: "receiver: aNode\x0a\x09receiver := aNode",
  31631. referencedClasses: [],
  31632. messageSends: []
  31633. }),
  31634. $globals.CascadeNode);
  31635. $core.addMethod(
  31636. $core.method({
  31637. selector: "subtreeNeedsAliasing",
  31638. protocol: 'testing',
  31639. fn: function (){
  31640. var self=this;
  31641. return $core.withContext(function($ctx1) {
  31642. return $recv($recv(self._parent())._isSequenceNode())._not();
  31643. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  31644. },
  31645. args: [],
  31646. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  31647. referencedClasses: [],
  31648. messageSends: ["not", "isSequenceNode", "parent"]
  31649. }),
  31650. $globals.CascadeNode);
  31651. $core.addClass('DynamicArrayNode', $globals.Node, [], 'Compiler-AST');
  31652. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  31653. $core.addMethod(
  31654. $core.method({
  31655. selector: "accept:",
  31656. protocol: 'visiting',
  31657. fn: function (aVisitor){
  31658. var self=this;
  31659. return $core.withContext(function($ctx1) {
  31660. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  31661. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  31662. },
  31663. args: ["aVisitor"],
  31664. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  31665. referencedClasses: [],
  31666. messageSends: ["visitDynamicArrayNode:"]
  31667. }),
  31668. $globals.DynamicArrayNode);
  31669. $core.addClass('DynamicDictionaryNode', $globals.Node, [], 'Compiler-AST');
  31670. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  31671. $core.addMethod(
  31672. $core.method({
  31673. selector: "accept:",
  31674. protocol: 'visiting',
  31675. fn: function (aVisitor){
  31676. var self=this;
  31677. return $core.withContext(function($ctx1) {
  31678. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  31679. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  31680. },
  31681. args: ["aVisitor"],
  31682. source: "accept: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  31683. referencedClasses: [],
  31684. messageSends: ["visitDynamicDictionaryNode:"]
  31685. }),
  31686. $globals.DynamicDictionaryNode);
  31687. $core.addClass('JSStatementNode', $globals.Node, [], 'Compiler-AST');
  31688. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  31689. $core.addMethod(
  31690. $core.method({
  31691. selector: "accept:",
  31692. protocol: 'visiting',
  31693. fn: function (aVisitor){
  31694. var self=this;
  31695. return $core.withContext(function($ctx1) {
  31696. return $recv(aVisitor)._visitJSStatementNode_(self);
  31697. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  31698. },
  31699. args: ["aVisitor"],
  31700. source: "accept: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  31701. referencedClasses: [],
  31702. messageSends: ["visitJSStatementNode:"]
  31703. }),
  31704. $globals.JSStatementNode);
  31705. $core.addMethod(
  31706. $core.method({
  31707. selector: "isJSStatementNode",
  31708. protocol: 'testing',
  31709. fn: function (){
  31710. var self=this;
  31711. return true;
  31712. },
  31713. args: [],
  31714. source: "isJSStatementNode\x0a\x09^ true",
  31715. referencedClasses: [],
  31716. messageSends: []
  31717. }),
  31718. $globals.JSStatementNode);
  31719. $core.addMethod(
  31720. $core.method({
  31721. selector: "requiresSmalltalkContext",
  31722. protocol: 'testing',
  31723. fn: function (){
  31724. var self=this;
  31725. return true;
  31726. },
  31727. args: [],
  31728. source: "requiresSmalltalkContext\x0a\x09^ true",
  31729. referencedClasses: [],
  31730. messageSends: []
  31731. }),
  31732. $globals.JSStatementNode);
  31733. $core.addClass('MethodNode', $globals.Node, ['selector', 'arguments', 'source', 'scope', 'classReferences', 'sendIndexes'], 'Compiler-AST');
  31734. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  31735. $core.addMethod(
  31736. $core.method({
  31737. selector: "accept:",
  31738. protocol: 'visiting',
  31739. fn: function (aVisitor){
  31740. var self=this;
  31741. return $core.withContext(function($ctx1) {
  31742. return $recv(aVisitor)._visitMethodNode_(self);
  31743. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.MethodNode)});
  31744. },
  31745. args: ["aVisitor"],
  31746. source: "accept: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  31747. referencedClasses: [],
  31748. messageSends: ["visitMethodNode:"]
  31749. }),
  31750. $globals.MethodNode);
  31751. $core.addMethod(
  31752. $core.method({
  31753. selector: "arguments",
  31754. protocol: 'accessing',
  31755. fn: function (){
  31756. var self=this;
  31757. return $core.withContext(function($ctx1) {
  31758. var $1,$receiver;
  31759. $1=self["@arguments"];
  31760. if(($receiver = $1) == null || $receiver.isNil){
  31761. return [];
  31762. } else {
  31763. return $1;
  31764. };
  31765. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  31766. },
  31767. args: [],
  31768. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  31769. referencedClasses: [],
  31770. messageSends: ["ifNil:"]
  31771. }),
  31772. $globals.MethodNode);
  31773. $core.addMethod(
  31774. $core.method({
  31775. selector: "arguments:",
  31776. protocol: 'accessing',
  31777. fn: function (aCollection){
  31778. var self=this;
  31779. self["@arguments"]=aCollection;
  31780. return self;
  31781. },
  31782. args: ["aCollection"],
  31783. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  31784. referencedClasses: [],
  31785. messageSends: []
  31786. }),
  31787. $globals.MethodNode);
  31788. $core.addMethod(
  31789. $core.method({
  31790. selector: "classReferences",
  31791. protocol: 'accessing',
  31792. fn: function (){
  31793. var self=this;
  31794. return self["@classReferences"];
  31795. },
  31796. args: [],
  31797. source: "classReferences\x0a\x09^ classReferences",
  31798. referencedClasses: [],
  31799. messageSends: []
  31800. }),
  31801. $globals.MethodNode);
  31802. $core.addMethod(
  31803. $core.method({
  31804. selector: "classReferences:",
  31805. protocol: 'accessing',
  31806. fn: function (aCollection){
  31807. var self=this;
  31808. self["@classReferences"]=aCollection;
  31809. return self;
  31810. },
  31811. args: ["aCollection"],
  31812. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  31813. referencedClasses: [],
  31814. messageSends: []
  31815. }),
  31816. $globals.MethodNode);
  31817. $core.addMethod(
  31818. $core.method({
  31819. selector: "messageSends",
  31820. protocol: 'accessing',
  31821. fn: function (){
  31822. var self=this;
  31823. return $core.withContext(function($ctx1) {
  31824. return $recv(self._sendIndexes())._keys();
  31825. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  31826. },
  31827. args: [],
  31828. source: "messageSends\x0a\x09^ self sendIndexes keys",
  31829. referencedClasses: [],
  31830. messageSends: ["keys", "sendIndexes"]
  31831. }),
  31832. $globals.MethodNode);
  31833. $core.addMethod(
  31834. $core.method({
  31835. selector: "method",
  31836. protocol: 'accessing',
  31837. fn: function (){
  31838. var self=this;
  31839. return self;
  31840. },
  31841. args: [],
  31842. source: "method\x0a\x09^ self",
  31843. referencedClasses: [],
  31844. messageSends: []
  31845. }),
  31846. $globals.MethodNode);
  31847. $core.addMethod(
  31848. $core.method({
  31849. selector: "scope",
  31850. protocol: 'accessing',
  31851. fn: function (){
  31852. var self=this;
  31853. return self["@scope"];
  31854. },
  31855. args: [],
  31856. source: "scope\x0a\x09^ scope",
  31857. referencedClasses: [],
  31858. messageSends: []
  31859. }),
  31860. $globals.MethodNode);
  31861. $core.addMethod(
  31862. $core.method({
  31863. selector: "scope:",
  31864. protocol: 'accessing',
  31865. fn: function (aMethodScope){
  31866. var self=this;
  31867. self["@scope"]=aMethodScope;
  31868. return self;
  31869. },
  31870. args: ["aMethodScope"],
  31871. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  31872. referencedClasses: [],
  31873. messageSends: []
  31874. }),
  31875. $globals.MethodNode);
  31876. $core.addMethod(
  31877. $core.method({
  31878. selector: "selector",
  31879. protocol: 'accessing',
  31880. fn: function (){
  31881. var self=this;
  31882. return self["@selector"];
  31883. },
  31884. args: [],
  31885. source: "selector\x0a\x09^ selector",
  31886. referencedClasses: [],
  31887. messageSends: []
  31888. }),
  31889. $globals.MethodNode);
  31890. $core.addMethod(
  31891. $core.method({
  31892. selector: "selector:",
  31893. protocol: 'accessing',
  31894. fn: function (aString){
  31895. var self=this;
  31896. self["@selector"]=aString;
  31897. return self;
  31898. },
  31899. args: ["aString"],
  31900. source: "selector: aString\x0a\x09selector := aString",
  31901. referencedClasses: [],
  31902. messageSends: []
  31903. }),
  31904. $globals.MethodNode);
  31905. $core.addMethod(
  31906. $core.method({
  31907. selector: "sendIndexes",
  31908. protocol: 'accessing',
  31909. fn: function (){
  31910. var self=this;
  31911. return self["@sendIndexes"];
  31912. },
  31913. args: [],
  31914. source: "sendIndexes\x0a\x09^ sendIndexes",
  31915. referencedClasses: [],
  31916. messageSends: []
  31917. }),
  31918. $globals.MethodNode);
  31919. $core.addMethod(
  31920. $core.method({
  31921. selector: "sendIndexes:",
  31922. protocol: 'accessing',
  31923. fn: function (aDictionary){
  31924. var self=this;
  31925. self["@sendIndexes"]=aDictionary;
  31926. return self;
  31927. },
  31928. args: ["aDictionary"],
  31929. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  31930. referencedClasses: [],
  31931. messageSends: []
  31932. }),
  31933. $globals.MethodNode);
  31934. $core.addMethod(
  31935. $core.method({
  31936. selector: "sequenceNode",
  31937. protocol: 'accessing',
  31938. fn: function (){
  31939. var self=this;
  31940. return $core.withContext(function($ctx1) {
  31941. var $1;
  31942. var $early={};
  31943. try {
  31944. $recv(self._nodes())._do_((function(each){
  31945. return $core.withContext(function($ctx2) {
  31946. $1=$recv(each)._isSequenceNode();
  31947. if($core.assert($1)){
  31948. throw $early=[each];
  31949. };
  31950. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31951. }));
  31952. return nil;
  31953. }
  31954. catch(e) {if(e===$early)return e[0]; throw e}
  31955. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  31956. },
  31957. args: [],
  31958. source: "sequenceNode\x0a\x09self nodes do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  31959. referencedClasses: [],
  31960. messageSends: ["do:", "nodes", "ifTrue:", "isSequenceNode"]
  31961. }),
  31962. $globals.MethodNode);
  31963. $core.addMethod(
  31964. $core.method({
  31965. selector: "source",
  31966. protocol: 'accessing',
  31967. fn: function (){
  31968. var self=this;
  31969. return self["@source"];
  31970. },
  31971. args: [],
  31972. source: "source\x0a\x09^ source",
  31973. referencedClasses: [],
  31974. messageSends: []
  31975. }),
  31976. $globals.MethodNode);
  31977. $core.addMethod(
  31978. $core.method({
  31979. selector: "source:",
  31980. protocol: 'accessing',
  31981. fn: function (aString){
  31982. var self=this;
  31983. self["@source"]=aString;
  31984. return self;
  31985. },
  31986. args: ["aString"],
  31987. source: "source: aString\x0a\x09source := aString",
  31988. referencedClasses: [],
  31989. messageSends: []
  31990. }),
  31991. $globals.MethodNode);
  31992. $core.addClass('ReturnNode', $globals.Node, ['scope'], 'Compiler-AST');
  31993. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  31994. $core.addMethod(
  31995. $core.method({
  31996. selector: "accept:",
  31997. protocol: 'visiting',
  31998. fn: function (aVisitor){
  31999. var self=this;
  32000. return $core.withContext(function($ctx1) {
  32001. return $recv(aVisitor)._visitReturnNode_(self);
  32002. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ReturnNode)});
  32003. },
  32004. args: ["aVisitor"],
  32005. source: "accept: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  32006. referencedClasses: [],
  32007. messageSends: ["visitReturnNode:"]
  32008. }),
  32009. $globals.ReturnNode);
  32010. $core.addMethod(
  32011. $core.method({
  32012. selector: "isReturnNode",
  32013. protocol: 'testing',
  32014. fn: function (){
  32015. var self=this;
  32016. return true;
  32017. },
  32018. args: [],
  32019. source: "isReturnNode\x0a\x09^ true",
  32020. referencedClasses: [],
  32021. messageSends: []
  32022. }),
  32023. $globals.ReturnNode);
  32024. $core.addMethod(
  32025. $core.method({
  32026. selector: "nonLocalReturn",
  32027. protocol: 'testing',
  32028. fn: function (){
  32029. var self=this;
  32030. return $core.withContext(function($ctx1) {
  32031. return $recv($recv(self._scope())._isMethodScope())._not();
  32032. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  32033. },
  32034. args: [],
  32035. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  32036. referencedClasses: [],
  32037. messageSends: ["not", "isMethodScope", "scope"]
  32038. }),
  32039. $globals.ReturnNode);
  32040. $core.addMethod(
  32041. $core.method({
  32042. selector: "scope",
  32043. protocol: 'accessing',
  32044. fn: function (){
  32045. var self=this;
  32046. return self["@scope"];
  32047. },
  32048. args: [],
  32049. source: "scope\x0a\x09^ scope",
  32050. referencedClasses: [],
  32051. messageSends: []
  32052. }),
  32053. $globals.ReturnNode);
  32054. $core.addMethod(
  32055. $core.method({
  32056. selector: "scope:",
  32057. protocol: 'accessing',
  32058. fn: function (aLexicalScope){
  32059. var self=this;
  32060. self["@scope"]=aLexicalScope;
  32061. return self;
  32062. },
  32063. args: ["aLexicalScope"],
  32064. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32065. referencedClasses: [],
  32066. messageSends: []
  32067. }),
  32068. $globals.ReturnNode);
  32069. $core.addClass('SendNode', $globals.Node, ['selector', 'arguments', 'receiver', 'index'], 'Compiler-AST');
  32070. $globals.SendNode.comment="I represent an message send node.";
  32071. $core.addMethod(
  32072. $core.method({
  32073. selector: "accept:",
  32074. protocol: 'visiting',
  32075. fn: function (aVisitor){
  32076. var self=this;
  32077. return $core.withContext(function($ctx1) {
  32078. return $recv(aVisitor)._visitSendNode_(self);
  32079. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SendNode)});
  32080. },
  32081. args: ["aVisitor"],
  32082. source: "accept: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  32083. referencedClasses: [],
  32084. messageSends: ["visitSendNode:"]
  32085. }),
  32086. $globals.SendNode);
  32087. $core.addMethod(
  32088. $core.method({
  32089. selector: "arguments",
  32090. protocol: 'accessing',
  32091. fn: function (){
  32092. var self=this;
  32093. return $core.withContext(function($ctx1) {
  32094. var $1,$receiver;
  32095. $1=self["@arguments"];
  32096. if(($receiver = $1) == null || $receiver.isNil){
  32097. self["@arguments"]=[];
  32098. return self["@arguments"];
  32099. } else {
  32100. return $1;
  32101. };
  32102. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  32103. },
  32104. args: [],
  32105. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  32106. referencedClasses: [],
  32107. messageSends: ["ifNil:"]
  32108. }),
  32109. $globals.SendNode);
  32110. $core.addMethod(
  32111. $core.method({
  32112. selector: "arguments:",
  32113. protocol: 'accessing',
  32114. fn: function (aCollection){
  32115. var self=this;
  32116. return $core.withContext(function($ctx1) {
  32117. self["@arguments"]=aCollection;
  32118. $recv(aCollection)._do_((function(each){
  32119. return $core.withContext(function($ctx2) {
  32120. return $recv(each)._parent_(self);
  32121. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32122. }));
  32123. return self;
  32124. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.SendNode)});
  32125. },
  32126. args: ["aCollection"],
  32127. source: "arguments: aCollection\x0a\x09arguments := aCollection.\x0a\x09aCollection do: [ :each | each parent: self ]",
  32128. referencedClasses: [],
  32129. messageSends: ["do:", "parent:"]
  32130. }),
  32131. $globals.SendNode);
  32132. $core.addMethod(
  32133. $core.method({
  32134. selector: "cascadeNodeWithMessages:",
  32135. protocol: 'accessing',
  32136. fn: function (aCollection){
  32137. var self=this;
  32138. var first;
  32139. return $core.withContext(function($ctx1) {
  32140. var $1,$2,$3;
  32141. $1=$recv($globals.SendNode)._new();
  32142. $ctx1.sendIdx["new"]=1;
  32143. $recv($1)._selector_(self._selector());
  32144. $recv($1)._arguments_(self._arguments());
  32145. $2=$recv($1)._yourself();
  32146. $ctx1.sendIdx["yourself"]=1;
  32147. first=$2;
  32148. $3=$recv($globals.CascadeNode)._new();
  32149. $recv($3)._receiver_(self._receiver());
  32150. $recv($3)._nodes_($recv($recv($globals.Array)._with_(first)).__comma(aCollection));
  32151. return $recv($3)._yourself();
  32152. }, function($ctx1) {$ctx1.fill(self,"cascadeNodeWithMessages:",{aCollection:aCollection,first:first},$globals.SendNode)});
  32153. },
  32154. args: ["aCollection"],
  32155. 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",
  32156. referencedClasses: ["SendNode", "CascadeNode", "Array"],
  32157. messageSends: ["selector:", "new", "selector", "arguments:", "arguments", "yourself", "receiver:", "receiver", "nodes:", ",", "with:"]
  32158. }),
  32159. $globals.SendNode);
  32160. $core.addMethod(
  32161. $core.method({
  32162. selector: "index",
  32163. protocol: 'accessing',
  32164. fn: function (){
  32165. var self=this;
  32166. return self["@index"];
  32167. },
  32168. args: [],
  32169. source: "index\x0a\x09^ index",
  32170. referencedClasses: [],
  32171. messageSends: []
  32172. }),
  32173. $globals.SendNode);
  32174. $core.addMethod(
  32175. $core.method({
  32176. selector: "index:",
  32177. protocol: 'accessing',
  32178. fn: function (anInteger){
  32179. var self=this;
  32180. self["@index"]=anInteger;
  32181. return self;
  32182. },
  32183. args: ["anInteger"],
  32184. source: "index: anInteger\x0a\x09index := anInteger",
  32185. referencedClasses: [],
  32186. messageSends: []
  32187. }),
  32188. $globals.SendNode);
  32189. $core.addMethod(
  32190. $core.method({
  32191. selector: "isCascadeSendNode",
  32192. protocol: 'testing',
  32193. fn: function (){
  32194. var self=this;
  32195. return $core.withContext(function($ctx1) {
  32196. return $recv(self._parent())._isCascadeNode();
  32197. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  32198. },
  32199. args: [],
  32200. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  32201. referencedClasses: [],
  32202. messageSends: ["isCascadeNode", "parent"]
  32203. }),
  32204. $globals.SendNode);
  32205. $core.addMethod(
  32206. $core.method({
  32207. selector: "isNavigationNode",
  32208. protocol: 'testing',
  32209. fn: function (){
  32210. var self=this;
  32211. return true;
  32212. },
  32213. args: [],
  32214. source: "isNavigationNode\x0a\x09^ true",
  32215. referencedClasses: [],
  32216. messageSends: []
  32217. }),
  32218. $globals.SendNode);
  32219. $core.addMethod(
  32220. $core.method({
  32221. selector: "isSendNode",
  32222. protocol: 'testing',
  32223. fn: function (){
  32224. var self=this;
  32225. return true;
  32226. },
  32227. args: [],
  32228. source: "isSendNode\x0a\x09^ true",
  32229. referencedClasses: [],
  32230. messageSends: []
  32231. }),
  32232. $globals.SendNode);
  32233. $core.addMethod(
  32234. $core.method({
  32235. selector: "navigationLink",
  32236. protocol: 'accessing',
  32237. fn: function (){
  32238. var self=this;
  32239. return $core.withContext(function($ctx1) {
  32240. return self._selector();
  32241. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  32242. },
  32243. args: [],
  32244. source: "navigationLink\x0a\x09^ self selector",
  32245. referencedClasses: [],
  32246. messageSends: ["selector"]
  32247. }),
  32248. $globals.SendNode);
  32249. $core.addMethod(
  32250. $core.method({
  32251. selector: "nodes",
  32252. protocol: 'accessing',
  32253. fn: function (){
  32254. var self=this;
  32255. return $core.withContext(function($ctx1) {
  32256. var $1,$2,$3,$receiver;
  32257. $1=self._receiver();
  32258. $ctx1.sendIdx["receiver"]=1;
  32259. if(($receiver = $1) == null || $receiver.isNil){
  32260. $2=self._arguments();
  32261. $ctx1.sendIdx["arguments"]=1;
  32262. return $recv($2)._copy();
  32263. } else {
  32264. $1;
  32265. };
  32266. $3=$recv($globals.Array)._with_(self._receiver());
  32267. $recv($3)._addAll_(self._arguments());
  32268. return $recv($3)._yourself();
  32269. }, function($ctx1) {$ctx1.fill(self,"nodes",{},$globals.SendNode)});
  32270. },
  32271. args: [],
  32272. 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",
  32273. referencedClasses: ["Array"],
  32274. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  32275. }),
  32276. $globals.SendNode);
  32277. $core.addMethod(
  32278. $core.method({
  32279. selector: "receiver",
  32280. protocol: 'accessing',
  32281. fn: function (){
  32282. var self=this;
  32283. return self["@receiver"];
  32284. },
  32285. args: [],
  32286. source: "receiver\x0a\x09^ receiver",
  32287. referencedClasses: [],
  32288. messageSends: []
  32289. }),
  32290. $globals.SendNode);
  32291. $core.addMethod(
  32292. $core.method({
  32293. selector: "receiver:",
  32294. protocol: 'accessing',
  32295. fn: function (aNode){
  32296. var self=this;
  32297. return $core.withContext(function($ctx1) {
  32298. var $1;
  32299. self["@receiver"]=aNode;
  32300. $1=$recv(aNode)._isNode();
  32301. if($core.assert($1)){
  32302. $recv(aNode)._parent_(self);
  32303. };
  32304. return self;
  32305. }, function($ctx1) {$ctx1.fill(self,"receiver:",{aNode:aNode},$globals.SendNode)});
  32306. },
  32307. args: ["aNode"],
  32308. source: "receiver: aNode\x0a\x09receiver := aNode.\x0a\x09aNode isNode ifTrue: [\x0a\x09\x09aNode parent: self ]",
  32309. referencedClasses: [],
  32310. messageSends: ["ifTrue:", "isNode", "parent:"]
  32311. }),
  32312. $globals.SendNode);
  32313. $core.addMethod(
  32314. $core.method({
  32315. selector: "requiresSmalltalkContext",
  32316. protocol: 'testing',
  32317. fn: function (){
  32318. var self=this;
  32319. return true;
  32320. },
  32321. args: [],
  32322. source: "requiresSmalltalkContext\x0a\x09^ true",
  32323. referencedClasses: [],
  32324. messageSends: []
  32325. }),
  32326. $globals.SendNode);
  32327. $core.addMethod(
  32328. $core.method({
  32329. selector: "selector",
  32330. protocol: 'accessing',
  32331. fn: function (){
  32332. var self=this;
  32333. return self["@selector"];
  32334. },
  32335. args: [],
  32336. source: "selector\x0a\x09^ selector",
  32337. referencedClasses: [],
  32338. messageSends: []
  32339. }),
  32340. $globals.SendNode);
  32341. $core.addMethod(
  32342. $core.method({
  32343. selector: "selector:",
  32344. protocol: 'accessing',
  32345. fn: function (aString){
  32346. var self=this;
  32347. self["@selector"]=aString;
  32348. return self;
  32349. },
  32350. args: ["aString"],
  32351. source: "selector: aString\x0a\x09selector := aString",
  32352. referencedClasses: [],
  32353. messageSends: []
  32354. }),
  32355. $globals.SendNode);
  32356. $core.addMethod(
  32357. $core.method({
  32358. selector: "shouldBeAliased",
  32359. protocol: 'testing',
  32360. fn: function (){
  32361. var self=this;
  32362. var sends;
  32363. return $core.withContext(function($ctx1) {
  32364. var $2,$1;
  32365. sends=$recv($recv($recv(self._method())._sendIndexes())._at_(self._selector()))._size();
  32366. $2=(
  32367. $ctx1.supercall = true,
  32368. ($globals.SendNode.superclass||$boot.dnu).fn.prototype._shouldBeAliased.apply($recv(self), []));
  32369. $ctx1.supercall = false;
  32370. $1=$recv($2)._or_((function(){
  32371. return $core.withContext(function($ctx2) {
  32372. return $recv(self._isReferenced())._and_((function(){
  32373. return $core.withContext(function($ctx3) {
  32374. return $recv($recv($recv(sends).__gt((1)))._and_((function(){
  32375. return $core.withContext(function($ctx4) {
  32376. return $recv(self._index()).__lt(sends);
  32377. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  32378. })))._or_((function(){
  32379. return $core.withContext(function($ctx4) {
  32380. return self._superSend();
  32381. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  32382. }));
  32383. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32384. }));
  32385. $ctx2.sendIdx["and:"]=1;
  32386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32387. }));
  32388. $ctx1.sendIdx["or:"]=1;
  32389. return $1;
  32390. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  32391. },
  32392. args: [],
  32393. 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\x09(sends > 1 and: [ self index < sends ])\x0a\x09\x09\x09\x09or: [ self superSend ] ] ])",
  32394. referencedClasses: [],
  32395. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", ">", "<", "index", "superSend"]
  32396. }),
  32397. $globals.SendNode);
  32398. $core.addMethod(
  32399. $core.method({
  32400. selector: "superSend",
  32401. protocol: 'accessing',
  32402. fn: function (){
  32403. var self=this;
  32404. return $core.withContext(function($ctx1) {
  32405. return $recv($recv(self._receiver())._value()).__eq("super");
  32406. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  32407. },
  32408. args: [],
  32409. source: "superSend\x0a\x09^ self receiver value = 'super'",
  32410. referencedClasses: [],
  32411. messageSends: ["=", "value", "receiver"]
  32412. }),
  32413. $globals.SendNode);
  32414. $core.addMethod(
  32415. $core.method({
  32416. selector: "valueForReceiver:",
  32417. protocol: 'building',
  32418. fn: function (anObject){
  32419. var self=this;
  32420. return $core.withContext(function($ctx1) {
  32421. var $1,$3,$2,$receiver;
  32422. $1=$recv($globals.SendNode)._new();
  32423. $recv($1)._position_(self._position());
  32424. $recv($1)._source_(self._source());
  32425. $3=self._receiver();
  32426. $ctx1.sendIdx["receiver"]=1;
  32427. if(($receiver = $3) == null || $receiver.isNil){
  32428. $2=anObject;
  32429. } else {
  32430. $2=$recv(self._receiver())._valueForReceiver_(anObject);
  32431. };
  32432. $recv($1)._receiver_($2);
  32433. $recv($1)._selector_(self._selector());
  32434. $recv($1)._arguments_(self._arguments());
  32435. return $recv($1)._yourself();
  32436. }, function($ctx1) {$ctx1.fill(self,"valueForReceiver:",{anObject:anObject},$globals.SendNode)});
  32437. },
  32438. args: ["anObject"],
  32439. 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",
  32440. referencedClasses: ["SendNode"],
  32441. messageSends: ["position:", "new", "position", "source:", "source", "receiver:", "ifNil:ifNotNil:", "receiver", "valueForReceiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  32442. }),
  32443. $globals.SendNode);
  32444. $core.addClass('SequenceNode', $globals.Node, ['temps', 'scope'], 'Compiler-AST');
  32445. $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).";
  32446. $core.addMethod(
  32447. $core.method({
  32448. selector: "accept:",
  32449. protocol: 'visiting',
  32450. fn: function (aVisitor){
  32451. var self=this;
  32452. return $core.withContext(function($ctx1) {
  32453. return $recv(aVisitor)._visitSequenceNode_(self);
  32454. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.SequenceNode)});
  32455. },
  32456. args: ["aVisitor"],
  32457. source: "accept: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  32458. referencedClasses: [],
  32459. messageSends: ["visitSequenceNode:"]
  32460. }),
  32461. $globals.SequenceNode);
  32462. $core.addMethod(
  32463. $core.method({
  32464. selector: "asBlockSequenceNode",
  32465. protocol: 'building',
  32466. fn: function (){
  32467. var self=this;
  32468. return $core.withContext(function($ctx1) {
  32469. var $1;
  32470. $1=$recv($globals.BlockSequenceNode)._new();
  32471. $recv($1)._position_(self._position());
  32472. $recv($1)._source_(self._source());
  32473. $recv($1)._nodes_(self._nodes());
  32474. $recv($1)._temps_(self._temps());
  32475. return $recv($1)._yourself();
  32476. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  32477. },
  32478. args: [],
  32479. 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",
  32480. referencedClasses: ["BlockSequenceNode"],
  32481. messageSends: ["position:", "new", "position", "source:", "source", "nodes:", "nodes", "temps:", "temps", "yourself"]
  32482. }),
  32483. $globals.SequenceNode);
  32484. $core.addMethod(
  32485. $core.method({
  32486. selector: "isSequenceNode",
  32487. protocol: 'testing',
  32488. fn: function (){
  32489. var self=this;
  32490. return true;
  32491. },
  32492. args: [],
  32493. source: "isSequenceNode\x0a\x09^ true",
  32494. referencedClasses: [],
  32495. messageSends: []
  32496. }),
  32497. $globals.SequenceNode);
  32498. $core.addMethod(
  32499. $core.method({
  32500. selector: "scope",
  32501. protocol: 'accessing',
  32502. fn: function (){
  32503. var self=this;
  32504. return self["@scope"];
  32505. },
  32506. args: [],
  32507. source: "scope\x0a\x09^ scope",
  32508. referencedClasses: [],
  32509. messageSends: []
  32510. }),
  32511. $globals.SequenceNode);
  32512. $core.addMethod(
  32513. $core.method({
  32514. selector: "scope:",
  32515. protocol: 'accessing',
  32516. fn: function (aLexicalScope){
  32517. var self=this;
  32518. self["@scope"]=aLexicalScope;
  32519. return self;
  32520. },
  32521. args: ["aLexicalScope"],
  32522. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  32523. referencedClasses: [],
  32524. messageSends: []
  32525. }),
  32526. $globals.SequenceNode);
  32527. $core.addMethod(
  32528. $core.method({
  32529. selector: "temps",
  32530. protocol: 'accessing',
  32531. fn: function (){
  32532. var self=this;
  32533. return $core.withContext(function($ctx1) {
  32534. var $1,$receiver;
  32535. $1=self["@temps"];
  32536. if(($receiver = $1) == null || $receiver.isNil){
  32537. return [];
  32538. } else {
  32539. return $1;
  32540. };
  32541. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  32542. },
  32543. args: [],
  32544. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  32545. referencedClasses: [],
  32546. messageSends: ["ifNil:"]
  32547. }),
  32548. $globals.SequenceNode);
  32549. $core.addMethod(
  32550. $core.method({
  32551. selector: "temps:",
  32552. protocol: 'accessing',
  32553. fn: function (aCollection){
  32554. var self=this;
  32555. self["@temps"]=aCollection;
  32556. return self;
  32557. },
  32558. args: ["aCollection"],
  32559. source: "temps: aCollection\x0a\x09temps := aCollection",
  32560. referencedClasses: [],
  32561. messageSends: []
  32562. }),
  32563. $globals.SequenceNode);
  32564. $core.addClass('BlockSequenceNode', $globals.SequenceNode, [], 'Compiler-AST');
  32565. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  32566. $core.addMethod(
  32567. $core.method({
  32568. selector: "accept:",
  32569. protocol: 'visiting',
  32570. fn: function (aVisitor){
  32571. var self=this;
  32572. return $core.withContext(function($ctx1) {
  32573. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  32574. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  32575. },
  32576. args: ["aVisitor"],
  32577. source: "accept: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  32578. referencedClasses: [],
  32579. messageSends: ["visitBlockSequenceNode:"]
  32580. }),
  32581. $globals.BlockSequenceNode);
  32582. $core.addMethod(
  32583. $core.method({
  32584. selector: "isBlockSequenceNode",
  32585. protocol: 'testing',
  32586. fn: function (){
  32587. var self=this;
  32588. return true;
  32589. },
  32590. args: [],
  32591. source: "isBlockSequenceNode\x0a\x09^ true",
  32592. referencedClasses: [],
  32593. messageSends: []
  32594. }),
  32595. $globals.BlockSequenceNode);
  32596. $core.addClass('ValueNode', $globals.Node, ['value'], 'Compiler-AST');
  32597. $globals.ValueNode.comment="I represent a value node.";
  32598. $core.addMethod(
  32599. $core.method({
  32600. selector: "accept:",
  32601. protocol: 'visiting',
  32602. fn: function (aVisitor){
  32603. var self=this;
  32604. return $core.withContext(function($ctx1) {
  32605. return $recv(aVisitor)._visitValueNode_(self);
  32606. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.ValueNode)});
  32607. },
  32608. args: ["aVisitor"],
  32609. source: "accept: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  32610. referencedClasses: [],
  32611. messageSends: ["visitValueNode:"]
  32612. }),
  32613. $globals.ValueNode);
  32614. $core.addMethod(
  32615. $core.method({
  32616. selector: "isImmutable",
  32617. protocol: 'testing',
  32618. fn: function (){
  32619. var self=this;
  32620. return $core.withContext(function($ctx1) {
  32621. return $recv(self._value())._isImmutable();
  32622. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  32623. },
  32624. args: [],
  32625. source: "isImmutable\x0a\x09^ self value isImmutable",
  32626. referencedClasses: [],
  32627. messageSends: ["isImmutable", "value"]
  32628. }),
  32629. $globals.ValueNode);
  32630. $core.addMethod(
  32631. $core.method({
  32632. selector: "isValueNode",
  32633. protocol: 'testing',
  32634. fn: function (){
  32635. var self=this;
  32636. return true;
  32637. },
  32638. args: [],
  32639. source: "isValueNode\x0a\x09^ true",
  32640. referencedClasses: [],
  32641. messageSends: []
  32642. }),
  32643. $globals.ValueNode);
  32644. $core.addMethod(
  32645. $core.method({
  32646. selector: "value",
  32647. protocol: 'accessing',
  32648. fn: function (){
  32649. var self=this;
  32650. return self["@value"];
  32651. },
  32652. args: [],
  32653. source: "value\x0a\x09^ value",
  32654. referencedClasses: [],
  32655. messageSends: []
  32656. }),
  32657. $globals.ValueNode);
  32658. $core.addMethod(
  32659. $core.method({
  32660. selector: "value:",
  32661. protocol: 'accessing',
  32662. fn: function (anObject){
  32663. var self=this;
  32664. self["@value"]=anObject;
  32665. return self;
  32666. },
  32667. args: ["anObject"],
  32668. source: "value: anObject\x0a\x09value := anObject",
  32669. referencedClasses: [],
  32670. messageSends: []
  32671. }),
  32672. $globals.ValueNode);
  32673. $core.addClass('VariableNode', $globals.ValueNode, ['assigned', 'binding'], 'Compiler-AST');
  32674. $globals.VariableNode.comment="I represent an variable node.";
  32675. $core.addMethod(
  32676. $core.method({
  32677. selector: "accept:",
  32678. protocol: 'visiting',
  32679. fn: function (aVisitor){
  32680. var self=this;
  32681. return $core.withContext(function($ctx1) {
  32682. return $recv(aVisitor)._visitVariableNode_(self);
  32683. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.VariableNode)});
  32684. },
  32685. args: ["aVisitor"],
  32686. source: "accept: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  32687. referencedClasses: [],
  32688. messageSends: ["visitVariableNode:"]
  32689. }),
  32690. $globals.VariableNode);
  32691. $core.addMethod(
  32692. $core.method({
  32693. selector: "alias",
  32694. protocol: 'accessing',
  32695. fn: function (){
  32696. var self=this;
  32697. return $core.withContext(function($ctx1) {
  32698. return $recv(self._binding())._alias();
  32699. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  32700. },
  32701. args: [],
  32702. source: "alias\x0a\x09^ self binding alias",
  32703. referencedClasses: [],
  32704. messageSends: ["alias", "binding"]
  32705. }),
  32706. $globals.VariableNode);
  32707. $core.addMethod(
  32708. $core.method({
  32709. selector: "assigned",
  32710. protocol: 'accessing',
  32711. fn: function (){
  32712. var self=this;
  32713. return $core.withContext(function($ctx1) {
  32714. var $1,$receiver;
  32715. $1=self["@assigned"];
  32716. if(($receiver = $1) == null || $receiver.isNil){
  32717. return false;
  32718. } else {
  32719. return $1;
  32720. };
  32721. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  32722. },
  32723. args: [],
  32724. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  32725. referencedClasses: [],
  32726. messageSends: ["ifNil:"]
  32727. }),
  32728. $globals.VariableNode);
  32729. $core.addMethod(
  32730. $core.method({
  32731. selector: "assigned:",
  32732. protocol: 'accessing',
  32733. fn: function (aBoolean){
  32734. var self=this;
  32735. self["@assigned"]=aBoolean;
  32736. return self;
  32737. },
  32738. args: ["aBoolean"],
  32739. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  32740. referencedClasses: [],
  32741. messageSends: []
  32742. }),
  32743. $globals.VariableNode);
  32744. $core.addMethod(
  32745. $core.method({
  32746. selector: "beAssigned",
  32747. protocol: 'accessing',
  32748. fn: function (){
  32749. var self=this;
  32750. return $core.withContext(function($ctx1) {
  32751. $recv(self._binding())._validateAssignment();
  32752. self["@assigned"]=true;
  32753. return self;
  32754. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  32755. },
  32756. args: [],
  32757. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  32758. referencedClasses: [],
  32759. messageSends: ["validateAssignment", "binding"]
  32760. }),
  32761. $globals.VariableNode);
  32762. $core.addMethod(
  32763. $core.method({
  32764. selector: "binding",
  32765. protocol: 'accessing',
  32766. fn: function (){
  32767. var self=this;
  32768. return self["@binding"];
  32769. },
  32770. args: [],
  32771. source: "binding\x0a\x09^ binding",
  32772. referencedClasses: [],
  32773. messageSends: []
  32774. }),
  32775. $globals.VariableNode);
  32776. $core.addMethod(
  32777. $core.method({
  32778. selector: "binding:",
  32779. protocol: 'accessing',
  32780. fn: function (aScopeVar){
  32781. var self=this;
  32782. self["@binding"]=aScopeVar;
  32783. return self;
  32784. },
  32785. args: ["aScopeVar"],
  32786. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  32787. referencedClasses: [],
  32788. messageSends: []
  32789. }),
  32790. $globals.VariableNode);
  32791. $core.addMethod(
  32792. $core.method({
  32793. selector: "isArgument",
  32794. protocol: 'testing',
  32795. fn: function (){
  32796. var self=this;
  32797. return $core.withContext(function($ctx1) {
  32798. return $recv(self._binding())._isArgVar();
  32799. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  32800. },
  32801. args: [],
  32802. source: "isArgument\x0a\x09^ self binding isArgVar",
  32803. referencedClasses: [],
  32804. messageSends: ["isArgVar", "binding"]
  32805. }),
  32806. $globals.VariableNode);
  32807. $core.addMethod(
  32808. $core.method({
  32809. selector: "isImmutable",
  32810. protocol: 'testing',
  32811. fn: function (){
  32812. var self=this;
  32813. return $core.withContext(function($ctx1) {
  32814. return $recv(self._binding())._isImmutable();
  32815. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  32816. },
  32817. args: [],
  32818. source: "isImmutable\x0a\x09^ self binding isImmutable",
  32819. referencedClasses: [],
  32820. messageSends: ["isImmutable", "binding"]
  32821. }),
  32822. $globals.VariableNode);
  32823. $core.addMethod(
  32824. $core.method({
  32825. selector: "isNavigationNode",
  32826. protocol: 'testing',
  32827. fn: function (){
  32828. var self=this;
  32829. return true;
  32830. },
  32831. args: [],
  32832. source: "isNavigationNode\x0a\x09^ true",
  32833. referencedClasses: [],
  32834. messageSends: []
  32835. }),
  32836. $globals.VariableNode);
  32837. $core.addMethod(
  32838. $core.method({
  32839. selector: "isVariableNode",
  32840. protocol: 'testing',
  32841. fn: function (){
  32842. var self=this;
  32843. return true;
  32844. },
  32845. args: [],
  32846. source: "isVariableNode\x0a\x09^ true",
  32847. referencedClasses: [],
  32848. messageSends: []
  32849. }),
  32850. $globals.VariableNode);
  32851. $core.addMethod(
  32852. $core.method({
  32853. selector: "navigationLink",
  32854. protocol: 'accessing',
  32855. fn: function (){
  32856. var self=this;
  32857. return $core.withContext(function($ctx1) {
  32858. return self._value();
  32859. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  32860. },
  32861. args: [],
  32862. source: "navigationLink\x0a\x09^ self value",
  32863. referencedClasses: [],
  32864. messageSends: ["value"]
  32865. }),
  32866. $globals.VariableNode);
  32867. $core.addClass('NodeVisitor', $globals.Object, [], 'Compiler-AST');
  32868. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  32869. $core.addMethod(
  32870. $core.method({
  32871. selector: "visit:",
  32872. protocol: 'visiting',
  32873. fn: function (aNode){
  32874. var self=this;
  32875. return $core.withContext(function($ctx1) {
  32876. return $recv(aNode)._accept_(self);
  32877. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.NodeVisitor)});
  32878. },
  32879. args: ["aNode"],
  32880. source: "visit: aNode\x0a\x09^ aNode accept: self",
  32881. referencedClasses: [],
  32882. messageSends: ["accept:"]
  32883. }),
  32884. $globals.NodeVisitor);
  32885. $core.addMethod(
  32886. $core.method({
  32887. selector: "visitAll:",
  32888. protocol: 'visiting',
  32889. fn: function (aCollection){
  32890. var self=this;
  32891. return $core.withContext(function($ctx1) {
  32892. return $recv(aCollection)._collect_((function(each){
  32893. return $core.withContext(function($ctx2) {
  32894. return self._visit_(each);
  32895. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  32896. }));
  32897. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.NodeVisitor)});
  32898. },
  32899. args: ["aCollection"],
  32900. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  32901. referencedClasses: [],
  32902. messageSends: ["collect:", "visit:"]
  32903. }),
  32904. $globals.NodeVisitor);
  32905. $core.addMethod(
  32906. $core.method({
  32907. selector: "visitAssignmentNode:",
  32908. protocol: 'visiting',
  32909. fn: function (aNode){
  32910. var self=this;
  32911. return $core.withContext(function($ctx1) {
  32912. return self._visitNode_(aNode);
  32913. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  32914. },
  32915. args: ["aNode"],
  32916. source: "visitAssignmentNode: aNode\x0a\x09^ self visitNode: aNode",
  32917. referencedClasses: [],
  32918. messageSends: ["visitNode:"]
  32919. }),
  32920. $globals.NodeVisitor);
  32921. $core.addMethod(
  32922. $core.method({
  32923. selector: "visitBlockNode:",
  32924. protocol: 'visiting',
  32925. fn: function (aNode){
  32926. var self=this;
  32927. return $core.withContext(function($ctx1) {
  32928. return self._visitNode_(aNode);
  32929. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  32930. },
  32931. args: ["aNode"],
  32932. source: "visitBlockNode: aNode\x0a\x09^ self visitNode: aNode",
  32933. referencedClasses: [],
  32934. messageSends: ["visitNode:"]
  32935. }),
  32936. $globals.NodeVisitor);
  32937. $core.addMethod(
  32938. $core.method({
  32939. selector: "visitBlockSequenceNode:",
  32940. protocol: 'visiting',
  32941. fn: function (aNode){
  32942. var self=this;
  32943. return $core.withContext(function($ctx1) {
  32944. return self._visitSequenceNode_(aNode);
  32945. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  32946. },
  32947. args: ["aNode"],
  32948. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  32949. referencedClasses: [],
  32950. messageSends: ["visitSequenceNode:"]
  32951. }),
  32952. $globals.NodeVisitor);
  32953. $core.addMethod(
  32954. $core.method({
  32955. selector: "visitCascadeNode:",
  32956. protocol: 'visiting',
  32957. fn: function (aNode){
  32958. var self=this;
  32959. return $core.withContext(function($ctx1) {
  32960. return self._visitNode_(aNode);
  32961. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  32962. },
  32963. args: ["aNode"],
  32964. source: "visitCascadeNode: aNode\x0a\x09^ self visitNode: aNode",
  32965. referencedClasses: [],
  32966. messageSends: ["visitNode:"]
  32967. }),
  32968. $globals.NodeVisitor);
  32969. $core.addMethod(
  32970. $core.method({
  32971. selector: "visitDynamicArrayNode:",
  32972. protocol: 'visiting',
  32973. fn: function (aNode){
  32974. var self=this;
  32975. return $core.withContext(function($ctx1) {
  32976. return self._visitNode_(aNode);
  32977. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  32978. },
  32979. args: ["aNode"],
  32980. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitNode: aNode",
  32981. referencedClasses: [],
  32982. messageSends: ["visitNode:"]
  32983. }),
  32984. $globals.NodeVisitor);
  32985. $core.addMethod(
  32986. $core.method({
  32987. selector: "visitDynamicDictionaryNode:",
  32988. protocol: 'visiting',
  32989. fn: function (aNode){
  32990. var self=this;
  32991. return $core.withContext(function($ctx1) {
  32992. return self._visitNode_(aNode);
  32993. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  32994. },
  32995. args: ["aNode"],
  32996. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitNode: aNode",
  32997. referencedClasses: [],
  32998. messageSends: ["visitNode:"]
  32999. }),
  33000. $globals.NodeVisitor);
  33001. $core.addMethod(
  33002. $core.method({
  33003. selector: "visitJSStatementNode:",
  33004. protocol: 'visiting',
  33005. fn: function (aNode){
  33006. var self=this;
  33007. return $core.withContext(function($ctx1) {
  33008. return self._visitNode_(aNode);
  33009. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  33010. },
  33011. args: ["aNode"],
  33012. source: "visitJSStatementNode: aNode\x0a\x09^ self visitNode: aNode",
  33013. referencedClasses: [],
  33014. messageSends: ["visitNode:"]
  33015. }),
  33016. $globals.NodeVisitor);
  33017. $core.addMethod(
  33018. $core.method({
  33019. selector: "visitMethodNode:",
  33020. protocol: 'visiting',
  33021. fn: function (aNode){
  33022. var self=this;
  33023. return $core.withContext(function($ctx1) {
  33024. return self._visitNode_(aNode);
  33025. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  33026. },
  33027. args: ["aNode"],
  33028. source: "visitMethodNode: aNode\x0a\x09^ self visitNode: aNode",
  33029. referencedClasses: [],
  33030. messageSends: ["visitNode:"]
  33031. }),
  33032. $globals.NodeVisitor);
  33033. $core.addMethod(
  33034. $core.method({
  33035. selector: "visitNode:",
  33036. protocol: 'visiting',
  33037. fn: function (aNode){
  33038. var self=this;
  33039. return $core.withContext(function($ctx1) {
  33040. return self._visitAll_($recv(aNode)._nodes());
  33041. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.NodeVisitor)});
  33042. },
  33043. args: ["aNode"],
  33044. source: "visitNode: aNode\x0a\x09^ self visitAll: aNode nodes",
  33045. referencedClasses: [],
  33046. messageSends: ["visitAll:", "nodes"]
  33047. }),
  33048. $globals.NodeVisitor);
  33049. $core.addMethod(
  33050. $core.method({
  33051. selector: "visitReturnNode:",
  33052. protocol: 'visiting',
  33053. fn: function (aNode){
  33054. var self=this;
  33055. return $core.withContext(function($ctx1) {
  33056. return self._visitNode_(aNode);
  33057. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  33058. },
  33059. args: ["aNode"],
  33060. source: "visitReturnNode: aNode\x0a\x09^ self visitNode: aNode",
  33061. referencedClasses: [],
  33062. messageSends: ["visitNode:"]
  33063. }),
  33064. $globals.NodeVisitor);
  33065. $core.addMethod(
  33066. $core.method({
  33067. selector: "visitSendNode:",
  33068. protocol: 'visiting',
  33069. fn: function (aNode){
  33070. var self=this;
  33071. return $core.withContext(function($ctx1) {
  33072. return self._visitNode_(aNode);
  33073. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  33074. },
  33075. args: ["aNode"],
  33076. source: "visitSendNode: aNode\x0a\x09^ self visitNode: aNode",
  33077. referencedClasses: [],
  33078. messageSends: ["visitNode:"]
  33079. }),
  33080. $globals.NodeVisitor);
  33081. $core.addMethod(
  33082. $core.method({
  33083. selector: "visitSequenceNode:",
  33084. protocol: 'visiting',
  33085. fn: function (aNode){
  33086. var self=this;
  33087. return $core.withContext(function($ctx1) {
  33088. return self._visitNode_(aNode);
  33089. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  33090. },
  33091. args: ["aNode"],
  33092. source: "visitSequenceNode: aNode\x0a\x09^ self visitNode: aNode",
  33093. referencedClasses: [],
  33094. messageSends: ["visitNode:"]
  33095. }),
  33096. $globals.NodeVisitor);
  33097. $core.addMethod(
  33098. $core.method({
  33099. selector: "visitValueNode:",
  33100. protocol: 'visiting',
  33101. fn: function (aNode){
  33102. var self=this;
  33103. return $core.withContext(function($ctx1) {
  33104. return self._visitNode_(aNode);
  33105. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  33106. },
  33107. args: ["aNode"],
  33108. source: "visitValueNode: aNode\x0a\x09^ self visitNode: aNode",
  33109. referencedClasses: [],
  33110. messageSends: ["visitNode:"]
  33111. }),
  33112. $globals.NodeVisitor);
  33113. $core.addMethod(
  33114. $core.method({
  33115. selector: "visitVariableNode:",
  33116. protocol: 'visiting',
  33117. fn: function (aNode){
  33118. var self=this;
  33119. return $core.withContext(function($ctx1) {
  33120. return self._visitNode_(aNode);
  33121. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  33122. },
  33123. args: ["aNode"],
  33124. source: "visitVariableNode: aNode\x0a\x09^ self visitNode: aNode",
  33125. referencedClasses: [],
  33126. messageSends: ["visitNode:"]
  33127. }),
  33128. $globals.NodeVisitor);
  33129. $core.addMethod(
  33130. $core.method({
  33131. selector: "ast",
  33132. protocol: '*Compiler-AST',
  33133. fn: function (){
  33134. var self=this;
  33135. return $core.withContext(function($ctx1) {
  33136. var $1;
  33137. $1=self._source();
  33138. $ctx1.sendIdx["source"]=1;
  33139. $recv($1)._ifEmpty_((function(){
  33140. return $core.withContext(function($ctx2) {
  33141. return self._error_("Method source is empty");
  33142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33143. }));
  33144. return $recv($globals.Smalltalk)._parse_(self._source());
  33145. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  33146. },
  33147. args: [],
  33148. source: "ast\x0a\x09self source ifEmpty: [ self error: 'Method source is empty' ].\x0a\x09\x0a\x09^ Smalltalk parse: self source",
  33149. referencedClasses: ["Smalltalk"],
  33150. messageSends: ["ifEmpty:", "source", "error:", "parse:"]
  33151. }),
  33152. $globals.CompiledMethod);
  33153. $core.addMethod(
  33154. $core.method({
  33155. selector: "isNode",
  33156. protocol: '*Compiler-AST',
  33157. fn: function (){
  33158. var self=this;
  33159. return false;
  33160. },
  33161. args: [],
  33162. source: "isNode\x0a\x09^ false",
  33163. referencedClasses: [],
  33164. messageSends: []
  33165. }),
  33166. $globals.Object);
  33167. });
  33168. define("amber_core/Compiler-Semantic", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Compiler-AST", "amber_core/Compiler-Core"], function($boot){"use strict";
  33169. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  33170. $core.addPackage('Compiler-Semantic');
  33171. $core.packages["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  33172. $core.packages["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33173. $core.addClass('LexicalScope', $globals.Object, ['node', 'instruction', 'temps', 'args', 'outerScope', 'blockIndex'], 'Compiler-Semantic');
  33174. $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.";
  33175. $core.addMethod(
  33176. $core.method({
  33177. selector: "addArg:",
  33178. protocol: 'adding',
  33179. fn: function (aString){
  33180. var self=this;
  33181. return $core.withContext(function($ctx1) {
  33182. var $1;
  33183. $1=self._args();
  33184. $ctx1.sendIdx["args"]=1;
  33185. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  33186. $recv($recv(self._args())._at_(aString))._scope_(self);
  33187. return self;
  33188. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  33189. },
  33190. args: ["aString"],
  33191. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  33192. referencedClasses: ["ArgVar"],
  33193. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  33194. }),
  33195. $globals.LexicalScope);
  33196. $core.addMethod(
  33197. $core.method({
  33198. selector: "addTemp:",
  33199. protocol: 'adding',
  33200. fn: function (aString){
  33201. var self=this;
  33202. return $core.withContext(function($ctx1) {
  33203. var $1;
  33204. $1=self._temps();
  33205. $ctx1.sendIdx["temps"]=1;
  33206. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  33207. $recv($recv(self._temps())._at_(aString))._scope_(self);
  33208. return self;
  33209. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  33210. },
  33211. args: ["aString"],
  33212. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  33213. referencedClasses: ["TempVar"],
  33214. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  33215. }),
  33216. $globals.LexicalScope);
  33217. $core.addMethod(
  33218. $core.method({
  33219. selector: "alias",
  33220. protocol: 'accessing',
  33221. fn: function (){
  33222. var self=this;
  33223. return $core.withContext(function($ctx1) {
  33224. return "$ctx".__comma($recv(self._scopeLevel())._asString());
  33225. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  33226. },
  33227. args: [],
  33228. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  33229. referencedClasses: [],
  33230. messageSends: [",", "asString", "scopeLevel"]
  33231. }),
  33232. $globals.LexicalScope);
  33233. $core.addMethod(
  33234. $core.method({
  33235. selector: "allVariableNames",
  33236. protocol: 'accessing',
  33237. fn: function (){
  33238. var self=this;
  33239. return $core.withContext(function($ctx1) {
  33240. var $1;
  33241. $1=$recv(self._args())._keys();
  33242. $ctx1.sendIdx["keys"]=1;
  33243. return $recv($1).__comma($recv(self._temps())._keys());
  33244. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  33245. },
  33246. args: [],
  33247. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  33248. referencedClasses: [],
  33249. messageSends: [",", "keys", "args", "temps"]
  33250. }),
  33251. $globals.LexicalScope);
  33252. $core.addMethod(
  33253. $core.method({
  33254. selector: "args",
  33255. protocol: 'accessing',
  33256. fn: function (){
  33257. var self=this;
  33258. return $core.withContext(function($ctx1) {
  33259. var $1,$receiver;
  33260. $1=self["@args"];
  33261. if(($receiver = $1) == null || $receiver.isNil){
  33262. self["@args"]=$recv($globals.Dictionary)._new();
  33263. return self["@args"];
  33264. } else {
  33265. return $1;
  33266. };
  33267. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  33268. },
  33269. args: [],
  33270. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  33271. referencedClasses: ["Dictionary"],
  33272. messageSends: ["ifNil:", "new"]
  33273. }),
  33274. $globals.LexicalScope);
  33275. $core.addMethod(
  33276. $core.method({
  33277. selector: "bindingFor:",
  33278. protocol: 'accessing',
  33279. fn: function (aStringOrNode){
  33280. var self=this;
  33281. return $core.withContext(function($ctx1) {
  33282. var $2,$3,$4,$5,$1;
  33283. $2=self._pseudoVars();
  33284. $3=$recv(aStringOrNode)._value();
  33285. $ctx1.sendIdx["value"]=1;
  33286. $1=$recv($2)._at_ifAbsent_($3,(function(){
  33287. return $core.withContext(function($ctx2) {
  33288. $4=self._args();
  33289. $5=$recv(aStringOrNode)._value();
  33290. $ctx2.sendIdx["value"]=2;
  33291. return $recv($4)._at_ifAbsent_($5,(function(){
  33292. return $core.withContext(function($ctx3) {
  33293. return $recv(self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  33294. return nil;
  33295. }));
  33296. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33297. }));
  33298. $ctx2.sendIdx["at:ifAbsent:"]=2;
  33299. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33300. }));
  33301. $ctx1.sendIdx["at:ifAbsent:"]=1;
  33302. return $1;
  33303. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  33304. },
  33305. args: ["aStringOrNode"],
  33306. 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 ]]]",
  33307. referencedClasses: [],
  33308. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  33309. }),
  33310. $globals.LexicalScope);
  33311. $core.addMethod(
  33312. $core.method({
  33313. selector: "blockIndex",
  33314. protocol: 'accessing',
  33315. fn: function (){
  33316. var self=this;
  33317. return $core.withContext(function($ctx1) {
  33318. var $1,$receiver;
  33319. $1=self["@blockIndex"];
  33320. if(($receiver = $1) == null || $receiver.isNil){
  33321. return (0);
  33322. } else {
  33323. return $1;
  33324. };
  33325. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  33326. },
  33327. args: [],
  33328. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  33329. referencedClasses: [],
  33330. messageSends: ["ifNil:"]
  33331. }),
  33332. $globals.LexicalScope);
  33333. $core.addMethod(
  33334. $core.method({
  33335. selector: "blockIndex:",
  33336. protocol: 'accessing',
  33337. fn: function (anInteger){
  33338. var self=this;
  33339. self["@blockIndex"]=anInteger;
  33340. return self;
  33341. },
  33342. args: ["anInteger"],
  33343. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  33344. referencedClasses: [],
  33345. messageSends: []
  33346. }),
  33347. $globals.LexicalScope);
  33348. $core.addMethod(
  33349. $core.method({
  33350. selector: "canInlineNonLocalReturns",
  33351. protocol: 'testing',
  33352. fn: function (){
  33353. var self=this;
  33354. return $core.withContext(function($ctx1) {
  33355. return $recv(self._isInlined())._and_((function(){
  33356. return $core.withContext(function($ctx2) {
  33357. return $recv(self._outerScope())._canInlineNonLocalReturns();
  33358. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33359. }));
  33360. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  33361. },
  33362. args: [],
  33363. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  33364. referencedClasses: [],
  33365. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  33366. }),
  33367. $globals.LexicalScope);
  33368. $core.addMethod(
  33369. $core.method({
  33370. selector: "instruction",
  33371. protocol: 'accessing',
  33372. fn: function (){
  33373. var self=this;
  33374. return self["@instruction"];
  33375. },
  33376. args: [],
  33377. source: "instruction\x0a\x09^ instruction",
  33378. referencedClasses: [],
  33379. messageSends: []
  33380. }),
  33381. $globals.LexicalScope);
  33382. $core.addMethod(
  33383. $core.method({
  33384. selector: "instruction:",
  33385. protocol: 'accessing',
  33386. fn: function (anIRInstruction){
  33387. var self=this;
  33388. self["@instruction"]=anIRInstruction;
  33389. return self;
  33390. },
  33391. args: ["anIRInstruction"],
  33392. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  33393. referencedClasses: [],
  33394. messageSends: []
  33395. }),
  33396. $globals.LexicalScope);
  33397. $core.addMethod(
  33398. $core.method({
  33399. selector: "isBlockScope",
  33400. protocol: 'testing',
  33401. fn: function (){
  33402. var self=this;
  33403. return $core.withContext(function($ctx1) {
  33404. return $recv(self._isMethodScope())._not();
  33405. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  33406. },
  33407. args: [],
  33408. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  33409. referencedClasses: [],
  33410. messageSends: ["not", "isMethodScope"]
  33411. }),
  33412. $globals.LexicalScope);
  33413. $core.addMethod(
  33414. $core.method({
  33415. selector: "isInlined",
  33416. protocol: 'testing',
  33417. fn: function (){
  33418. var self=this;
  33419. return $core.withContext(function($ctx1) {
  33420. var $2,$1;
  33421. $2=self._instruction();
  33422. $ctx1.sendIdx["instruction"]=1;
  33423. $1=$recv($2)._notNil();
  33424. return $recv($1)._and_((function(){
  33425. return $core.withContext(function($ctx2) {
  33426. return $recv(self._instruction())._isInlined();
  33427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33428. }));
  33429. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  33430. },
  33431. args: [],
  33432. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  33433. referencedClasses: [],
  33434. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  33435. }),
  33436. $globals.LexicalScope);
  33437. $core.addMethod(
  33438. $core.method({
  33439. selector: "isMethodScope",
  33440. protocol: 'testing',
  33441. fn: function (){
  33442. var self=this;
  33443. return false;
  33444. },
  33445. args: [],
  33446. source: "isMethodScope\x0a\x09^ false",
  33447. referencedClasses: [],
  33448. messageSends: []
  33449. }),
  33450. $globals.LexicalScope);
  33451. $core.addMethod(
  33452. $core.method({
  33453. selector: "lookupVariable:",
  33454. protocol: 'accessing',
  33455. fn: function (aNode){
  33456. var self=this;
  33457. var lookup;
  33458. return $core.withContext(function($ctx1) {
  33459. var $1,$2,$receiver;
  33460. lookup=self._bindingFor_(aNode);
  33461. $1=lookup;
  33462. if(($receiver = $1) == null || $receiver.isNil){
  33463. $2=self._outerScope();
  33464. $ctx1.sendIdx["outerScope"]=1;
  33465. if(($receiver = $2) == null || $receiver.isNil){
  33466. lookup=$2;
  33467. } else {
  33468. lookup=$recv(self._outerScope())._lookupVariable_(aNode);
  33469. };
  33470. lookup;
  33471. } else {
  33472. $1;
  33473. };
  33474. return lookup;
  33475. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  33476. },
  33477. args: ["aNode"],
  33478. 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",
  33479. referencedClasses: [],
  33480. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  33481. }),
  33482. $globals.LexicalScope);
  33483. $core.addMethod(
  33484. $core.method({
  33485. selector: "methodScope",
  33486. protocol: 'accessing',
  33487. fn: function (){
  33488. var self=this;
  33489. return $core.withContext(function($ctx1) {
  33490. var $1,$receiver;
  33491. $1=self._outerScope();
  33492. $ctx1.sendIdx["outerScope"]=1;
  33493. if(($receiver = $1) == null || $receiver.isNil){
  33494. return $1;
  33495. } else {
  33496. return $recv(self._outerScope())._methodScope();
  33497. };
  33498. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  33499. },
  33500. args: [],
  33501. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  33502. referencedClasses: [],
  33503. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  33504. }),
  33505. $globals.LexicalScope);
  33506. $core.addMethod(
  33507. $core.method({
  33508. selector: "node",
  33509. protocol: 'accessing',
  33510. fn: function (){
  33511. var self=this;
  33512. return self["@node"];
  33513. },
  33514. args: [],
  33515. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  33516. referencedClasses: [],
  33517. messageSends: []
  33518. }),
  33519. $globals.LexicalScope);
  33520. $core.addMethod(
  33521. $core.method({
  33522. selector: "node:",
  33523. protocol: 'accessing',
  33524. fn: function (aNode){
  33525. var self=this;
  33526. self["@node"]=aNode;
  33527. return self;
  33528. },
  33529. args: ["aNode"],
  33530. source: "node: aNode\x0a\x09node := aNode",
  33531. referencedClasses: [],
  33532. messageSends: []
  33533. }),
  33534. $globals.LexicalScope);
  33535. $core.addMethod(
  33536. $core.method({
  33537. selector: "outerScope",
  33538. protocol: 'accessing',
  33539. fn: function (){
  33540. var self=this;
  33541. return self["@outerScope"];
  33542. },
  33543. args: [],
  33544. source: "outerScope\x0a\x09^ outerScope",
  33545. referencedClasses: [],
  33546. messageSends: []
  33547. }),
  33548. $globals.LexicalScope);
  33549. $core.addMethod(
  33550. $core.method({
  33551. selector: "outerScope:",
  33552. protocol: 'accessing',
  33553. fn: function (aLexicalScope){
  33554. var self=this;
  33555. self["@outerScope"]=aLexicalScope;
  33556. return self;
  33557. },
  33558. args: ["aLexicalScope"],
  33559. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  33560. referencedClasses: [],
  33561. messageSends: []
  33562. }),
  33563. $globals.LexicalScope);
  33564. $core.addMethod(
  33565. $core.method({
  33566. selector: "pseudoVars",
  33567. protocol: 'accessing',
  33568. fn: function (){
  33569. var self=this;
  33570. return $core.withContext(function($ctx1) {
  33571. return $recv(self._methodScope())._pseudoVars();
  33572. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  33573. },
  33574. args: [],
  33575. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  33576. referencedClasses: [],
  33577. messageSends: ["pseudoVars", "methodScope"]
  33578. }),
  33579. $globals.LexicalScope);
  33580. $core.addMethod(
  33581. $core.method({
  33582. selector: "scopeLevel",
  33583. protocol: 'accessing',
  33584. fn: function (){
  33585. var self=this;
  33586. return $core.withContext(function($ctx1) {
  33587. var $1,$2,$4,$3,$receiver;
  33588. $1=self._outerScope();
  33589. $ctx1.sendIdx["outerScope"]=1;
  33590. if(($receiver = $1) == null || $receiver.isNil){
  33591. return (1);
  33592. } else {
  33593. $1;
  33594. };
  33595. $2=self._isInlined();
  33596. if($core.assert($2)){
  33597. $4=self._outerScope();
  33598. $ctx1.sendIdx["outerScope"]=2;
  33599. $3=$recv($4)._scopeLevel();
  33600. $ctx1.sendIdx["scopeLevel"]=1;
  33601. return $3;
  33602. };
  33603. return $recv($recv(self._outerScope())._scopeLevel()).__plus((1));
  33604. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  33605. },
  33606. args: [],
  33607. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  33608. referencedClasses: [],
  33609. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  33610. }),
  33611. $globals.LexicalScope);
  33612. $core.addMethod(
  33613. $core.method({
  33614. selector: "temps",
  33615. protocol: 'accessing',
  33616. fn: function (){
  33617. var self=this;
  33618. return $core.withContext(function($ctx1) {
  33619. var $1,$receiver;
  33620. $1=self["@temps"];
  33621. if(($receiver = $1) == null || $receiver.isNil){
  33622. self["@temps"]=$recv($globals.Dictionary)._new();
  33623. return self["@temps"];
  33624. } else {
  33625. return $1;
  33626. };
  33627. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  33628. },
  33629. args: [],
  33630. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  33631. referencedClasses: ["Dictionary"],
  33632. messageSends: ["ifNil:", "new"]
  33633. }),
  33634. $globals.LexicalScope);
  33635. $core.addClass('MethodLexicalScope', $globals.LexicalScope, ['iVars', 'pseudoVars', 'unknownVariables', 'localReturn', 'nonLocalReturns'], 'Compiler-Semantic');
  33636. $globals.MethodLexicalScope.comment="I represent a method scope.";
  33637. $core.addMethod(
  33638. $core.method({
  33639. selector: "addIVar:",
  33640. protocol: 'adding',
  33641. fn: function (aString){
  33642. var self=this;
  33643. return $core.withContext(function($ctx1) {
  33644. var $1;
  33645. $1=self._iVars();
  33646. $ctx1.sendIdx["iVars"]=1;
  33647. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  33648. $recv($recv(self._iVars())._at_(aString))._scope_(self);
  33649. return self;
  33650. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  33651. },
  33652. args: ["aString"],
  33653. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  33654. referencedClasses: ["InstanceVar"],
  33655. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  33656. }),
  33657. $globals.MethodLexicalScope);
  33658. $core.addMethod(
  33659. $core.method({
  33660. selector: "addNonLocalReturn:",
  33661. protocol: 'adding',
  33662. fn: function (aScope){
  33663. var self=this;
  33664. return $core.withContext(function($ctx1) {
  33665. $recv(self._nonLocalReturns())._add_(aScope);
  33666. return self;
  33667. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  33668. },
  33669. args: ["aScope"],
  33670. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  33671. referencedClasses: [],
  33672. messageSends: ["add:", "nonLocalReturns"]
  33673. }),
  33674. $globals.MethodLexicalScope);
  33675. $core.addMethod(
  33676. $core.method({
  33677. selector: "allVariableNames",
  33678. protocol: 'accessing',
  33679. fn: function (){
  33680. var self=this;
  33681. return $core.withContext(function($ctx1) {
  33682. var $1;
  33683. $1=(
  33684. $ctx1.supercall = true,
  33685. ($globals.MethodLexicalScope.superclass||$boot.dnu).fn.prototype._allVariableNames.apply($recv(self), []));
  33686. $ctx1.supercall = false;
  33687. return $recv($1).__comma($recv(self._iVars())._keys());
  33688. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  33689. },
  33690. args: [],
  33691. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  33692. referencedClasses: [],
  33693. messageSends: [",", "allVariableNames", "keys", "iVars"]
  33694. }),
  33695. $globals.MethodLexicalScope);
  33696. $core.addMethod(
  33697. $core.method({
  33698. selector: "bindingFor:",
  33699. protocol: 'accessing',
  33700. fn: function (aNode){
  33701. var self=this;
  33702. return $core.withContext(function($ctx1) {
  33703. var $1,$receiver;
  33704. $1=(
  33705. $ctx1.supercall = true,
  33706. ($globals.MethodLexicalScope.superclass||$boot.dnu).fn.prototype._bindingFor_.apply($recv(self), [aNode]));
  33707. $ctx1.supercall = false;
  33708. if(($receiver = $1) == null || $receiver.isNil){
  33709. return $recv(self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  33710. return nil;
  33711. }));
  33712. } else {
  33713. return $1;
  33714. };
  33715. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  33716. },
  33717. args: ["aNode"],
  33718. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  33719. referencedClasses: [],
  33720. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  33721. }),
  33722. $globals.MethodLexicalScope);
  33723. $core.addMethod(
  33724. $core.method({
  33725. selector: "canInlineNonLocalReturns",
  33726. protocol: 'testing',
  33727. fn: function (){
  33728. var self=this;
  33729. return true;
  33730. },
  33731. args: [],
  33732. source: "canInlineNonLocalReturns\x0a\x09^ true",
  33733. referencedClasses: [],
  33734. messageSends: []
  33735. }),
  33736. $globals.MethodLexicalScope);
  33737. $core.addMethod(
  33738. $core.method({
  33739. selector: "hasLocalReturn",
  33740. protocol: 'testing',
  33741. fn: function (){
  33742. var self=this;
  33743. return $core.withContext(function($ctx1) {
  33744. return self._localReturn();
  33745. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  33746. },
  33747. args: [],
  33748. source: "hasLocalReturn\x0a\x09^ self localReturn",
  33749. referencedClasses: [],
  33750. messageSends: ["localReturn"]
  33751. }),
  33752. $globals.MethodLexicalScope);
  33753. $core.addMethod(
  33754. $core.method({
  33755. selector: "hasNonLocalReturn",
  33756. protocol: 'testing',
  33757. fn: function (){
  33758. var self=this;
  33759. return $core.withContext(function($ctx1) {
  33760. return $recv(self._nonLocalReturns())._notEmpty();
  33761. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  33762. },
  33763. args: [],
  33764. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  33765. referencedClasses: [],
  33766. messageSends: ["notEmpty", "nonLocalReturns"]
  33767. }),
  33768. $globals.MethodLexicalScope);
  33769. $core.addMethod(
  33770. $core.method({
  33771. selector: "iVars",
  33772. protocol: 'accessing',
  33773. fn: function (){
  33774. var self=this;
  33775. return $core.withContext(function($ctx1) {
  33776. var $1,$receiver;
  33777. $1=self["@iVars"];
  33778. if(($receiver = $1) == null || $receiver.isNil){
  33779. self["@iVars"]=$recv($globals.Dictionary)._new();
  33780. return self["@iVars"];
  33781. } else {
  33782. return $1;
  33783. };
  33784. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  33785. },
  33786. args: [],
  33787. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  33788. referencedClasses: ["Dictionary"],
  33789. messageSends: ["ifNil:", "new"]
  33790. }),
  33791. $globals.MethodLexicalScope);
  33792. $core.addMethod(
  33793. $core.method({
  33794. selector: "isMethodScope",
  33795. protocol: 'testing',
  33796. fn: function (){
  33797. var self=this;
  33798. return true;
  33799. },
  33800. args: [],
  33801. source: "isMethodScope\x0a\x09^ true",
  33802. referencedClasses: [],
  33803. messageSends: []
  33804. }),
  33805. $globals.MethodLexicalScope);
  33806. $core.addMethod(
  33807. $core.method({
  33808. selector: "localReturn",
  33809. protocol: 'accessing',
  33810. fn: function (){
  33811. var self=this;
  33812. return $core.withContext(function($ctx1) {
  33813. var $1,$receiver;
  33814. $1=self["@localReturn"];
  33815. if(($receiver = $1) == null || $receiver.isNil){
  33816. return false;
  33817. } else {
  33818. return $1;
  33819. };
  33820. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  33821. },
  33822. args: [],
  33823. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  33824. referencedClasses: [],
  33825. messageSends: ["ifNil:"]
  33826. }),
  33827. $globals.MethodLexicalScope);
  33828. $core.addMethod(
  33829. $core.method({
  33830. selector: "localReturn:",
  33831. protocol: 'accessing',
  33832. fn: function (aBoolean){
  33833. var self=this;
  33834. self["@localReturn"]=aBoolean;
  33835. return self;
  33836. },
  33837. args: ["aBoolean"],
  33838. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  33839. referencedClasses: [],
  33840. messageSends: []
  33841. }),
  33842. $globals.MethodLexicalScope);
  33843. $core.addMethod(
  33844. $core.method({
  33845. selector: "methodScope",
  33846. protocol: 'accessing',
  33847. fn: function (){
  33848. var self=this;
  33849. return self;
  33850. },
  33851. args: [],
  33852. source: "methodScope\x0a\x09^ self",
  33853. referencedClasses: [],
  33854. messageSends: []
  33855. }),
  33856. $globals.MethodLexicalScope);
  33857. $core.addMethod(
  33858. $core.method({
  33859. selector: "nonLocalReturns",
  33860. protocol: 'accessing',
  33861. fn: function (){
  33862. var self=this;
  33863. return $core.withContext(function($ctx1) {
  33864. var $1,$receiver;
  33865. $1=self["@nonLocalReturns"];
  33866. if(($receiver = $1) == null || $receiver.isNil){
  33867. self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  33868. return self["@nonLocalReturns"];
  33869. } else {
  33870. return $1;
  33871. };
  33872. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  33873. },
  33874. args: [],
  33875. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  33876. referencedClasses: ["OrderedCollection"],
  33877. messageSends: ["ifNil:", "new"]
  33878. }),
  33879. $globals.MethodLexicalScope);
  33880. $core.addMethod(
  33881. $core.method({
  33882. selector: "pseudoVars",
  33883. protocol: 'accessing',
  33884. fn: function (){
  33885. var self=this;
  33886. return $core.withContext(function($ctx1) {
  33887. var $1,$2,$4,$3,$receiver;
  33888. $1=self["@pseudoVars"];
  33889. if(($receiver = $1) == null || $receiver.isNil){
  33890. self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  33891. self["@pseudoVars"];
  33892. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  33893. return $core.withContext(function($ctx2) {
  33894. $2=self["@pseudoVars"];
  33895. $4=$recv($globals.PseudoVar)._on_(each);
  33896. $recv($4)._scope_(self._methodScope());
  33897. $3=$recv($4)._yourself();
  33898. return $recv($2)._at_put_(each,$3);
  33899. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  33900. }));
  33901. } else {
  33902. $1;
  33903. };
  33904. return self["@pseudoVars"];
  33905. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  33906. },
  33907. args: [],
  33908. 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",
  33909. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  33910. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  33911. }),
  33912. $globals.MethodLexicalScope);
  33913. $core.addMethod(
  33914. $core.method({
  33915. selector: "removeNonLocalReturn:",
  33916. protocol: 'adding',
  33917. fn: function (aScope){
  33918. var self=this;
  33919. return $core.withContext(function($ctx1) {
  33920. $recv(self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  33921. }));
  33922. return self;
  33923. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  33924. },
  33925. args: ["aScope"],
  33926. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  33927. referencedClasses: [],
  33928. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  33929. }),
  33930. $globals.MethodLexicalScope);
  33931. $core.addMethod(
  33932. $core.method({
  33933. selector: "unknownVariables",
  33934. protocol: 'accessing',
  33935. fn: function (){
  33936. var self=this;
  33937. return $core.withContext(function($ctx1) {
  33938. var $1,$receiver;
  33939. $1=self["@unknownVariables"];
  33940. if(($receiver = $1) == null || $receiver.isNil){
  33941. self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  33942. return self["@unknownVariables"];
  33943. } else {
  33944. return $1;
  33945. };
  33946. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  33947. },
  33948. args: [],
  33949. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  33950. referencedClasses: ["OrderedCollection"],
  33951. messageSends: ["ifNil:", "new"]
  33952. }),
  33953. $globals.MethodLexicalScope);
  33954. $core.addClass('ScopeVar', $globals.Object, ['scope', 'name'], 'Compiler-Semantic');
  33955. $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.";
  33956. $core.addMethod(
  33957. $core.method({
  33958. selector: "alias",
  33959. protocol: 'accessing',
  33960. fn: function (){
  33961. var self=this;
  33962. return $core.withContext(function($ctx1) {
  33963. return $recv(self._name())._asVariableName();
  33964. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  33965. },
  33966. args: [],
  33967. source: "alias\x0a\x09^ self name asVariableName",
  33968. referencedClasses: [],
  33969. messageSends: ["asVariableName", "name"]
  33970. }),
  33971. $globals.ScopeVar);
  33972. $core.addMethod(
  33973. $core.method({
  33974. selector: "isArgVar",
  33975. protocol: 'testing',
  33976. fn: function (){
  33977. var self=this;
  33978. return false;
  33979. },
  33980. args: [],
  33981. source: "isArgVar\x0a\x09^ false",
  33982. referencedClasses: [],
  33983. messageSends: []
  33984. }),
  33985. $globals.ScopeVar);
  33986. $core.addMethod(
  33987. $core.method({
  33988. selector: "isClassRefVar",
  33989. protocol: 'testing',
  33990. fn: function (){
  33991. var self=this;
  33992. return false;
  33993. },
  33994. args: [],
  33995. source: "isClassRefVar\x0a\x09^ false",
  33996. referencedClasses: [],
  33997. messageSends: []
  33998. }),
  33999. $globals.ScopeVar);
  34000. $core.addMethod(
  34001. $core.method({
  34002. selector: "isImmutable",
  34003. protocol: 'testing',
  34004. fn: function (){
  34005. var self=this;
  34006. return false;
  34007. },
  34008. args: [],
  34009. source: "isImmutable\x0a\x09^ false",
  34010. referencedClasses: [],
  34011. messageSends: []
  34012. }),
  34013. $globals.ScopeVar);
  34014. $core.addMethod(
  34015. $core.method({
  34016. selector: "isInstanceVar",
  34017. protocol: 'testing',
  34018. fn: function (){
  34019. var self=this;
  34020. return false;
  34021. },
  34022. args: [],
  34023. source: "isInstanceVar\x0a\x09^ false",
  34024. referencedClasses: [],
  34025. messageSends: []
  34026. }),
  34027. $globals.ScopeVar);
  34028. $core.addMethod(
  34029. $core.method({
  34030. selector: "isPseudoVar",
  34031. protocol: 'testing',
  34032. fn: function (){
  34033. var self=this;
  34034. return false;
  34035. },
  34036. args: [],
  34037. source: "isPseudoVar\x0a\x09^ false",
  34038. referencedClasses: [],
  34039. messageSends: []
  34040. }),
  34041. $globals.ScopeVar);
  34042. $core.addMethod(
  34043. $core.method({
  34044. selector: "isTempVar",
  34045. protocol: 'testing',
  34046. fn: function (){
  34047. var self=this;
  34048. return false;
  34049. },
  34050. args: [],
  34051. source: "isTempVar\x0a\x09^ false",
  34052. referencedClasses: [],
  34053. messageSends: []
  34054. }),
  34055. $globals.ScopeVar);
  34056. $core.addMethod(
  34057. $core.method({
  34058. selector: "isUnknownVar",
  34059. protocol: 'testing',
  34060. fn: function (){
  34061. var self=this;
  34062. return false;
  34063. },
  34064. args: [],
  34065. source: "isUnknownVar\x0a\x09^ false",
  34066. referencedClasses: [],
  34067. messageSends: []
  34068. }),
  34069. $globals.ScopeVar);
  34070. $core.addMethod(
  34071. $core.method({
  34072. selector: "name",
  34073. protocol: 'accessing',
  34074. fn: function (){
  34075. var self=this;
  34076. return self["@name"];
  34077. },
  34078. args: [],
  34079. source: "name\x0a\x09^ name",
  34080. referencedClasses: [],
  34081. messageSends: []
  34082. }),
  34083. $globals.ScopeVar);
  34084. $core.addMethod(
  34085. $core.method({
  34086. selector: "name:",
  34087. protocol: 'accessing',
  34088. fn: function (aString){
  34089. var self=this;
  34090. self["@name"]=aString;
  34091. return self;
  34092. },
  34093. args: ["aString"],
  34094. source: "name: aString\x0a\x09name := aString",
  34095. referencedClasses: [],
  34096. messageSends: []
  34097. }),
  34098. $globals.ScopeVar);
  34099. $core.addMethod(
  34100. $core.method({
  34101. selector: "scope",
  34102. protocol: 'accessing',
  34103. fn: function (){
  34104. var self=this;
  34105. return self["@scope"];
  34106. },
  34107. args: [],
  34108. source: "scope\x0a\x09^ scope",
  34109. referencedClasses: [],
  34110. messageSends: []
  34111. }),
  34112. $globals.ScopeVar);
  34113. $core.addMethod(
  34114. $core.method({
  34115. selector: "scope:",
  34116. protocol: 'accessing',
  34117. fn: function (aScope){
  34118. var self=this;
  34119. self["@scope"]=aScope;
  34120. return self;
  34121. },
  34122. args: ["aScope"],
  34123. source: "scope: aScope\x0a\x09scope := aScope",
  34124. referencedClasses: [],
  34125. messageSends: []
  34126. }),
  34127. $globals.ScopeVar);
  34128. $core.addMethod(
  34129. $core.method({
  34130. selector: "validateAssignment",
  34131. protocol: 'testing',
  34132. fn: function (){
  34133. var self=this;
  34134. return $core.withContext(function($ctx1) {
  34135. var $1,$2;
  34136. $1=$recv(self._isArgVar())._or_((function(){
  34137. return $core.withContext(function($ctx2) {
  34138. return self._isPseudoVar();
  34139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34140. }));
  34141. if($core.assert($1)){
  34142. $2=$recv($globals.InvalidAssignmentError)._new();
  34143. $recv($2)._variableName_(self._name());
  34144. $recv($2)._signal();
  34145. };
  34146. return self;
  34147. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  34148. },
  34149. args: [],
  34150. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  34151. referencedClasses: ["InvalidAssignmentError"],
  34152. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  34153. }),
  34154. $globals.ScopeVar);
  34155. $core.addMethod(
  34156. $core.method({
  34157. selector: "on:",
  34158. protocol: 'instance creation',
  34159. fn: function (aString){
  34160. var self=this;
  34161. return $core.withContext(function($ctx1) {
  34162. var $1;
  34163. $1=self._new();
  34164. $recv($1)._name_(aString);
  34165. return $recv($1)._yourself();
  34166. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.klass)});
  34167. },
  34168. args: ["aString"],
  34169. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  34170. referencedClasses: [],
  34171. messageSends: ["name:", "new", "yourself"]
  34172. }),
  34173. $globals.ScopeVar.klass);
  34174. $core.addClass('AliasVar', $globals.ScopeVar, ['node'], 'Compiler-Semantic');
  34175. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  34176. $core.addMethod(
  34177. $core.method({
  34178. selector: "isImmutable",
  34179. protocol: 'testing',
  34180. fn: function (){
  34181. var self=this;
  34182. return true;
  34183. },
  34184. args: [],
  34185. source: "isImmutable\x0a\x09^ true",
  34186. referencedClasses: [],
  34187. messageSends: []
  34188. }),
  34189. $globals.AliasVar);
  34190. $core.addMethod(
  34191. $core.method({
  34192. selector: "node",
  34193. protocol: 'accessing',
  34194. fn: function (){
  34195. var self=this;
  34196. return self["@node"];
  34197. },
  34198. args: [],
  34199. source: "node\x0a\x09^ node",
  34200. referencedClasses: [],
  34201. messageSends: []
  34202. }),
  34203. $globals.AliasVar);
  34204. $core.addMethod(
  34205. $core.method({
  34206. selector: "node:",
  34207. protocol: 'accessing',
  34208. fn: function (aNode){
  34209. var self=this;
  34210. self["@node"]=aNode;
  34211. return self;
  34212. },
  34213. args: ["aNode"],
  34214. source: "node: aNode\x0a\x09node := aNode",
  34215. referencedClasses: [],
  34216. messageSends: []
  34217. }),
  34218. $globals.AliasVar);
  34219. $core.addClass('ArgVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34220. $globals.ArgVar.comment="I am an argument of a method or block.";
  34221. $core.addMethod(
  34222. $core.method({
  34223. selector: "isArgVar",
  34224. protocol: 'testing',
  34225. fn: function (){
  34226. var self=this;
  34227. return true;
  34228. },
  34229. args: [],
  34230. source: "isArgVar\x0a\x09^ true",
  34231. referencedClasses: [],
  34232. messageSends: []
  34233. }),
  34234. $globals.ArgVar);
  34235. $core.addMethod(
  34236. $core.method({
  34237. selector: "isImmutable",
  34238. protocol: 'testing',
  34239. fn: function (){
  34240. var self=this;
  34241. return true;
  34242. },
  34243. args: [],
  34244. source: "isImmutable\x0a\x09^ true",
  34245. referencedClasses: [],
  34246. messageSends: []
  34247. }),
  34248. $globals.ArgVar);
  34249. $core.addClass('ClassRefVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34250. $globals.ClassRefVar.comment="I am an class reference variable";
  34251. $core.addMethod(
  34252. $core.method({
  34253. selector: "alias",
  34254. protocol: 'accessing',
  34255. fn: function (){
  34256. var self=this;
  34257. return $core.withContext(function($ctx1) {
  34258. return "$globals.".__comma(self._name());
  34259. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  34260. },
  34261. args: [],
  34262. 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",
  34263. referencedClasses: [],
  34264. messageSends: [",", "name"]
  34265. }),
  34266. $globals.ClassRefVar);
  34267. $core.addMethod(
  34268. $core.method({
  34269. selector: "isClassRefVar",
  34270. protocol: 'testing',
  34271. fn: function (){
  34272. var self=this;
  34273. return true;
  34274. },
  34275. args: [],
  34276. source: "isClassRefVar\x0a\x09^ true",
  34277. referencedClasses: [],
  34278. messageSends: []
  34279. }),
  34280. $globals.ClassRefVar);
  34281. $core.addMethod(
  34282. $core.method({
  34283. selector: "isImmutable",
  34284. protocol: 'testing',
  34285. fn: function (){
  34286. var self=this;
  34287. return true;
  34288. },
  34289. args: [],
  34290. source: "isImmutable\x0a\x09^ true",
  34291. referencedClasses: [],
  34292. messageSends: []
  34293. }),
  34294. $globals.ClassRefVar);
  34295. $core.addClass('InstanceVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34296. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  34297. $core.addMethod(
  34298. $core.method({
  34299. selector: "alias",
  34300. protocol: 'testing',
  34301. fn: function (){
  34302. var self=this;
  34303. return $core.withContext(function($ctx1) {
  34304. var $1;
  34305. $1=$recv("self[\x22@".__comma(self._name())).__comma("\x22]");
  34306. $ctx1.sendIdx[","]=1;
  34307. return $1;
  34308. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  34309. },
  34310. args: [],
  34311. source: "alias\x0a\x09^ 'self[\x22@', self name, '\x22]'",
  34312. referencedClasses: [],
  34313. messageSends: [",", "name"]
  34314. }),
  34315. $globals.InstanceVar);
  34316. $core.addMethod(
  34317. $core.method({
  34318. selector: "isInstanceVar",
  34319. protocol: 'testing',
  34320. fn: function (){
  34321. var self=this;
  34322. return true;
  34323. },
  34324. args: [],
  34325. source: "isInstanceVar\x0a\x09^ true",
  34326. referencedClasses: [],
  34327. messageSends: []
  34328. }),
  34329. $globals.InstanceVar);
  34330. $core.addClass('PseudoVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34331. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  34332. $core.addMethod(
  34333. $core.method({
  34334. selector: "alias",
  34335. protocol: 'accessing',
  34336. fn: function (){
  34337. var self=this;
  34338. return $core.withContext(function($ctx1) {
  34339. return self._name();
  34340. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  34341. },
  34342. args: [],
  34343. source: "alias\x0a\x09^ self name",
  34344. referencedClasses: [],
  34345. messageSends: ["name"]
  34346. }),
  34347. $globals.PseudoVar);
  34348. $core.addMethod(
  34349. $core.method({
  34350. selector: "isImmutable",
  34351. protocol: 'testing',
  34352. fn: function (){
  34353. var self=this;
  34354. return true;
  34355. },
  34356. args: [],
  34357. source: "isImmutable\x0a\x09^ true",
  34358. referencedClasses: [],
  34359. messageSends: []
  34360. }),
  34361. $globals.PseudoVar);
  34362. $core.addMethod(
  34363. $core.method({
  34364. selector: "isPseudoVar",
  34365. protocol: 'testing',
  34366. fn: function (){
  34367. var self=this;
  34368. return true;
  34369. },
  34370. args: [],
  34371. source: "isPseudoVar\x0a\x09^ true",
  34372. referencedClasses: [],
  34373. messageSends: []
  34374. }),
  34375. $globals.PseudoVar);
  34376. $core.addClass('TempVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34377. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  34378. $core.addMethod(
  34379. $core.method({
  34380. selector: "isTempVar",
  34381. protocol: 'testing',
  34382. fn: function (){
  34383. var self=this;
  34384. return true;
  34385. },
  34386. args: [],
  34387. source: "isTempVar\x0a\x09^ true",
  34388. referencedClasses: [],
  34389. messageSends: []
  34390. }),
  34391. $globals.TempVar);
  34392. $core.addClass('UnknownVar', $globals.ScopeVar, [], 'Compiler-Semantic');
  34393. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  34394. $core.addMethod(
  34395. $core.method({
  34396. selector: "isUnknownVar",
  34397. protocol: 'testing',
  34398. fn: function (){
  34399. var self=this;
  34400. return true;
  34401. },
  34402. args: [],
  34403. source: "isUnknownVar\x0a\x09^ true",
  34404. referencedClasses: [],
  34405. messageSends: []
  34406. }),
  34407. $globals.UnknownVar);
  34408. $core.addClass('SemanticAnalyzer', $globals.NodeVisitor, ['currentScope', 'blockIndex', 'thePackage', 'theClass', 'classReferences', 'messageSends'], 'Compiler-Semantic');
  34409. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  34410. $core.addMethod(
  34411. $core.method({
  34412. selector: "classReferences",
  34413. protocol: 'accessing',
  34414. fn: function (){
  34415. var self=this;
  34416. return $core.withContext(function($ctx1) {
  34417. var $1,$receiver;
  34418. $1=self["@classReferences"];
  34419. if(($receiver = $1) == null || $receiver.isNil){
  34420. self["@classReferences"]=$recv($globals.Set)._new();
  34421. return self["@classReferences"];
  34422. } else {
  34423. return $1;
  34424. };
  34425. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  34426. },
  34427. args: [],
  34428. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  34429. referencedClasses: ["Set"],
  34430. messageSends: ["ifNil:", "new"]
  34431. }),
  34432. $globals.SemanticAnalyzer);
  34433. $core.addMethod(
  34434. $core.method({
  34435. selector: "errorShadowingVariable:",
  34436. protocol: 'error handling',
  34437. fn: function (aString){
  34438. var self=this;
  34439. return $core.withContext(function($ctx1) {
  34440. var $1;
  34441. $1=$recv($globals.ShadowingVariableError)._new();
  34442. $recv($1)._variableName_(aString);
  34443. $recv($1)._signal();
  34444. return self;
  34445. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  34446. },
  34447. args: ["aString"],
  34448. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  34449. referencedClasses: ["ShadowingVariableError"],
  34450. messageSends: ["variableName:", "new", "signal"]
  34451. }),
  34452. $globals.SemanticAnalyzer);
  34453. $core.addMethod(
  34454. $core.method({
  34455. selector: "errorUnknownVariable:",
  34456. protocol: 'error handling',
  34457. fn: function (aNode){
  34458. var self=this;
  34459. var identifier;
  34460. return $core.withContext(function($ctx1) {
  34461. var $1,$2,$3;
  34462. identifier=$recv(aNode)._value();
  34463. $ctx1.sendIdx["value"]=1;
  34464. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  34465. return $core.withContext(function($ctx2) {
  34466. return self._isVariableUndefined_inPackage_(identifier,self._thePackage());
  34467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34468. }));
  34469. if($core.assert($1)){
  34470. $2=$recv($globals.UnknownVariableError)._new();
  34471. $3=$recv(aNode)._value();
  34472. $ctx1.sendIdx["value"]=2;
  34473. $recv($2)._variableName_($3);
  34474. $recv($2)._signal();
  34475. } else {
  34476. $recv($recv($recv(self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  34477. };
  34478. return self;
  34479. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  34480. },
  34481. args: ["aNode"],
  34482. 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 ]",
  34483. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  34484. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  34485. }),
  34486. $globals.SemanticAnalyzer);
  34487. $core.addMethod(
  34488. $core.method({
  34489. selector: "isVariableUndefined:inPackage:",
  34490. protocol: 'testing',
  34491. fn: function (aString,aPackage){
  34492. var self=this;
  34493. return $core.withContext(function($ctx1) {
  34494. var $1,$2,$3,$receiver;
  34495. if(($receiver = aPackage) == null || $receiver.isNil){
  34496. aPackage;
  34497. } else {
  34498. var packageKnownVars;
  34499. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  34500. packageKnownVars;
  34501. $1=$recv(packageKnownVars)._includes_(aString);
  34502. if($core.assert($1)){
  34503. return false;
  34504. };
  34505. };
  34506. $2=$recv($globals.Compiler)._new();
  34507. $3=$recv("typeof ".__comma(aString)).__comma(" == \x22undefined\x22");
  34508. $ctx1.sendIdx[","]=1;
  34509. return $recv($2)._eval_($3);
  34510. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  34511. },
  34512. args: ["aString", "aPackage"],
  34513. 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'",
  34514. referencedClasses: ["Compiler"],
  34515. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", "new", ","]
  34516. }),
  34517. $globals.SemanticAnalyzer);
  34518. $core.addMethod(
  34519. $core.method({
  34520. selector: "messageSends",
  34521. protocol: 'accessing',
  34522. fn: function (){
  34523. var self=this;
  34524. return $core.withContext(function($ctx1) {
  34525. var $1,$receiver;
  34526. $1=self["@messageSends"];
  34527. if(($receiver = $1) == null || $receiver.isNil){
  34528. self["@messageSends"]=$recv($globals.Dictionary)._new();
  34529. return self["@messageSends"];
  34530. } else {
  34531. return $1;
  34532. };
  34533. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  34534. },
  34535. args: [],
  34536. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  34537. referencedClasses: ["Dictionary"],
  34538. messageSends: ["ifNil:", "new"]
  34539. }),
  34540. $globals.SemanticAnalyzer);
  34541. $core.addMethod(
  34542. $core.method({
  34543. selector: "newBlockScope",
  34544. protocol: 'factory',
  34545. fn: function (){
  34546. var self=this;
  34547. return $core.withContext(function($ctx1) {
  34548. return self._newScopeOfClass_($globals.LexicalScope);
  34549. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  34550. },
  34551. args: [],
  34552. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  34553. referencedClasses: ["LexicalScope"],
  34554. messageSends: ["newScopeOfClass:"]
  34555. }),
  34556. $globals.SemanticAnalyzer);
  34557. $core.addMethod(
  34558. $core.method({
  34559. selector: "newMethodScope",
  34560. protocol: 'factory',
  34561. fn: function (){
  34562. var self=this;
  34563. return $core.withContext(function($ctx1) {
  34564. return self._newScopeOfClass_($globals.MethodLexicalScope);
  34565. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  34566. },
  34567. args: [],
  34568. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  34569. referencedClasses: ["MethodLexicalScope"],
  34570. messageSends: ["newScopeOfClass:"]
  34571. }),
  34572. $globals.SemanticAnalyzer);
  34573. $core.addMethod(
  34574. $core.method({
  34575. selector: "newScopeOfClass:",
  34576. protocol: 'factory',
  34577. fn: function (aLexicalScopeClass){
  34578. var self=this;
  34579. return $core.withContext(function($ctx1) {
  34580. var $1;
  34581. $1=$recv(aLexicalScopeClass)._new();
  34582. $recv($1)._outerScope_(self["@currentScope"]);
  34583. return $recv($1)._yourself();
  34584. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  34585. },
  34586. args: ["aLexicalScopeClass"],
  34587. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  34588. referencedClasses: [],
  34589. messageSends: ["outerScope:", "new", "yourself"]
  34590. }),
  34591. $globals.SemanticAnalyzer);
  34592. $core.addMethod(
  34593. $core.method({
  34594. selector: "nextBlockIndex",
  34595. protocol: 'private',
  34596. fn: function (){
  34597. var self=this;
  34598. return $core.withContext(function($ctx1) {
  34599. var $1,$receiver;
  34600. $1=self["@blockIndex"];
  34601. if(($receiver = $1) == null || $receiver.isNil){
  34602. self["@blockIndex"]=(0);
  34603. self["@blockIndex"];
  34604. } else {
  34605. $1;
  34606. };
  34607. self["@blockIndex"]=$recv(self["@blockIndex"]).__plus((1));
  34608. return self["@blockIndex"];
  34609. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  34610. },
  34611. args: [],
  34612. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  34613. referencedClasses: [],
  34614. messageSends: ["ifNil:", "+"]
  34615. }),
  34616. $globals.SemanticAnalyzer);
  34617. $core.addMethod(
  34618. $core.method({
  34619. selector: "popScope",
  34620. protocol: 'scope',
  34621. fn: function (){
  34622. var self=this;
  34623. return $core.withContext(function($ctx1) {
  34624. var $1,$receiver;
  34625. $1=self["@currentScope"];
  34626. if(($receiver = $1) == null || $receiver.isNil){
  34627. $1;
  34628. } else {
  34629. self["@currentScope"]=$recv(self["@currentScope"])._outerScope();
  34630. self["@currentScope"];
  34631. };
  34632. return self;
  34633. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  34634. },
  34635. args: [],
  34636. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  34637. referencedClasses: [],
  34638. messageSends: ["ifNotNil:", "outerScope"]
  34639. }),
  34640. $globals.SemanticAnalyzer);
  34641. $core.addMethod(
  34642. $core.method({
  34643. selector: "pushScope:",
  34644. protocol: 'scope',
  34645. fn: function (aScope){
  34646. var self=this;
  34647. return $core.withContext(function($ctx1) {
  34648. $recv(aScope)._outerScope_(self["@currentScope"]);
  34649. self["@currentScope"]=aScope;
  34650. return self;
  34651. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  34652. },
  34653. args: ["aScope"],
  34654. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  34655. referencedClasses: [],
  34656. messageSends: ["outerScope:"]
  34657. }),
  34658. $globals.SemanticAnalyzer);
  34659. $core.addMethod(
  34660. $core.method({
  34661. selector: "theClass",
  34662. protocol: 'accessing',
  34663. fn: function (){
  34664. var self=this;
  34665. return self["@theClass"];
  34666. },
  34667. args: [],
  34668. source: "theClass\x0a\x09^ theClass",
  34669. referencedClasses: [],
  34670. messageSends: []
  34671. }),
  34672. $globals.SemanticAnalyzer);
  34673. $core.addMethod(
  34674. $core.method({
  34675. selector: "theClass:",
  34676. protocol: 'accessing',
  34677. fn: function (aClass){
  34678. var self=this;
  34679. self["@theClass"]=aClass;
  34680. return self;
  34681. },
  34682. args: ["aClass"],
  34683. source: "theClass: aClass\x0a\x09theClass := aClass",
  34684. referencedClasses: [],
  34685. messageSends: []
  34686. }),
  34687. $globals.SemanticAnalyzer);
  34688. $core.addMethod(
  34689. $core.method({
  34690. selector: "thePackage",
  34691. protocol: 'accessing',
  34692. fn: function (){
  34693. var self=this;
  34694. return self["@thePackage"];
  34695. },
  34696. args: [],
  34697. source: "thePackage\x0a\x09^ thePackage",
  34698. referencedClasses: [],
  34699. messageSends: []
  34700. }),
  34701. $globals.SemanticAnalyzer);
  34702. $core.addMethod(
  34703. $core.method({
  34704. selector: "thePackage:",
  34705. protocol: 'accessing',
  34706. fn: function (aPackage){
  34707. var self=this;
  34708. self["@thePackage"]=aPackage;
  34709. return self;
  34710. },
  34711. args: ["aPackage"],
  34712. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  34713. referencedClasses: [],
  34714. messageSends: []
  34715. }),
  34716. $globals.SemanticAnalyzer);
  34717. $core.addMethod(
  34718. $core.method({
  34719. selector: "validateVariableScope:",
  34720. protocol: 'scope',
  34721. fn: function (aString){
  34722. var self=this;
  34723. return $core.withContext(function($ctx1) {
  34724. var $1,$receiver;
  34725. $1=$recv(self["@currentScope"])._lookupVariable_(aString);
  34726. if(($receiver = $1) == null || $receiver.isNil){
  34727. $1;
  34728. } else {
  34729. self._errorShadowingVariable_(aString);
  34730. };
  34731. return self;
  34732. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  34733. },
  34734. args: ["aString"],
  34735. 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 ]",
  34736. referencedClasses: [],
  34737. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  34738. }),
  34739. $globals.SemanticAnalyzer);
  34740. $core.addMethod(
  34741. $core.method({
  34742. selector: "visitAssignmentNode:",
  34743. protocol: 'visiting',
  34744. fn: function (aNode){
  34745. var self=this;
  34746. return $core.withContext(function($ctx1) {
  34747. (
  34748. $ctx1.supercall = true,
  34749. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitAssignmentNode_.apply($recv(self), [aNode]));
  34750. $ctx1.supercall = false;
  34751. $recv($recv(aNode)._left())._beAssigned();
  34752. return self;
  34753. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34754. },
  34755. args: ["aNode"],
  34756. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  34757. referencedClasses: [],
  34758. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  34759. }),
  34760. $globals.SemanticAnalyzer);
  34761. $core.addMethod(
  34762. $core.method({
  34763. selector: "visitBlockNode:",
  34764. protocol: 'visiting',
  34765. fn: function (aNode){
  34766. var self=this;
  34767. return $core.withContext(function($ctx1) {
  34768. self._pushScope_(self._newBlockScope());
  34769. $recv(aNode)._scope_(self["@currentScope"]);
  34770. $recv(self["@currentScope"])._node_(aNode);
  34771. $recv(self["@currentScope"])._blockIndex_(self._nextBlockIndex());
  34772. $recv($recv(aNode)._parameters())._do_((function(each){
  34773. return $core.withContext(function($ctx2) {
  34774. self._validateVariableScope_(each);
  34775. return $recv(self["@currentScope"])._addArg_(each);
  34776. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34777. }));
  34778. (
  34779. $ctx1.supercall = true,
  34780. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitBlockNode_.apply($recv(self), [aNode]));
  34781. $ctx1.supercall = false;
  34782. self._popScope();
  34783. return self;
  34784. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34785. },
  34786. args: ["aNode"],
  34787. 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",
  34788. referencedClasses: [],
  34789. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  34790. }),
  34791. $globals.SemanticAnalyzer);
  34792. $core.addMethod(
  34793. $core.method({
  34794. selector: "visitCascadeNode:",
  34795. protocol: 'visiting',
  34796. fn: function (aNode){
  34797. var self=this;
  34798. return $core.withContext(function($ctx1) {
  34799. $recv(aNode)._receiver_($recv($recv($recv(aNode)._nodes())._first())._receiver());
  34800. (
  34801. $ctx1.supercall = true,
  34802. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitCascadeNode_.apply($recv(self), [aNode]));
  34803. $ctx1.supercall = false;
  34804. return self;
  34805. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34806. },
  34807. args: ["aNode"],
  34808. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode nodes first receiver.\x0a\x09super visitCascadeNode: aNode",
  34809. referencedClasses: [],
  34810. messageSends: ["receiver:", "receiver", "first", "nodes", "visitCascadeNode:"]
  34811. }),
  34812. $globals.SemanticAnalyzer);
  34813. $core.addMethod(
  34814. $core.method({
  34815. selector: "visitMethodNode:",
  34816. protocol: 'visiting',
  34817. fn: function (aNode){
  34818. var self=this;
  34819. return $core.withContext(function($ctx1) {
  34820. self._pushScope_(self._newMethodScope());
  34821. $recv(aNode)._scope_(self["@currentScope"]);
  34822. $recv(self["@currentScope"])._node_(aNode);
  34823. $recv($recv(self._theClass())._allInstanceVariableNames())._do_((function(each){
  34824. return $core.withContext(function($ctx2) {
  34825. return $recv(self["@currentScope"])._addIVar_(each);
  34826. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34827. }));
  34828. $ctx1.sendIdx["do:"]=1;
  34829. $recv($recv(aNode)._arguments())._do_((function(each){
  34830. return $core.withContext(function($ctx2) {
  34831. self._validateVariableScope_(each);
  34832. return $recv(self["@currentScope"])._addArg_(each);
  34833. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  34834. }));
  34835. (
  34836. $ctx1.supercall = true,
  34837. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitMethodNode_.apply($recv(self), [aNode]));
  34838. $ctx1.supercall = false;
  34839. $recv(aNode)._classReferences_(self._classReferences());
  34840. $recv(aNode)._sendIndexes_(self._messageSends());
  34841. self._popScope();
  34842. return self;
  34843. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34844. },
  34845. args: ["aNode"],
  34846. 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",
  34847. referencedClasses: [],
  34848. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  34849. }),
  34850. $globals.SemanticAnalyzer);
  34851. $core.addMethod(
  34852. $core.method({
  34853. selector: "visitReturnNode:",
  34854. protocol: 'visiting',
  34855. fn: function (aNode){
  34856. var self=this;
  34857. return $core.withContext(function($ctx1) {
  34858. var $1;
  34859. $recv(aNode)._scope_(self["@currentScope"]);
  34860. $1=$recv(self["@currentScope"])._isMethodScope();
  34861. if($core.assert($1)){
  34862. $recv(self["@currentScope"])._localReturn_(true);
  34863. } else {
  34864. $recv($recv(self["@currentScope"])._methodScope())._addNonLocalReturn_(self["@currentScope"]);
  34865. };
  34866. (
  34867. $ctx1.supercall = true,
  34868. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitReturnNode_.apply($recv(self), [aNode]));
  34869. $ctx1.supercall = false;
  34870. return self;
  34871. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34872. },
  34873. args: ["aNode"],
  34874. 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",
  34875. referencedClasses: [],
  34876. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  34877. }),
  34878. $globals.SemanticAnalyzer);
  34879. $core.addMethod(
  34880. $core.method({
  34881. selector: "visitSendNode:",
  34882. protocol: 'visiting',
  34883. fn: function (aNode){
  34884. var self=this;
  34885. return $core.withContext(function($ctx1) {
  34886. var $3,$2,$1,$5,$6,$4,$7,$8,$9,$11,$12,$10,$receiver;
  34887. $3=$recv(aNode)._receiver();
  34888. $ctx1.sendIdx["receiver"]=1;
  34889. $2=$recv($3)._value();
  34890. $1=$recv($2).__eq("super");
  34891. if(!$core.assert($1)){
  34892. $5=$recv($globals.IRSendInliner)._inlinedSelectors();
  34893. $6=$recv(aNode)._selector();
  34894. $ctx1.sendIdx["selector"]=1;
  34895. $4=$recv($5)._includes_($6);
  34896. if($core.assert($4)){
  34897. $recv(aNode)._shouldBeInlined_(true);
  34898. $7=$recv(aNode)._receiver();
  34899. if(($receiver = $7) == null || $receiver.isNil){
  34900. $7;
  34901. } else {
  34902. var receiver;
  34903. receiver=$receiver;
  34904. $recv(receiver)._shouldBeAliased_(true);
  34905. };
  34906. };
  34907. };
  34908. $8=self._messageSends();
  34909. $ctx1.sendIdx["messageSends"]=1;
  34910. $9=$recv(aNode)._selector();
  34911. $ctx1.sendIdx["selector"]=2;
  34912. $recv($8)._at_ifAbsentPut_($9,(function(){
  34913. return $core.withContext(function($ctx2) {
  34914. return $recv($globals.Set)._new();
  34915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  34916. }));
  34917. $11=self._messageSends();
  34918. $ctx1.sendIdx["messageSends"]=2;
  34919. $12=$recv(aNode)._selector();
  34920. $ctx1.sendIdx["selector"]=3;
  34921. $10=$recv($11)._at_($12);
  34922. $ctx1.sendIdx["at:"]=1;
  34923. $recv($10)._add_(aNode);
  34924. $recv(aNode)._index_($recv($recv(self._messageSends())._at_($recv(aNode)._selector()))._size());
  34925. (
  34926. $ctx1.supercall = true,
  34927. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  34928. $ctx1.supercall = false;
  34929. return self;
  34930. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34931. },
  34932. args: ["aNode"],
  34933. source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super'\x0a\x09\x09ifFalse: [ (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",
  34934. referencedClasses: ["IRSendInliner", "Set"],
  34935. messageSends: ["ifFalse:", "=", "value", "receiver", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "shouldBeAliased:", "at:ifAbsentPut:", "messageSends", "new", "add:", "at:", "index:", "size", "visitSendNode:"]
  34936. }),
  34937. $globals.SemanticAnalyzer);
  34938. $core.addMethod(
  34939. $core.method({
  34940. selector: "visitSequenceNode:",
  34941. protocol: 'visiting',
  34942. fn: function (aNode){
  34943. var self=this;
  34944. return $core.withContext(function($ctx1) {
  34945. $recv($recv(aNode)._temps())._do_((function(each){
  34946. return $core.withContext(function($ctx2) {
  34947. self._validateVariableScope_(each);
  34948. return $recv(self["@currentScope"])._addTemp_(each);
  34949. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34950. }));
  34951. (
  34952. $ctx1.supercall = true,
  34953. ($globals.SemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  34954. $ctx1.supercall = false;
  34955. return self;
  34956. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  34957. },
  34958. args: ["aNode"],
  34959. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  34960. referencedClasses: [],
  34961. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  34962. }),
  34963. $globals.SemanticAnalyzer);
  34964. $core.addMethod(
  34965. $core.method({
  34966. selector: "visitVariableNode:",
  34967. protocol: 'visiting',
  34968. fn: function (aNode){
  34969. var self=this;
  34970. var binding;
  34971. return $core.withContext(function($ctx1) {
  34972. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  34973. binding=$recv(self["@currentScope"])._lookupVariable_(aNode);
  34974. $1=binding;
  34975. if(($receiver = $1) == null || $receiver.isNil){
  34976. $3=$recv(aNode)._value();
  34977. $ctx1.sendIdx["value"]=1;
  34978. $2=$recv($3)._isCapitalized();
  34979. if($core.assert($2)){
  34980. $4=$recv($globals.ClassRefVar)._new();
  34981. $ctx1.sendIdx["new"]=1;
  34982. $5=$recv(aNode)._value();
  34983. $ctx1.sendIdx["value"]=2;
  34984. $recv($4)._name_($5);
  34985. $ctx1.sendIdx["name:"]=1;
  34986. $6=$recv($4)._yourself();
  34987. $ctx1.sendIdx["yourself"]=1;
  34988. binding=$6;
  34989. binding;
  34990. $7=self._classReferences();
  34991. $8=$recv(aNode)._value();
  34992. $ctx1.sendIdx["value"]=3;
  34993. $recv($7)._add_($8);
  34994. } else {
  34995. self._errorUnknownVariable_(aNode);
  34996. $9=$recv($globals.UnknownVar)._new();
  34997. $recv($9)._name_($recv(aNode)._value());
  34998. binding=$recv($9)._yourself();
  34999. binding;
  35000. };
  35001. } else {
  35002. $1;
  35003. };
  35004. $recv(aNode)._binding_(binding);
  35005. return self;
  35006. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  35007. },
  35008. args: ["aNode"],
  35009. 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.",
  35010. referencedClasses: ["ClassRefVar", "UnknownVar"],
  35011. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  35012. }),
  35013. $globals.SemanticAnalyzer);
  35014. $core.addMethod(
  35015. $core.method({
  35016. selector: "on:",
  35017. protocol: 'instance creation',
  35018. fn: function (aClass){
  35019. var self=this;
  35020. return $core.withContext(function($ctx1) {
  35021. var $1;
  35022. $1=self._new();
  35023. $recv($1)._theClass_(aClass);
  35024. return $recv($1)._yourself();
  35025. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.klass)});
  35026. },
  35027. args: ["aClass"],
  35028. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  35029. referencedClasses: [],
  35030. messageSends: ["theClass:", "new", "yourself"]
  35031. }),
  35032. $globals.SemanticAnalyzer.klass);
  35033. $core.addClass('SemanticError', $globals.CompilerError, [], 'Compiler-Semantic');
  35034. $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";
  35035. $core.addClass('InvalidAssignmentError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35036. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  35037. $core.addMethod(
  35038. $core.method({
  35039. selector: "messageText",
  35040. protocol: 'accessing',
  35041. fn: function (){
  35042. var self=this;
  35043. return $core.withContext(function($ctx1) {
  35044. return " Invalid assignment to variable: ".__comma(self._variableName());
  35045. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  35046. },
  35047. args: [],
  35048. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  35049. referencedClasses: [],
  35050. messageSends: [",", "variableName"]
  35051. }),
  35052. $globals.InvalidAssignmentError);
  35053. $core.addMethod(
  35054. $core.method({
  35055. selector: "variableName",
  35056. protocol: 'accessing',
  35057. fn: function (){
  35058. var self=this;
  35059. return self["@variableName"];
  35060. },
  35061. args: [],
  35062. source: "variableName\x0a\x09^ variableName",
  35063. referencedClasses: [],
  35064. messageSends: []
  35065. }),
  35066. $globals.InvalidAssignmentError);
  35067. $core.addMethod(
  35068. $core.method({
  35069. selector: "variableName:",
  35070. protocol: 'accessing',
  35071. fn: function (aString){
  35072. var self=this;
  35073. self["@variableName"]=aString;
  35074. return self;
  35075. },
  35076. args: ["aString"],
  35077. source: "variableName: aString\x0a\x09variableName := aString",
  35078. referencedClasses: [],
  35079. messageSends: []
  35080. }),
  35081. $globals.InvalidAssignmentError);
  35082. $core.addClass('ShadowingVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35083. $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.";
  35084. $core.addMethod(
  35085. $core.method({
  35086. selector: "messageText",
  35087. protocol: 'accessing',
  35088. fn: function (){
  35089. var self=this;
  35090. return $core.withContext(function($ctx1) {
  35091. var $1;
  35092. $1=$recv("Variable shadowing error: ".__comma(self._variableName())).__comma(" is already defined");
  35093. $ctx1.sendIdx[","]=1;
  35094. return $1;
  35095. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  35096. },
  35097. args: [],
  35098. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  35099. referencedClasses: [],
  35100. messageSends: [",", "variableName"]
  35101. }),
  35102. $globals.ShadowingVariableError);
  35103. $core.addMethod(
  35104. $core.method({
  35105. selector: "variableName",
  35106. protocol: 'accessing',
  35107. fn: function (){
  35108. var self=this;
  35109. return self["@variableName"];
  35110. },
  35111. args: [],
  35112. source: "variableName\x0a\x09^ variableName",
  35113. referencedClasses: [],
  35114. messageSends: []
  35115. }),
  35116. $globals.ShadowingVariableError);
  35117. $core.addMethod(
  35118. $core.method({
  35119. selector: "variableName:",
  35120. protocol: 'accessing',
  35121. fn: function (aString){
  35122. var self=this;
  35123. self["@variableName"]=aString;
  35124. return self;
  35125. },
  35126. args: ["aString"],
  35127. source: "variableName: aString\x0a\x09variableName := aString",
  35128. referencedClasses: [],
  35129. messageSends: []
  35130. }),
  35131. $globals.ShadowingVariableError);
  35132. $core.addClass('UnknownVariableError', $globals.SemanticError, ['variableName'], 'Compiler-Semantic');
  35133. $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.";
  35134. $core.addMethod(
  35135. $core.method({
  35136. selector: "messageText",
  35137. protocol: 'accessing',
  35138. fn: function (){
  35139. var self=this;
  35140. return $core.withContext(function($ctx1) {
  35141. var $1;
  35142. $1=$recv("Unknown Variable error: ".__comma(self._variableName())).__comma(" is not defined");
  35143. $ctx1.sendIdx[","]=1;
  35144. return $1;
  35145. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  35146. },
  35147. args: [],
  35148. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  35149. referencedClasses: [],
  35150. messageSends: [",", "variableName"]
  35151. }),
  35152. $globals.UnknownVariableError);
  35153. $core.addMethod(
  35154. $core.method({
  35155. selector: "variableName",
  35156. protocol: 'accessing',
  35157. fn: function (){
  35158. var self=this;
  35159. return self["@variableName"];
  35160. },
  35161. args: [],
  35162. source: "variableName\x0a\x09^ variableName",
  35163. referencedClasses: [],
  35164. messageSends: []
  35165. }),
  35166. $globals.UnknownVariableError);
  35167. $core.addMethod(
  35168. $core.method({
  35169. selector: "variableName:",
  35170. protocol: 'accessing',
  35171. fn: function (aString){
  35172. var self=this;
  35173. self["@variableName"]=aString;
  35174. return self;
  35175. },
  35176. args: ["aString"],
  35177. source: "variableName: aString\x0a\x09variableName := aString",
  35178. referencedClasses: [],
  35179. messageSends: []
  35180. }),
  35181. $globals.UnknownVariableError);
  35182. });
  35183. define("amber_core/Compiler-IR", ["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Objects", "amber_core/Kernel-Methods"], function($boot){"use strict";
  35184. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  35185. $core.addPackage('Compiler-IR');
  35186. $core.packages["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  35187. $core.packages["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35188. $core.addClass('IRASTTranslator', $globals.NodeVisitor, ['source', 'theClass', 'method', 'sequence', 'nextAlias'], 'Compiler-IR');
  35189. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  35190. $core.addMethod(
  35191. $core.method({
  35192. selector: "alias:",
  35193. protocol: 'visiting',
  35194. fn: function (aNode){
  35195. var self=this;
  35196. var variable;
  35197. return $core.withContext(function($ctx1) {
  35198. var $1,$2,$3,$5,$4,$6,$7,$9,$8;
  35199. $1=$recv(aNode)._isImmutable();
  35200. if($core.assert($1)){
  35201. $2=self._visit_(aNode);
  35202. $ctx1.sendIdx["visit:"]=1;
  35203. return $2;
  35204. };
  35205. $3=$recv($globals.IRVariable)._new();
  35206. $ctx1.sendIdx["new"]=1;
  35207. $5=$recv($globals.AliasVar)._new();
  35208. $ctx1.sendIdx["new"]=2;
  35209. $4=$recv($5)._name_("$".__comma(self._nextAlias()));
  35210. $recv($3)._variable_($4);
  35211. $6=$recv($3)._yourself();
  35212. $ctx1.sendIdx["yourself"]=1;
  35213. variable=$6;
  35214. $7=self._sequence();
  35215. $9=$recv($globals.IRAssignment)._new();
  35216. $recv($9)._add_(variable);
  35217. $ctx1.sendIdx["add:"]=2;
  35218. $recv($9)._add_(self._visit_(aNode));
  35219. $ctx1.sendIdx["add:"]=3;
  35220. $8=$recv($9)._yourself();
  35221. $recv($7)._add_($8);
  35222. $ctx1.sendIdx["add:"]=1;
  35223. $recv($recv(self._method())._internalVariables())._add_(variable);
  35224. return variable;
  35225. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  35226. },
  35227. args: ["aNode"],
  35228. 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",
  35229. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  35230. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "add:", "sequence", "internalVariables", "method"]
  35231. }),
  35232. $globals.IRASTTranslator);
  35233. $core.addMethod(
  35234. $core.method({
  35235. selector: "aliasTemporally:",
  35236. protocol: 'visiting',
  35237. fn: function (aCollection){
  35238. var self=this;
  35239. var threshold,result;
  35240. return $core.withContext(function($ctx1) {
  35241. var $1,$2,$4,$3;
  35242. threshold=(0);
  35243. $recv(aCollection)._withIndexDo_((function(each,i){
  35244. return $core.withContext(function($ctx2) {
  35245. $1=$recv(each)._subtreeNeedsAliasing();
  35246. if($core.assert($1)){
  35247. threshold=i;
  35248. return threshold;
  35249. };
  35250. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  35251. }));
  35252. $ctx1.sendIdx["withIndexDo:"]=1;
  35253. result=$recv($globals.OrderedCollection)._new();
  35254. $recv(aCollection)._withIndexDo_((function(each,i){
  35255. return $core.withContext(function($ctx2) {
  35256. $2=result;
  35257. $4=$recv(i).__lt_eq(threshold);
  35258. if($core.assert($4)){
  35259. $3=self._alias_(each);
  35260. } else {
  35261. $3=self._visit_(each);
  35262. };
  35263. return $recv($2)._add_($3);
  35264. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  35265. }));
  35266. return result;
  35267. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  35268. },
  35269. args: ["aCollection"],
  35270. source: "aliasTemporally: aCollection\x0a\x09\x22https://github.com/NicolasPetton/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",
  35271. referencedClasses: ["OrderedCollection"],
  35272. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  35273. }),
  35274. $globals.IRASTTranslator);
  35275. $core.addMethod(
  35276. $core.method({
  35277. selector: "method",
  35278. protocol: 'accessing',
  35279. fn: function (){
  35280. var self=this;
  35281. return self["@method"];
  35282. },
  35283. args: [],
  35284. source: "method\x0a\x09^ method",
  35285. referencedClasses: [],
  35286. messageSends: []
  35287. }),
  35288. $globals.IRASTTranslator);
  35289. $core.addMethod(
  35290. $core.method({
  35291. selector: "method:",
  35292. protocol: 'accessing',
  35293. fn: function (anIRMethod){
  35294. var self=this;
  35295. self["@method"]=anIRMethod;
  35296. return self;
  35297. },
  35298. args: ["anIRMethod"],
  35299. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  35300. referencedClasses: [],
  35301. messageSends: []
  35302. }),
  35303. $globals.IRASTTranslator);
  35304. $core.addMethod(
  35305. $core.method({
  35306. selector: "nextAlias",
  35307. protocol: 'accessing',
  35308. fn: function (){
  35309. var self=this;
  35310. return $core.withContext(function($ctx1) {
  35311. var $1,$receiver;
  35312. $1=self["@nextAlias"];
  35313. if(($receiver = $1) == null || $receiver.isNil){
  35314. self["@nextAlias"]=(0);
  35315. self["@nextAlias"];
  35316. } else {
  35317. $1;
  35318. };
  35319. self["@nextAlias"]=$recv(self["@nextAlias"]).__plus((1));
  35320. return $recv(self["@nextAlias"])._asString();
  35321. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  35322. },
  35323. args: [],
  35324. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  35325. referencedClasses: [],
  35326. messageSends: ["ifNil:", "+", "asString"]
  35327. }),
  35328. $globals.IRASTTranslator);
  35329. $core.addMethod(
  35330. $core.method({
  35331. selector: "sequence",
  35332. protocol: 'accessing',
  35333. fn: function (){
  35334. var self=this;
  35335. return self["@sequence"];
  35336. },
  35337. args: [],
  35338. source: "sequence\x0a\x09^ sequence",
  35339. referencedClasses: [],
  35340. messageSends: []
  35341. }),
  35342. $globals.IRASTTranslator);
  35343. $core.addMethod(
  35344. $core.method({
  35345. selector: "sequence:",
  35346. protocol: 'accessing',
  35347. fn: function (anIRSequence){
  35348. var self=this;
  35349. self["@sequence"]=anIRSequence;
  35350. return self;
  35351. },
  35352. args: ["anIRSequence"],
  35353. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  35354. referencedClasses: [],
  35355. messageSends: []
  35356. }),
  35357. $globals.IRASTTranslator);
  35358. $core.addMethod(
  35359. $core.method({
  35360. selector: "source",
  35361. protocol: 'accessing',
  35362. fn: function (){
  35363. var self=this;
  35364. return self["@source"];
  35365. },
  35366. args: [],
  35367. source: "source\x0a\x09^ source",
  35368. referencedClasses: [],
  35369. messageSends: []
  35370. }),
  35371. $globals.IRASTTranslator);
  35372. $core.addMethod(
  35373. $core.method({
  35374. selector: "source:",
  35375. protocol: 'accessing',
  35376. fn: function (aString){
  35377. var self=this;
  35378. self["@source"]=aString;
  35379. return self;
  35380. },
  35381. args: ["aString"],
  35382. source: "source: aString\x0a\x09source := aString",
  35383. referencedClasses: [],
  35384. messageSends: []
  35385. }),
  35386. $globals.IRASTTranslator);
  35387. $core.addMethod(
  35388. $core.method({
  35389. selector: "theClass",
  35390. protocol: 'accessing',
  35391. fn: function (){
  35392. var self=this;
  35393. return self["@theClass"];
  35394. },
  35395. args: [],
  35396. source: "theClass\x0a\x09^ theClass",
  35397. referencedClasses: [],
  35398. messageSends: []
  35399. }),
  35400. $globals.IRASTTranslator);
  35401. $core.addMethod(
  35402. $core.method({
  35403. selector: "theClass:",
  35404. protocol: 'accessing',
  35405. fn: function (aClass){
  35406. var self=this;
  35407. self["@theClass"]=aClass;
  35408. return self;
  35409. },
  35410. args: ["aClass"],
  35411. source: "theClass: aClass\x0a\x09theClass := aClass",
  35412. referencedClasses: [],
  35413. messageSends: []
  35414. }),
  35415. $globals.IRASTTranslator);
  35416. $core.addMethod(
  35417. $core.method({
  35418. selector: "visitAssignmentNode:",
  35419. protocol: 'visiting',
  35420. fn: function (aNode){
  35421. var self=this;
  35422. var left,right,assignment;
  35423. return $core.withContext(function($ctx1) {
  35424. var $1,$3,$2;
  35425. right=self._visit_($recv(aNode)._right());
  35426. $ctx1.sendIdx["visit:"]=1;
  35427. left=self._visit_($recv(aNode)._left());
  35428. $1=self._sequence();
  35429. $3=$recv($globals.IRAssignment)._new();
  35430. $recv($3)._add_(left);
  35431. $ctx1.sendIdx["add:"]=2;
  35432. $recv($3)._add_(right);
  35433. $2=$recv($3)._yourself();
  35434. $recv($1)._add_($2);
  35435. $ctx1.sendIdx["add:"]=1;
  35436. return left;
  35437. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  35438. },
  35439. args: ["aNode"],
  35440. 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",
  35441. referencedClasses: ["IRAssignment"],
  35442. messageSends: ["visit:", "right", "left", "add:", "sequence", "new", "yourself"]
  35443. }),
  35444. $globals.IRASTTranslator);
  35445. $core.addMethod(
  35446. $core.method({
  35447. selector: "visitBlockNode:",
  35448. protocol: 'visiting',
  35449. fn: function (aNode){
  35450. var self=this;
  35451. var closure;
  35452. return $core.withContext(function($ctx1) {
  35453. var $1,$2,$3,$5,$4,$6,$8,$7;
  35454. $1=$recv($globals.IRClosure)._new();
  35455. $ctx1.sendIdx["new"]=1;
  35456. $recv($1)._arguments_($recv(aNode)._parameters());
  35457. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  35458. $2=$recv(aNode)._scope();
  35459. $ctx1.sendIdx["scope"]=1;
  35460. $recv($1)._scope_($2);
  35461. $ctx1.sendIdx["scope:"]=1;
  35462. $3=$recv($1)._yourself();
  35463. $ctx1.sendIdx["yourself"]=1;
  35464. closure=$3;
  35465. $5=$recv(aNode)._scope();
  35466. $ctx1.sendIdx["scope"]=2;
  35467. $4=$recv($5)._temps();
  35468. $recv($4)._do_((function(each){
  35469. return $core.withContext(function($ctx2) {
  35470. $6=closure;
  35471. $8=$recv($globals.IRTempDeclaration)._new();
  35472. $recv($8)._name_($recv(each)._name());
  35473. $recv($8)._scope_($recv(aNode)._scope());
  35474. $7=$recv($8)._yourself();
  35475. return $recv($6)._add_($7);
  35476. $ctx2.sendIdx["add:"]=1;
  35477. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35478. }));
  35479. $ctx1.sendIdx["do:"]=1;
  35480. $recv($recv(aNode)._nodes())._do_((function(each){
  35481. return $core.withContext(function($ctx2) {
  35482. return $recv(closure)._add_(self._visit_(each));
  35483. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35484. }));
  35485. return closure;
  35486. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  35487. },
  35488. args: ["aNode"],
  35489. 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",
  35490. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  35491. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"]
  35492. }),
  35493. $globals.IRASTTranslator);
  35494. $core.addMethod(
  35495. $core.method({
  35496. selector: "visitBlockSequenceNode:",
  35497. protocol: 'visiting',
  35498. fn: function (aNode){
  35499. var self=this;
  35500. return $core.withContext(function($ctx1) {
  35501. var $1,$2,$4,$3,$5,$6,$9,$8,$7,$10,$12,$15,$14,$13,$11;
  35502. $1=$recv($globals.IRBlockSequence)._new();
  35503. $ctx1.sendIdx["new"]=1;
  35504. return self._withSequence_do_($1,(function(){
  35505. return $core.withContext(function($ctx2) {
  35506. $2=$recv(aNode)._nodes();
  35507. $ctx2.sendIdx["nodes"]=1;
  35508. return $recv($2)._ifNotEmpty_((function(){
  35509. return $core.withContext(function($ctx3) {
  35510. $4=$recv(aNode)._nodes();
  35511. $ctx3.sendIdx["nodes"]=2;
  35512. $3=$recv($4)._allButLast();
  35513. $recv($3)._do_((function(each){
  35514. return $core.withContext(function($ctx4) {
  35515. $5=self._sequence();
  35516. $ctx4.sendIdx["sequence"]=1;
  35517. $6=self._visitOrAlias_(each);
  35518. $ctx4.sendIdx["visitOrAlias:"]=1;
  35519. return $recv($5)._add_($6);
  35520. $ctx4.sendIdx["add:"]=1;
  35521. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  35522. }));
  35523. $9=$recv(aNode)._nodes();
  35524. $ctx3.sendIdx["nodes"]=3;
  35525. $8=$recv($9)._last();
  35526. $ctx3.sendIdx["last"]=1;
  35527. $7=$recv($8)._isReturnNode();
  35528. if($core.assert($7)){
  35529. return $recv(self._sequence())._add_(self._visitOrAlias_($recv($recv(aNode)._nodes())._last()));
  35530. } else {
  35531. $10=self._sequence();
  35532. $ctx3.sendIdx["sequence"]=2;
  35533. $12=$recv($globals.IRBlockReturn)._new();
  35534. $15=$recv(aNode)._nodes();
  35535. $ctx3.sendIdx["nodes"]=4;
  35536. $14=$recv($15)._last();
  35537. $ctx3.sendIdx["last"]=2;
  35538. $13=self._visitOrAlias_($14);
  35539. $ctx3.sendIdx["visitOrAlias:"]=2;
  35540. $recv($12)._add_($13);
  35541. $ctx3.sendIdx["add:"]=3;
  35542. $11=$recv($12)._yourself();
  35543. return $recv($10)._add_($11);
  35544. $ctx3.sendIdx["add:"]=2;
  35545. };
  35546. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  35547. }));
  35548. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35549. }));
  35550. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35551. },
  35552. args: ["aNode"],
  35553. 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) ] ]]",
  35554. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  35555. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "nodes", "do:", "allButLast", "add:", "sequence", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "yourself"]
  35556. }),
  35557. $globals.IRASTTranslator);
  35558. $core.addMethod(
  35559. $core.method({
  35560. selector: "visitCascadeNode:",
  35561. protocol: 'visiting',
  35562. fn: function (aNode){
  35563. var self=this;
  35564. return $core.withContext(function($ctx1) {
  35565. var $1,$2,$4,$3;
  35566. $1=$recv(aNode)._nodes();
  35567. $ctx1.sendIdx["nodes"]=1;
  35568. $recv($1)._inject_into_($recv(aNode)._receiver(),(function(previous,each){
  35569. var receiver;
  35570. return $core.withContext(function($ctx2) {
  35571. $2=$recv(previous)._isImmutable();
  35572. if($core.assert($2)){
  35573. receiver=previous;
  35574. } else {
  35575. var alias;
  35576. alias=self._alias_(previous);
  35577. alias;
  35578. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  35579. };
  35580. receiver;
  35581. $recv(each)._receiver_(receiver);
  35582. return receiver;
  35583. }, function($ctx2) {$ctx2.fillBlock({previous:previous,each:each,receiver:receiver},$ctx1,1)});
  35584. }));
  35585. $4=$recv(aNode)._nodes();
  35586. $ctx1.sendIdx["nodes"]=2;
  35587. $3=$recv($4)._allButLast();
  35588. $recv($3)._do_((function(each){
  35589. return $core.withContext(function($ctx2) {
  35590. return $recv(self._sequence())._add_(self._visit_(each));
  35591. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  35592. }));
  35593. return self._visitOrAlias_($recv($recv(aNode)._nodes())._last());
  35594. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35595. },
  35596. args: ["aNode"],
  35597. source: "visitCascadeNode: aNode\x0a\x09aNode nodes inject: aNode receiver into: [ :previous :each |\x0a\x09\x09| receiver |\x0a\x09\x09receiver := previous isImmutable \x0a\x09\x09\x09ifTrue: [ previous ]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09| alias |\x0a\x09\x09\x09\x09alias := self alias: previous.\x0a\x09\x09\x09\x09VariableNode new binding: alias variable ].\x0a\x09\x09each receiver: receiver.\x0a\x09\x09receiver ].\x0a\x0a\x09aNode nodes allButLast do: [ :each |\x0a\x09\x09self sequence add: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode nodes last",
  35598. referencedClasses: ["VariableNode"],
  35599. messageSends: ["inject:into:", "nodes", "receiver", "ifTrue:ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "receiver:", "do:", "allButLast", "add:", "sequence", "visit:", "visitOrAlias:", "last"]
  35600. }),
  35601. $globals.IRASTTranslator);
  35602. $core.addMethod(
  35603. $core.method({
  35604. selector: "visitDynamicArrayNode:",
  35605. protocol: 'visiting',
  35606. fn: function (aNode){
  35607. var self=this;
  35608. var array;
  35609. return $core.withContext(function($ctx1) {
  35610. array=$recv($globals.IRDynamicArray)._new();
  35611. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  35612. return $core.withContext(function($ctx2) {
  35613. return $recv(array)._add_(each);
  35614. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35615. }));
  35616. return array;
  35617. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  35618. },
  35619. args: ["aNode"],
  35620. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | array add: each ].\x0a\x09^ array",
  35621. referencedClasses: ["IRDynamicArray"],
  35622. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  35623. }),
  35624. $globals.IRASTTranslator);
  35625. $core.addMethod(
  35626. $core.method({
  35627. selector: "visitDynamicDictionaryNode:",
  35628. protocol: 'visiting',
  35629. fn: function (aNode){
  35630. var self=this;
  35631. var dictionary;
  35632. return $core.withContext(function($ctx1) {
  35633. dictionary=$recv($globals.IRDynamicDictionary)._new();
  35634. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  35635. return $core.withContext(function($ctx2) {
  35636. return $recv(dictionary)._add_(each);
  35637. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35638. }));
  35639. return dictionary;
  35640. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  35641. },
  35642. args: ["aNode"],
  35643. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode nodes) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  35644. referencedClasses: ["IRDynamicDictionary"],
  35645. messageSends: ["new", "do:", "aliasTemporally:", "nodes", "add:"]
  35646. }),
  35647. $globals.IRASTTranslator);
  35648. $core.addMethod(
  35649. $core.method({
  35650. selector: "visitJSStatementNode:",
  35651. protocol: 'visiting',
  35652. fn: function (aNode){
  35653. var self=this;
  35654. return $core.withContext(function($ctx1) {
  35655. var $1;
  35656. $1=$recv($globals.IRVerbatim)._new();
  35657. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  35658. return $recv($1)._yourself();
  35659. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35660. },
  35661. args: ["aNode"],
  35662. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  35663. referencedClasses: ["IRVerbatim"],
  35664. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  35665. }),
  35666. $globals.IRASTTranslator);
  35667. $core.addMethod(
  35668. $core.method({
  35669. selector: "visitMethodNode:",
  35670. protocol: 'visiting',
  35671. fn: function (aNode){
  35672. var self=this;
  35673. return $core.withContext(function($ctx1) {
  35674. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  35675. $2=$recv($globals.IRMethod)._new();
  35676. $ctx1.sendIdx["new"]=1;
  35677. $recv($2)._source_($recv(self._source())._crlfSanitized());
  35678. $ctx1.sendIdx["source:"]=1;
  35679. $recv($2)._theClass_(self._theClass());
  35680. $recv($2)._arguments_($recv(aNode)._arguments());
  35681. $recv($2)._selector_($recv(aNode)._selector());
  35682. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  35683. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  35684. $recv($2)._classReferences_($recv(aNode)._classReferences());
  35685. $3=$recv(aNode)._scope();
  35686. $ctx1.sendIdx["scope"]=1;
  35687. $recv($2)._scope_($3);
  35688. $ctx1.sendIdx["scope:"]=1;
  35689. $4=$recv($2)._yourself();
  35690. $ctx1.sendIdx["yourself"]=1;
  35691. $1=$4;
  35692. self._method_($1);
  35693. $6=$recv(aNode)._scope();
  35694. $ctx1.sendIdx["scope"]=2;
  35695. $5=$recv($6)._temps();
  35696. $recv($5)._do_((function(each){
  35697. return $core.withContext(function($ctx2) {
  35698. $7=self._method();
  35699. $ctx2.sendIdx["method"]=1;
  35700. $9=$recv($globals.IRTempDeclaration)._new();
  35701. $ctx2.sendIdx["new"]=2;
  35702. $recv($9)._name_($recv(each)._name());
  35703. $10=$recv(aNode)._scope();
  35704. $ctx2.sendIdx["scope"]=3;
  35705. $recv($9)._scope_($10);
  35706. $11=$recv($9)._yourself();
  35707. $ctx2.sendIdx["yourself"]=2;
  35708. $8=$11;
  35709. return $recv($7)._add_($8);
  35710. $ctx2.sendIdx["add:"]=1;
  35711. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35712. }));
  35713. $ctx1.sendIdx["do:"]=1;
  35714. $recv($recv(aNode)._nodes())._do_((function(each){
  35715. return $core.withContext(function($ctx2) {
  35716. $12=self._method();
  35717. $ctx2.sendIdx["method"]=2;
  35718. return $recv($12)._add_(self._visit_(each));
  35719. $ctx2.sendIdx["add:"]=2;
  35720. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  35721. }));
  35722. $14=$recv(aNode)._scope();
  35723. $ctx1.sendIdx["scope"]=4;
  35724. $13=$recv($14)._hasLocalReturn();
  35725. if(!$core.assert($13)){
  35726. $15=self._method();
  35727. $ctx1.sendIdx["method"]=3;
  35728. $17=$recv($globals.IRReturn)._new();
  35729. $ctx1.sendIdx["new"]=3;
  35730. $19=$recv($globals.IRVariable)._new();
  35731. $ctx1.sendIdx["new"]=4;
  35732. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  35733. $20=$recv($19)._yourself();
  35734. $ctx1.sendIdx["yourself"]=3;
  35735. $18=$20;
  35736. $recv($17)._add_($18);
  35737. $ctx1.sendIdx["add:"]=4;
  35738. $21=$recv($17)._yourself();
  35739. $ctx1.sendIdx["yourself"]=4;
  35740. $16=$21;
  35741. $recv($15)._add_($16);
  35742. $ctx1.sendIdx["add:"]=3;
  35743. $23=$recv($globals.IRVerbatim)._new();
  35744. $recv($23)._source_("");
  35745. $22=$recv($23)._yourself();
  35746. $recv($15)._add_($22);
  35747. };
  35748. return self._method();
  35749. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35750. },
  35751. args: ["aNode"],
  35752. 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",
  35753. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim"],
  35754. 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"]
  35755. }),
  35756. $globals.IRASTTranslator);
  35757. $core.addMethod(
  35758. $core.method({
  35759. selector: "visitOrAlias:",
  35760. protocol: 'visiting',
  35761. fn: function (aNode){
  35762. var self=this;
  35763. return $core.withContext(function($ctx1) {
  35764. var $1;
  35765. $1=$recv(aNode)._shouldBeAliased();
  35766. if($core.assert($1)){
  35767. return self._alias_(aNode);
  35768. } else {
  35769. return self._visit_(aNode);
  35770. };
  35771. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  35772. },
  35773. args: ["aNode"],
  35774. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  35775. referencedClasses: [],
  35776. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  35777. }),
  35778. $globals.IRASTTranslator);
  35779. $core.addMethod(
  35780. $core.method({
  35781. selector: "visitReturnNode:",
  35782. protocol: 'visiting',
  35783. fn: function (aNode){
  35784. var self=this;
  35785. var return_;
  35786. return $core.withContext(function($ctx1) {
  35787. var $1;
  35788. $1=$recv(aNode)._nonLocalReturn();
  35789. if($core.assert($1)){
  35790. return_=$recv($globals.IRNonLocalReturn)._new();
  35791. $ctx1.sendIdx["new"]=1;
  35792. } else {
  35793. return_=$recv($globals.IRReturn)._new();
  35794. };
  35795. $recv(return_)._scope_($recv(aNode)._scope());
  35796. $recv($recv(aNode)._nodes())._do_((function(each){
  35797. return $core.withContext(function($ctx2) {
  35798. return $recv(return_)._add_(self._visitOrAlias_(each));
  35799. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  35800. }));
  35801. return return_;
  35802. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  35803. },
  35804. args: ["aNode"],
  35805. 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",
  35806. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  35807. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "nodes", "add:", "visitOrAlias:"]
  35808. }),
  35809. $globals.IRASTTranslator);
  35810. $core.addMethod(
  35811. $core.method({
  35812. selector: "visitSendNode:",
  35813. protocol: 'visiting',
  35814. fn: function (aNode){
  35815. var self=this;
  35816. var send;
  35817. return $core.withContext(function($ctx1) {
  35818. var $1;
  35819. send=$recv($globals.IRSend)._new();
  35820. $1=send;
  35821. $recv($1)._selector_($recv(aNode)._selector());
  35822. $recv($1)._index_($recv(aNode)._index());
  35823. $recv(self._aliasTemporally_($recv(aNode)._nodes()))._do_((function(each){
  35824. return $core.withContext(function($ctx2) {
  35825. return $recv(send)._add_(each);
  35826. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35827. }));
  35828. return send;
  35829. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  35830. },
  35831. args: ["aNode"],
  35832. 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",
  35833. referencedClasses: ["IRSend"],
  35834. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "nodes", "add:"]
  35835. }),
  35836. $globals.IRASTTranslator);
  35837. $core.addMethod(
  35838. $core.method({
  35839. selector: "visitSequenceNode:",
  35840. protocol: 'visiting',
  35841. fn: function (aNode){
  35842. var self=this;
  35843. return $core.withContext(function($ctx1) {
  35844. var $1;
  35845. return self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  35846. return $core.withContext(function($ctx2) {
  35847. return $recv($recv(aNode)._nodes())._do_((function(each){
  35848. var instruction;
  35849. return $core.withContext(function($ctx3) {
  35850. instruction=self._visitOrAlias_(each);
  35851. instruction;
  35852. $1=$recv(instruction)._isVariable();
  35853. if(!$core.assert($1)){
  35854. return $recv(self._sequence())._add_(instruction);
  35855. };
  35856. }, function($ctx3) {$ctx3.fillBlock({each:each,instruction:instruction},$ctx2,2)});
  35857. }));
  35858. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35859. }));
  35860. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35861. },
  35862. args: ["aNode"],
  35863. 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 ] ]]",
  35864. referencedClasses: ["IRSequence"],
  35865. messageSends: ["withSequence:do:", "new", "do:", "nodes", "visitOrAlias:", "ifFalse:", "isVariable", "add:", "sequence"]
  35866. }),
  35867. $globals.IRASTTranslator);
  35868. $core.addMethod(
  35869. $core.method({
  35870. selector: "visitValueNode:",
  35871. protocol: 'visiting',
  35872. fn: function (aNode){
  35873. var self=this;
  35874. return $core.withContext(function($ctx1) {
  35875. var $1;
  35876. $1=$recv($globals.IRValue)._new();
  35877. $recv($1)._value_($recv(aNode)._value());
  35878. return $recv($1)._yourself();
  35879. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35880. },
  35881. args: ["aNode"],
  35882. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  35883. referencedClasses: ["IRValue"],
  35884. messageSends: ["value:", "new", "value", "yourself"]
  35885. }),
  35886. $globals.IRASTTranslator);
  35887. $core.addMethod(
  35888. $core.method({
  35889. selector: "visitVariableNode:",
  35890. protocol: 'visiting',
  35891. fn: function (aNode){
  35892. var self=this;
  35893. return $core.withContext(function($ctx1) {
  35894. var $1;
  35895. $1=$recv($globals.IRVariable)._new();
  35896. $recv($1)._variable_($recv(aNode)._binding());
  35897. return $recv($1)._yourself();
  35898. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  35899. },
  35900. args: ["aNode"],
  35901. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  35902. referencedClasses: ["IRVariable"],
  35903. messageSends: ["variable:", "new", "binding", "yourself"]
  35904. }),
  35905. $globals.IRASTTranslator);
  35906. $core.addMethod(
  35907. $core.method({
  35908. selector: "withSequence:do:",
  35909. protocol: 'accessing',
  35910. fn: function (aSequence,aBlock){
  35911. var self=this;
  35912. var outerSequence;
  35913. return $core.withContext(function($ctx1) {
  35914. outerSequence=self._sequence();
  35915. self._sequence_(aSequence);
  35916. $ctx1.sendIdx["sequence:"]=1;
  35917. $recv(aBlock)._value();
  35918. self._sequence_(outerSequence);
  35919. return aSequence;
  35920. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  35921. },
  35922. args: ["aSequence", "aBlock"],
  35923. 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",
  35924. referencedClasses: [],
  35925. messageSends: ["sequence", "sequence:", "value"]
  35926. }),
  35927. $globals.IRASTTranslator);
  35928. $core.addClass('IRInstruction', $globals.Object, ['parent', 'instructions'], 'Compiler-IR');
  35929. $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.";
  35930. $core.addMethod(
  35931. $core.method({
  35932. selector: "accept:",
  35933. protocol: 'visiting',
  35934. fn: function (aVisitor){
  35935. var self=this;
  35936. return $core.withContext(function($ctx1) {
  35937. return $recv(aVisitor)._visitIRInstruction_(self);
  35938. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInstruction)});
  35939. },
  35940. args: ["aVisitor"],
  35941. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInstruction: self",
  35942. referencedClasses: [],
  35943. messageSends: ["visitIRInstruction:"]
  35944. }),
  35945. $globals.IRInstruction);
  35946. $core.addMethod(
  35947. $core.method({
  35948. selector: "add:",
  35949. protocol: 'building',
  35950. fn: function (anObject){
  35951. var self=this;
  35952. return $core.withContext(function($ctx1) {
  35953. $recv(anObject)._parent_(self);
  35954. return $recv(self._instructions())._add_(anObject);
  35955. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  35956. },
  35957. args: ["anObject"],
  35958. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self instructions add: anObject",
  35959. referencedClasses: [],
  35960. messageSends: ["parent:", "add:", "instructions"]
  35961. }),
  35962. $globals.IRInstruction);
  35963. $core.addMethod(
  35964. $core.method({
  35965. selector: "canBeAssigned",
  35966. protocol: 'testing',
  35967. fn: function (){
  35968. var self=this;
  35969. return true;
  35970. },
  35971. args: [],
  35972. source: "canBeAssigned\x0a\x09^ true",
  35973. referencedClasses: [],
  35974. messageSends: []
  35975. }),
  35976. $globals.IRInstruction);
  35977. $core.addMethod(
  35978. $core.method({
  35979. selector: "instructions",
  35980. protocol: 'accessing',
  35981. fn: function (){
  35982. var self=this;
  35983. return $core.withContext(function($ctx1) {
  35984. var $1,$receiver;
  35985. $1=self["@instructions"];
  35986. if(($receiver = $1) == null || $receiver.isNil){
  35987. self["@instructions"]=$recv($globals.OrderedCollection)._new();
  35988. return self["@instructions"];
  35989. } else {
  35990. return $1;
  35991. };
  35992. }, function($ctx1) {$ctx1.fill(self,"instructions",{},$globals.IRInstruction)});
  35993. },
  35994. args: [],
  35995. source: "instructions\x0a\x09^ instructions ifNil: [ instructions := OrderedCollection new ]",
  35996. referencedClasses: ["OrderedCollection"],
  35997. messageSends: ["ifNil:", "new"]
  35998. }),
  35999. $globals.IRInstruction);
  36000. $core.addMethod(
  36001. $core.method({
  36002. selector: "isClosure",
  36003. protocol: 'testing',
  36004. fn: function (){
  36005. var self=this;
  36006. return false;
  36007. },
  36008. args: [],
  36009. source: "isClosure\x0a\x09^ false",
  36010. referencedClasses: [],
  36011. messageSends: []
  36012. }),
  36013. $globals.IRInstruction);
  36014. $core.addMethod(
  36015. $core.method({
  36016. selector: "isInlined",
  36017. protocol: 'testing',
  36018. fn: function (){
  36019. var self=this;
  36020. return false;
  36021. },
  36022. args: [],
  36023. source: "isInlined\x0a\x09^ false",
  36024. referencedClasses: [],
  36025. messageSends: []
  36026. }),
  36027. $globals.IRInstruction);
  36028. $core.addMethod(
  36029. $core.method({
  36030. selector: "isLocalReturn",
  36031. protocol: 'testing',
  36032. fn: function (){
  36033. var self=this;
  36034. return false;
  36035. },
  36036. args: [],
  36037. source: "isLocalReturn\x0a\x09^ false",
  36038. referencedClasses: [],
  36039. messageSends: []
  36040. }),
  36041. $globals.IRInstruction);
  36042. $core.addMethod(
  36043. $core.method({
  36044. selector: "isMethod",
  36045. protocol: 'testing',
  36046. fn: function (){
  36047. var self=this;
  36048. return false;
  36049. },
  36050. args: [],
  36051. source: "isMethod\x0a\x09^ false",
  36052. referencedClasses: [],
  36053. messageSends: []
  36054. }),
  36055. $globals.IRInstruction);
  36056. $core.addMethod(
  36057. $core.method({
  36058. selector: "isReturn",
  36059. protocol: 'testing',
  36060. fn: function (){
  36061. var self=this;
  36062. return false;
  36063. },
  36064. args: [],
  36065. source: "isReturn\x0a\x09^ false",
  36066. referencedClasses: [],
  36067. messageSends: []
  36068. }),
  36069. $globals.IRInstruction);
  36070. $core.addMethod(
  36071. $core.method({
  36072. selector: "isSend",
  36073. protocol: 'testing',
  36074. fn: function (){
  36075. var self=this;
  36076. return false;
  36077. },
  36078. args: [],
  36079. source: "isSend\x0a\x09^ false",
  36080. referencedClasses: [],
  36081. messageSends: []
  36082. }),
  36083. $globals.IRInstruction);
  36084. $core.addMethod(
  36085. $core.method({
  36086. selector: "isSequence",
  36087. protocol: 'testing',
  36088. fn: function (){
  36089. var self=this;
  36090. return false;
  36091. },
  36092. args: [],
  36093. source: "isSequence\x0a\x09^ false",
  36094. referencedClasses: [],
  36095. messageSends: []
  36096. }),
  36097. $globals.IRInstruction);
  36098. $core.addMethod(
  36099. $core.method({
  36100. selector: "isTempDeclaration",
  36101. protocol: 'testing',
  36102. fn: function (){
  36103. var self=this;
  36104. return false;
  36105. },
  36106. args: [],
  36107. source: "isTempDeclaration\x0a\x09^ false",
  36108. referencedClasses: [],
  36109. messageSends: []
  36110. }),
  36111. $globals.IRInstruction);
  36112. $core.addMethod(
  36113. $core.method({
  36114. selector: "isVariable",
  36115. protocol: 'testing',
  36116. fn: function (){
  36117. var self=this;
  36118. return false;
  36119. },
  36120. args: [],
  36121. source: "isVariable\x0a\x09^ false",
  36122. referencedClasses: [],
  36123. messageSends: []
  36124. }),
  36125. $globals.IRInstruction);
  36126. $core.addMethod(
  36127. $core.method({
  36128. selector: "method",
  36129. protocol: 'accessing',
  36130. fn: function (){
  36131. var self=this;
  36132. return $core.withContext(function($ctx1) {
  36133. return $recv(self._parent())._method();
  36134. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  36135. },
  36136. args: [],
  36137. source: "method\x0a\x09^ self parent method",
  36138. referencedClasses: [],
  36139. messageSends: ["method", "parent"]
  36140. }),
  36141. $globals.IRInstruction);
  36142. $core.addMethod(
  36143. $core.method({
  36144. selector: "needsBoxingAsReceiver",
  36145. protocol: 'testing',
  36146. fn: function (){
  36147. var self=this;
  36148. return true;
  36149. },
  36150. args: [],
  36151. source: "needsBoxingAsReceiver\x0a\x09^ true",
  36152. referencedClasses: [],
  36153. messageSends: []
  36154. }),
  36155. $globals.IRInstruction);
  36156. $core.addMethod(
  36157. $core.method({
  36158. selector: "parent",
  36159. protocol: 'accessing',
  36160. fn: function (){
  36161. var self=this;
  36162. return self["@parent"];
  36163. },
  36164. args: [],
  36165. source: "parent\x0a\x09^ parent",
  36166. referencedClasses: [],
  36167. messageSends: []
  36168. }),
  36169. $globals.IRInstruction);
  36170. $core.addMethod(
  36171. $core.method({
  36172. selector: "parent:",
  36173. protocol: 'accessing',
  36174. fn: function (anIRInstruction){
  36175. var self=this;
  36176. self["@parent"]=anIRInstruction;
  36177. return self;
  36178. },
  36179. args: ["anIRInstruction"],
  36180. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  36181. referencedClasses: [],
  36182. messageSends: []
  36183. }),
  36184. $globals.IRInstruction);
  36185. $core.addMethod(
  36186. $core.method({
  36187. selector: "remove",
  36188. protocol: 'building',
  36189. fn: function (){
  36190. var self=this;
  36191. return $core.withContext(function($ctx1) {
  36192. $recv(self._parent())._remove_(self);
  36193. return self;
  36194. }, function($ctx1) {$ctx1.fill(self,"remove",{},$globals.IRInstruction)});
  36195. },
  36196. args: [],
  36197. source: "remove\x0a\x09self parent remove: self",
  36198. referencedClasses: [],
  36199. messageSends: ["remove:", "parent"]
  36200. }),
  36201. $globals.IRInstruction);
  36202. $core.addMethod(
  36203. $core.method({
  36204. selector: "remove:",
  36205. protocol: 'building',
  36206. fn: function (anIRInstruction){
  36207. var self=this;
  36208. return $core.withContext(function($ctx1) {
  36209. $recv(self._instructions())._remove_(anIRInstruction);
  36210. return self;
  36211. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  36212. },
  36213. args: ["anIRInstruction"],
  36214. source: "remove: anIRInstruction\x0a\x09self instructions remove: anIRInstruction",
  36215. referencedClasses: [],
  36216. messageSends: ["remove:", "instructions"]
  36217. }),
  36218. $globals.IRInstruction);
  36219. $core.addMethod(
  36220. $core.method({
  36221. selector: "replace:with:",
  36222. protocol: 'building',
  36223. fn: function (anIRInstruction,anotherIRInstruction){
  36224. var self=this;
  36225. return $core.withContext(function($ctx1) {
  36226. var $1;
  36227. $recv(anotherIRInstruction)._parent_(self);
  36228. $1=self._instructions();
  36229. $ctx1.sendIdx["instructions"]=1;
  36230. $recv($1)._at_put_($recv(self._instructions())._indexOf_(anIRInstruction),anotherIRInstruction);
  36231. return self;
  36232. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  36233. },
  36234. args: ["anIRInstruction", "anotherIRInstruction"],
  36235. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self instructions\x0a\x09\x09at: (self instructions indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  36236. referencedClasses: [],
  36237. messageSends: ["parent:", "at:put:", "instructions", "indexOf:"]
  36238. }),
  36239. $globals.IRInstruction);
  36240. $core.addMethod(
  36241. $core.method({
  36242. selector: "replaceWith:",
  36243. protocol: 'building',
  36244. fn: function (anIRInstruction){
  36245. var self=this;
  36246. return $core.withContext(function($ctx1) {
  36247. $recv(self._parent())._replace_with_(self,anIRInstruction);
  36248. return self;
  36249. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  36250. },
  36251. args: ["anIRInstruction"],
  36252. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  36253. referencedClasses: [],
  36254. messageSends: ["replace:with:", "parent"]
  36255. }),
  36256. $globals.IRInstruction);
  36257. $core.addMethod(
  36258. $core.method({
  36259. selector: "scope",
  36260. protocol: 'accessing',
  36261. fn: function (){
  36262. var self=this;
  36263. return $core.withContext(function($ctx1) {
  36264. var $1,$receiver;
  36265. $1=self._parent();
  36266. if(($receiver = $1) == null || $receiver.isNil){
  36267. return $1;
  36268. } else {
  36269. var node;
  36270. node=$receiver;
  36271. return $recv(node)._scope();
  36272. };
  36273. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  36274. },
  36275. args: [],
  36276. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  36277. referencedClasses: [],
  36278. messageSends: ["ifNotNil:", "parent", "scope"]
  36279. }),
  36280. $globals.IRInstruction);
  36281. $core.addMethod(
  36282. $core.method({
  36283. selector: "on:",
  36284. protocol: 'instance creation',
  36285. fn: function (aBuilder){
  36286. var self=this;
  36287. return $core.withContext(function($ctx1) {
  36288. var $1;
  36289. $1=self._new();
  36290. $recv($1)._builder_(aBuilder);
  36291. return $recv($1)._yourself();
  36292. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.klass)});
  36293. },
  36294. args: ["aBuilder"],
  36295. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  36296. referencedClasses: [],
  36297. messageSends: ["builder:", "new", "yourself"]
  36298. }),
  36299. $globals.IRInstruction.klass);
  36300. $core.addClass('IRAssignment', $globals.IRInstruction, [], 'Compiler-IR');
  36301. $core.addMethod(
  36302. $core.method({
  36303. selector: "accept:",
  36304. protocol: 'visiting',
  36305. fn: function (aVisitor){
  36306. var self=this;
  36307. return $core.withContext(function($ctx1) {
  36308. return $recv(aVisitor)._visitIRAssignment_(self);
  36309. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRAssignment)});
  36310. },
  36311. args: ["aVisitor"],
  36312. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  36313. referencedClasses: [],
  36314. messageSends: ["visitIRAssignment:"]
  36315. }),
  36316. $globals.IRAssignment);
  36317. $core.addClass('IRDynamicArray', $globals.IRInstruction, [], 'Compiler-IR');
  36318. $core.addMethod(
  36319. $core.method({
  36320. selector: "accept:",
  36321. protocol: 'visiting',
  36322. fn: function (aVisitor){
  36323. var self=this;
  36324. return $core.withContext(function($ctx1) {
  36325. return $recv(aVisitor)._visitIRDynamicArray_(self);
  36326. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  36327. },
  36328. args: ["aVisitor"],
  36329. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  36330. referencedClasses: [],
  36331. messageSends: ["visitIRDynamicArray:"]
  36332. }),
  36333. $globals.IRDynamicArray);
  36334. $core.addClass('IRDynamicDictionary', $globals.IRInstruction, [], 'Compiler-IR');
  36335. $core.addMethod(
  36336. $core.method({
  36337. selector: "accept:",
  36338. protocol: 'visiting',
  36339. fn: function (aVisitor){
  36340. var self=this;
  36341. return $core.withContext(function($ctx1) {
  36342. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  36343. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  36344. },
  36345. args: ["aVisitor"],
  36346. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  36347. referencedClasses: [],
  36348. messageSends: ["visitIRDynamicDictionary:"]
  36349. }),
  36350. $globals.IRDynamicDictionary);
  36351. $core.addClass('IRScopedInstruction', $globals.IRInstruction, ['scope'], 'Compiler-IR');
  36352. $core.addMethod(
  36353. $core.method({
  36354. selector: "scope",
  36355. protocol: 'accessing',
  36356. fn: function (){
  36357. var self=this;
  36358. return self["@scope"];
  36359. },
  36360. args: [],
  36361. source: "scope\x0a\x09^ scope",
  36362. referencedClasses: [],
  36363. messageSends: []
  36364. }),
  36365. $globals.IRScopedInstruction);
  36366. $core.addMethod(
  36367. $core.method({
  36368. selector: "scope:",
  36369. protocol: 'accessing',
  36370. fn: function (aScope){
  36371. var self=this;
  36372. self["@scope"]=aScope;
  36373. return self;
  36374. },
  36375. args: ["aScope"],
  36376. source: "scope: aScope\x0a\x09scope := aScope",
  36377. referencedClasses: [],
  36378. messageSends: []
  36379. }),
  36380. $globals.IRScopedInstruction);
  36381. $core.addClass('IRClosureInstruction', $globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
  36382. $core.addMethod(
  36383. $core.method({
  36384. selector: "arguments",
  36385. protocol: 'accessing',
  36386. fn: function (){
  36387. var self=this;
  36388. return $core.withContext(function($ctx1) {
  36389. var $1,$receiver;
  36390. $1=self["@arguments"];
  36391. if(($receiver = $1) == null || $receiver.isNil){
  36392. return [];
  36393. } else {
  36394. return $1;
  36395. };
  36396. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  36397. },
  36398. args: [],
  36399. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  36400. referencedClasses: [],
  36401. messageSends: ["ifNil:"]
  36402. }),
  36403. $globals.IRClosureInstruction);
  36404. $core.addMethod(
  36405. $core.method({
  36406. selector: "arguments:",
  36407. protocol: 'accessing',
  36408. fn: function (aCollection){
  36409. var self=this;
  36410. self["@arguments"]=aCollection;
  36411. return self;
  36412. },
  36413. args: ["aCollection"],
  36414. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  36415. referencedClasses: [],
  36416. messageSends: []
  36417. }),
  36418. $globals.IRClosureInstruction);
  36419. $core.addMethod(
  36420. $core.method({
  36421. selector: "locals",
  36422. protocol: 'accessing',
  36423. fn: function (){
  36424. var self=this;
  36425. return $core.withContext(function($ctx1) {
  36426. var $1;
  36427. $1=$recv(self._arguments())._copy();
  36428. $recv($1)._addAll_($recv(self._tempDeclarations())._collect_((function(each){
  36429. return $core.withContext(function($ctx2) {
  36430. return $recv(each)._name();
  36431. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36432. })));
  36433. return $recv($1)._yourself();
  36434. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  36435. },
  36436. args: [],
  36437. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  36438. referencedClasses: [],
  36439. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  36440. }),
  36441. $globals.IRClosureInstruction);
  36442. $core.addMethod(
  36443. $core.method({
  36444. selector: "requiresSmalltalkContext",
  36445. protocol: 'accessing',
  36446. fn: function (){
  36447. var self=this;
  36448. return $core.withContext(function($ctx1) {
  36449. var $1,$receiver;
  36450. $1=self["@requiresSmalltalkContext"];
  36451. if(($receiver = $1) == null || $receiver.isNil){
  36452. return false;
  36453. } else {
  36454. return $1;
  36455. };
  36456. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  36457. },
  36458. args: [],
  36459. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  36460. referencedClasses: [],
  36461. messageSends: ["ifNil:"]
  36462. }),
  36463. $globals.IRClosureInstruction);
  36464. $core.addMethod(
  36465. $core.method({
  36466. selector: "requiresSmalltalkContext:",
  36467. protocol: 'accessing',
  36468. fn: function (anObject){
  36469. var self=this;
  36470. self["@requiresSmalltalkContext"]=anObject;
  36471. return self;
  36472. },
  36473. args: ["anObject"],
  36474. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  36475. referencedClasses: [],
  36476. messageSends: []
  36477. }),
  36478. $globals.IRClosureInstruction);
  36479. $core.addMethod(
  36480. $core.method({
  36481. selector: "scope:",
  36482. protocol: 'accessing',
  36483. fn: function (aScope){
  36484. var self=this;
  36485. return $core.withContext(function($ctx1) {
  36486. (
  36487. $ctx1.supercall = true,
  36488. ($globals.IRClosureInstruction.superclass||$boot.dnu).fn.prototype._scope_.apply($recv(self), [aScope]));
  36489. $ctx1.supercall = false;
  36490. $recv(aScope)._instruction_(self);
  36491. return self;
  36492. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  36493. },
  36494. args: ["aScope"],
  36495. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  36496. referencedClasses: [],
  36497. messageSends: ["scope:", "instruction:"]
  36498. }),
  36499. $globals.IRClosureInstruction);
  36500. $core.addMethod(
  36501. $core.method({
  36502. selector: "tempDeclarations",
  36503. protocol: 'accessing',
  36504. fn: function (){
  36505. var self=this;
  36506. return $core.withContext(function($ctx1) {
  36507. return $recv(self._instructions())._select_((function(each){
  36508. return $core.withContext(function($ctx2) {
  36509. return $recv(each)._isTempDeclaration();
  36510. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36511. }));
  36512. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  36513. },
  36514. args: [],
  36515. source: "tempDeclarations\x0a\x09^ self instructions select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  36516. referencedClasses: [],
  36517. messageSends: ["select:", "instructions", "isTempDeclaration"]
  36518. }),
  36519. $globals.IRClosureInstruction);
  36520. $core.addClass('IRClosure', $globals.IRClosureInstruction, [], 'Compiler-IR');
  36521. $core.addMethod(
  36522. $core.method({
  36523. selector: "accept:",
  36524. protocol: 'visiting',
  36525. fn: function (aVisitor){
  36526. var self=this;
  36527. return $core.withContext(function($ctx1) {
  36528. return $recv(aVisitor)._visitIRClosure_(self);
  36529. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRClosure)});
  36530. },
  36531. args: ["aVisitor"],
  36532. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  36533. referencedClasses: [],
  36534. messageSends: ["visitIRClosure:"]
  36535. }),
  36536. $globals.IRClosure);
  36537. $core.addMethod(
  36538. $core.method({
  36539. selector: "isClosure",
  36540. protocol: 'testing',
  36541. fn: function (){
  36542. var self=this;
  36543. return true;
  36544. },
  36545. args: [],
  36546. source: "isClosure\x0a\x09^ true",
  36547. referencedClasses: [],
  36548. messageSends: []
  36549. }),
  36550. $globals.IRClosure);
  36551. $core.addMethod(
  36552. $core.method({
  36553. selector: "sequence",
  36554. protocol: 'accessing',
  36555. fn: function (){
  36556. var self=this;
  36557. return $core.withContext(function($ctx1) {
  36558. return $recv(self._instructions())._last();
  36559. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  36560. },
  36561. args: [],
  36562. source: "sequence\x0a\x09^ self instructions last",
  36563. referencedClasses: [],
  36564. messageSends: ["last", "instructions"]
  36565. }),
  36566. $globals.IRClosure);
  36567. $core.addClass('IRMethod', $globals.IRClosureInstruction, ['theClass', 'source', 'selector', 'classReferences', 'sendIndexes', 'requiresSmalltalkContext', 'internalVariables'], 'Compiler-IR');
  36568. $globals.IRMethod.comment="I am a method instruction";
  36569. $core.addMethod(
  36570. $core.method({
  36571. selector: "accept:",
  36572. protocol: 'visiting',
  36573. fn: function (aVisitor){
  36574. var self=this;
  36575. return $core.withContext(function($ctx1) {
  36576. return $recv(aVisitor)._visitIRMethod_(self);
  36577. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRMethod)});
  36578. },
  36579. args: ["aVisitor"],
  36580. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  36581. referencedClasses: [],
  36582. messageSends: ["visitIRMethod:"]
  36583. }),
  36584. $globals.IRMethod);
  36585. $core.addMethod(
  36586. $core.method({
  36587. selector: "classReferences",
  36588. protocol: 'accessing',
  36589. fn: function (){
  36590. var self=this;
  36591. return self["@classReferences"];
  36592. },
  36593. args: [],
  36594. source: "classReferences\x0a\x09^ classReferences",
  36595. referencedClasses: [],
  36596. messageSends: []
  36597. }),
  36598. $globals.IRMethod);
  36599. $core.addMethod(
  36600. $core.method({
  36601. selector: "classReferences:",
  36602. protocol: 'accessing',
  36603. fn: function (aCollection){
  36604. var self=this;
  36605. self["@classReferences"]=aCollection;
  36606. return self;
  36607. },
  36608. args: ["aCollection"],
  36609. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  36610. referencedClasses: [],
  36611. messageSends: []
  36612. }),
  36613. $globals.IRMethod);
  36614. $core.addMethod(
  36615. $core.method({
  36616. selector: "internalVariables",
  36617. protocol: 'accessing',
  36618. fn: function (){
  36619. var self=this;
  36620. return $core.withContext(function($ctx1) {
  36621. var $1,$receiver;
  36622. $1=self["@internalVariables"];
  36623. if(($receiver = $1) == null || $receiver.isNil){
  36624. self["@internalVariables"]=$recv($globals.Set)._new();
  36625. return self["@internalVariables"];
  36626. } else {
  36627. return $1;
  36628. };
  36629. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  36630. },
  36631. args: [],
  36632. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  36633. referencedClasses: ["Set"],
  36634. messageSends: ["ifNil:", "new"]
  36635. }),
  36636. $globals.IRMethod);
  36637. $core.addMethod(
  36638. $core.method({
  36639. selector: "isMethod",
  36640. protocol: 'accessing',
  36641. fn: function (){
  36642. var self=this;
  36643. return true;
  36644. },
  36645. args: [],
  36646. source: "isMethod\x0a\x09^ true",
  36647. referencedClasses: [],
  36648. messageSends: []
  36649. }),
  36650. $globals.IRMethod);
  36651. $core.addMethod(
  36652. $core.method({
  36653. selector: "messageSends",
  36654. protocol: 'accessing',
  36655. fn: function (){
  36656. var self=this;
  36657. return $core.withContext(function($ctx1) {
  36658. return $recv(self._sendIndexes())._keys();
  36659. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  36660. },
  36661. args: [],
  36662. source: "messageSends\x0a\x09^ self sendIndexes keys",
  36663. referencedClasses: [],
  36664. messageSends: ["keys", "sendIndexes"]
  36665. }),
  36666. $globals.IRMethod);
  36667. $core.addMethod(
  36668. $core.method({
  36669. selector: "method",
  36670. protocol: 'accessing',
  36671. fn: function (){
  36672. var self=this;
  36673. return self;
  36674. },
  36675. args: [],
  36676. source: "method\x0a\x09^ self",
  36677. referencedClasses: [],
  36678. messageSends: []
  36679. }),
  36680. $globals.IRMethod);
  36681. $core.addMethod(
  36682. $core.method({
  36683. selector: "selector",
  36684. protocol: 'accessing',
  36685. fn: function (){
  36686. var self=this;
  36687. return self["@selector"];
  36688. },
  36689. args: [],
  36690. source: "selector\x0a\x09^ selector",
  36691. referencedClasses: [],
  36692. messageSends: []
  36693. }),
  36694. $globals.IRMethod);
  36695. $core.addMethod(
  36696. $core.method({
  36697. selector: "selector:",
  36698. protocol: 'accessing',
  36699. fn: function (aString){
  36700. var self=this;
  36701. self["@selector"]=aString;
  36702. return self;
  36703. },
  36704. args: ["aString"],
  36705. source: "selector: aString\x0a\x09selector := aString",
  36706. referencedClasses: [],
  36707. messageSends: []
  36708. }),
  36709. $globals.IRMethod);
  36710. $core.addMethod(
  36711. $core.method({
  36712. selector: "sendIndexes",
  36713. protocol: 'accessing',
  36714. fn: function (){
  36715. var self=this;
  36716. return self["@sendIndexes"];
  36717. },
  36718. args: [],
  36719. source: "sendIndexes\x0a\x09^ sendIndexes",
  36720. referencedClasses: [],
  36721. messageSends: []
  36722. }),
  36723. $globals.IRMethod);
  36724. $core.addMethod(
  36725. $core.method({
  36726. selector: "sendIndexes:",
  36727. protocol: 'accessing',
  36728. fn: function (aDictionary){
  36729. var self=this;
  36730. self["@sendIndexes"]=aDictionary;
  36731. return self;
  36732. },
  36733. args: ["aDictionary"],
  36734. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  36735. referencedClasses: [],
  36736. messageSends: []
  36737. }),
  36738. $globals.IRMethod);
  36739. $core.addMethod(
  36740. $core.method({
  36741. selector: "source",
  36742. protocol: 'accessing',
  36743. fn: function (){
  36744. var self=this;
  36745. return self["@source"];
  36746. },
  36747. args: [],
  36748. source: "source\x0a\x09^ source",
  36749. referencedClasses: [],
  36750. messageSends: []
  36751. }),
  36752. $globals.IRMethod);
  36753. $core.addMethod(
  36754. $core.method({
  36755. selector: "source:",
  36756. protocol: 'accessing',
  36757. fn: function (aString){
  36758. var self=this;
  36759. self["@source"]=aString;
  36760. return self;
  36761. },
  36762. args: ["aString"],
  36763. source: "source: aString\x0a\x09source := aString",
  36764. referencedClasses: [],
  36765. messageSends: []
  36766. }),
  36767. $globals.IRMethod);
  36768. $core.addMethod(
  36769. $core.method({
  36770. selector: "theClass",
  36771. protocol: 'accessing',
  36772. fn: function (){
  36773. var self=this;
  36774. return self["@theClass"];
  36775. },
  36776. args: [],
  36777. source: "theClass\x0a\x09^ theClass",
  36778. referencedClasses: [],
  36779. messageSends: []
  36780. }),
  36781. $globals.IRMethod);
  36782. $core.addMethod(
  36783. $core.method({
  36784. selector: "theClass:",
  36785. protocol: 'accessing',
  36786. fn: function (aClass){
  36787. var self=this;
  36788. self["@theClass"]=aClass;
  36789. return self;
  36790. },
  36791. args: ["aClass"],
  36792. source: "theClass: aClass\x0a\x09theClass := aClass",
  36793. referencedClasses: [],
  36794. messageSends: []
  36795. }),
  36796. $globals.IRMethod);
  36797. $core.addClass('IRReturn', $globals.IRScopedInstruction, [], 'Compiler-IR');
  36798. $globals.IRReturn.comment="I am a local return instruction.";
  36799. $core.addMethod(
  36800. $core.method({
  36801. selector: "accept:",
  36802. protocol: 'visiting',
  36803. fn: function (aVisitor){
  36804. var self=this;
  36805. return $core.withContext(function($ctx1) {
  36806. return $recv(aVisitor)._visitIRReturn_(self);
  36807. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRReturn)});
  36808. },
  36809. args: ["aVisitor"],
  36810. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  36811. referencedClasses: [],
  36812. messageSends: ["visitIRReturn:"]
  36813. }),
  36814. $globals.IRReturn);
  36815. $core.addMethod(
  36816. $core.method({
  36817. selector: "canBeAssigned",
  36818. protocol: 'testing',
  36819. fn: function (){
  36820. var self=this;
  36821. return false;
  36822. },
  36823. args: [],
  36824. source: "canBeAssigned\x0a\x09^ false",
  36825. referencedClasses: [],
  36826. messageSends: []
  36827. }),
  36828. $globals.IRReturn);
  36829. $core.addMethod(
  36830. $core.method({
  36831. selector: "isBlockReturn",
  36832. protocol: 'testing',
  36833. fn: function (){
  36834. var self=this;
  36835. return false;
  36836. },
  36837. args: [],
  36838. source: "isBlockReturn\x0a\x09^ false",
  36839. referencedClasses: [],
  36840. messageSends: []
  36841. }),
  36842. $globals.IRReturn);
  36843. $core.addMethod(
  36844. $core.method({
  36845. selector: "isLocalReturn",
  36846. protocol: 'testing',
  36847. fn: function (){
  36848. var self=this;
  36849. return true;
  36850. },
  36851. args: [],
  36852. source: "isLocalReturn\x0a\x09^ true",
  36853. referencedClasses: [],
  36854. messageSends: []
  36855. }),
  36856. $globals.IRReturn);
  36857. $core.addMethod(
  36858. $core.method({
  36859. selector: "isNonLocalReturn",
  36860. protocol: 'testing',
  36861. fn: function (){
  36862. var self=this;
  36863. return $core.withContext(function($ctx1) {
  36864. return $recv(self._isLocalReturn())._not();
  36865. }, function($ctx1) {$ctx1.fill(self,"isNonLocalReturn",{},$globals.IRReturn)});
  36866. },
  36867. args: [],
  36868. source: "isNonLocalReturn\x0a\x09^ self isLocalReturn not",
  36869. referencedClasses: [],
  36870. messageSends: ["not", "isLocalReturn"]
  36871. }),
  36872. $globals.IRReturn);
  36873. $core.addMethod(
  36874. $core.method({
  36875. selector: "isReturn",
  36876. protocol: 'testing',
  36877. fn: function (){
  36878. var self=this;
  36879. return true;
  36880. },
  36881. args: [],
  36882. source: "isReturn\x0a\x09^ true",
  36883. referencedClasses: [],
  36884. messageSends: []
  36885. }),
  36886. $globals.IRReturn);
  36887. $core.addMethod(
  36888. $core.method({
  36889. selector: "scope",
  36890. protocol: 'accessing',
  36891. fn: function (){
  36892. var self=this;
  36893. return $core.withContext(function($ctx1) {
  36894. var $1,$receiver;
  36895. $1=self["@scope"];
  36896. if(($receiver = $1) == null || $receiver.isNil){
  36897. return $recv(self._parent())._scope();
  36898. } else {
  36899. return $1;
  36900. };
  36901. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  36902. },
  36903. args: [],
  36904. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  36905. referencedClasses: [],
  36906. messageSends: ["ifNil:", "scope", "parent"]
  36907. }),
  36908. $globals.IRReturn);
  36909. $core.addClass('IRBlockReturn', $globals.IRReturn, [], 'Compiler-IR');
  36910. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  36911. $core.addMethod(
  36912. $core.method({
  36913. selector: "accept:",
  36914. protocol: 'visiting',
  36915. fn: function (aVisitor){
  36916. var self=this;
  36917. return $core.withContext(function($ctx1) {
  36918. return $recv(aVisitor)._visitIRBlockReturn_(self);
  36919. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  36920. },
  36921. args: ["aVisitor"],
  36922. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  36923. referencedClasses: [],
  36924. messageSends: ["visitIRBlockReturn:"]
  36925. }),
  36926. $globals.IRBlockReturn);
  36927. $core.addMethod(
  36928. $core.method({
  36929. selector: "isBlockReturn",
  36930. protocol: 'testing',
  36931. fn: function (){
  36932. var self=this;
  36933. return true;
  36934. },
  36935. args: [],
  36936. source: "isBlockReturn\x0a\x09^ true",
  36937. referencedClasses: [],
  36938. messageSends: []
  36939. }),
  36940. $globals.IRBlockReturn);
  36941. $core.addClass('IRNonLocalReturn', $globals.IRReturn, [], 'Compiler-IR');
  36942. $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.";
  36943. $core.addMethod(
  36944. $core.method({
  36945. selector: "accept:",
  36946. protocol: 'visiting',
  36947. fn: function (aVisitor){
  36948. var self=this;
  36949. return $core.withContext(function($ctx1) {
  36950. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  36951. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  36952. },
  36953. args: ["aVisitor"],
  36954. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  36955. referencedClasses: [],
  36956. messageSends: ["visitIRNonLocalReturn:"]
  36957. }),
  36958. $globals.IRNonLocalReturn);
  36959. $core.addMethod(
  36960. $core.method({
  36961. selector: "isLocalReturn",
  36962. protocol: 'testing',
  36963. fn: function (){
  36964. var self=this;
  36965. return false;
  36966. },
  36967. args: [],
  36968. source: "isLocalReturn\x0a\x09^ false",
  36969. referencedClasses: [],
  36970. messageSends: []
  36971. }),
  36972. $globals.IRNonLocalReturn);
  36973. $core.addClass('IRTempDeclaration', $globals.IRScopedInstruction, ['name'], 'Compiler-IR');
  36974. $core.addMethod(
  36975. $core.method({
  36976. selector: "accept:",
  36977. protocol: 'visiting',
  36978. fn: function (aVisitor){
  36979. var self=this;
  36980. return $core.withContext(function($ctx1) {
  36981. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  36982. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  36983. },
  36984. args: ["aVisitor"],
  36985. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  36986. referencedClasses: [],
  36987. messageSends: ["visitIRTempDeclaration:"]
  36988. }),
  36989. $globals.IRTempDeclaration);
  36990. $core.addMethod(
  36991. $core.method({
  36992. selector: "isTempDeclaration",
  36993. protocol: 'testing',
  36994. fn: function (){
  36995. var self=this;
  36996. return true;
  36997. },
  36998. args: [],
  36999. source: "isTempDeclaration\x0a\x09^ true",
  37000. referencedClasses: [],
  37001. messageSends: []
  37002. }),
  37003. $globals.IRTempDeclaration);
  37004. $core.addMethod(
  37005. $core.method({
  37006. selector: "name",
  37007. protocol: 'accessing',
  37008. fn: function (){
  37009. var self=this;
  37010. return self["@name"];
  37011. },
  37012. args: [],
  37013. source: "name\x0a\x09^ name",
  37014. referencedClasses: [],
  37015. messageSends: []
  37016. }),
  37017. $globals.IRTempDeclaration);
  37018. $core.addMethod(
  37019. $core.method({
  37020. selector: "name:",
  37021. protocol: 'accessing',
  37022. fn: function (aString){
  37023. var self=this;
  37024. self["@name"]=aString;
  37025. return self;
  37026. },
  37027. args: ["aString"],
  37028. source: "name: aString\x0a\x09name := aString",
  37029. referencedClasses: [],
  37030. messageSends: []
  37031. }),
  37032. $globals.IRTempDeclaration);
  37033. $core.addClass('IRSend', $globals.IRInstruction, ['selector', 'index'], 'Compiler-IR');
  37034. $globals.IRSend.comment="I am a message send instruction.";
  37035. $core.addMethod(
  37036. $core.method({
  37037. selector: "accept:",
  37038. protocol: 'visiting',
  37039. fn: function (aVisitor){
  37040. var self=this;
  37041. return $core.withContext(function($ctx1) {
  37042. return $recv(aVisitor)._visitIRSend_(self);
  37043. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSend)});
  37044. },
  37045. args: ["aVisitor"],
  37046. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  37047. referencedClasses: [],
  37048. messageSends: ["visitIRSend:"]
  37049. }),
  37050. $globals.IRSend);
  37051. $core.addMethod(
  37052. $core.method({
  37053. selector: "index",
  37054. protocol: 'accessing',
  37055. fn: function (){
  37056. var self=this;
  37057. return self["@index"];
  37058. },
  37059. args: [],
  37060. source: "index\x0a\x09^ index",
  37061. referencedClasses: [],
  37062. messageSends: []
  37063. }),
  37064. $globals.IRSend);
  37065. $core.addMethod(
  37066. $core.method({
  37067. selector: "index:",
  37068. protocol: 'accessing',
  37069. fn: function (anInteger){
  37070. var self=this;
  37071. self["@index"]=anInteger;
  37072. return self;
  37073. },
  37074. args: ["anInteger"],
  37075. source: "index: anInteger\x0a\x09index := anInteger",
  37076. referencedClasses: [],
  37077. messageSends: []
  37078. }),
  37079. $globals.IRSend);
  37080. $core.addMethod(
  37081. $core.method({
  37082. selector: "isSend",
  37083. protocol: 'testing',
  37084. fn: function (){
  37085. var self=this;
  37086. return true;
  37087. },
  37088. args: [],
  37089. source: "isSend\x0a\x09^ true",
  37090. referencedClasses: [],
  37091. messageSends: []
  37092. }),
  37093. $globals.IRSend);
  37094. $core.addMethod(
  37095. $core.method({
  37096. selector: "isSuperSend",
  37097. protocol: 'accessing',
  37098. fn: function (){
  37099. var self=this;
  37100. var receiver;
  37101. return $core.withContext(function($ctx1) {
  37102. receiver=$recv(self._instructions())._first();
  37103. return $recv($recv(receiver)._isVariable())._and_((function(){
  37104. return $core.withContext(function($ctx2) {
  37105. return $recv($recv($recv(receiver)._variable())._name()).__eq("super");
  37106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37107. }));
  37108. }, function($ctx1) {$ctx1.fill(self,"isSuperSend",{receiver:receiver},$globals.IRSend)});
  37109. },
  37110. args: [],
  37111. source: "isSuperSend\x0a\x09| receiver |\x0a\x09receiver := self instructions first.\x0a\x09^ receiver isVariable and: [ receiver variable name = 'super' ]",
  37112. referencedClasses: [],
  37113. messageSends: ["first", "instructions", "and:", "isVariable", "=", "name", "variable"]
  37114. }),
  37115. $globals.IRSend);
  37116. $core.addMethod(
  37117. $core.method({
  37118. selector: "selector",
  37119. protocol: 'accessing',
  37120. fn: function (){
  37121. var self=this;
  37122. return self["@selector"];
  37123. },
  37124. args: [],
  37125. source: "selector\x0a\x09^ selector",
  37126. referencedClasses: [],
  37127. messageSends: []
  37128. }),
  37129. $globals.IRSend);
  37130. $core.addMethod(
  37131. $core.method({
  37132. selector: "selector:",
  37133. protocol: 'accessing',
  37134. fn: function (aString){
  37135. var self=this;
  37136. self["@selector"]=aString;
  37137. return self;
  37138. },
  37139. args: ["aString"],
  37140. source: "selector: aString\x0a\x09selector := aString",
  37141. referencedClasses: [],
  37142. messageSends: []
  37143. }),
  37144. $globals.IRSend);
  37145. $core.addClass('IRSequence', $globals.IRInstruction, [], 'Compiler-IR');
  37146. $core.addMethod(
  37147. $core.method({
  37148. selector: "accept:",
  37149. protocol: 'visiting',
  37150. fn: function (aVisitor){
  37151. var self=this;
  37152. return $core.withContext(function($ctx1) {
  37153. return $recv(aVisitor)._visitIRSequence_(self);
  37154. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRSequence)});
  37155. },
  37156. args: ["aVisitor"],
  37157. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  37158. referencedClasses: [],
  37159. messageSends: ["visitIRSequence:"]
  37160. }),
  37161. $globals.IRSequence);
  37162. $core.addMethod(
  37163. $core.method({
  37164. selector: "isSequence",
  37165. protocol: 'testing',
  37166. fn: function (){
  37167. var self=this;
  37168. return true;
  37169. },
  37170. args: [],
  37171. source: "isSequence\x0a\x09^ true",
  37172. referencedClasses: [],
  37173. messageSends: []
  37174. }),
  37175. $globals.IRSequence);
  37176. $core.addClass('IRBlockSequence', $globals.IRSequence, [], 'Compiler-IR');
  37177. $core.addMethod(
  37178. $core.method({
  37179. selector: "accept:",
  37180. protocol: 'visiting',
  37181. fn: function (aVisitor){
  37182. var self=this;
  37183. return $core.withContext(function($ctx1) {
  37184. return $recv(aVisitor)._visitIRBlockSequence_(self);
  37185. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  37186. },
  37187. args: ["aVisitor"],
  37188. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  37189. referencedClasses: [],
  37190. messageSends: ["visitIRBlockSequence:"]
  37191. }),
  37192. $globals.IRBlockSequence);
  37193. $core.addClass('IRValue', $globals.IRInstruction, ['value'], 'Compiler-IR');
  37194. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  37195. $core.addMethod(
  37196. $core.method({
  37197. selector: "accept:",
  37198. protocol: 'visiting',
  37199. fn: function (aVisitor){
  37200. var self=this;
  37201. return $core.withContext(function($ctx1) {
  37202. return $recv(aVisitor)._visitIRValue_(self);
  37203. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRValue)});
  37204. },
  37205. args: ["aVisitor"],
  37206. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  37207. referencedClasses: [],
  37208. messageSends: ["visitIRValue:"]
  37209. }),
  37210. $globals.IRValue);
  37211. $core.addMethod(
  37212. $core.method({
  37213. selector: "needsBoxingAsReceiver",
  37214. protocol: 'testing',
  37215. fn: function (){
  37216. var self=this;
  37217. return false;
  37218. },
  37219. args: [],
  37220. source: "needsBoxingAsReceiver\x0a\x09^ false",
  37221. referencedClasses: [],
  37222. messageSends: []
  37223. }),
  37224. $globals.IRValue);
  37225. $core.addMethod(
  37226. $core.method({
  37227. selector: "value",
  37228. protocol: 'accessing',
  37229. fn: function (){
  37230. var self=this;
  37231. return self["@value"];
  37232. },
  37233. args: [],
  37234. source: "value\x0a\x09^ value",
  37235. referencedClasses: [],
  37236. messageSends: []
  37237. }),
  37238. $globals.IRValue);
  37239. $core.addMethod(
  37240. $core.method({
  37241. selector: "value:",
  37242. protocol: 'accessing',
  37243. fn: function (aString){
  37244. var self=this;
  37245. self["@value"]=aString;
  37246. return self;
  37247. },
  37248. args: ["aString"],
  37249. source: "value: aString\x0a\x09value := aString",
  37250. referencedClasses: [],
  37251. messageSends: []
  37252. }),
  37253. $globals.IRValue);
  37254. $core.addClass('IRVariable', $globals.IRInstruction, ['variable'], 'Compiler-IR');
  37255. $globals.IRVariable.comment="I am a variable instruction.";
  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)._visitIRVariable_(self);
  37264. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVariable)});
  37265. },
  37266. args: ["aVisitor"],
  37267. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  37268. referencedClasses: [],
  37269. messageSends: ["visitIRVariable:"]
  37270. }),
  37271. $globals.IRVariable);
  37272. $core.addMethod(
  37273. $core.method({
  37274. selector: "isVariable",
  37275. protocol: 'testing',
  37276. fn: function (){
  37277. var self=this;
  37278. return true;
  37279. },
  37280. args: [],
  37281. source: "isVariable\x0a\x09^ true",
  37282. referencedClasses: [],
  37283. messageSends: []
  37284. }),
  37285. $globals.IRVariable);
  37286. $core.addMethod(
  37287. $core.method({
  37288. selector: "needsBoxingAsReceiver",
  37289. protocol: 'testing',
  37290. fn: function (){
  37291. var self=this;
  37292. return $core.withContext(function($ctx1) {
  37293. return $recv($recv(self._variable())._isPseudoVar())._not();
  37294. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  37295. },
  37296. args: [],
  37297. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  37298. referencedClasses: [],
  37299. messageSends: ["not", "isPseudoVar", "variable"]
  37300. }),
  37301. $globals.IRVariable);
  37302. $core.addMethod(
  37303. $core.method({
  37304. selector: "variable",
  37305. protocol: 'accessing',
  37306. fn: function (){
  37307. var self=this;
  37308. return self["@variable"];
  37309. },
  37310. args: [],
  37311. source: "variable\x0a\x09^ variable",
  37312. referencedClasses: [],
  37313. messageSends: []
  37314. }),
  37315. $globals.IRVariable);
  37316. $core.addMethod(
  37317. $core.method({
  37318. selector: "variable:",
  37319. protocol: 'accessing',
  37320. fn: function (aScopeVariable){
  37321. var self=this;
  37322. self["@variable"]=aScopeVariable;
  37323. return self;
  37324. },
  37325. args: ["aScopeVariable"],
  37326. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  37327. referencedClasses: [],
  37328. messageSends: []
  37329. }),
  37330. $globals.IRVariable);
  37331. $core.addClass('IRVerbatim', $globals.IRInstruction, ['source'], 'Compiler-IR');
  37332. $core.addMethod(
  37333. $core.method({
  37334. selector: "accept:",
  37335. protocol: 'visiting',
  37336. fn: function (aVisitor){
  37337. var self=this;
  37338. return $core.withContext(function($ctx1) {
  37339. return $recv(aVisitor)._visitIRVerbatim_(self);
  37340. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  37341. },
  37342. args: ["aVisitor"],
  37343. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  37344. referencedClasses: [],
  37345. messageSends: ["visitIRVerbatim:"]
  37346. }),
  37347. $globals.IRVerbatim);
  37348. $core.addMethod(
  37349. $core.method({
  37350. selector: "source",
  37351. protocol: 'accessing',
  37352. fn: function (){
  37353. var self=this;
  37354. return self["@source"];
  37355. },
  37356. args: [],
  37357. source: "source\x0a\x09^ source",
  37358. referencedClasses: [],
  37359. messageSends: []
  37360. }),
  37361. $globals.IRVerbatim);
  37362. $core.addMethod(
  37363. $core.method({
  37364. selector: "source:",
  37365. protocol: 'accessing',
  37366. fn: function (aString){
  37367. var self=this;
  37368. self["@source"]=aString;
  37369. return self;
  37370. },
  37371. args: ["aString"],
  37372. source: "source: aString\x0a\x09source := aString",
  37373. referencedClasses: [],
  37374. messageSends: []
  37375. }),
  37376. $globals.IRVerbatim);
  37377. $core.addClass('IRVisitor', $globals.Object, [], 'Compiler-IR');
  37378. $core.addMethod(
  37379. $core.method({
  37380. selector: "visit:",
  37381. protocol: 'visiting',
  37382. fn: function (anIRInstruction){
  37383. var self=this;
  37384. return $core.withContext(function($ctx1) {
  37385. return $recv(anIRInstruction)._accept_(self);
  37386. }, function($ctx1) {$ctx1.fill(self,"visit:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  37387. },
  37388. args: ["anIRInstruction"],
  37389. source: "visit: anIRInstruction\x0a\x09^ anIRInstruction accept: self",
  37390. referencedClasses: [],
  37391. messageSends: ["accept:"]
  37392. }),
  37393. $globals.IRVisitor);
  37394. $core.addMethod(
  37395. $core.method({
  37396. selector: "visitIRAssignment:",
  37397. protocol: 'visiting',
  37398. fn: function (anIRAssignment){
  37399. var self=this;
  37400. return $core.withContext(function($ctx1) {
  37401. return self._visitIRInstruction_(anIRAssignment);
  37402. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  37403. },
  37404. args: ["anIRAssignment"],
  37405. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitIRInstruction: anIRAssignment",
  37406. referencedClasses: [],
  37407. messageSends: ["visitIRInstruction:"]
  37408. }),
  37409. $globals.IRVisitor);
  37410. $core.addMethod(
  37411. $core.method({
  37412. selector: "visitIRBlockReturn:",
  37413. protocol: 'visiting',
  37414. fn: function (anIRBlockReturn){
  37415. var self=this;
  37416. return $core.withContext(function($ctx1) {
  37417. return self._visitIRReturn_(anIRBlockReturn);
  37418. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  37419. },
  37420. args: ["anIRBlockReturn"],
  37421. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  37422. referencedClasses: [],
  37423. messageSends: ["visitIRReturn:"]
  37424. }),
  37425. $globals.IRVisitor);
  37426. $core.addMethod(
  37427. $core.method({
  37428. selector: "visitIRBlockSequence:",
  37429. protocol: 'visiting',
  37430. fn: function (anIRBlockSequence){
  37431. var self=this;
  37432. return $core.withContext(function($ctx1) {
  37433. return self._visitIRSequence_(anIRBlockSequence);
  37434. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  37435. },
  37436. args: ["anIRBlockSequence"],
  37437. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  37438. referencedClasses: [],
  37439. messageSends: ["visitIRSequence:"]
  37440. }),
  37441. $globals.IRVisitor);
  37442. $core.addMethod(
  37443. $core.method({
  37444. selector: "visitIRClosure:",
  37445. protocol: 'visiting',
  37446. fn: function (anIRClosure){
  37447. var self=this;
  37448. return $core.withContext(function($ctx1) {
  37449. return self._visitIRInstruction_(anIRClosure);
  37450. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  37451. },
  37452. args: ["anIRClosure"],
  37453. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitIRInstruction: anIRClosure",
  37454. referencedClasses: [],
  37455. messageSends: ["visitIRInstruction:"]
  37456. }),
  37457. $globals.IRVisitor);
  37458. $core.addMethod(
  37459. $core.method({
  37460. selector: "visitIRDynamicArray:",
  37461. protocol: 'visiting',
  37462. fn: function (anIRDynamicArray){
  37463. var self=this;
  37464. return $core.withContext(function($ctx1) {
  37465. return self._visitIRInstruction_(anIRDynamicArray);
  37466. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  37467. },
  37468. args: ["anIRDynamicArray"],
  37469. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitIRInstruction: anIRDynamicArray",
  37470. referencedClasses: [],
  37471. messageSends: ["visitIRInstruction:"]
  37472. }),
  37473. $globals.IRVisitor);
  37474. $core.addMethod(
  37475. $core.method({
  37476. selector: "visitIRDynamicDictionary:",
  37477. protocol: 'visiting',
  37478. fn: function (anIRDynamicDictionary){
  37479. var self=this;
  37480. return $core.withContext(function($ctx1) {
  37481. return self._visitIRInstruction_(anIRDynamicDictionary);
  37482. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  37483. },
  37484. args: ["anIRDynamicDictionary"],
  37485. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitIRInstruction: anIRDynamicDictionary",
  37486. referencedClasses: [],
  37487. messageSends: ["visitIRInstruction:"]
  37488. }),
  37489. $globals.IRVisitor);
  37490. $core.addMethod(
  37491. $core.method({
  37492. selector: "visitIRInlinedClosure:",
  37493. protocol: 'visiting',
  37494. fn: function (anIRInlinedClosure){
  37495. var self=this;
  37496. return $core.withContext(function($ctx1) {
  37497. return self._visitIRClosure_(anIRInlinedClosure);
  37498. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  37499. },
  37500. args: ["anIRInlinedClosure"],
  37501. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  37502. referencedClasses: [],
  37503. messageSends: ["visitIRClosure:"]
  37504. }),
  37505. $globals.IRVisitor);
  37506. $core.addMethod(
  37507. $core.method({
  37508. selector: "visitIRInlinedSequence:",
  37509. protocol: 'visiting',
  37510. fn: function (anIRInlinedSequence){
  37511. var self=this;
  37512. return $core.withContext(function($ctx1) {
  37513. return self._visitIRSequence_(anIRInlinedSequence);
  37514. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  37515. },
  37516. args: ["anIRInlinedSequence"],
  37517. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  37518. referencedClasses: [],
  37519. messageSends: ["visitIRSequence:"]
  37520. }),
  37521. $globals.IRVisitor);
  37522. $core.addMethod(
  37523. $core.method({
  37524. selector: "visitIRInstruction:",
  37525. protocol: 'visiting',
  37526. fn: function (anIRInstruction){
  37527. var self=this;
  37528. return $core.withContext(function($ctx1) {
  37529. $recv($recv(anIRInstruction)._instructions())._do_((function(each){
  37530. return $core.withContext(function($ctx2) {
  37531. return self._visit_(each);
  37532. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  37533. }));
  37534. return anIRInstruction;
  37535. }, function($ctx1) {$ctx1.fill(self,"visitIRInstruction:",{anIRInstruction:anIRInstruction},$globals.IRVisitor)});
  37536. },
  37537. args: ["anIRInstruction"],
  37538. source: "visitIRInstruction: anIRInstruction\x0a\x09anIRInstruction instructions do: [ :each | self visit: each ].\x0a\x09^ anIRInstruction",
  37539. referencedClasses: [],
  37540. messageSends: ["do:", "instructions", "visit:"]
  37541. }),
  37542. $globals.IRVisitor);
  37543. $core.addMethod(
  37544. $core.method({
  37545. selector: "visitIRMethod:",
  37546. protocol: 'visiting',
  37547. fn: function (anIRMethod){
  37548. var self=this;
  37549. return $core.withContext(function($ctx1) {
  37550. return self._visitIRInstruction_(anIRMethod);
  37551. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  37552. },
  37553. args: ["anIRMethod"],
  37554. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitIRInstruction: anIRMethod",
  37555. referencedClasses: [],
  37556. messageSends: ["visitIRInstruction:"]
  37557. }),
  37558. $globals.IRVisitor);
  37559. $core.addMethod(
  37560. $core.method({
  37561. selector: "visitIRNonLocalReturn:",
  37562. protocol: 'visiting',
  37563. fn: function (anIRNonLocalReturn){
  37564. var self=this;
  37565. return $core.withContext(function($ctx1) {
  37566. return self._visitIRInstruction_(anIRNonLocalReturn);
  37567. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  37568. },
  37569. args: ["anIRNonLocalReturn"],
  37570. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitIRInstruction: anIRNonLocalReturn",
  37571. referencedClasses: [],
  37572. messageSends: ["visitIRInstruction:"]
  37573. }),
  37574. $globals.IRVisitor);
  37575. $core.addMethod(
  37576. $core.method({
  37577. selector: "visitIRNonLocalReturnHandling:",
  37578. protocol: 'visiting',
  37579. fn: function (anIRNonLocalReturnHandling){
  37580. var self=this;
  37581. return $core.withContext(function($ctx1) {
  37582. return self._visitIRInstruction_(anIRNonLocalReturnHandling);
  37583. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  37584. },
  37585. args: ["anIRNonLocalReturnHandling"],
  37586. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitIRInstruction: anIRNonLocalReturnHandling",
  37587. referencedClasses: [],
  37588. messageSends: ["visitIRInstruction:"]
  37589. }),
  37590. $globals.IRVisitor);
  37591. $core.addMethod(
  37592. $core.method({
  37593. selector: "visitIRReturn:",
  37594. protocol: 'visiting',
  37595. fn: function (anIRReturn){
  37596. var self=this;
  37597. return $core.withContext(function($ctx1) {
  37598. return self._visitIRInstruction_(anIRReturn);
  37599. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  37600. },
  37601. args: ["anIRReturn"],
  37602. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitIRInstruction: anIRReturn",
  37603. referencedClasses: [],
  37604. messageSends: ["visitIRInstruction:"]
  37605. }),
  37606. $globals.IRVisitor);
  37607. $core.addMethod(
  37608. $core.method({
  37609. selector: "visitIRSend:",
  37610. protocol: 'visiting',
  37611. fn: function (anIRSend){
  37612. var self=this;
  37613. return $core.withContext(function($ctx1) {
  37614. return self._visitIRInstruction_(anIRSend);
  37615. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  37616. },
  37617. args: ["anIRSend"],
  37618. source: "visitIRSend: anIRSend\x0a\x09^ self visitIRInstruction: anIRSend",
  37619. referencedClasses: [],
  37620. messageSends: ["visitIRInstruction:"]
  37621. }),
  37622. $globals.IRVisitor);
  37623. $core.addMethod(
  37624. $core.method({
  37625. selector: "visitIRSequence:",
  37626. protocol: 'visiting',
  37627. fn: function (anIRSequence){
  37628. var self=this;
  37629. return $core.withContext(function($ctx1) {
  37630. return self._visitIRInstruction_(anIRSequence);
  37631. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  37632. },
  37633. args: ["anIRSequence"],
  37634. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitIRInstruction: anIRSequence",
  37635. referencedClasses: [],
  37636. messageSends: ["visitIRInstruction:"]
  37637. }),
  37638. $globals.IRVisitor);
  37639. $core.addMethod(
  37640. $core.method({
  37641. selector: "visitIRTempDeclaration:",
  37642. protocol: 'visiting',
  37643. fn: function (anIRTempDeclaration){
  37644. var self=this;
  37645. return $core.withContext(function($ctx1) {
  37646. return self._visitIRInstruction_(anIRTempDeclaration);
  37647. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  37648. },
  37649. args: ["anIRTempDeclaration"],
  37650. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitIRInstruction: anIRTempDeclaration",
  37651. referencedClasses: [],
  37652. messageSends: ["visitIRInstruction:"]
  37653. }),
  37654. $globals.IRVisitor);
  37655. $core.addMethod(
  37656. $core.method({
  37657. selector: "visitIRValue:",
  37658. protocol: 'visiting',
  37659. fn: function (anIRValue){
  37660. var self=this;
  37661. return $core.withContext(function($ctx1) {
  37662. return self._visitIRInstruction_(anIRValue);
  37663. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  37664. },
  37665. args: ["anIRValue"],
  37666. source: "visitIRValue: anIRValue\x0a\x09^ self visitIRInstruction: anIRValue",
  37667. referencedClasses: [],
  37668. messageSends: ["visitIRInstruction:"]
  37669. }),
  37670. $globals.IRVisitor);
  37671. $core.addMethod(
  37672. $core.method({
  37673. selector: "visitIRVariable:",
  37674. protocol: 'visiting',
  37675. fn: function (anIRVariable){
  37676. var self=this;
  37677. return $core.withContext(function($ctx1) {
  37678. return self._visitIRInstruction_(anIRVariable);
  37679. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  37680. },
  37681. args: ["anIRVariable"],
  37682. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitIRInstruction: anIRVariable",
  37683. referencedClasses: [],
  37684. messageSends: ["visitIRInstruction:"]
  37685. }),
  37686. $globals.IRVisitor);
  37687. $core.addMethod(
  37688. $core.method({
  37689. selector: "visitIRVerbatim:",
  37690. protocol: 'visiting',
  37691. fn: function (anIRVerbatim){
  37692. var self=this;
  37693. return $core.withContext(function($ctx1) {
  37694. return self._visitIRInstruction_(anIRVerbatim);
  37695. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  37696. },
  37697. args: ["anIRVerbatim"],
  37698. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitIRInstruction: anIRVerbatim",
  37699. referencedClasses: [],
  37700. messageSends: ["visitIRInstruction:"]
  37701. }),
  37702. $globals.IRVisitor);
  37703. $core.addClass('IRJSTranslator', $globals.IRVisitor, ['stream', 'currentClass'], 'Compiler-IR');
  37704. $core.addMethod(
  37705. $core.method({
  37706. selector: "contents",
  37707. protocol: 'accessing',
  37708. fn: function (){
  37709. var self=this;
  37710. return $core.withContext(function($ctx1) {
  37711. return $recv(self._stream())._contents();
  37712. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  37713. },
  37714. args: [],
  37715. source: "contents\x0a\x09^ self stream contents",
  37716. referencedClasses: [],
  37717. messageSends: ["contents", "stream"]
  37718. }),
  37719. $globals.IRJSTranslator);
  37720. $core.addMethod(
  37721. $core.method({
  37722. selector: "currentClass",
  37723. protocol: 'accessing',
  37724. fn: function (){
  37725. var self=this;
  37726. return self["@currentClass"];
  37727. },
  37728. args: [],
  37729. source: "currentClass\x0a\x09^ currentClass",
  37730. referencedClasses: [],
  37731. messageSends: []
  37732. }),
  37733. $globals.IRJSTranslator);
  37734. $core.addMethod(
  37735. $core.method({
  37736. selector: "currentClass:",
  37737. protocol: 'accessing',
  37738. fn: function (aClass){
  37739. var self=this;
  37740. self["@currentClass"]=aClass;
  37741. return self;
  37742. },
  37743. args: ["aClass"],
  37744. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  37745. referencedClasses: [],
  37746. messageSends: []
  37747. }),
  37748. $globals.IRJSTranslator);
  37749. $core.addMethod(
  37750. $core.method({
  37751. selector: "initialize",
  37752. protocol: 'initialization',
  37753. fn: function (){
  37754. var self=this;
  37755. return $core.withContext(function($ctx1) {
  37756. (
  37757. $ctx1.supercall = true,
  37758. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  37759. $ctx1.supercall = false;
  37760. self["@stream"]=$recv($globals.JSStream)._new();
  37761. return self;
  37762. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  37763. },
  37764. args: [],
  37765. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  37766. referencedClasses: ["JSStream"],
  37767. messageSends: ["initialize", "new"]
  37768. }),
  37769. $globals.IRJSTranslator);
  37770. $core.addMethod(
  37771. $core.method({
  37772. selector: "stream",
  37773. protocol: 'accessing',
  37774. fn: function (){
  37775. var self=this;
  37776. return self["@stream"];
  37777. },
  37778. args: [],
  37779. source: "stream\x0a\x09^ stream",
  37780. referencedClasses: [],
  37781. messageSends: []
  37782. }),
  37783. $globals.IRJSTranslator);
  37784. $core.addMethod(
  37785. $core.method({
  37786. selector: "stream:",
  37787. protocol: 'accessing',
  37788. fn: function (aStream){
  37789. var self=this;
  37790. self["@stream"]=aStream;
  37791. return self;
  37792. },
  37793. args: ["aStream"],
  37794. source: "stream: aStream\x0a\x09stream := aStream",
  37795. referencedClasses: [],
  37796. messageSends: []
  37797. }),
  37798. $globals.IRJSTranslator);
  37799. $core.addMethod(
  37800. $core.method({
  37801. selector: "visitIRAssignment:",
  37802. protocol: 'visiting',
  37803. fn: function (anIRAssignment){
  37804. var self=this;
  37805. return $core.withContext(function($ctx1) {
  37806. var $2,$1;
  37807. $recv(self._stream())._nextPutAssignLhs_rhs_((function(){
  37808. return $core.withContext(function($ctx2) {
  37809. $2=$recv(anIRAssignment)._instructions();
  37810. $ctx2.sendIdx["instructions"]=1;
  37811. $1=$recv($2)._first();
  37812. return self._visit_($1);
  37813. $ctx2.sendIdx["visit:"]=1;
  37814. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37815. }),(function(){
  37816. return $core.withContext(function($ctx2) {
  37817. return self._visit_($recv($recv(anIRAssignment)._instructions())._last());
  37818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  37819. }));
  37820. return self;
  37821. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  37822. },
  37823. args: ["anIRAssignment"],
  37824. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment instructions first]\x0a\x09\x09rhs: [self visit: anIRAssignment instructions last].",
  37825. referencedClasses: [],
  37826. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "first", "instructions", "last"]
  37827. }),
  37828. $globals.IRJSTranslator);
  37829. $core.addMethod(
  37830. $core.method({
  37831. selector: "visitIRClosure:",
  37832. protocol: 'visiting',
  37833. fn: function (anIRClosure){
  37834. var self=this;
  37835. return $core.withContext(function($ctx1) {
  37836. var $1,$2;
  37837. $1=self._stream();
  37838. $ctx1.sendIdx["stream"]=1;
  37839. $recv($1)._nextPutClosureWith_arguments_((function(){
  37840. return $core.withContext(function($ctx2) {
  37841. $2=self._stream();
  37842. $ctx2.sendIdx["stream"]=2;
  37843. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  37844. return $core.withContext(function($ctx3) {
  37845. return $recv($recv(each)._name())._asVariableName();
  37846. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  37847. })));
  37848. return $recv(self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  37849. return $core.withContext(function($ctx3) {
  37850. return (
  37851. $ctx3.supercall = true,
  37852. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._visitIRClosure_.apply($recv(self), [anIRClosure]));
  37853. $ctx3.supercall = false;
  37854. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  37855. }));
  37856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37857. }),$recv(anIRClosure)._arguments());
  37858. return self;
  37859. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  37860. },
  37861. args: ["anIRClosure"],
  37862. 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",
  37863. referencedClasses: [],
  37864. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  37865. }),
  37866. $globals.IRJSTranslator);
  37867. $core.addMethod(
  37868. $core.method({
  37869. selector: "visitIRDynamicArray:",
  37870. protocol: 'visiting',
  37871. fn: function (anIRDynamicArray){
  37872. var self=this;
  37873. return $core.withContext(function($ctx1) {
  37874. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._instructions(),"[","]");
  37875. return self;
  37876. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  37877. },
  37878. args: ["anIRDynamicArray"],
  37879. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray instructions\x0a\x09\x09enclosedBetween: '[' and: ']'",
  37880. referencedClasses: [],
  37881. messageSends: ["visitInstructionList:enclosedBetween:and:", "instructions"]
  37882. }),
  37883. $globals.IRJSTranslator);
  37884. $core.addMethod(
  37885. $core.method({
  37886. selector: "visitIRDynamicDictionary:",
  37887. protocol: 'visiting',
  37888. fn: function (anIRDynamicDictionary){
  37889. var self=this;
  37890. return $core.withContext(function($ctx1) {
  37891. self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._instructions(),"$globals.HashedCollection._newFromPairs_([","])");
  37892. return self;
  37893. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  37894. },
  37895. args: ["anIRDynamicDictionary"],
  37896. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary instructions\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  37897. referencedClasses: [],
  37898. messageSends: ["visitInstructionList:enclosedBetween:and:", "instructions"]
  37899. }),
  37900. $globals.IRJSTranslator);
  37901. $core.addMethod(
  37902. $core.method({
  37903. selector: "visitIRMethod:",
  37904. protocol: 'visiting',
  37905. fn: function (anIRMethod){
  37906. var self=this;
  37907. return $core.withContext(function($ctx1) {
  37908. var $1,$2,$3,$4,$5,$7,$6,$8,$9;
  37909. $1=self._stream();
  37910. $ctx1.sendIdx["stream"]=1;
  37911. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  37912. return $core.withContext(function($ctx2) {
  37913. $2=self._stream();
  37914. $ctx2.sendIdx["stream"]=2;
  37915. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  37916. return $core.withContext(function($ctx3) {
  37917. $3=self._stream();
  37918. $ctx3.sendIdx["stream"]=3;
  37919. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  37920. return $core.withContext(function($ctx4) {
  37921. return $recv($recv(each)._name())._asVariableName();
  37922. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  37923. }));
  37924. $ctx3.sendIdx["collect:"]=1;
  37925. $recv($3)._nextPutVars_($4);
  37926. $ctx3.sendIdx["nextPutVars:"]=1;
  37927. $5=self._stream();
  37928. $ctx3.sendIdx["stream"]=4;
  37929. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  37930. return $core.withContext(function($ctx4) {
  37931. $7=$recv(anIRMethod)._internalVariables();
  37932. $ctx4.sendIdx["internalVariables"]=1;
  37933. $6=$recv($7)._notEmpty();
  37934. if($core.assert($6)){
  37935. $8=self._stream();
  37936. $ctx4.sendIdx["stream"]=5;
  37937. $recv($8)._nextPutVars_($recv($recv($recv(anIRMethod)._internalVariables())._asSet())._collect_((function(each){
  37938. return $core.withContext(function($ctx5) {
  37939. return $recv($recv(each)._variable())._alias();
  37940. }, function($ctx5) {$ctx5.fillBlock({each:each},$ctx4,6)});
  37941. })));
  37942. };
  37943. $9=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  37944. if($core.assert($9)){
  37945. return $recv(self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  37946. return $core.withContext(function($ctx5) {
  37947. return (
  37948. $ctx5.supercall = true,
  37949. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  37950. $ctx5.supercall = false;
  37951. $ctx5.sendIdx["visitIRMethod:"]=1;
  37952. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  37953. }));
  37954. } else {
  37955. return (
  37956. $ctx4.supercall = true,
  37957. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._visitIRMethod_.apply($recv(self), [anIRMethod]));
  37958. $ctx4.supercall = false;
  37959. };
  37960. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  37961. }));
  37962. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  37963. }),$recv(anIRMethod)._arguments());
  37964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37965. }));
  37966. return self;
  37967. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  37968. },
  37969. args: ["anIRMethod"],
  37970. 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\x09anIRMethod internalVariables notEmpty ifTrue: [\x0a\x09\x09\x09\x09\x09self stream nextPutVars: (anIRMethod internalVariables asSet collect: [ :each |\x0a\x09\x09\x09\x09\x09\x09each 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 ]",
  37971. referencedClasses: [],
  37972. messageSends: ["nextPutMethodDeclaration:with:", "stream", "nextPutFunctionWith:arguments:", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutContextFor:during:", "ifTrue:", "notEmpty", "internalVariables", "asSet", "alias", "variable", "ifTrue:ifFalse:", "hasNonLocalReturn", "scope", "nextPutNonLocalReturnHandlingWith:", "visitIRMethod:", "arguments"]
  37973. }),
  37974. $globals.IRJSTranslator);
  37975. $core.addMethod(
  37976. $core.method({
  37977. selector: "visitIRNonLocalReturn:",
  37978. protocol: 'visiting',
  37979. fn: function (anIRNonLocalReturn){
  37980. var self=this;
  37981. return $core.withContext(function($ctx1) {
  37982. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  37983. return $core.withContext(function($ctx2) {
  37984. return (
  37985. $ctx2.supercall = true,
  37986. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  37987. $ctx2.supercall = false;
  37988. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37989. }));
  37990. return self;
  37991. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  37992. },
  37993. args: ["anIRNonLocalReturn"],
  37994. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  37995. referencedClasses: [],
  37996. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  37997. }),
  37998. $globals.IRJSTranslator);
  37999. $core.addMethod(
  38000. $core.method({
  38001. selector: "visitIRReturn:",
  38002. protocol: 'visiting',
  38003. fn: function (anIRReturn){
  38004. var self=this;
  38005. return $core.withContext(function($ctx1) {
  38006. $recv(self._stream())._nextPutReturnWith_((function(){
  38007. return $core.withContext(function($ctx2) {
  38008. return (
  38009. $ctx2.supercall = true,
  38010. ($globals.IRJSTranslator.superclass||$boot.dnu).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  38011. $ctx2.supercall = false;
  38012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38013. }));
  38014. return self;
  38015. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  38016. },
  38017. args: ["anIRReturn"],
  38018. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  38019. referencedClasses: [],
  38020. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  38021. }),
  38022. $globals.IRJSTranslator);
  38023. $core.addMethod(
  38024. $core.method({
  38025. selector: "visitIRSend:",
  38026. protocol: 'visiting',
  38027. fn: function (anIRSend){
  38028. var self=this;
  38029. var sends,superclass;
  38030. return $core.withContext(function($ctx1) {
  38031. var $1,$2;
  38032. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  38033. $1=$recv(anIRSend)._isSuperSend();
  38034. if($core.assert($1)){
  38035. self._visitSuperSend_(anIRSend);
  38036. } else {
  38037. self._visitSend_(anIRSend);
  38038. };
  38039. $2=$recv($recv(sends).__gt((1)))._and_((function(){
  38040. return $core.withContext(function($ctx2) {
  38041. return $recv($recv(anIRSend)._index()).__lt(sends);
  38042. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38043. }));
  38044. if($core.assert($2)){
  38045. $recv(self._stream())._nextPutSendIndexFor_(anIRSend);
  38046. };
  38047. return self;
  38048. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  38049. },
  38050. args: ["anIRSend"],
  38051. 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 ]",
  38052. referencedClasses: [],
  38053. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuperSend", "visitSuperSend:", "visitSend:", "ifTrue:", "and:", ">", "<", "index", "nextPutSendIndexFor:", "stream"]
  38054. }),
  38055. $globals.IRJSTranslator);
  38056. $core.addMethod(
  38057. $core.method({
  38058. selector: "visitIRSequence:",
  38059. protocol: 'visiting',
  38060. fn: function (anIRSequence){
  38061. var self=this;
  38062. return $core.withContext(function($ctx1) {
  38063. var $1;
  38064. $1=self._stream();
  38065. $ctx1.sendIdx["stream"]=1;
  38066. $recv($1)._nextPutSequenceWith_((function(){
  38067. return $core.withContext(function($ctx2) {
  38068. return $recv($recv(anIRSequence)._instructions())._do_((function(each){
  38069. return $core.withContext(function($ctx3) {
  38070. return $recv(self._stream())._nextPutStatementWith_(self._visit_(each));
  38071. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  38072. }));
  38073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38074. }));
  38075. return self;
  38076. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  38077. },
  38078. args: ["anIRSequence"],
  38079. source: "visitIRSequence: anIRSequence\x0a\x09self stream nextPutSequenceWith: [\x0a\x09\x09anIRSequence instructions do: [ :each |\x0a\x09\x09\x09self stream nextPutStatementWith: (self visit: each) ] ]",
  38080. referencedClasses: [],
  38081. messageSends: ["nextPutSequenceWith:", "stream", "do:", "instructions", "nextPutStatementWith:", "visit:"]
  38082. }),
  38083. $globals.IRJSTranslator);
  38084. $core.addMethod(
  38085. $core.method({
  38086. selector: "visitIRTempDeclaration:",
  38087. protocol: 'visiting',
  38088. fn: function (anIRTempDeclaration){
  38089. var self=this;
  38090. return self;
  38091. },
  38092. args: ["anIRTempDeclaration"],
  38093. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  38094. referencedClasses: [],
  38095. messageSends: []
  38096. }),
  38097. $globals.IRJSTranslator);
  38098. $core.addMethod(
  38099. $core.method({
  38100. selector: "visitIRValue:",
  38101. protocol: 'visiting',
  38102. fn: function (anIRValue){
  38103. var self=this;
  38104. return $core.withContext(function($ctx1) {
  38105. $recv(self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavascript());
  38106. return self;
  38107. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  38108. },
  38109. args: ["anIRValue"],
  38110. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavascript",
  38111. referencedClasses: [],
  38112. messageSends: ["nextPutAll:", "stream", "asJavascript", "value"]
  38113. }),
  38114. $globals.IRJSTranslator);
  38115. $core.addMethod(
  38116. $core.method({
  38117. selector: "visitIRVariable:",
  38118. protocol: 'visiting',
  38119. fn: function (anIRVariable){
  38120. var self=this;
  38121. return $core.withContext(function($ctx1) {
  38122. var $3,$2,$1,$4;
  38123. $3=$recv(anIRVariable)._variable();
  38124. $ctx1.sendIdx["variable"]=1;
  38125. $2=$recv($3)._name();
  38126. $1=$recv($2).__eq("thisContext");
  38127. if($core.assert($1)){
  38128. $4=self._stream();
  38129. $ctx1.sendIdx["stream"]=1;
  38130. $recv($4)._nextPutAll_("$core.getThisContext()");
  38131. $ctx1.sendIdx["nextPutAll:"]=1;
  38132. } else {
  38133. $recv(self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  38134. };
  38135. return self;
  38136. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  38137. },
  38138. args: ["anIRVariable"],
  38139. 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 ]",
  38140. referencedClasses: [],
  38141. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  38142. }),
  38143. $globals.IRJSTranslator);
  38144. $core.addMethod(
  38145. $core.method({
  38146. selector: "visitIRVerbatim:",
  38147. protocol: 'visiting',
  38148. fn: function (anIRVerbatim){
  38149. var self=this;
  38150. return $core.withContext(function($ctx1) {
  38151. var $1;
  38152. $1=self._stream();
  38153. $ctx1.sendIdx["stream"]=1;
  38154. $recv($1)._nextPutStatementWith_((function(){
  38155. return $core.withContext(function($ctx2) {
  38156. return $recv(self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  38157. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38158. }));
  38159. return self;
  38160. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  38161. },
  38162. args: ["anIRVerbatim"],
  38163. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self stream nextPutAll: anIRVerbatim source ]",
  38164. referencedClasses: [],
  38165. messageSends: ["nextPutStatementWith:", "stream", "nextPutAll:", "source"]
  38166. }),
  38167. $globals.IRJSTranslator);
  38168. $core.addMethod(
  38169. $core.method({
  38170. selector: "visitInstructionList:enclosedBetween:and:",
  38171. protocol: 'visiting',
  38172. fn: function (anArray,aString,anotherString){
  38173. var self=this;
  38174. return $core.withContext(function($ctx1) {
  38175. var $1;
  38176. $1=self._stream();
  38177. $ctx1.sendIdx["stream"]=1;
  38178. $recv($1)._nextPutAll_(aString);
  38179. $ctx1.sendIdx["nextPutAll:"]=1;
  38180. $recv(anArray)._do_separatedBy_((function(each){
  38181. return $core.withContext(function($ctx2) {
  38182. return self._visit_(each);
  38183. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38184. }),(function(){
  38185. return $core.withContext(function($ctx2) {
  38186. return $recv(self._stream())._nextPutAll_(",");
  38187. $ctx2.sendIdx["nextPutAll:"]=2;
  38188. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38189. }));
  38190. $recv(self["@stream"])._nextPutAll_(anotherString);
  38191. return self;
  38192. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  38193. },
  38194. args: ["anArray", "aString", "anotherString"],
  38195. 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",
  38196. referencedClasses: [],
  38197. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  38198. }),
  38199. $globals.IRJSTranslator);
  38200. $core.addMethod(
  38201. $core.method({
  38202. selector: "visitReceiver:",
  38203. protocol: 'visiting',
  38204. fn: function (anIRInstruction){
  38205. var self=this;
  38206. return $core.withContext(function($ctx1) {
  38207. var $1,$2,$3;
  38208. $1=$recv(anIRInstruction)._needsBoxingAsReceiver();
  38209. if(!$core.assert($1)){
  38210. $2=self._visit_(anIRInstruction);
  38211. $ctx1.sendIdx["visit:"]=1;
  38212. return $2;
  38213. };
  38214. $3=self._stream();
  38215. $ctx1.sendIdx["stream"]=1;
  38216. $recv($3)._nextPutAll_("$recv(");
  38217. $ctx1.sendIdx["nextPutAll:"]=1;
  38218. self._visit_(anIRInstruction);
  38219. $recv(self._stream())._nextPutAll_(")");
  38220. return self;
  38221. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction},$globals.IRJSTranslator)});
  38222. },
  38223. args: ["anIRInstruction"],
  38224. 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: ')'",
  38225. referencedClasses: [],
  38226. messageSends: ["ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  38227. }),
  38228. $globals.IRJSTranslator);
  38229. $core.addMethod(
  38230. $core.method({
  38231. selector: "visitSend:",
  38232. protocol: 'visiting',
  38233. fn: function (anIRSend){
  38234. var self=this;
  38235. return $core.withContext(function($ctx1) {
  38236. var $2,$1;
  38237. $2=$recv(anIRSend)._instructions();
  38238. $ctx1.sendIdx["instructions"]=1;
  38239. $1=$recv($2)._first();
  38240. self._visitReceiver_($1);
  38241. $recv(self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  38242. self._visitInstructionList_enclosedBetween_and_($recv($recv(anIRSend)._instructions())._allButFirst(),"(",")");
  38243. return self;
  38244. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  38245. },
  38246. args: ["anIRSend"],
  38247. source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend instructions allButFirst\x0a\x09\x09enclosedBetween: '(' and: ')'",
  38248. referencedClasses: [],
  38249. messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "allButFirst"]
  38250. }),
  38251. $globals.IRJSTranslator);
  38252. $core.addMethod(
  38253. $core.method({
  38254. selector: "visitSuperSend:",
  38255. protocol: 'visiting',
  38256. fn: function (anIRSend){
  38257. var self=this;
  38258. return $core.withContext(function($ctx1) {
  38259. var $1,$4,$3,$2,$5,$6,$7,$8;
  38260. $1=self._stream();
  38261. $ctx1.sendIdx["stream"]=1;
  38262. $recv($1)._nextPutAll_("(");
  38263. $ctx1.sendIdx["nextPutAll:"]=1;
  38264. $recv($1)._lf();
  38265. $ctx1.sendIdx["lf"]=1;
  38266. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38267. $ctx1.sendIdx["nextPutAll:"]=2;
  38268. $recv($1)._lf();
  38269. $ctx1.sendIdx["lf"]=2;
  38270. $4=$recv(anIRSend)._scope();
  38271. $ctx1.sendIdx["scope"]=1;
  38272. $3=$recv($4)._alias();
  38273. $ctx1.sendIdx["alias"]=1;
  38274. $2=$recv($3).__comma(".supercall = true,");
  38275. $ctx1.sendIdx[","]=1;
  38276. $recv($1)._nextPutAll_($2);
  38277. $ctx1.sendIdx["nextPutAll:"]=3;
  38278. $recv($1)._lf();
  38279. $ctx1.sendIdx["lf"]=3;
  38280. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38281. $ctx1.sendIdx["nextPutAll:"]=4;
  38282. $recv($1)._lf();
  38283. $ctx1.sendIdx["lf"]=4;
  38284. $5="(".__comma($recv(self._currentClass())._asJavascript());
  38285. $ctx1.sendIdx[","]=2;
  38286. $recv($1)._nextPutAll_($5);
  38287. $ctx1.sendIdx["nextPutAll:"]=5;
  38288. $recv($1)._nextPutAll_(".superclass||$boot.dnu).fn.prototype.");
  38289. $ctx1.sendIdx["nextPutAll:"]=6;
  38290. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  38291. $ctx1.sendIdx[","]=3;
  38292. $recv($1)._nextPutAll_($6);
  38293. $ctx1.sendIdx["nextPutAll:"]=7;
  38294. $7=$recv($1)._nextPutAll_("$recv(self), ");
  38295. $ctx1.sendIdx["nextPutAll:"]=8;
  38296. self._visitInstructionList_enclosedBetween_and_($recv($recv(anIRSend)._instructions())._allButFirst(),"[","]");
  38297. $8=self._stream();
  38298. $recv($8)._nextPutAll_("));");
  38299. $ctx1.sendIdx["nextPutAll:"]=9;
  38300. $recv($8)._lf();
  38301. $ctx1.sendIdx["lf"]=5;
  38302. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38303. $ctx1.sendIdx["nextPutAll:"]=10;
  38304. $recv($8)._lf();
  38305. $ctx1.sendIdx["lf"]=6;
  38306. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  38307. $ctx1.sendIdx["nextPutAll:"]=11;
  38308. $recv($8)._lf();
  38309. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38310. return self;
  38311. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  38312. },
  38313. args: ["anIRSend"],
  38314. 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.dnu).fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$recv(self), '.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend instructions allButFirst\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);'",
  38315. referencedClasses: [],
  38316. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "allButFirst", "instructions"]
  38317. }),
  38318. $globals.IRJSTranslator);
  38319. $core.addClass('JSStream', $globals.Object, ['stream'], 'Compiler-IR');
  38320. $core.addMethod(
  38321. $core.method({
  38322. selector: "contents",
  38323. protocol: 'accessing',
  38324. fn: function (){
  38325. var self=this;
  38326. return $core.withContext(function($ctx1) {
  38327. return $recv(self["@stream"])._contents();
  38328. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  38329. },
  38330. args: [],
  38331. source: "contents\x0a\x09^ stream contents",
  38332. referencedClasses: [],
  38333. messageSends: ["contents"]
  38334. }),
  38335. $globals.JSStream);
  38336. $core.addMethod(
  38337. $core.method({
  38338. selector: "initialize",
  38339. protocol: 'initialization',
  38340. fn: function (){
  38341. var self=this;
  38342. return $core.withContext(function($ctx1) {
  38343. (
  38344. $ctx1.supercall = true,
  38345. ($globals.JSStream.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  38346. $ctx1.supercall = false;
  38347. self["@stream"]=""._writeStream();
  38348. return self;
  38349. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  38350. },
  38351. args: [],
  38352. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  38353. referencedClasses: [],
  38354. messageSends: ["initialize", "writeStream"]
  38355. }),
  38356. $globals.JSStream);
  38357. $core.addMethod(
  38358. $core.method({
  38359. selector: "lf",
  38360. protocol: 'streaming',
  38361. fn: function (){
  38362. var self=this;
  38363. return $core.withContext(function($ctx1) {
  38364. $recv(self["@stream"])._lf();
  38365. return self;
  38366. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  38367. },
  38368. args: [],
  38369. source: "lf\x0a\x09stream lf",
  38370. referencedClasses: [],
  38371. messageSends: ["lf"]
  38372. }),
  38373. $globals.JSStream);
  38374. $core.addMethod(
  38375. $core.method({
  38376. selector: "nextPut:",
  38377. protocol: 'streaming',
  38378. fn: function (aString){
  38379. var self=this;
  38380. return $core.withContext(function($ctx1) {
  38381. $recv(self["@stream"])._nextPut_(aString);
  38382. return self;
  38383. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  38384. },
  38385. args: ["aString"],
  38386. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  38387. referencedClasses: [],
  38388. messageSends: ["nextPut:"]
  38389. }),
  38390. $globals.JSStream);
  38391. $core.addMethod(
  38392. $core.method({
  38393. selector: "nextPutAll:",
  38394. protocol: 'streaming',
  38395. fn: function (aString){
  38396. var self=this;
  38397. return $core.withContext(function($ctx1) {
  38398. $recv(self["@stream"])._nextPutAll_(aString);
  38399. return self;
  38400. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  38401. },
  38402. args: ["aString"],
  38403. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  38404. referencedClasses: [],
  38405. messageSends: ["nextPutAll:"]
  38406. }),
  38407. $globals.JSStream);
  38408. $core.addMethod(
  38409. $core.method({
  38410. selector: "nextPutAssignLhs:rhs:",
  38411. protocol: 'streaming',
  38412. fn: function (aBlock,anotherBlock){
  38413. var self=this;
  38414. return $core.withContext(function($ctx1) {
  38415. $recv(aBlock)._value();
  38416. $ctx1.sendIdx["value"]=1;
  38417. $recv(self["@stream"])._nextPutAll_("=");
  38418. $recv(anotherBlock)._value();
  38419. return self;
  38420. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  38421. },
  38422. args: ["aBlock", "anotherBlock"],
  38423. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  38424. referencedClasses: [],
  38425. messageSends: ["value", "nextPutAll:"]
  38426. }),
  38427. $globals.JSStream);
  38428. $core.addMethod(
  38429. $core.method({
  38430. selector: "nextPutBlockContextFor:during:",
  38431. protocol: 'streaming',
  38432. fn: function (anIRClosure,aBlock){
  38433. var self=this;
  38434. return $core.withContext(function($ctx1) {
  38435. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  38436. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  38437. if(!$core.assert($1)){
  38438. $2=$recv(aBlock)._value();
  38439. $ctx1.sendIdx["value"]=1;
  38440. return $2;
  38441. };
  38442. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38443. $ctx1.sendIdx["nextPutAll:"]=1;
  38444. self._lf();
  38445. $ctx1.sendIdx["lf"]=1;
  38446. $6=$recv(anIRClosure)._scope();
  38447. $ctx1.sendIdx["scope"]=1;
  38448. $5=$recv($6)._alias();
  38449. $ctx1.sendIdx["alias"]=1;
  38450. $4="return $core.withContext(function(".__comma($5);
  38451. $ctx1.sendIdx[","]=2;
  38452. $3=$recv($4).__comma(") {");
  38453. $ctx1.sendIdx[","]=1;
  38454. self._nextPutAll_($3);
  38455. $ctx1.sendIdx["nextPutAll:"]=2;
  38456. self._lf();
  38457. $ctx1.sendIdx["lf"]=2;
  38458. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38459. $ctx1.sendIdx["nextPutAll:"]=3;
  38460. $7=self._lf();
  38461. $ctx1.sendIdx["lf"]=3;
  38462. $recv(aBlock)._value();
  38463. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38464. $ctx1.sendIdx["nextPutAll:"]=4;
  38465. self._lf();
  38466. $ctx1.sendIdx["lf"]=4;
  38467. $11=$recv(anIRClosure)._scope();
  38468. $ctx1.sendIdx["scope"]=2;
  38469. $10=$recv($11)._alias();
  38470. $ctx1.sendIdx["alias"]=2;
  38471. $9="}, function(".__comma($10);
  38472. $ctx1.sendIdx[","]=4;
  38473. $8=$recv($9).__comma(") {");
  38474. $ctx1.sendIdx[","]=3;
  38475. self._nextPutAll_($8);
  38476. $ctx1.sendIdx["nextPutAll:"]=5;
  38477. $15=$recv(anIRClosure)._scope();
  38478. $ctx1.sendIdx["scope"]=3;
  38479. $14=$recv($15)._alias();
  38480. $ctx1.sendIdx["alias"]=3;
  38481. $13=$recv($14).__comma(".fillBlock({");
  38482. $ctx1.sendIdx[","]=5;
  38483. $12=self._nextPutAll_($13);
  38484. $ctx1.sendIdx["nextPutAll:"]=6;
  38485. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  38486. return $core.withContext(function($ctx2) {
  38487. $16=$recv(each)._asVariableName();
  38488. $ctx2.sendIdx["asVariableName"]=1;
  38489. self._nextPutAll_($16);
  38490. $ctx2.sendIdx["nextPutAll:"]=7;
  38491. self._nextPutAll_(":");
  38492. $ctx2.sendIdx["nextPutAll:"]=8;
  38493. $17=self._nextPutAll_($recv(each)._asVariableName());
  38494. $ctx2.sendIdx["nextPutAll:"]=9;
  38495. return $17;
  38496. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38497. }),(function(){
  38498. return $core.withContext(function($ctx2) {
  38499. return self._nextPutAll_(",");
  38500. $ctx2.sendIdx["nextPutAll:"]=10;
  38501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38502. }));
  38503. self._nextPutAll_("},");
  38504. $ctx1.sendIdx["nextPutAll:"]=11;
  38505. $23=$recv(anIRClosure)._scope();
  38506. $ctx1.sendIdx["scope"]=4;
  38507. $22=$recv($23)._outerScope();
  38508. $21=$recv($22)._alias();
  38509. $20=$recv($21).__comma(",");
  38510. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  38511. $ctx1.sendIdx[","]=7;
  38512. $18=$recv($19).__comma(")});");
  38513. $ctx1.sendIdx[","]=6;
  38514. self._nextPutAll_($18);
  38515. $ctx1.sendIdx["nextPutAll:"]=12;
  38516. self._lf();
  38517. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38518. return self;
  38519. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  38520. },
  38521. args: ["anIRClosure", "aBlock"],
  38522. 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);'",
  38523. referencedClasses: [],
  38524. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  38525. }),
  38526. $globals.JSStream);
  38527. $core.addMethod(
  38528. $core.method({
  38529. selector: "nextPutClosureWith:arguments:",
  38530. protocol: 'streaming',
  38531. fn: function (aBlock,anArray){
  38532. var self=this;
  38533. return $core.withContext(function($ctx1) {
  38534. var $1,$2,$3;
  38535. $recv(self["@stream"])._nextPutAll_("(function(");
  38536. $ctx1.sendIdx["nextPutAll:"]=1;
  38537. $recv(anArray)._do_separatedBy_((function(each){
  38538. return $core.withContext(function($ctx2) {
  38539. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  38540. $ctx2.sendIdx["nextPutAll:"]=2;
  38541. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38542. }),(function(){
  38543. return $core.withContext(function($ctx2) {
  38544. return $recv(self["@stream"])._nextPut_(",");
  38545. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38546. }));
  38547. $1=self["@stream"];
  38548. $recv($1)._nextPutAll_("){");
  38549. $ctx1.sendIdx["nextPutAll:"]=3;
  38550. $2=$recv($1)._lf();
  38551. $ctx1.sendIdx["lf"]=1;
  38552. $recv(aBlock)._value();
  38553. $3=self["@stream"];
  38554. $recv($3)._lf();
  38555. $recv($3)._nextPutAll_("})");
  38556. return self;
  38557. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  38558. },
  38559. args: ["aBlock", "anArray"],
  38560. 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: '})'",
  38561. referencedClasses: [],
  38562. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  38563. }),
  38564. $globals.JSStream);
  38565. $core.addMethod(
  38566. $core.method({
  38567. selector: "nextPutContextFor:during:",
  38568. protocol: 'streaming',
  38569. fn: function (aMethod,aBlock){
  38570. var self=this;
  38571. return $core.withContext(function($ctx1) {
  38572. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  38573. $1=$recv(aMethod)._requiresSmalltalkContext();
  38574. if(!$core.assert($1)){
  38575. $2=$recv(aBlock)._value();
  38576. $ctx1.sendIdx["value"]=1;
  38577. return $2;
  38578. };
  38579. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38580. $ctx1.sendIdx["nextPutAll:"]=1;
  38581. self._lf();
  38582. $ctx1.sendIdx["lf"]=1;
  38583. $6=$recv(aMethod)._scope();
  38584. $ctx1.sendIdx["scope"]=1;
  38585. $5=$recv($6)._alias();
  38586. $ctx1.sendIdx["alias"]=1;
  38587. $4="return $core.withContext(function(".__comma($5);
  38588. $ctx1.sendIdx[","]=2;
  38589. $3=$recv($4).__comma(") {");
  38590. $ctx1.sendIdx[","]=1;
  38591. self._nextPutAll_($3);
  38592. $ctx1.sendIdx["nextPutAll:"]=2;
  38593. self._lf();
  38594. $ctx1.sendIdx["lf"]=2;
  38595. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38596. $ctx1.sendIdx["nextPutAll:"]=3;
  38597. $7=self._lf();
  38598. $ctx1.sendIdx["lf"]=3;
  38599. $recv(aBlock)._value();
  38600. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38601. $ctx1.sendIdx["nextPutAll:"]=4;
  38602. self._lf();
  38603. $ctx1.sendIdx["lf"]=4;
  38604. $12=$recv(aMethod)._scope();
  38605. $ctx1.sendIdx["scope"]=2;
  38606. $11=$recv($12)._alias();
  38607. $ctx1.sendIdx["alias"]=2;
  38608. $10="}, function(".__comma($11);
  38609. $ctx1.sendIdx[","]=5;
  38610. $9=$recv($10).__comma(") {");
  38611. $ctx1.sendIdx[","]=4;
  38612. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  38613. $ctx1.sendIdx[","]=3;
  38614. self._nextPutAll_($8);
  38615. $ctx1.sendIdx["nextPutAll:"]=5;
  38616. $16=$recv($recv(aMethod)._selector())._asJavascript();
  38617. $ctx1.sendIdx["asJavascript"]=1;
  38618. $15=".fill(self,".__comma($16);
  38619. $14=$recv($15).__comma(",{");
  38620. $ctx1.sendIdx[","]=6;
  38621. $13=self._nextPutAll_($14);
  38622. $ctx1.sendIdx["nextPutAll:"]=6;
  38623. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  38624. return $core.withContext(function($ctx2) {
  38625. $17=$recv(each)._asVariableName();
  38626. $ctx2.sendIdx["asVariableName"]=1;
  38627. self._nextPutAll_($17);
  38628. $ctx2.sendIdx["nextPutAll:"]=7;
  38629. self._nextPutAll_(":");
  38630. $ctx2.sendIdx["nextPutAll:"]=8;
  38631. $18=self._nextPutAll_($recv(each)._asVariableName());
  38632. $ctx2.sendIdx["nextPutAll:"]=9;
  38633. return $18;
  38634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38635. }),(function(){
  38636. return $core.withContext(function($ctx2) {
  38637. return self._nextPutAll_(",");
  38638. $ctx2.sendIdx["nextPutAll:"]=10;
  38639. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38640. }));
  38641. self._nextPutAll_("},");
  38642. $ctx1.sendIdx["nextPutAll:"]=11;
  38643. self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavascript());
  38644. $ctx1.sendIdx["nextPutAll:"]=12;
  38645. self._nextPutAll_(")});");
  38646. $ctx1.sendIdx["nextPutAll:"]=13;
  38647. self._lf();
  38648. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  38649. return self;
  38650. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  38651. },
  38652. args: ["aMethod", "aBlock"],
  38653. 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);'",
  38654. referencedClasses: [],
  38655. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavascript", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  38656. }),
  38657. $globals.JSStream);
  38658. $core.addMethod(
  38659. $core.method({
  38660. selector: "nextPutFunctionWith:arguments:",
  38661. protocol: 'streaming',
  38662. fn: function (aBlock,anArray){
  38663. var self=this;
  38664. return $core.withContext(function($ctx1) {
  38665. var $1,$2,$3,$4,$5;
  38666. $recv(self["@stream"])._nextPutAll_("fn: function(");
  38667. $ctx1.sendIdx["nextPutAll:"]=1;
  38668. $recv(anArray)._do_separatedBy_((function(each){
  38669. return $core.withContext(function($ctx2) {
  38670. return $recv(self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  38671. $ctx2.sendIdx["nextPutAll:"]=2;
  38672. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38673. }),(function(){
  38674. return $core.withContext(function($ctx2) {
  38675. return $recv(self["@stream"])._nextPut_(",");
  38676. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  38677. }));
  38678. $1=self["@stream"];
  38679. $recv($1)._nextPutAll_("){");
  38680. $ctx1.sendIdx["nextPutAll:"]=3;
  38681. $2=$recv($1)._lf();
  38682. $ctx1.sendIdx["lf"]=1;
  38683. $3=self["@stream"];
  38684. $recv($3)._nextPutAll_("var self=this;");
  38685. $ctx1.sendIdx["nextPutAll:"]=4;
  38686. $4=$recv($3)._lf();
  38687. $ctx1.sendIdx["lf"]=2;
  38688. $recv(aBlock)._value();
  38689. $5=self["@stream"];
  38690. $recv($5)._lf();
  38691. $recv($5)._nextPutAll_("}");
  38692. return self;
  38693. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  38694. },
  38695. args: ["aBlock", "anArray"],
  38696. 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: '}'",
  38697. referencedClasses: [],
  38698. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  38699. }),
  38700. $globals.JSStream);
  38701. $core.addMethod(
  38702. $core.method({
  38703. selector: "nextPutIf:then:",
  38704. protocol: 'streaming',
  38705. fn: function (aBlock,anotherBlock){
  38706. var self=this;
  38707. return $core.withContext(function($ctx1) {
  38708. var $1;
  38709. $recv(self["@stream"])._nextPutAll_("if(");
  38710. $ctx1.sendIdx["nextPutAll:"]=1;
  38711. $recv(aBlock)._value();
  38712. $ctx1.sendIdx["value"]=1;
  38713. $1=self["@stream"];
  38714. $recv($1)._nextPutAll_("){");
  38715. $ctx1.sendIdx["nextPutAll:"]=2;
  38716. $recv($1)._lf();
  38717. $recv(anotherBlock)._value();
  38718. $recv(self["@stream"])._nextPutAll_("}");
  38719. return self;
  38720. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  38721. },
  38722. args: ["aBlock", "anotherBlock"],
  38723. source: "nextPutIf: aBlock then: anotherBlock\x0a\x09stream nextPutAll: 'if('.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '){'; lf.\x0a\x09anotherBlock value.\x0a\x09stream nextPutAll: '}'",
  38724. referencedClasses: [],
  38725. messageSends: ["nextPutAll:", "value", "lf"]
  38726. }),
  38727. $globals.JSStream);
  38728. $core.addMethod(
  38729. $core.method({
  38730. selector: "nextPutIf:then:else:",
  38731. protocol: 'streaming',
  38732. fn: function (aBlock,ifBlock,elseBlock){
  38733. var self=this;
  38734. return $core.withContext(function($ctx1) {
  38735. var $1,$2,$3;
  38736. $recv(self["@stream"])._nextPutAll_("if(");
  38737. $ctx1.sendIdx["nextPutAll:"]=1;
  38738. $recv(aBlock)._value();
  38739. $ctx1.sendIdx["value"]=1;
  38740. $1=self["@stream"];
  38741. $recv($1)._nextPutAll_("){");
  38742. $ctx1.sendIdx["nextPutAll:"]=2;
  38743. $2=$recv($1)._lf();
  38744. $ctx1.sendIdx["lf"]=1;
  38745. $recv(ifBlock)._value();
  38746. $ctx1.sendIdx["value"]=2;
  38747. $3=self["@stream"];
  38748. $recv($3)._nextPutAll_("} else {");
  38749. $ctx1.sendIdx["nextPutAll:"]=3;
  38750. $recv($3)._lf();
  38751. $recv(elseBlock)._value();
  38752. $recv(self["@stream"])._nextPutAll_("}");
  38753. return self;
  38754. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  38755. },
  38756. args: ["aBlock", "ifBlock", "elseBlock"],
  38757. 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: '}'",
  38758. referencedClasses: [],
  38759. messageSends: ["nextPutAll:", "value", "lf"]
  38760. }),
  38761. $globals.JSStream);
  38762. $core.addMethod(
  38763. $core.method({
  38764. selector: "nextPutMethodDeclaration:with:",
  38765. protocol: 'streaming',
  38766. fn: function (aMethod,aBlock){
  38767. var self=this;
  38768. return $core.withContext(function($ctx1) {
  38769. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  38770. $1=self["@stream"];
  38771. $recv($1)._nextPutAll_("$core.method({");
  38772. $ctx1.sendIdx["nextPutAll:"]=1;
  38773. $recv($1)._lf();
  38774. $ctx1.sendIdx["lf"]=1;
  38775. $4=$recv($recv(aMethod)._selector())._asJavascript();
  38776. $ctx1.sendIdx["asJavascript"]=1;
  38777. $3="selector: ".__comma($4);
  38778. $ctx1.sendIdx[","]=2;
  38779. $2=$recv($3).__comma(",");
  38780. $ctx1.sendIdx[","]=1;
  38781. $recv($1)._nextPutAll_($2);
  38782. $ctx1.sendIdx["nextPutAll:"]=2;
  38783. $recv($1)._lf();
  38784. $ctx1.sendIdx["lf"]=2;
  38785. $7=$recv($recv(aMethod)._source())._asJavascript();
  38786. $ctx1.sendIdx["asJavascript"]=2;
  38787. $6="source: ".__comma($7);
  38788. $ctx1.sendIdx[","]=4;
  38789. $5=$recv($6).__comma(",");
  38790. $ctx1.sendIdx[","]=3;
  38791. $recv($1)._nextPutAll_($5);
  38792. $ctx1.sendIdx["nextPutAll:"]=3;
  38793. $8=$recv($1)._lf();
  38794. $ctx1.sendIdx["lf"]=3;
  38795. $recv(aBlock)._value();
  38796. $ctx1.sendIdx["value"]=1;
  38797. $9=self["@stream"];
  38798. $12=$recv($globals.String)._lf();
  38799. $ctx1.sendIdx["lf"]=4;
  38800. $11=",".__comma($12);
  38801. $ctx1.sendIdx[","]=6;
  38802. $10=$recv($11).__comma("messageSends: ");
  38803. $ctx1.sendIdx[","]=5;
  38804. $recv($9)._nextPutAll_($10);
  38805. $ctx1.sendIdx["nextPutAll:"]=4;
  38806. $15=$recv($recv(aMethod)._messageSends())._asArray();
  38807. $ctx1.sendIdx["asArray"]=1;
  38808. $14=$recv($15)._asJavascript();
  38809. $ctx1.sendIdx["asJavascript"]=3;
  38810. $13=$recv($14).__comma(",");
  38811. $ctx1.sendIdx[","]=7;
  38812. $recv($9)._nextPutAll_($13);
  38813. $ctx1.sendIdx["nextPutAll:"]=5;
  38814. $recv($9)._lf();
  38815. $ctx1.sendIdx["lf"]=5;
  38816. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  38817. return $core.withContext(function($ctx2) {
  38818. return $recv(each)._value();
  38819. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38820. })))._asArray())._asJavascript();
  38821. $ctx1.sendIdx["asJavascript"]=4;
  38822. $17="args: ".__comma($18);
  38823. $16=$recv($17).__comma(",");
  38824. $ctx1.sendIdx[","]=8;
  38825. $recv($9)._nextPutAll_($16);
  38826. $ctx1.sendIdx["nextPutAll:"]=6;
  38827. $recv($9)._lf();
  38828. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  38829. $ctx1.sendIdx["nextPutAll:"]=7;
  38830. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  38831. return $core.withContext(function($ctx2) {
  38832. return $recv(self["@stream"])._nextPutAll_($recv(each)._asJavascript());
  38833. $ctx2.sendIdx["nextPutAll:"]=8;
  38834. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38835. }),(function(){
  38836. return $core.withContext(function($ctx2) {
  38837. return $recv(self["@stream"])._nextPutAll_(",");
  38838. $ctx2.sendIdx["nextPutAll:"]=9;
  38839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  38840. }));
  38841. $20=self["@stream"];
  38842. $recv($20)._nextPutAll_("]");
  38843. $ctx1.sendIdx["nextPutAll:"]=10;
  38844. $recv($20)._nextPutAll_("})");
  38845. return self;
  38846. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  38847. },
  38848. args: ["aMethod", "aBlock"],
  38849. 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: '})'",
  38850. referencedClasses: ["String"],
  38851. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  38852. }),
  38853. $globals.JSStream);
  38854. $core.addMethod(
  38855. $core.method({
  38856. selector: "nextPutNonLocalReturnHandlingWith:",
  38857. protocol: 'streaming',
  38858. fn: function (aBlock){
  38859. var self=this;
  38860. return $core.withContext(function($ctx1) {
  38861. var $1,$2,$3;
  38862. $1=self["@stream"];
  38863. $recv($1)._nextPutAll_("var $early={};");
  38864. $ctx1.sendIdx["nextPutAll:"]=1;
  38865. $recv($1)._lf();
  38866. $ctx1.sendIdx["lf"]=1;
  38867. $recv($1)._nextPutAll_("try {");
  38868. $ctx1.sendIdx["nextPutAll:"]=2;
  38869. $2=$recv($1)._lf();
  38870. $ctx1.sendIdx["lf"]=2;
  38871. $recv(aBlock)._value();
  38872. $3=self["@stream"];
  38873. $recv($3)._nextPutAll_("}");
  38874. $ctx1.sendIdx["nextPutAll:"]=3;
  38875. $recv($3)._lf();
  38876. $ctx1.sendIdx["lf"]=3;
  38877. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  38878. $recv($3)._lf();
  38879. return self;
  38880. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  38881. },
  38882. args: ["aBlock"],
  38883. 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",
  38884. referencedClasses: [],
  38885. messageSends: ["nextPutAll:", "lf", "value"]
  38886. }),
  38887. $globals.JSStream);
  38888. $core.addMethod(
  38889. $core.method({
  38890. selector: "nextPutNonLocalReturnWith:",
  38891. protocol: 'streaming',
  38892. fn: function (aBlock){
  38893. var self=this;
  38894. return $core.withContext(function($ctx1) {
  38895. $recv(self["@stream"])._nextPutAll_("throw $early=[");
  38896. $ctx1.sendIdx["nextPutAll:"]=1;
  38897. $recv(aBlock)._value();
  38898. $recv(self["@stream"])._nextPutAll_("]");
  38899. return self;
  38900. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  38901. },
  38902. args: ["aBlock"],
  38903. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  38904. referencedClasses: [],
  38905. messageSends: ["nextPutAll:", "value"]
  38906. }),
  38907. $globals.JSStream);
  38908. $core.addMethod(
  38909. $core.method({
  38910. selector: "nextPutReturnWith:",
  38911. protocol: 'streaming',
  38912. fn: function (aBlock){
  38913. var self=this;
  38914. return $core.withContext(function($ctx1) {
  38915. $recv(self["@stream"])._nextPutAll_("return ");
  38916. $recv(aBlock)._value();
  38917. return self;
  38918. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  38919. },
  38920. args: ["aBlock"],
  38921. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  38922. referencedClasses: [],
  38923. messageSends: ["nextPutAll:", "value"]
  38924. }),
  38925. $globals.JSStream);
  38926. $core.addMethod(
  38927. $core.method({
  38928. selector: "nextPutSendIndexFor:",
  38929. protocol: 'streaming',
  38930. fn: function (anIRSend){
  38931. var self=this;
  38932. return $core.withContext(function($ctx1) {
  38933. self._nextPutAll_(";");
  38934. $ctx1.sendIdx["nextPutAll:"]=1;
  38935. self._lf();
  38936. $ctx1.sendIdx["lf"]=1;
  38937. self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  38938. $ctx1.sendIdx["nextPutAll:"]=2;
  38939. self._lf();
  38940. $ctx1.sendIdx["lf"]=2;
  38941. self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  38942. $ctx1.sendIdx["nextPutAll:"]=3;
  38943. self._nextPutAll_(".sendIdx[");
  38944. $ctx1.sendIdx["nextPutAll:"]=4;
  38945. self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavascript());
  38946. $ctx1.sendIdx["nextPutAll:"]=5;
  38947. self._nextPutAll_("]=");
  38948. $ctx1.sendIdx["nextPutAll:"]=6;
  38949. self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  38950. $ctx1.sendIdx["nextPutAll:"]=7;
  38951. self._nextPutAll_(";");
  38952. $ctx1.sendIdx["nextPutAll:"]=8;
  38953. self._lf();
  38954. self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  38955. return self;
  38956. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  38957. },
  38958. args: ["anIRSend"],
  38959. 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)'",
  38960. referencedClasses: [],
  38961. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavascript", "selector", "asString", "index"]
  38962. }),
  38963. $globals.JSStream);
  38964. $core.addMethod(
  38965. $core.method({
  38966. selector: "nextPutSequenceWith:",
  38967. protocol: 'streaming',
  38968. fn: function (aBlock){
  38969. var self=this;
  38970. return $core.withContext(function($ctx1) {
  38971. $recv(aBlock)._value();
  38972. return self;
  38973. }, function($ctx1) {$ctx1.fill(self,"nextPutSequenceWith:",{aBlock:aBlock},$globals.JSStream)});
  38974. },
  38975. args: ["aBlock"],
  38976. 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",
  38977. referencedClasses: [],
  38978. messageSends: ["value"]
  38979. }),
  38980. $globals.JSStream);
  38981. $core.addMethod(
  38982. $core.method({
  38983. selector: "nextPutStatementWith:",
  38984. protocol: 'streaming',
  38985. fn: function (aBlock){
  38986. var self=this;
  38987. return $core.withContext(function($ctx1) {
  38988. var $1;
  38989. $recv(aBlock)._value();
  38990. $1=self["@stream"];
  38991. $recv($1)._nextPutAll_(";");
  38992. $recv($1)._lf();
  38993. return self;
  38994. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  38995. },
  38996. args: ["aBlock"],
  38997. source: "nextPutStatementWith: aBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ';'; lf",
  38998. referencedClasses: [],
  38999. messageSends: ["value", "nextPutAll:", "lf"]
  39000. }),
  39001. $globals.JSStream);
  39002. $core.addMethod(
  39003. $core.method({
  39004. selector: "nextPutVars:",
  39005. protocol: 'streaming',
  39006. fn: function (aCollection){
  39007. var self=this;
  39008. return $core.withContext(function($ctx1) {
  39009. var $1;
  39010. $recv(aCollection)._ifNotEmpty_((function(){
  39011. return $core.withContext(function($ctx2) {
  39012. $recv(self["@stream"])._nextPutAll_("var ");
  39013. $ctx2.sendIdx["nextPutAll:"]=1;
  39014. $recv(aCollection)._do_separatedBy_((function(each){
  39015. return $core.withContext(function($ctx3) {
  39016. return $recv(self["@stream"])._nextPutAll_(each);
  39017. $ctx3.sendIdx["nextPutAll:"]=2;
  39018. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39019. }),(function(){
  39020. return $core.withContext(function($ctx3) {
  39021. return $recv(self["@stream"])._nextPutAll_(",");
  39022. $ctx3.sendIdx["nextPutAll:"]=3;
  39023. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  39024. }));
  39025. $1=self["@stream"];
  39026. $recv($1)._nextPutAll_(";");
  39027. return $recv($1)._lf();
  39028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39029. }));
  39030. return self;
  39031. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  39032. },
  39033. args: ["aCollection"],
  39034. 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 ]",
  39035. referencedClasses: [],
  39036. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  39037. }),
  39038. $globals.JSStream);
  39039. $core.addMethod(
  39040. $core.method({
  39041. selector: "appendToInstruction:",
  39042. protocol: '*Compiler-IR',
  39043. fn: function (anIRInstruction){
  39044. var self=this;
  39045. return $core.withContext(function($ctx1) {
  39046. $recv(anIRInstruction)._appendBlock_(self);
  39047. return self;
  39048. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  39049. },
  39050. args: ["anIRInstruction"],
  39051. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  39052. referencedClasses: [],
  39053. messageSends: ["appendBlock:"]
  39054. }),
  39055. $globals.BlockClosure);
  39056. });
  39057. define("amber_core/Compiler-Inlining", ["amber/boot", "amber_core/Compiler-IR", "amber_core/Kernel-Objects", "amber_core/Compiler-Core", "amber_core/Compiler-Semantic"], function($boot){"use strict";
  39058. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  39059. $core.addPackage('Compiler-Inlining');
  39060. $core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  39061. $core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  39062. $core.addClass('IRInlinedAssignment', $globals.IRAssignment, [], 'Compiler-Inlining');
  39063. $globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
  39064. $core.addMethod(
  39065. $core.method({
  39066. selector: "accept:",
  39067. protocol: 'visiting',
  39068. fn: function (aVisitor){
  39069. var self=this;
  39070. return $core.withContext(function($ctx1) {
  39071. return $recv(aVisitor)._visitIRInlinedAssignment_(self);
  39072. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedAssignment)});
  39073. },
  39074. args: ["aVisitor"],
  39075. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  39076. referencedClasses: [],
  39077. messageSends: ["visitIRInlinedAssignment:"]
  39078. }),
  39079. $globals.IRInlinedAssignment);
  39080. $core.addMethod(
  39081. $core.method({
  39082. selector: "isInlined",
  39083. protocol: 'testing',
  39084. fn: function (){
  39085. var self=this;
  39086. return true;
  39087. },
  39088. args: [],
  39089. source: "isInlined\x0a\x09^ true",
  39090. referencedClasses: [],
  39091. messageSends: []
  39092. }),
  39093. $globals.IRInlinedAssignment);
  39094. $core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining');
  39095. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  39096. $core.addMethod(
  39097. $core.method({
  39098. selector: "accept:",
  39099. protocol: 'visiting',
  39100. fn: function (aVisitor){
  39101. var self=this;
  39102. return $core.withContext(function($ctx1) {
  39103. $recv(aVisitor)._visitIRInlinedClosure_(self);
  39104. return self;
  39105. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  39106. },
  39107. args: ["aVisitor"],
  39108. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  39109. referencedClasses: [],
  39110. messageSends: ["visitIRInlinedClosure:"]
  39111. }),
  39112. $globals.IRInlinedClosure);
  39113. $core.addMethod(
  39114. $core.method({
  39115. selector: "isInlined",
  39116. protocol: 'testing',
  39117. fn: function (){
  39118. var self=this;
  39119. return true;
  39120. },
  39121. args: [],
  39122. source: "isInlined\x0a\x09^ true",
  39123. referencedClasses: [],
  39124. messageSends: []
  39125. }),
  39126. $globals.IRInlinedClosure);
  39127. $core.addClass('IRInlinedReturn', $globals.IRReturn, [], 'Compiler-Inlining');
  39128. $globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
  39129. $core.addMethod(
  39130. $core.method({
  39131. selector: "accept:",
  39132. protocol: 'visiting',
  39133. fn: function (aVisitor){
  39134. var self=this;
  39135. return $core.withContext(function($ctx1) {
  39136. return $recv(aVisitor)._visitIRInlinedReturn_(self);
  39137. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedReturn)});
  39138. },
  39139. args: ["aVisitor"],
  39140. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  39141. referencedClasses: [],
  39142. messageSends: ["visitIRInlinedReturn:"]
  39143. }),
  39144. $globals.IRInlinedReturn);
  39145. $core.addMethod(
  39146. $core.method({
  39147. selector: "isInlined",
  39148. protocol: 'testing',
  39149. fn: function (){
  39150. var self=this;
  39151. return true;
  39152. },
  39153. args: [],
  39154. source: "isInlined\x0a\x09^ true",
  39155. referencedClasses: [],
  39156. messageSends: []
  39157. }),
  39158. $globals.IRInlinedReturn);
  39159. $core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining');
  39160. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  39161. $core.addMethod(
  39162. $core.method({
  39163. selector: "accept:",
  39164. protocol: 'visiting',
  39165. fn: function (aVisitor){
  39166. var self=this;
  39167. return $core.withContext(function($ctx1) {
  39168. $recv(aVisitor)._visitInlinedSend_(self);
  39169. return self;
  39170. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  39171. },
  39172. args: ["aVisitor"],
  39173. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  39174. referencedClasses: [],
  39175. messageSends: ["visitInlinedSend:"]
  39176. }),
  39177. $globals.IRInlinedSend);
  39178. $core.addMethod(
  39179. $core.method({
  39180. selector: "internalVariables",
  39181. protocol: 'accessing',
  39182. fn: function (){
  39183. var self=this;
  39184. return [];
  39185. },
  39186. args: [],
  39187. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  39188. referencedClasses: [],
  39189. messageSends: []
  39190. }),
  39191. $globals.IRInlinedSend);
  39192. $core.addMethod(
  39193. $core.method({
  39194. selector: "isInlined",
  39195. protocol: 'testing',
  39196. fn: function (){
  39197. var self=this;
  39198. return true;
  39199. },
  39200. args: [],
  39201. source: "isInlined\x0a\x09^ true",
  39202. referencedClasses: [],
  39203. messageSends: []
  39204. }),
  39205. $globals.IRInlinedSend);
  39206. $core.addClass('IRInlinedIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39207. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  39208. $core.addMethod(
  39209. $core.method({
  39210. selector: "accept:",
  39211. protocol: 'visiting',
  39212. fn: function (aVisitor){
  39213. var self=this;
  39214. return $core.withContext(function($ctx1) {
  39215. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  39216. return self;
  39217. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  39218. },
  39219. args: ["aVisitor"],
  39220. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  39221. referencedClasses: [],
  39222. messageSends: ["visitIRInlinedIfFalse:"]
  39223. }),
  39224. $globals.IRInlinedIfFalse);
  39225. $core.addClass('IRInlinedIfNilIfNotNil', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39226. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  39227. $core.addMethod(
  39228. $core.method({
  39229. selector: "accept:",
  39230. protocol: 'visiting',
  39231. fn: function (aVisitor){
  39232. var self=this;
  39233. return $core.withContext(function($ctx1) {
  39234. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  39235. return self;
  39236. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  39237. },
  39238. args: ["aVisitor"],
  39239. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  39240. referencedClasses: [],
  39241. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  39242. }),
  39243. $globals.IRInlinedIfNilIfNotNil);
  39244. $core.addMethod(
  39245. $core.method({
  39246. selector: "internalVariables",
  39247. protocol: 'accessing',
  39248. fn: function (){
  39249. var self=this;
  39250. return $core.withContext(function($ctx1) {
  39251. return $recv($globals.Array)._with_(self._receiverInternalVariable());
  39252. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  39253. },
  39254. args: [],
  39255. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  39256. referencedClasses: ["Array"],
  39257. messageSends: ["with:", "receiverInternalVariable"]
  39258. }),
  39259. $globals.IRInlinedIfNilIfNotNil);
  39260. $core.addMethod(
  39261. $core.method({
  39262. selector: "receiverInternalVariable",
  39263. protocol: 'accessing',
  39264. fn: function (){
  39265. var self=this;
  39266. return $core.withContext(function($ctx1) {
  39267. var $1;
  39268. $1=$recv($globals.IRVariable)._new();
  39269. $ctx1.sendIdx["new"]=1;
  39270. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_(self._receiverInternalVariableName()));
  39271. return $recv($1)._yourself();
  39272. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  39273. },
  39274. args: [],
  39275. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  39276. referencedClasses: ["IRVariable", "AliasVar"],
  39277. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  39278. }),
  39279. $globals.IRInlinedIfNilIfNotNil);
  39280. $core.addMethod(
  39281. $core.method({
  39282. selector: "receiverInternalVariableName",
  39283. protocol: 'accessing',
  39284. fn: function (){
  39285. var self=this;
  39286. return "$receiver";
  39287. },
  39288. args: [],
  39289. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  39290. referencedClasses: [],
  39291. messageSends: []
  39292. }),
  39293. $globals.IRInlinedIfNilIfNotNil);
  39294. $core.addClass('IRInlinedIfTrue', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39295. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  39296. $core.addMethod(
  39297. $core.method({
  39298. selector: "accept:",
  39299. protocol: 'visiting',
  39300. fn: function (aVisitor){
  39301. var self=this;
  39302. return $core.withContext(function($ctx1) {
  39303. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  39304. return self;
  39305. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  39306. },
  39307. args: ["aVisitor"],
  39308. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  39309. referencedClasses: [],
  39310. messageSends: ["visitIRInlinedIfTrue:"]
  39311. }),
  39312. $globals.IRInlinedIfTrue);
  39313. $core.addClass('IRInlinedIfTrueIfFalse', $globals.IRInlinedSend, [], 'Compiler-Inlining');
  39314. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  39315. $core.addMethod(
  39316. $core.method({
  39317. selector: "accept:",
  39318. protocol: 'visiting',
  39319. fn: function (aVisitor){
  39320. var self=this;
  39321. return $core.withContext(function($ctx1) {
  39322. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  39323. return self;
  39324. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  39325. },
  39326. args: ["aVisitor"],
  39327. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  39328. referencedClasses: [],
  39329. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  39330. }),
  39331. $globals.IRInlinedIfTrueIfFalse);
  39332. $core.addClass('IRInlinedSequence', $globals.IRBlockSequence, [], 'Compiler-Inlining');
  39333. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  39334. $core.addMethod(
  39335. $core.method({
  39336. selector: "accept:",
  39337. protocol: 'visiting',
  39338. fn: function (aVisitor){
  39339. var self=this;
  39340. return $core.withContext(function($ctx1) {
  39341. $recv(aVisitor)._visitIRInlinedSequence_(self);
  39342. return self;
  39343. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  39344. },
  39345. args: ["aVisitor"],
  39346. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  39347. referencedClasses: [],
  39348. messageSends: ["visitIRInlinedSequence:"]
  39349. }),
  39350. $globals.IRInlinedSequence);
  39351. $core.addMethod(
  39352. $core.method({
  39353. selector: "isInlined",
  39354. protocol: 'testing',
  39355. fn: function (){
  39356. var self=this;
  39357. return true;
  39358. },
  39359. args: [],
  39360. source: "isInlined\x0a\x09^ true",
  39361. referencedClasses: [],
  39362. messageSends: []
  39363. }),
  39364. $globals.IRInlinedSequence);
  39365. $core.addClass('IRInliner', $globals.IRVisitor, [], 'Compiler-Inlining');
  39366. $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`";
  39367. $core.addMethod(
  39368. $core.method({
  39369. selector: "assignmentInliner",
  39370. protocol: 'factory',
  39371. fn: function (){
  39372. var self=this;
  39373. return $core.withContext(function($ctx1) {
  39374. var $1;
  39375. $1=$recv($globals.IRAssignmentInliner)._new();
  39376. $recv($1)._translator_(self);
  39377. return $recv($1)._yourself();
  39378. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  39379. },
  39380. args: [],
  39381. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39382. referencedClasses: ["IRAssignmentInliner"],
  39383. messageSends: ["translator:", "new", "yourself"]
  39384. }),
  39385. $globals.IRInliner);
  39386. $core.addMethod(
  39387. $core.method({
  39388. selector: "returnInliner",
  39389. protocol: 'factory',
  39390. fn: function (){
  39391. var self=this;
  39392. return $core.withContext(function($ctx1) {
  39393. var $1;
  39394. $1=$recv($globals.IRReturnInliner)._new();
  39395. $recv($1)._translator_(self);
  39396. return $recv($1)._yourself();
  39397. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  39398. },
  39399. args: [],
  39400. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39401. referencedClasses: ["IRReturnInliner"],
  39402. messageSends: ["translator:", "new", "yourself"]
  39403. }),
  39404. $globals.IRInliner);
  39405. $core.addMethod(
  39406. $core.method({
  39407. selector: "sendInliner",
  39408. protocol: 'factory',
  39409. fn: function (){
  39410. var self=this;
  39411. return $core.withContext(function($ctx1) {
  39412. var $1;
  39413. $1=$recv($globals.IRSendInliner)._new();
  39414. $recv($1)._translator_(self);
  39415. return $recv($1)._yourself();
  39416. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  39417. },
  39418. args: [],
  39419. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  39420. referencedClasses: ["IRSendInliner"],
  39421. messageSends: ["translator:", "new", "yourself"]
  39422. }),
  39423. $globals.IRInliner);
  39424. $core.addMethod(
  39425. $core.method({
  39426. selector: "shouldInlineAssignment:",
  39427. protocol: 'testing',
  39428. fn: function (anIRAssignment){
  39429. var self=this;
  39430. return $core.withContext(function($ctx1) {
  39431. var $4,$3,$2,$1;
  39432. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  39433. return $core.withContext(function($ctx2) {
  39434. $4=$recv(anIRAssignment)._instructions();
  39435. $ctx2.sendIdx["instructions"]=1;
  39436. $3=$recv($4)._last();
  39437. $ctx2.sendIdx["last"]=1;
  39438. $2=$recv($3)._isSend();
  39439. return $recv($2)._and_((function(){
  39440. return $core.withContext(function($ctx3) {
  39441. return self._shouldInlineSend_($recv($recv(anIRAssignment)._instructions())._last());
  39442. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39443. }));
  39444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39445. }));
  39446. $ctx1.sendIdx["and:"]=1;
  39447. return $1;
  39448. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  39449. },
  39450. args: ["anIRAssignment"],
  39451. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  39452. referencedClasses: [],
  39453. messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"]
  39454. }),
  39455. $globals.IRInliner);
  39456. $core.addMethod(
  39457. $core.method({
  39458. selector: "shouldInlineReturn:",
  39459. protocol: 'testing',
  39460. fn: function (anIRReturn){
  39461. var self=this;
  39462. return $core.withContext(function($ctx1) {
  39463. var $4,$3,$2,$1;
  39464. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  39465. return $core.withContext(function($ctx2) {
  39466. $4=$recv(anIRReturn)._instructions();
  39467. $ctx2.sendIdx["instructions"]=1;
  39468. $3=$recv($4)._first();
  39469. $ctx2.sendIdx["first"]=1;
  39470. $2=$recv($3)._isSend();
  39471. return $recv($2)._and_((function(){
  39472. return $core.withContext(function($ctx3) {
  39473. return self._shouldInlineSend_($recv($recv(anIRReturn)._instructions())._first());
  39474. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39475. }));
  39476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39477. }));
  39478. $ctx1.sendIdx["and:"]=1;
  39479. return $1;
  39480. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  39481. },
  39482. args: ["anIRReturn"],
  39483. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  39484. referencedClasses: [],
  39485. messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"]
  39486. }),
  39487. $globals.IRInliner);
  39488. $core.addMethod(
  39489. $core.method({
  39490. selector: "shouldInlineSend:",
  39491. protocol: 'testing',
  39492. fn: function (anIRSend){
  39493. var self=this;
  39494. return $core.withContext(function($ctx1) {
  39495. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  39496. return $core.withContext(function($ctx2) {
  39497. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  39498. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39499. }));
  39500. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  39501. },
  39502. args: ["anIRSend"],
  39503. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  39504. referencedClasses: ["IRSendInliner"],
  39505. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  39506. }),
  39507. $globals.IRInliner);
  39508. $core.addMethod(
  39509. $core.method({
  39510. selector: "transformNonLocalReturn:",
  39511. protocol: 'visiting',
  39512. fn: function (anIRNonLocalReturn){
  39513. var self=this;
  39514. var localReturn;
  39515. return $core.withContext(function($ctx1) {
  39516. var $2,$1,$4,$3,$5,$6,$7;
  39517. $2=$recv(anIRNonLocalReturn)._scope();
  39518. $ctx1.sendIdx["scope"]=1;
  39519. $1=$recv($2)._canInlineNonLocalReturns();
  39520. if($core.assert($1)){
  39521. $4=$recv(anIRNonLocalReturn)._scope();
  39522. $ctx1.sendIdx["scope"]=2;
  39523. $3=$recv($4)._methodScope();
  39524. $5=$recv(anIRNonLocalReturn)._scope();
  39525. $ctx1.sendIdx["scope"]=3;
  39526. $recv($3)._removeNonLocalReturn_($5);
  39527. $6=$recv($globals.IRReturn)._new();
  39528. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  39529. localReturn=$recv($6)._yourself();
  39530. localReturn;
  39531. $recv($recv(anIRNonLocalReturn)._instructions())._do_((function(each){
  39532. return $core.withContext(function($ctx2) {
  39533. return $recv(localReturn)._add_(each);
  39534. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39535. }));
  39536. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  39537. return localReturn;
  39538. };
  39539. $7=(
  39540. $ctx1.supercall = true,
  39541. ($globals.IRInliner.superclass||$boot.dnu).fn.prototype._visitIRNonLocalReturn_.apply($recv(self), [anIRNonLocalReturn]));
  39542. $ctx1.supercall = false;
  39543. return $7;
  39544. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  39545. },
  39546. args: ["anIRNonLocalReturn"],
  39547. 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",
  39548. referencedClasses: ["IRReturn"],
  39549. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"]
  39550. }),
  39551. $globals.IRInliner);
  39552. $core.addMethod(
  39553. $core.method({
  39554. selector: "visitIRAssignment:",
  39555. protocol: 'visiting',
  39556. fn: function (anIRAssignment){
  39557. var self=this;
  39558. return $core.withContext(function($ctx1) {
  39559. var $1;
  39560. $1=self._shouldInlineAssignment_(anIRAssignment);
  39561. if($core.assert($1)){
  39562. return $recv(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  39563. } else {
  39564. return (
  39565. $ctx1.supercall = true,
  39566. ($globals.IRInliner.superclass||$boot.dnu).fn.prototype._visitIRAssignment_.apply($recv(self), [anIRAssignment]));
  39567. $ctx1.supercall = false;
  39568. };
  39569. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  39570. },
  39571. args: ["anIRAssignment"],
  39572. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  39573. referencedClasses: [],
  39574. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  39575. }),
  39576. $globals.IRInliner);
  39577. $core.addMethod(
  39578. $core.method({
  39579. selector: "visitIRNonLocalReturn:",
  39580. protocol: 'visiting',
  39581. fn: function (anIRNonLocalReturn){
  39582. var self=this;
  39583. return $core.withContext(function($ctx1) {
  39584. return self._transformNonLocalReturn_(anIRNonLocalReturn);
  39585. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRInliner)});
  39586. },
  39587. args: ["anIRNonLocalReturn"],
  39588. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
  39589. referencedClasses: [],
  39590. messageSends: ["transformNonLocalReturn:"]
  39591. }),
  39592. $globals.IRInliner);
  39593. $core.addMethod(
  39594. $core.method({
  39595. selector: "visitIRReturn:",
  39596. protocol: 'visiting',
  39597. fn: function (anIRReturn){
  39598. var self=this;
  39599. return $core.withContext(function($ctx1) {
  39600. var $1;
  39601. $1=self._shouldInlineReturn_(anIRReturn);
  39602. if($core.assert($1)){
  39603. return $recv(self._returnInliner())._inlineReturn_(anIRReturn);
  39604. } else {
  39605. return (
  39606. $ctx1.supercall = true,
  39607. ($globals.IRInliner.superclass||$boot.dnu).fn.prototype._visitIRReturn_.apply($recv(self), [anIRReturn]));
  39608. $ctx1.supercall = false;
  39609. };
  39610. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  39611. },
  39612. args: ["anIRReturn"],
  39613. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  39614. referencedClasses: [],
  39615. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  39616. }),
  39617. $globals.IRInliner);
  39618. $core.addMethod(
  39619. $core.method({
  39620. selector: "visitIRSend:",
  39621. protocol: 'visiting',
  39622. fn: function (anIRSend){
  39623. var self=this;
  39624. return $core.withContext(function($ctx1) {
  39625. var $1;
  39626. $1=self._shouldInlineSend_(anIRSend);
  39627. if($core.assert($1)){
  39628. return $recv(self._sendInliner())._inlineSend_(anIRSend);
  39629. } else {
  39630. return (
  39631. $ctx1.supercall = true,
  39632. ($globals.IRInliner.superclass||$boot.dnu).fn.prototype._visitIRSend_.apply($recv(self), [anIRSend]));
  39633. $ctx1.supercall = false;
  39634. };
  39635. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  39636. },
  39637. args: ["anIRSend"],
  39638. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  39639. referencedClasses: [],
  39640. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  39641. }),
  39642. $globals.IRInliner);
  39643. $core.addClass('IRInliningJSTranslator', $globals.IRJSTranslator, [], 'Compiler-Inlining');
  39644. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  39645. $core.addMethod(
  39646. $core.method({
  39647. selector: "visitIRInlinedAssignment:",
  39648. protocol: 'visiting',
  39649. fn: function (anIRInlinedAssignment){
  39650. var self=this;
  39651. return $core.withContext(function($ctx1) {
  39652. self._visit_($recv($recv(anIRInlinedAssignment)._instructions())._last());
  39653. return self;
  39654. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},$globals.IRInliningJSTranslator)});
  39655. },
  39656. args: ["anIRInlinedAssignment"],
  39657. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  39658. referencedClasses: [],
  39659. messageSends: ["visit:", "last", "instructions"]
  39660. }),
  39661. $globals.IRInliningJSTranslator);
  39662. $core.addMethod(
  39663. $core.method({
  39664. selector: "visitIRInlinedClosure:",
  39665. protocol: 'visiting',
  39666. fn: function (anIRInlinedClosure){
  39667. var self=this;
  39668. return $core.withContext(function($ctx1) {
  39669. $recv(self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  39670. return $core.withContext(function($ctx2) {
  39671. return $recv($recv(each)._name())._asVariableName();
  39672. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39673. })));
  39674. $recv($recv(anIRInlinedClosure)._instructions())._do_((function(each){
  39675. return $core.withContext(function($ctx2) {
  39676. return self._visit_(each);
  39677. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39678. }));
  39679. return self;
  39680. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  39681. },
  39682. args: ["anIRInlinedClosure"],
  39683. 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 ]",
  39684. referencedClasses: [],
  39685. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"]
  39686. }),
  39687. $globals.IRInliningJSTranslator);
  39688. $core.addMethod(
  39689. $core.method({
  39690. selector: "visitIRInlinedIfFalse:",
  39691. protocol: 'visiting',
  39692. fn: function (anIRInlinedIfFalse){
  39693. var self=this;
  39694. return $core.withContext(function($ctx1) {
  39695. var $1,$2,$4,$3;
  39696. $1=self._stream();
  39697. $ctx1.sendIdx["stream"]=1;
  39698. $recv($1)._nextPutIf_then_((function(){
  39699. return $core.withContext(function($ctx2) {
  39700. $2=self._stream();
  39701. $ctx2.sendIdx["stream"]=2;
  39702. $recv($2)._nextPutAll_("!$core.assert(");
  39703. $ctx2.sendIdx["nextPutAll:"]=1;
  39704. $4=$recv(anIRInlinedIfFalse)._instructions();
  39705. $ctx2.sendIdx["instructions"]=1;
  39706. $3=$recv($4)._first();
  39707. self._visit_($3);
  39708. $ctx2.sendIdx["visit:"]=1;
  39709. return $recv(self._stream())._nextPutAll_(")");
  39710. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39711. }),(function(){
  39712. return $core.withContext(function($ctx2) {
  39713. return self._visit_($recv($recv(anIRInlinedIfFalse)._instructions())._last());
  39714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39715. }));
  39716. return self;
  39717. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  39718. },
  39719. args: ["anIRInlinedIfFalse"],
  39720. 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 ]",
  39721. referencedClasses: [],
  39722. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  39723. }),
  39724. $globals.IRInliningJSTranslator);
  39725. $core.addMethod(
  39726. $core.method({
  39727. selector: "visitIRInlinedIfNilIfNotNil:",
  39728. protocol: 'visiting',
  39729. fn: function (anIRInlinedIfNilIfNotNil){
  39730. var self=this;
  39731. return $core.withContext(function($ctx1) {
  39732. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  39733. $1=self._stream();
  39734. $ctx1.sendIdx["stream"]=1;
  39735. $recv($1)._nextPutIf_then_else_((function(){
  39736. var recvVarName;
  39737. return $core.withContext(function($ctx2) {
  39738. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  39739. recvVarName;
  39740. $2=self._stream();
  39741. $ctx2.sendIdx["stream"]=2;
  39742. $4="(".__comma(recvVarName);
  39743. $ctx2.sendIdx[","]=2;
  39744. $3=$recv($4).__comma(" = ");
  39745. $ctx2.sendIdx[","]=1;
  39746. $recv($2)._nextPutAll_($3);
  39747. $ctx2.sendIdx["nextPutAll:"]=1;
  39748. $6=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  39749. $ctx2.sendIdx["instructions"]=1;
  39750. $5=$recv($6)._first();
  39751. self._visit_($5);
  39752. $ctx2.sendIdx["visit:"]=1;
  39753. $7=self._stream();
  39754. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".isNil");
  39755. $ctx2.sendIdx[","]=3;
  39756. return $recv($7)._nextPutAll_($8);
  39757. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  39758. }),(function(){
  39759. return $core.withContext(function($ctx2) {
  39760. $10=$recv(anIRInlinedIfNilIfNotNil)._instructions();
  39761. $ctx2.sendIdx["instructions"]=2;
  39762. $9=$recv($10)._second();
  39763. return self._visit_($9);
  39764. $ctx2.sendIdx["visit:"]=2;
  39765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39766. }),(function(){
  39767. return $core.withContext(function($ctx2) {
  39768. return self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._instructions())._third());
  39769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39770. }));
  39771. return self;
  39772. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  39773. },
  39774. args: ["anIRInlinedIfNilIfNotNil"],
  39775. 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 ]",
  39776. referencedClasses: [],
  39777. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "instructions", "second", "third"]
  39778. }),
  39779. $globals.IRInliningJSTranslator);
  39780. $core.addMethod(
  39781. $core.method({
  39782. selector: "visitIRInlinedIfTrue:",
  39783. protocol: 'visiting',
  39784. fn: function (anIRInlinedIfTrue){
  39785. var self=this;
  39786. return $core.withContext(function($ctx1) {
  39787. var $1,$2,$4,$3;
  39788. $1=self._stream();
  39789. $ctx1.sendIdx["stream"]=1;
  39790. $recv($1)._nextPutIf_then_((function(){
  39791. return $core.withContext(function($ctx2) {
  39792. $2=self._stream();
  39793. $ctx2.sendIdx["stream"]=2;
  39794. $recv($2)._nextPutAll_("$core.assert(");
  39795. $ctx2.sendIdx["nextPutAll:"]=1;
  39796. $4=$recv(anIRInlinedIfTrue)._instructions();
  39797. $ctx2.sendIdx["instructions"]=1;
  39798. $3=$recv($4)._first();
  39799. self._visit_($3);
  39800. $ctx2.sendIdx["visit:"]=1;
  39801. return $recv(self._stream())._nextPutAll_(")");
  39802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39803. }),(function(){
  39804. return $core.withContext(function($ctx2) {
  39805. return self._visit_($recv($recv(anIRInlinedIfTrue)._instructions())._last());
  39806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39807. }));
  39808. return self;
  39809. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  39810. },
  39811. args: ["anIRInlinedIfTrue"],
  39812. 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 ]",
  39813. referencedClasses: [],
  39814. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"]
  39815. }),
  39816. $globals.IRInliningJSTranslator);
  39817. $core.addMethod(
  39818. $core.method({
  39819. selector: "visitIRInlinedIfTrueIfFalse:",
  39820. protocol: 'visiting',
  39821. fn: function (anIRInlinedIfTrueIfFalse){
  39822. var self=this;
  39823. return $core.withContext(function($ctx1) {
  39824. var $1,$2,$4,$3,$6,$5;
  39825. $1=self._stream();
  39826. $ctx1.sendIdx["stream"]=1;
  39827. $recv($1)._nextPutIf_then_else_((function(){
  39828. return $core.withContext(function($ctx2) {
  39829. $2=self._stream();
  39830. $ctx2.sendIdx["stream"]=2;
  39831. $recv($2)._nextPutAll_("$core.assert(");
  39832. $ctx2.sendIdx["nextPutAll:"]=1;
  39833. $4=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  39834. $ctx2.sendIdx["instructions"]=1;
  39835. $3=$recv($4)._first();
  39836. self._visit_($3);
  39837. $ctx2.sendIdx["visit:"]=1;
  39838. return $recv(self._stream())._nextPutAll_(")");
  39839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39840. }),(function(){
  39841. return $core.withContext(function($ctx2) {
  39842. $6=$recv(anIRInlinedIfTrueIfFalse)._instructions();
  39843. $ctx2.sendIdx["instructions"]=2;
  39844. $5=$recv($6)._second();
  39845. return self._visit_($5);
  39846. $ctx2.sendIdx["visit:"]=2;
  39847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  39848. }),(function(){
  39849. return $core.withContext(function($ctx2) {
  39850. return self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._instructions())._third());
  39851. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  39852. }));
  39853. return self;
  39854. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  39855. },
  39856. args: ["anIRInlinedIfTrueIfFalse"],
  39857. 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 ]",
  39858. referencedClasses: [],
  39859. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"]
  39860. }),
  39861. $globals.IRInliningJSTranslator);
  39862. $core.addMethod(
  39863. $core.method({
  39864. selector: "visitIRInlinedNonLocalReturn:",
  39865. protocol: 'visiting',
  39866. fn: function (anIRInlinedReturn){
  39867. var self=this;
  39868. return $core.withContext(function($ctx1) {
  39869. var $1;
  39870. $1=self._stream();
  39871. $ctx1.sendIdx["stream"]=1;
  39872. $recv($1)._nextPutStatementWith_((function(){
  39873. return $core.withContext(function($ctx2) {
  39874. return self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  39875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39876. }));
  39877. $recv(self._stream())._nextPutNonLocalReturnWith_((function(){
  39878. }));
  39879. return self;
  39880. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  39881. },
  39882. args: ["anIRInlinedReturn"],
  39883. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  39884. referencedClasses: [],
  39885. messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"]
  39886. }),
  39887. $globals.IRInliningJSTranslator);
  39888. $core.addMethod(
  39889. $core.method({
  39890. selector: "visitIRInlinedReturn:",
  39891. protocol: 'visiting',
  39892. fn: function (anIRInlinedReturn){
  39893. var self=this;
  39894. return $core.withContext(function($ctx1) {
  39895. self._visit_($recv($recv(anIRInlinedReturn)._instructions())._last());
  39896. return self;
  39897. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
  39898. },
  39899. args: ["anIRInlinedReturn"],
  39900. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  39901. referencedClasses: [],
  39902. messageSends: ["visit:", "last", "instructions"]
  39903. }),
  39904. $globals.IRInliningJSTranslator);
  39905. $core.addMethod(
  39906. $core.method({
  39907. selector: "visitIRInlinedSequence:",
  39908. protocol: 'visiting',
  39909. fn: function (anIRInlinedSequence){
  39910. var self=this;
  39911. return $core.withContext(function($ctx1) {
  39912. $recv($recv(anIRInlinedSequence)._instructions())._do_((function(each){
  39913. return $core.withContext(function($ctx2) {
  39914. return $recv(self._stream())._nextPutStatementWith_((function(){
  39915. return $core.withContext(function($ctx3) {
  39916. return self._visit_(each);
  39917. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39918. }));
  39919. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39920. }));
  39921. return self;
  39922. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRInliningJSTranslator)});
  39923. },
  39924. args: ["anIRInlinedSequence"],
  39925. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  39926. referencedClasses: [],
  39927. messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"]
  39928. }),
  39929. $globals.IRInliningJSTranslator);
  39930. $core.addClass('IRSendInliner', $globals.Object, ['send', 'translator'], 'Compiler-Inlining');
  39931. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  39932. $core.addMethod(
  39933. $core.method({
  39934. selector: "ifFalse:",
  39935. protocol: 'inlining',
  39936. fn: function (anIRInstruction){
  39937. var self=this;
  39938. return $core.withContext(function($ctx1) {
  39939. return self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  39940. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  39941. },
  39942. args: ["anIRInstruction"],
  39943. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  39944. referencedClasses: ["IRInlinedIfFalse"],
  39945. messageSends: ["inlinedSend:withBlock:", "new"]
  39946. }),
  39947. $globals.IRSendInliner);
  39948. $core.addMethod(
  39949. $core.method({
  39950. selector: "ifFalse:ifTrue:",
  39951. protocol: 'inlining',
  39952. fn: function (anIRInstruction,anotherIRInstruction){
  39953. var self=this;
  39954. return $core.withContext(function($ctx1) {
  39955. return self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  39956. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  39957. },
  39958. args: ["anIRInstruction", "anotherIRInstruction"],
  39959. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  39960. referencedClasses: [],
  39961. messageSends: ["perform:withArguments:"]
  39962. }),
  39963. $globals.IRSendInliner);
  39964. $core.addMethod(
  39965. $core.method({
  39966. selector: "ifNil:",
  39967. protocol: 'inlining',
  39968. fn: function (anIRInstruction){
  39969. var self=this;
  39970. return $core.withContext(function($ctx1) {
  39971. var $1,$3,$5,$6,$4,$2;
  39972. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  39973. $ctx1.sendIdx["new"]=1;
  39974. $3=$recv($globals.IRClosure)._new();
  39975. $ctx1.sendIdx["new"]=2;
  39976. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  39977. $5=$recv($globals.IRBlockSequence)._new();
  39978. $recv($5)._add_($recv($recv(self._send())._instructions())._first());
  39979. $6=$recv($5)._yourself();
  39980. $ctx1.sendIdx["yourself"]=1;
  39981. $4=$6;
  39982. $recv($3)._add_($4);
  39983. $ctx1.sendIdx["add:"]=1;
  39984. $2=$recv($3)._yourself();
  39985. return self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  39986. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  39987. },
  39988. args: ["anIRInstruction"],
  39989. 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 instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
  39990. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  39991. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  39992. }),
  39993. $globals.IRSendInliner);
  39994. $core.addMethod(
  39995. $core.method({
  39996. selector: "ifNil:ifNotNil:",
  39997. protocol: 'inlining',
  39998. fn: function (anIRInstruction,anotherIRInstruction){
  39999. var self=this;
  40000. return $core.withContext(function($ctx1) {
  40001. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  40002. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40003. },
  40004. args: ["anIRInstruction", "anotherIRInstruction"],
  40005. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  40006. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  40007. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40008. }),
  40009. $globals.IRSendInliner);
  40010. $core.addMethod(
  40011. $core.method({
  40012. selector: "ifNotNil:",
  40013. protocol: 'inlining',
  40014. fn: function (anIRInstruction){
  40015. var self=this;
  40016. return $core.withContext(function($ctx1) {
  40017. var $1,$3,$5,$6,$4,$2;
  40018. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  40019. $ctx1.sendIdx["new"]=1;
  40020. $3=$recv($globals.IRClosure)._new();
  40021. $ctx1.sendIdx["new"]=2;
  40022. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  40023. $5=$recv($globals.IRBlockSequence)._new();
  40024. $recv($5)._add_($recv($recv(self._send())._instructions())._first());
  40025. $6=$recv($5)._yourself();
  40026. $ctx1.sendIdx["yourself"]=1;
  40027. $4=$6;
  40028. $recv($3)._add_($4);
  40029. $ctx1.sendIdx["add:"]=1;
  40030. $2=$recv($3)._yourself();
  40031. return self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  40032. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40033. },
  40034. args: ["anIRInstruction"],
  40035. 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 instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09withBlock: anIRInstruction",
  40036. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  40037. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
  40038. }),
  40039. $globals.IRSendInliner);
  40040. $core.addMethod(
  40041. $core.method({
  40042. selector: "ifNotNil:ifNil:",
  40043. protocol: 'inlining',
  40044. fn: function (anIRInstruction,anotherIRInstruction){
  40045. var self=this;
  40046. return $core.withContext(function($ctx1) {
  40047. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  40048. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40049. },
  40050. args: ["anIRInstruction", "anotherIRInstruction"],
  40051. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  40052. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  40053. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40054. }),
  40055. $globals.IRSendInliner);
  40056. $core.addMethod(
  40057. $core.method({
  40058. selector: "ifTrue:",
  40059. protocol: 'inlining',
  40060. fn: function (anIRInstruction){
  40061. var self=this;
  40062. return $core.withContext(function($ctx1) {
  40063. return self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  40064. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  40065. },
  40066. args: ["anIRInstruction"],
  40067. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  40068. referencedClasses: ["IRInlinedIfTrue"],
  40069. messageSends: ["inlinedSend:withBlock:", "new"]
  40070. }),
  40071. $globals.IRSendInliner);
  40072. $core.addMethod(
  40073. $core.method({
  40074. selector: "ifTrue:ifFalse:",
  40075. protocol: 'inlining',
  40076. fn: function (anIRInstruction,anotherIRInstruction){
  40077. var self=this;
  40078. return $core.withContext(function($ctx1) {
  40079. return self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  40080. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  40081. },
  40082. args: ["anIRInstruction", "anotherIRInstruction"],
  40083. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  40084. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  40085. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  40086. }),
  40087. $globals.IRSendInliner);
  40088. $core.addMethod(
  40089. $core.method({
  40090. selector: "inlineClosure:",
  40091. protocol: 'inlining',
  40092. fn: function (anIRClosure){
  40093. var self=this;
  40094. var inlinedClosure,sequence,statements;
  40095. return $core.withContext(function($ctx1) {
  40096. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8,$22,$21,$25,$24,$26,$23,$27,$30,$29,$28;
  40097. inlinedClosure=self._inlinedClosure();
  40098. $1=inlinedClosure;
  40099. $2=$recv(anIRClosure)._scope();
  40100. $ctx1.sendIdx["scope"]=1;
  40101. $recv($1)._scope_($2);
  40102. $ctx1.sendIdx["scope:"]=1;
  40103. $recv($1)._parent_($recv(anIRClosure)._parent());
  40104. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  40105. return $core.withContext(function($ctx2) {
  40106. return $recv(inlinedClosure)._add_(each);
  40107. $ctx2.sendIdx["add:"]=1;
  40108. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40109. }));
  40110. $ctx1.sendIdx["do:"]=1;
  40111. sequence=self._inlinedSequence();
  40112. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  40113. return $core.withContext(function($ctx2) {
  40114. $3=inlinedClosure;
  40115. $5=$recv($globals.IRTempDeclaration)._new();
  40116. $ctx2.sendIdx["new"]=1;
  40117. $recv($5)._name_(each);
  40118. $ctx2.sendIdx["name:"]=1;
  40119. $6=$recv($5)._yourself();
  40120. $ctx2.sendIdx["yourself"]=1;
  40121. $4=$6;
  40122. $recv($3)._add_($4);
  40123. $ctx2.sendIdx["add:"]=2;
  40124. $7=sequence;
  40125. $9=$recv($globals.IRAssignment)._new();
  40126. $ctx2.sendIdx["new"]=2;
  40127. $11=$recv($globals.IRVariable)._new();
  40128. $ctx2.sendIdx["new"]=3;
  40129. $13=$recv($globals.AliasVar)._new();
  40130. $ctx2.sendIdx["new"]=4;
  40131. $14=$recv(inlinedClosure)._scope();
  40132. $ctx2.sendIdx["scope"]=2;
  40133. $recv($13)._scope_($14);
  40134. $ctx2.sendIdx["scope:"]=2;
  40135. $recv($13)._name_(each);
  40136. $ctx2.sendIdx["name:"]=2;
  40137. $15=$recv($13)._yourself();
  40138. $ctx2.sendIdx["yourself"]=2;
  40139. $12=$15;
  40140. $10=$recv($11)._variable_($12);
  40141. $ctx2.sendIdx["variable:"]=1;
  40142. $recv($9)._add_($10);
  40143. $ctx2.sendIdx["add:"]=4;
  40144. $17=$recv($globals.IRVariable)._new();
  40145. $ctx2.sendIdx["new"]=5;
  40146. $19=$recv($globals.AliasVar)._new();
  40147. $recv($19)._scope_($recv(inlinedClosure)._scope());
  40148. $recv($19)._name_("$receiver");
  40149. $20=$recv($19)._yourself();
  40150. $ctx2.sendIdx["yourself"]=3;
  40151. $18=$20;
  40152. $16=$recv($17)._variable_($18);
  40153. $recv($9)._add_($16);
  40154. $ctx2.sendIdx["add:"]=5;
  40155. $8=$recv($9)._yourself();
  40156. return $recv($7)._add_($8);
  40157. $ctx2.sendIdx["add:"]=3;
  40158. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40159. }));
  40160. $ctx1.sendIdx["do:"]=2;
  40161. $recv(inlinedClosure)._add_(sequence);
  40162. $ctx1.sendIdx["add:"]=6;
  40163. $22=$recv(anIRClosure)._instructions();
  40164. $ctx1.sendIdx["instructions"]=2;
  40165. $21=$recv($22)._last();
  40166. $ctx1.sendIdx["last"]=1;
  40167. statements=$recv($21)._instructions();
  40168. $ctx1.sendIdx["instructions"]=1;
  40169. $recv(statements)._ifNotEmpty_((function(){
  40170. return $core.withContext(function($ctx2) {
  40171. $recv($recv(statements)._allButLast())._do_((function(each){
  40172. return $core.withContext(function($ctx3) {
  40173. return $recv(sequence)._add_(each);
  40174. $ctx3.sendIdx["add:"]=7;
  40175. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  40176. }));
  40177. $25=$recv(statements)._last();
  40178. $ctx2.sendIdx["last"]=2;
  40179. $24=$recv($25)._isReturn();
  40180. $23=$recv($24)._and_((function(){
  40181. return $core.withContext(function($ctx3) {
  40182. $26=$recv(statements)._last();
  40183. $ctx3.sendIdx["last"]=3;
  40184. return $recv($26)._isBlockReturn();
  40185. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  40186. }));
  40187. if($core.assert($23)){
  40188. $27=sequence;
  40189. $30=$recv(statements)._last();
  40190. $ctx2.sendIdx["last"]=4;
  40191. $29=$recv($30)._instructions();
  40192. $28=$recv($29)._first();
  40193. return $recv($27)._add_($28);
  40194. $ctx2.sendIdx["add:"]=8;
  40195. } else {
  40196. return $recv(sequence)._add_($recv(statements)._last());
  40197. };
  40198. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  40199. }));
  40200. return inlinedClosure;
  40201. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  40202. },
  40203. args: ["anIRClosure"],
  40204. 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 instructions last 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 instructions first ]\x0a\x09\x09\x09ifFalse: [ sequence add: statements last ] ].\x0a\x0a\x09^ inlinedClosure",
  40205. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  40206. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "instructions", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "and:", "isReturn", "isBlockReturn", "first"]
  40207. }),
  40208. $globals.IRSendInliner);
  40209. $core.addMethod(
  40210. $core.method({
  40211. selector: "inlineSend:",
  40212. protocol: 'inlining',
  40213. fn: function (anIRSend){
  40214. var self=this;
  40215. return $core.withContext(function($ctx1) {
  40216. var $2,$1;
  40217. self._send_(anIRSend);
  40218. $2=self._send();
  40219. $ctx1.sendIdx["send"]=1;
  40220. $1=$recv($2)._selector();
  40221. return self._perform_withArguments_($1,$recv($recv(self._send())._instructions())._allButFirst());
  40222. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  40223. },
  40224. args: ["anIRSend"],
  40225. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
  40226. referencedClasses: [],
  40227. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"]
  40228. }),
  40229. $globals.IRSendInliner);
  40230. $core.addMethod(
  40231. $core.method({
  40232. selector: "inlinedClosure",
  40233. protocol: 'factory',
  40234. fn: function (){
  40235. var self=this;
  40236. return $core.withContext(function($ctx1) {
  40237. return $recv($globals.IRInlinedClosure)._new();
  40238. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  40239. },
  40240. args: [],
  40241. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  40242. referencedClasses: ["IRInlinedClosure"],
  40243. messageSends: ["new"]
  40244. }),
  40245. $globals.IRSendInliner);
  40246. $core.addMethod(
  40247. $core.method({
  40248. selector: "inlinedSend:withBlock:",
  40249. protocol: 'inlining',
  40250. fn: function (inlinedSend,anIRInstruction){
  40251. var self=this;
  40252. var inlinedClosure;
  40253. return $core.withContext(function($ctx1) {
  40254. var $1,$2,$5,$4,$3,$6;
  40255. $1=$recv(anIRInstruction)._isClosure();
  40256. if(!$core.assert($1)){
  40257. self._inliningError_("Message argument should be a block");
  40258. $ctx1.sendIdx["inliningError:"]=1;
  40259. };
  40260. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  40261. if(!$core.assert($2)){
  40262. self._inliningError_("Inlined block should have zero argument");
  40263. };
  40264. inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  40265. $5=self._send();
  40266. $ctx1.sendIdx["send"]=1;
  40267. $4=$recv($5)._instructions();
  40268. $3=$recv($4)._first();
  40269. $recv(inlinedSend)._add_($3);
  40270. $ctx1.sendIdx["add:"]=1;
  40271. $recv(inlinedSend)._add_(inlinedClosure);
  40272. $recv(self._send())._replaceWith_(inlinedSend);
  40273. $6=$recv($recv(inlinedSend)._method())._internalVariables();
  40274. $ctx1.sendIdx["internalVariables"]=1;
  40275. $recv($6)._addAll_($recv(inlinedSend)._internalVariables());
  40276. return inlinedSend;
  40277. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  40278. },
  40279. args: ["inlinedSend", "anIRInstruction"],
  40280. 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 instructions first;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend",
  40281. referencedClasses: [],
  40282. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  40283. }),
  40284. $globals.IRSendInliner);
  40285. $core.addMethod(
  40286. $core.method({
  40287. selector: "inlinedSend:withBlock:withBlock:",
  40288. protocol: 'inlining',
  40289. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  40290. var self=this;
  40291. var inlinedClosure1,inlinedClosure2;
  40292. return $core.withContext(function($ctx1) {
  40293. var $1,$2,$3,$4,$7,$6,$5,$8;
  40294. $1=$recv(anIRInstruction)._isClosure();
  40295. $ctx1.sendIdx["isClosure"]=1;
  40296. if(!$core.assert($1)){
  40297. self._inliningError_("Message argument should be a block");
  40298. $ctx1.sendIdx["inliningError:"]=1;
  40299. };
  40300. $2=$recv(anotherIRInstruction)._isClosure();
  40301. if(!$core.assert($2)){
  40302. self._inliningError_("Message argument should be a block");
  40303. };
  40304. $3=self._translator();
  40305. $ctx1.sendIdx["translator"]=1;
  40306. $4=self._inlineClosure_(anIRInstruction);
  40307. $ctx1.sendIdx["inlineClosure:"]=1;
  40308. inlinedClosure1=$recv($3)._visit_($4);
  40309. $ctx1.sendIdx["visit:"]=1;
  40310. inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  40311. $7=self._send();
  40312. $ctx1.sendIdx["send"]=1;
  40313. $6=$recv($7)._instructions();
  40314. $5=$recv($6)._first();
  40315. $recv(inlinedSend)._add_($5);
  40316. $ctx1.sendIdx["add:"]=1;
  40317. $recv(inlinedSend)._add_(inlinedClosure1);
  40318. $ctx1.sendIdx["add:"]=2;
  40319. $recv(inlinedSend)._add_(inlinedClosure2);
  40320. $recv(self._send())._replaceWith_(inlinedSend);
  40321. $8=$recv($recv(inlinedSend)._method())._internalVariables();
  40322. $ctx1.sendIdx["internalVariables"]=1;
  40323. $recv($8)._addAll_($recv(inlinedSend)._internalVariables());
  40324. return inlinedSend;
  40325. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  40326. },
  40327. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  40328. 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 instructions first;\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",
  40329. referencedClasses: [],
  40330. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  40331. }),
  40332. $globals.IRSendInliner);
  40333. $core.addMethod(
  40334. $core.method({
  40335. selector: "inlinedSequence",
  40336. protocol: 'factory',
  40337. fn: function (){
  40338. var self=this;
  40339. return $core.withContext(function($ctx1) {
  40340. return $recv($globals.IRInlinedSequence)._new();
  40341. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  40342. },
  40343. args: [],
  40344. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  40345. referencedClasses: ["IRInlinedSequence"],
  40346. messageSends: ["new"]
  40347. }),
  40348. $globals.IRSendInliner);
  40349. $core.addMethod(
  40350. $core.method({
  40351. selector: "inliningError:",
  40352. protocol: 'error handling',
  40353. fn: function (aString){
  40354. var self=this;
  40355. return $core.withContext(function($ctx1) {
  40356. $recv($globals.InliningError)._signal_(aString);
  40357. return self;
  40358. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  40359. },
  40360. args: ["aString"],
  40361. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  40362. referencedClasses: ["InliningError"],
  40363. messageSends: ["signal:"]
  40364. }),
  40365. $globals.IRSendInliner);
  40366. $core.addMethod(
  40367. $core.method({
  40368. selector: "send",
  40369. protocol: 'accessing',
  40370. fn: function (){
  40371. var self=this;
  40372. return self["@send"];
  40373. },
  40374. args: [],
  40375. source: "send\x0a\x09^ send",
  40376. referencedClasses: [],
  40377. messageSends: []
  40378. }),
  40379. $globals.IRSendInliner);
  40380. $core.addMethod(
  40381. $core.method({
  40382. selector: "send:",
  40383. protocol: 'accessing',
  40384. fn: function (anIRSend){
  40385. var self=this;
  40386. self["@send"]=anIRSend;
  40387. return self;
  40388. },
  40389. args: ["anIRSend"],
  40390. source: "send: anIRSend\x0a\x09send := anIRSend",
  40391. referencedClasses: [],
  40392. messageSends: []
  40393. }),
  40394. $globals.IRSendInliner);
  40395. $core.addMethod(
  40396. $core.method({
  40397. selector: "translator",
  40398. protocol: 'accessing',
  40399. fn: function (){
  40400. var self=this;
  40401. return self["@translator"];
  40402. },
  40403. args: [],
  40404. source: "translator\x0a\x09^ translator",
  40405. referencedClasses: [],
  40406. messageSends: []
  40407. }),
  40408. $globals.IRSendInliner);
  40409. $core.addMethod(
  40410. $core.method({
  40411. selector: "translator:",
  40412. protocol: 'accessing',
  40413. fn: function (anASTTranslator){
  40414. var self=this;
  40415. self["@translator"]=anASTTranslator;
  40416. return self;
  40417. },
  40418. args: ["anASTTranslator"],
  40419. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  40420. referencedClasses: [],
  40421. messageSends: []
  40422. }),
  40423. $globals.IRSendInliner);
  40424. $core.addMethod(
  40425. $core.method({
  40426. selector: "inlinedSelectors",
  40427. protocol: 'accessing',
  40428. fn: function (){
  40429. var self=this;
  40430. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  40431. },
  40432. args: [],
  40433. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  40434. referencedClasses: [],
  40435. messageSends: []
  40436. }),
  40437. $globals.IRSendInliner.klass);
  40438. $core.addMethod(
  40439. $core.method({
  40440. selector: "shouldInline:",
  40441. protocol: 'accessing',
  40442. fn: function (anIRInstruction){
  40443. var self=this;
  40444. return $core.withContext(function($ctx1) {
  40445. var $1;
  40446. $1=$recv(self._inlinedSelectors())._includes_($recv(anIRInstruction)._selector());
  40447. if(!$core.assert($1)){
  40448. return false;
  40449. };
  40450. return $recv($recv($recv(anIRInstruction)._instructions())._allButFirst())._allSatisfy_((function(each){
  40451. return $core.withContext(function($ctx2) {
  40452. return $recv(each)._isClosure();
  40453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  40454. }));
  40455. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner.klass)});
  40456. },
  40457. args: ["anIRInstruction"],
  40458. source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09^ anIRInstruction instructions allButFirst allSatisfy: [ :each | each isClosure]",
  40459. referencedClasses: [],
  40460. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "allButFirst", "instructions", "isClosure"]
  40461. }),
  40462. $globals.IRSendInliner.klass);
  40463. $core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  40464. $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};";
  40465. $core.addMethod(
  40466. $core.method({
  40467. selector: "assignment",
  40468. protocol: 'accessing',
  40469. fn: function (){
  40470. var self=this;
  40471. return self["@assignment"];
  40472. },
  40473. args: [],
  40474. source: "assignment\x0a\x09^ assignment",
  40475. referencedClasses: [],
  40476. messageSends: []
  40477. }),
  40478. $globals.IRAssignmentInliner);
  40479. $core.addMethod(
  40480. $core.method({
  40481. selector: "assignment:",
  40482. protocol: 'accessing',
  40483. fn: function (aNode){
  40484. var self=this;
  40485. self["@assignment"]=aNode;
  40486. return self;
  40487. },
  40488. args: ["aNode"],
  40489. source: "assignment: aNode\x0a\x09assignment := aNode",
  40490. referencedClasses: [],
  40491. messageSends: []
  40492. }),
  40493. $globals.IRAssignmentInliner);
  40494. $core.addMethod(
  40495. $core.method({
  40496. selector: "inlineAssignment:",
  40497. protocol: 'inlining',
  40498. fn: function (anIRAssignment){
  40499. var self=this;
  40500. var inlinedAssignment;
  40501. return $core.withContext(function($ctx1) {
  40502. var $1;
  40503. self._assignment_(anIRAssignment);
  40504. inlinedAssignment=$recv($globals.IRInlinedAssignment)._new();
  40505. $1=$recv(anIRAssignment)._instructions();
  40506. $ctx1.sendIdx["instructions"]=1;
  40507. $recv($1)._do_((function(each){
  40508. return $core.withContext(function($ctx2) {
  40509. return $recv(inlinedAssignment)._add_(each);
  40510. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40511. }));
  40512. $recv(anIRAssignment)._replaceWith_(inlinedAssignment);
  40513. self._inlineSend_($recv($recv(inlinedAssignment)._instructions())._last());
  40514. return inlinedAssignment;
  40515. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},$globals.IRAssignmentInliner)});
  40516. },
  40517. args: ["anIRAssignment"],
  40518. 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 instructions last.\x0a\x09^ inlinedAssignment",
  40519. referencedClasses: ["IRInlinedAssignment"],
  40520. messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  40521. }),
  40522. $globals.IRAssignmentInliner);
  40523. $core.addMethod(
  40524. $core.method({
  40525. selector: "inlineClosure:",
  40526. protocol: 'inlining',
  40527. fn: function (anIRClosure){
  40528. var self=this;
  40529. var inlinedClosure,statements;
  40530. return $core.withContext(function($ctx1) {
  40531. var $2,$1,$4,$3,$5,$7,$6;
  40532. inlinedClosure=(
  40533. $ctx1.supercall = true,
  40534. ($globals.IRAssignmentInliner.superclass||$boot.dnu).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  40535. $ctx1.supercall = false;
  40536. $2=$recv(inlinedClosure)._instructions();
  40537. $ctx1.sendIdx["instructions"]=2;
  40538. $1=$recv($2)._last();
  40539. $ctx1.sendIdx["last"]=1;
  40540. statements=$recv($1)._instructions();
  40541. $ctx1.sendIdx["instructions"]=1;
  40542. $recv(statements)._ifNotEmpty_((function(){
  40543. return $core.withContext(function($ctx2) {
  40544. $4=$recv(statements)._last();
  40545. $ctx2.sendIdx["last"]=2;
  40546. $3=$recv($4)._canBeAssigned();
  40547. if($core.assert($3)){
  40548. $5=$recv(statements)._last();
  40549. $ctx2.sendIdx["last"]=3;
  40550. $7=$recv($globals.IRAssignment)._new();
  40551. $recv($7)._add_($recv($recv(self._assignment())._instructions())._first());
  40552. $ctx2.sendIdx["add:"]=1;
  40553. $recv($7)._add_($recv($recv(statements)._last())._copy());
  40554. $6=$recv($7)._yourself();
  40555. return $recv($5)._replaceWith_($6);
  40556. };
  40557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40558. }));
  40559. return inlinedClosure;
  40560. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},$globals.IRAssignmentInliner)});
  40561. },
  40562. args: ["anIRClosure"],
  40563. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure statements |\x0a\x0a\x09inlinedClosure := super inlineClosure: anIRClosure.\x0a\x09statements := inlinedClosure instructions last 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 instructions first;\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ inlinedClosure",
  40564. referencedClasses: ["IRAssignment"],
  40565. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"]
  40566. }),
  40567. $globals.IRAssignmentInliner);
  40568. $core.addClass('IRReturnInliner', $globals.IRSendInliner, [], 'Compiler-Inlining');
  40569. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  40570. $core.addMethod(
  40571. $core.method({
  40572. selector: "inlineClosure:",
  40573. protocol: 'inlining',
  40574. fn: function (anIRClosure){
  40575. var self=this;
  40576. var closure,statements;
  40577. return $core.withContext(function($ctx1) {
  40578. var $1,$3,$2,$4,$6,$5;
  40579. closure=(
  40580. $ctx1.supercall = true,
  40581. ($globals.IRReturnInliner.superclass||$boot.dnu).fn.prototype._inlineClosure_.apply($recv(self), [anIRClosure]));
  40582. $ctx1.supercall = false;
  40583. $1=$recv($recv(closure)._instructions())._last();
  40584. $ctx1.sendIdx["last"]=1;
  40585. statements=$recv($1)._instructions();
  40586. $ctx1.sendIdx["instructions"]=1;
  40587. $recv(statements)._ifNotEmpty_((function(){
  40588. return $core.withContext(function($ctx2) {
  40589. $3=$recv(statements)._last();
  40590. $ctx2.sendIdx["last"]=2;
  40591. $2=$recv($3)._isReturn();
  40592. if(!$core.assert($2)){
  40593. $4=$recv(statements)._last();
  40594. $ctx2.sendIdx["last"]=3;
  40595. $6=$recv($globals.IRReturn)._new();
  40596. $recv($6)._add_($recv($recv(statements)._last())._copy());
  40597. $5=$recv($6)._yourself();
  40598. return $recv($4)._replaceWith_($5);
  40599. };
  40600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  40601. }));
  40602. return closure;
  40603. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},$globals.IRReturnInliner)});
  40604. },
  40605. args: ["anIRClosure"],
  40606. source: "inlineClosure: anIRClosure\x0a\x09| closure statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09statements := closure instructions last 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",
  40607. referencedClasses: ["IRReturn"],
  40608. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"]
  40609. }),
  40610. $globals.IRReturnInliner);
  40611. $core.addMethod(
  40612. $core.method({
  40613. selector: "inlineReturn:",
  40614. protocol: 'inlining',
  40615. fn: function (anIRReturn){
  40616. var self=this;
  40617. var return_;
  40618. return $core.withContext(function($ctx1) {
  40619. var $1;
  40620. return_=self._inlinedReturn();
  40621. $1=$recv(anIRReturn)._instructions();
  40622. $ctx1.sendIdx["instructions"]=1;
  40623. $recv($1)._do_((function(each){
  40624. return $core.withContext(function($ctx2) {
  40625. return $recv(return_)._add_(each);
  40626. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40627. }));
  40628. $recv(anIRReturn)._replaceWith_(return_);
  40629. self._inlineSend_($recv($recv(return_)._instructions())._last());
  40630. return return_;
  40631. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},$globals.IRReturnInliner)});
  40632. },
  40633. args: ["anIRReturn"],
  40634. 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 instructions last.\x0a\x09^ return",
  40635. referencedClasses: [],
  40636. messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
  40637. }),
  40638. $globals.IRReturnInliner);
  40639. $core.addMethod(
  40640. $core.method({
  40641. selector: "inlinedReturn",
  40642. protocol: 'factory',
  40643. fn: function (){
  40644. var self=this;
  40645. return $core.withContext(function($ctx1) {
  40646. return $recv($globals.IRInlinedReturn)._new();
  40647. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},$globals.IRReturnInliner)});
  40648. },
  40649. args: [],
  40650. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  40651. referencedClasses: ["IRInlinedReturn"],
  40652. messageSends: ["new"]
  40653. }),
  40654. $globals.IRReturnInliner);
  40655. $core.addClass('InliningCodeGenerator', $globals.CodeGenerator, [], 'Compiler-Inlining');
  40656. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  40657. $core.addMethod(
  40658. $core.method({
  40659. selector: "compileNode:",
  40660. protocol: 'compiling',
  40661. fn: function (aNode){
  40662. var self=this;
  40663. var ir,stream;
  40664. return $core.withContext(function($ctx1) {
  40665. var $1;
  40666. $recv(self._semanticAnalyzer())._visit_(aNode);
  40667. $ctx1.sendIdx["visit:"]=1;
  40668. ir=$recv(self._translator())._visit_(aNode);
  40669. $ctx1.sendIdx["visit:"]=2;
  40670. $recv(self._inliner())._visit_(ir);
  40671. $ctx1.sendIdx["visit:"]=3;
  40672. $1=self._irTranslator();
  40673. $recv($1)._currentClass_(self._currentClass());
  40674. $recv($1)._visit_(ir);
  40675. return $recv($1)._contents();
  40676. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},$globals.InliningCodeGenerator)});
  40677. },
  40678. args: ["aNode"],
  40679. 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",
  40680. referencedClasses: [],
  40681. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"]
  40682. }),
  40683. $globals.InliningCodeGenerator);
  40684. $core.addMethod(
  40685. $core.method({
  40686. selector: "inliner",
  40687. protocol: 'compiling',
  40688. fn: function (){
  40689. var self=this;
  40690. return $core.withContext(function($ctx1) {
  40691. return $recv($globals.IRInliner)._new();
  40692. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  40693. },
  40694. args: [],
  40695. source: "inliner\x0a\x09^ IRInliner new",
  40696. referencedClasses: ["IRInliner"],
  40697. messageSends: ["new"]
  40698. }),
  40699. $globals.InliningCodeGenerator);
  40700. $core.addMethod(
  40701. $core.method({
  40702. selector: "irTranslator",
  40703. protocol: 'compiling',
  40704. fn: function (){
  40705. var self=this;
  40706. return $core.withContext(function($ctx1) {
  40707. return $recv($globals.IRInliningJSTranslator)._new();
  40708. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.InliningCodeGenerator)});
  40709. },
  40710. args: [],
  40711. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  40712. referencedClasses: ["IRInliningJSTranslator"],
  40713. messageSends: ["new"]
  40714. }),
  40715. $globals.InliningCodeGenerator);
  40716. $core.addClass('InliningError', $globals.SemanticError, [], 'Compiler-Inlining');
  40717. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  40718. });
  40719. define("amber_core/Compiler-Interpreter", ["amber/boot", "amber_core/Kernel-Methods", "amber_core/Compiler-Semantic", "amber_core/Kernel-Objects", "amber_core/Compiler-AST", "amber_core/Kernel-Exceptions"], function($boot){"use strict";
  40720. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  40721. $core.addPackage('Compiler-Interpreter');
  40722. $core.packages["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  40723. $core.packages["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  40724. $core.addClass('AIBlockClosure', $globals.BlockClosure, ['node', 'outerContext'], 'Compiler-Interpreter');
  40725. $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`).";
  40726. $core.addMethod(
  40727. $core.method({
  40728. selector: "applyTo:arguments:",
  40729. protocol: 'evaluating',
  40730. fn: function (anObject,aCollection){
  40731. var self=this;
  40732. return $core.withContext(function($ctx1) {
  40733. self._interpreterError();
  40734. return self;
  40735. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  40736. },
  40737. args: ["anObject", "aCollection"],
  40738. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  40739. referencedClasses: [],
  40740. messageSends: ["interpreterError"]
  40741. }),
  40742. $globals.AIBlockClosure);
  40743. $core.addMethod(
  40744. $core.method({
  40745. selector: "compiledSource",
  40746. protocol: 'accessing',
  40747. fn: function (){
  40748. var self=this;
  40749. return "[ AST Block closure ]";
  40750. },
  40751. args: [],
  40752. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  40753. referencedClasses: [],
  40754. messageSends: []
  40755. }),
  40756. $globals.AIBlockClosure);
  40757. $core.addMethod(
  40758. $core.method({
  40759. selector: "currySelf",
  40760. protocol: 'converting',
  40761. fn: function (){
  40762. var self=this;
  40763. return $core.withContext(function($ctx1) {
  40764. self._interpreterError();
  40765. return self;
  40766. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  40767. },
  40768. args: [],
  40769. source: "currySelf\x0a\x09self interpreterError",
  40770. referencedClasses: [],
  40771. messageSends: ["interpreterError"]
  40772. }),
  40773. $globals.AIBlockClosure);
  40774. $core.addMethod(
  40775. $core.method({
  40776. selector: "initializeWithContext:node:",
  40777. protocol: 'initialization',
  40778. fn: function (aContext,aNode){
  40779. var self=this;
  40780. self["@node"]=aNode;
  40781. self["@outerContext"]=aContext;
  40782. return self;
  40783. },
  40784. args: ["aContext", "aNode"],
  40785. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  40786. referencedClasses: [],
  40787. messageSends: []
  40788. }),
  40789. $globals.AIBlockClosure);
  40790. $core.addMethod(
  40791. $core.method({
  40792. selector: "interpreterError",
  40793. protocol: 'error handling',
  40794. fn: function (){
  40795. var self=this;
  40796. return $core.withContext(function($ctx1) {
  40797. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  40798. return self;
  40799. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  40800. },
  40801. args: [],
  40802. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  40803. referencedClasses: ["ASTInterpreterError"],
  40804. messageSends: ["signal:"]
  40805. }),
  40806. $globals.AIBlockClosure);
  40807. $core.addMethod(
  40808. $core.method({
  40809. selector: "numArgs",
  40810. protocol: 'accessing',
  40811. fn: function (){
  40812. var self=this;
  40813. return $core.withContext(function($ctx1) {
  40814. return $recv($recv(self["@node"])._temps())._size();
  40815. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  40816. },
  40817. args: [],
  40818. source: "numArgs\x0a\x09^ node temps size",
  40819. referencedClasses: [],
  40820. messageSends: ["size", "temps"]
  40821. }),
  40822. $globals.AIBlockClosure);
  40823. $core.addMethod(
  40824. $core.method({
  40825. selector: "value",
  40826. protocol: 'evaluating',
  40827. fn: function (){
  40828. var self=this;
  40829. return $core.withContext(function($ctx1) {
  40830. return self._valueWithPossibleArguments_([]);
  40831. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  40832. },
  40833. args: [],
  40834. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  40835. referencedClasses: [],
  40836. messageSends: ["valueWithPossibleArguments:"]
  40837. }),
  40838. $globals.AIBlockClosure);
  40839. $core.addMethod(
  40840. $core.method({
  40841. selector: "value:",
  40842. protocol: 'evaluating',
  40843. fn: function (anArgument){
  40844. var self=this;
  40845. return $core.withContext(function($ctx1) {
  40846. return self._valueWithPossibleArguments_([anArgument]);
  40847. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  40848. },
  40849. args: ["anArgument"],
  40850. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  40851. referencedClasses: [],
  40852. messageSends: ["valueWithPossibleArguments:"]
  40853. }),
  40854. $globals.AIBlockClosure);
  40855. $core.addMethod(
  40856. $core.method({
  40857. selector: "value:value:",
  40858. protocol: 'evaluating',
  40859. fn: function (firstArgument,secondArgument){
  40860. var self=this;
  40861. return $core.withContext(function($ctx1) {
  40862. return self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  40863. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  40864. },
  40865. args: ["firstArgument", "secondArgument"],
  40866. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  40867. referencedClasses: [],
  40868. messageSends: ["valueWithPossibleArguments:"]
  40869. }),
  40870. $globals.AIBlockClosure);
  40871. $core.addMethod(
  40872. $core.method({
  40873. selector: "value:value:value:",
  40874. protocol: 'evaluating',
  40875. fn: function (firstArgument,secondArgument,thirdArgument){
  40876. var self=this;
  40877. return $core.withContext(function($ctx1) {
  40878. return self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  40879. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  40880. },
  40881. args: ["firstArgument", "secondArgument", "thirdArgument"],
  40882. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  40883. referencedClasses: [],
  40884. messageSends: ["valueWithPossibleArguments:"]
  40885. }),
  40886. $globals.AIBlockClosure);
  40887. $core.addMethod(
  40888. $core.method({
  40889. selector: "valueWithPossibleArguments:",
  40890. protocol: 'evaluating',
  40891. fn: function (aCollection){
  40892. var self=this;
  40893. var context,sequenceNode;
  40894. return $core.withContext(function($ctx1) {
  40895. var $1,$2,$3;
  40896. context=$recv(self["@outerContext"])._newInnerContext();
  40897. $1=$recv($recv($recv(self["@node"])._nodes())._first())._copy();
  40898. $recv($1)._parent_(nil);
  40899. sequenceNode=$recv($1)._yourself();
  40900. $recv($recv(sequenceNode)._temps())._do_((function(each){
  40901. return $core.withContext(function($ctx2) {
  40902. return $recv(context)._defineLocal_(each);
  40903. $ctx2.sendIdx["defineLocal:"]=1;
  40904. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40905. }));
  40906. $recv($recv(self["@node"])._parameters())._withIndexDo_((function(each,index){
  40907. return $core.withContext(function($ctx2) {
  40908. $recv(context)._defineLocal_(each);
  40909. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  40910. return nil;
  40911. })));
  40912. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  40913. }));
  40914. $2=$recv(context)._interpreter();
  40915. $ctx1.sendIdx["interpreter"]=1;
  40916. $recv($2)._node_(sequenceNode);
  40917. $recv($2)._enterNode();
  40918. $recv($2)._proceed();
  40919. $3=$recv(self["@outerContext"])._interpreter();
  40920. $ctx1.sendIdx["interpreter"]=2;
  40921. $recv($3)._setNonLocalReturnFromContext_(context);
  40922. return $recv($recv(context)._interpreter())._pop();
  40923. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  40924. },
  40925. args: ["aCollection"],
  40926. 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",
  40927. referencedClasses: [],
  40928. messageSends: ["newInnerContext", "parent:", "copy", "first", "nodes", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  40929. }),
  40930. $globals.AIBlockClosure);
  40931. $core.addMethod(
  40932. $core.method({
  40933. selector: "forContext:node:",
  40934. protocol: 'instance creation',
  40935. fn: function (aContext,aNode){
  40936. var self=this;
  40937. return $core.withContext(function($ctx1) {
  40938. var $1;
  40939. $1=self._new();
  40940. $recv($1)._initializeWithContext_node_(aContext,aNode);
  40941. return $recv($1)._yourself();
  40942. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.klass)});
  40943. },
  40944. args: ["aContext", "aNode"],
  40945. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  40946. referencedClasses: [],
  40947. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  40948. }),
  40949. $globals.AIBlockClosure.klass);
  40950. $core.addClass('AIContext', $globals.MethodContext, ['outerContext', 'innerContext', 'pc', 'locals', 'selector', 'index', 'sendIndexes', 'evaluatedSelector', 'ast', 'interpreter', 'supercall'], 'Compiler-Interpreter');
  40951. $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)";
  40952. $core.addMethod(
  40953. $core.method({
  40954. selector: "arguments",
  40955. protocol: 'interpreting',
  40956. fn: function (){
  40957. var self=this;
  40958. return $core.withContext(function($ctx1) {
  40959. return $recv($recv(self._ast())._arguments())._collect_((function(each){
  40960. return $core.withContext(function($ctx2) {
  40961. return self._localAt_ifAbsent_(each,(function(){
  40962. return $core.withContext(function($ctx3) {
  40963. return self._error_("Argument not in context");
  40964. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  40965. }));
  40966. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40967. }));
  40968. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  40969. },
  40970. args: [],
  40971. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  40972. referencedClasses: [],
  40973. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  40974. }),
  40975. $globals.AIContext);
  40976. $core.addMethod(
  40977. $core.method({
  40978. selector: "ast",
  40979. protocol: 'interpreting',
  40980. fn: function (){
  40981. var self=this;
  40982. return $core.withContext(function($ctx1) {
  40983. var $1,$2,$3,$receiver;
  40984. $1=self._isBlockContext();
  40985. if($core.assert($1)){
  40986. $2=self._outerContext();
  40987. return $recv($2)._ifNotNil_((function(context){
  40988. return $core.withContext(function($ctx2) {
  40989. return $recv(context)._ast();
  40990. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,2)});
  40991. }));
  40992. };
  40993. $3=self["@ast"];
  40994. if(($receiver = $3) == null || $receiver.isNil){
  40995. self._initializeAST();
  40996. } else {
  40997. $3;
  40998. };
  40999. return self["@ast"];
  41000. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  41001. },
  41002. args: [],
  41003. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  41004. referencedClasses: [],
  41005. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  41006. }),
  41007. $globals.AIContext);
  41008. $core.addMethod(
  41009. $core.method({
  41010. selector: "basicLocalAt:",
  41011. protocol: 'private',
  41012. fn: function (aString){
  41013. var self=this;
  41014. return $core.withContext(function($ctx1) {
  41015. return $recv(self._locals())._at_(aString);
  41016. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  41017. },
  41018. args: ["aString"],
  41019. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  41020. referencedClasses: [],
  41021. messageSends: ["at:", "locals"]
  41022. }),
  41023. $globals.AIContext);
  41024. $core.addMethod(
  41025. $core.method({
  41026. selector: "basicLocalAt:put:",
  41027. protocol: 'private',
  41028. fn: function (aString,anObject){
  41029. var self=this;
  41030. return $core.withContext(function($ctx1) {
  41031. $recv(self._locals())._at_put_(aString,anObject);
  41032. return self;
  41033. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  41034. },
  41035. args: ["aString", "anObject"],
  41036. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  41037. referencedClasses: [],
  41038. messageSends: ["at:put:", "locals"]
  41039. }),
  41040. $globals.AIContext);
  41041. $core.addMethod(
  41042. $core.method({
  41043. selector: "basicReceiver",
  41044. protocol: 'interpreting',
  41045. fn: function (){
  41046. var self=this;
  41047. return $core.withContext(function($ctx1) {
  41048. return self._localAt_("self");
  41049. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  41050. },
  41051. args: [],
  41052. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  41053. referencedClasses: [],
  41054. messageSends: ["localAt:"]
  41055. }),
  41056. $globals.AIContext);
  41057. $core.addMethod(
  41058. $core.method({
  41059. selector: "defineLocal:",
  41060. protocol: 'accessing',
  41061. fn: function (aString){
  41062. var self=this;
  41063. return $core.withContext(function($ctx1) {
  41064. $recv(self._locals())._at_put_(aString,nil);
  41065. return self;
  41066. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  41067. },
  41068. args: ["aString"],
  41069. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  41070. referencedClasses: [],
  41071. messageSends: ["at:put:", "locals"]
  41072. }),
  41073. $globals.AIContext);
  41074. $core.addMethod(
  41075. $core.method({
  41076. selector: "evaluate:on:",
  41077. protocol: 'evaluating',
  41078. fn: function (aString,anEvaluator){
  41079. var self=this;
  41080. return $core.withContext(function($ctx1) {
  41081. return $recv(anEvaluator)._evaluate_context_(aString,self);
  41082. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  41083. },
  41084. args: ["aString", "anEvaluator"],
  41085. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  41086. referencedClasses: [],
  41087. messageSends: ["evaluate:context:"]
  41088. }),
  41089. $globals.AIContext);
  41090. $core.addMethod(
  41091. $core.method({
  41092. selector: "evaluateNode:",
  41093. protocol: 'evaluating',
  41094. fn: function (aNode){
  41095. var self=this;
  41096. return $core.withContext(function($ctx1) {
  41097. var $1;
  41098. $1=$recv($globals.ASTInterpreter)._new();
  41099. $recv($1)._context_(self);
  41100. $recv($1)._node_(aNode);
  41101. $recv($1)._enterNode();
  41102. $recv($1)._proceed();
  41103. return $recv($1)._result();
  41104. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  41105. },
  41106. args: ["aNode"],
  41107. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  41108. referencedClasses: ["ASTInterpreter"],
  41109. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  41110. }),
  41111. $globals.AIContext);
  41112. $core.addMethod(
  41113. $core.method({
  41114. selector: "evaluatedSelector",
  41115. protocol: 'accessing',
  41116. fn: function (){
  41117. var self=this;
  41118. return self["@evaluatedSelector"];
  41119. },
  41120. args: [],
  41121. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  41122. referencedClasses: [],
  41123. messageSends: []
  41124. }),
  41125. $globals.AIContext);
  41126. $core.addMethod(
  41127. $core.method({
  41128. selector: "evaluatedSelector:",
  41129. protocol: 'accessing',
  41130. fn: function (aString){
  41131. var self=this;
  41132. self["@evaluatedSelector"]=aString;
  41133. return self;
  41134. },
  41135. args: ["aString"],
  41136. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  41137. referencedClasses: [],
  41138. messageSends: []
  41139. }),
  41140. $globals.AIContext);
  41141. $core.addMethod(
  41142. $core.method({
  41143. selector: "index",
  41144. protocol: 'accessing',
  41145. fn: function (){
  41146. var self=this;
  41147. return $core.withContext(function($ctx1) {
  41148. var $1,$receiver;
  41149. $1=self["@index"];
  41150. if(($receiver = $1) == null || $receiver.isNil){
  41151. return (0);
  41152. } else {
  41153. return $1;
  41154. };
  41155. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  41156. },
  41157. args: [],
  41158. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  41159. referencedClasses: [],
  41160. messageSends: ["ifNil:"]
  41161. }),
  41162. $globals.AIContext);
  41163. $core.addMethod(
  41164. $core.method({
  41165. selector: "index:",
  41166. protocol: 'accessing',
  41167. fn: function (anInteger){
  41168. var self=this;
  41169. self["@index"]=anInteger;
  41170. return self;
  41171. },
  41172. args: ["anInteger"],
  41173. source: "index: anInteger\x0a\x09index := anInteger",
  41174. referencedClasses: [],
  41175. messageSends: []
  41176. }),
  41177. $globals.AIContext);
  41178. $core.addMethod(
  41179. $core.method({
  41180. selector: "initializeAST",
  41181. protocol: 'initialization',
  41182. fn: function (){
  41183. var self=this;
  41184. return $core.withContext(function($ctx1) {
  41185. var $1;
  41186. $1=self._method();
  41187. $ctx1.sendIdx["method"]=1;
  41188. self["@ast"]=$recv($1)._ast();
  41189. $recv($recv($globals.SemanticAnalyzer)._on_($recv(self._method())._methodClass()))._visit_(self["@ast"]);
  41190. return self;
  41191. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  41192. },
  41193. args: [],
  41194. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  41195. referencedClasses: ["SemanticAnalyzer"],
  41196. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  41197. }),
  41198. $globals.AIContext);
  41199. $core.addMethod(
  41200. $core.method({
  41201. selector: "initializeFromMethodContext:",
  41202. protocol: 'initialization',
  41203. fn: function (aMethodContext){
  41204. var self=this;
  41205. return $core.withContext(function($ctx1) {
  41206. var $1,$2,$3,$receiver;
  41207. self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  41208. self._index_($recv(aMethodContext)._index());
  41209. self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  41210. self._receiver_($recv(aMethodContext)._receiver());
  41211. self._supercall_($recv(aMethodContext)._supercall());
  41212. self._selector_($recv(aMethodContext)._selector());
  41213. $1=$recv(aMethodContext)._outerContext();
  41214. $ctx1.sendIdx["outerContext"]=1;
  41215. if(($receiver = $1) == null || $receiver.isNil){
  41216. $1;
  41217. } else {
  41218. var outer;
  41219. outer=$receiver;
  41220. $2=$recv(outer)._methodContext();
  41221. if(($receiver = $2) == null || $receiver.isNil){
  41222. $2;
  41223. } else {
  41224. self._outerContext_($recv(self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  41225. };
  41226. $3=$recv(aMethodContext)._locals();
  41227. $ctx1.sendIdx["locals"]=1;
  41228. $recv($3)._keysAndValuesDo_((function(key,value){
  41229. return $core.withContext(function($ctx2) {
  41230. return $recv(self._locals())._at_put_(key,value);
  41231. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  41232. }));
  41233. };
  41234. return self;
  41235. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  41236. },
  41237. args: ["aMethodContext"],
  41238. 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 ] ]",
  41239. referencedClasses: [],
  41240. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  41241. }),
  41242. $globals.AIContext);
  41243. $core.addMethod(
  41244. $core.method({
  41245. selector: "initializeInterpreter",
  41246. protocol: 'initialization',
  41247. fn: function (){
  41248. var self=this;
  41249. return $core.withContext(function($ctx1) {
  41250. var $1,$2,$receiver;
  41251. $1=$recv($globals.ASTInterpreter)._new();
  41252. $recv($1)._context_(self);
  41253. self["@interpreter"]=$recv($1)._yourself();
  41254. $2=self._innerContext();
  41255. if(($receiver = $2) == null || $receiver.isNil){
  41256. $2;
  41257. } else {
  41258. self._setupInterpreter_(self["@interpreter"]);
  41259. };
  41260. return self;
  41261. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  41262. },
  41263. args: [],
  41264. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  41265. referencedClasses: ["ASTInterpreter"],
  41266. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  41267. }),
  41268. $globals.AIContext);
  41269. $core.addMethod(
  41270. $core.method({
  41271. selector: "initializeLocals",
  41272. protocol: 'initialization',
  41273. fn: function (){
  41274. var self=this;
  41275. return $core.withContext(function($ctx1) {
  41276. self["@locals"]=$recv($globals.Dictionary)._new();
  41277. $recv(self["@locals"])._at_put_("thisContext",self);
  41278. return self;
  41279. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  41280. },
  41281. args: [],
  41282. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  41283. referencedClasses: ["Dictionary"],
  41284. messageSends: ["new", "at:put:"]
  41285. }),
  41286. $globals.AIContext);
  41287. $core.addMethod(
  41288. $core.method({
  41289. selector: "innerContext",
  41290. protocol: 'accessing',
  41291. fn: function (){
  41292. var self=this;
  41293. return self["@innerContext"];
  41294. },
  41295. args: [],
  41296. source: "innerContext\x0a\x09^ innerContext",
  41297. referencedClasses: [],
  41298. messageSends: []
  41299. }),
  41300. $globals.AIContext);
  41301. $core.addMethod(
  41302. $core.method({
  41303. selector: "innerContext:",
  41304. protocol: 'accessing',
  41305. fn: function (anAIContext){
  41306. var self=this;
  41307. self["@innerContext"]=anAIContext;
  41308. return self;
  41309. },
  41310. args: ["anAIContext"],
  41311. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  41312. referencedClasses: [],
  41313. messageSends: []
  41314. }),
  41315. $globals.AIContext);
  41316. $core.addMethod(
  41317. $core.method({
  41318. selector: "interpreter",
  41319. protocol: 'interpreting',
  41320. fn: function (){
  41321. var self=this;
  41322. return $core.withContext(function($ctx1) {
  41323. var $1,$receiver;
  41324. $1=self["@interpreter"];
  41325. if(($receiver = $1) == null || $receiver.isNil){
  41326. self._initializeInterpreter();
  41327. } else {
  41328. $1;
  41329. };
  41330. return self["@interpreter"];
  41331. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  41332. },
  41333. args: [],
  41334. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  41335. referencedClasses: [],
  41336. messageSends: ["ifNil:", "initializeInterpreter"]
  41337. }),
  41338. $globals.AIContext);
  41339. $core.addMethod(
  41340. $core.method({
  41341. selector: "interpreter:",
  41342. protocol: 'interpreting',
  41343. fn: function (anInterpreter){
  41344. var self=this;
  41345. self["@interpreter"]=anInterpreter;
  41346. return self;
  41347. },
  41348. args: ["anInterpreter"],
  41349. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  41350. referencedClasses: [],
  41351. messageSends: []
  41352. }),
  41353. $globals.AIContext);
  41354. $core.addMethod(
  41355. $core.method({
  41356. selector: "isTopContext",
  41357. protocol: 'testing',
  41358. fn: function (){
  41359. var self=this;
  41360. return $core.withContext(function($ctx1) {
  41361. return $recv(self._innerContext())._isNil();
  41362. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  41363. },
  41364. args: [],
  41365. source: "isTopContext\x0a\x09^ self innerContext isNil",
  41366. referencedClasses: [],
  41367. messageSends: ["isNil", "innerContext"]
  41368. }),
  41369. $globals.AIContext);
  41370. $core.addMethod(
  41371. $core.method({
  41372. selector: "localAt:",
  41373. protocol: 'accessing',
  41374. fn: function (aString){
  41375. var self=this;
  41376. var context;
  41377. return $core.withContext(function($ctx1) {
  41378. context=self._lookupContextForLocal_(aString);
  41379. return $recv(context)._basicLocalAt_(aString);
  41380. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  41381. },
  41382. args: ["aString"],
  41383. 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",
  41384. referencedClasses: [],
  41385. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  41386. }),
  41387. $globals.AIContext);
  41388. $core.addMethod(
  41389. $core.method({
  41390. selector: "localAt:ifAbsent:",
  41391. protocol: 'accessing',
  41392. fn: function (aString,aBlock){
  41393. var self=this;
  41394. var context;
  41395. return $core.withContext(function($ctx1) {
  41396. var $early={};
  41397. try {
  41398. context=self._lookupContextForLocal_ifNone_(aString,(function(){
  41399. return $core.withContext(function($ctx2) {
  41400. throw $early=[$recv(aBlock)._value()];
  41401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41402. }));
  41403. return $recv(context)._basicLocalAt_(aString);
  41404. }
  41405. catch(e) {if(e===$early)return e[0]; throw e}
  41406. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  41407. },
  41408. args: ["aString", "aBlock"],
  41409. 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",
  41410. referencedClasses: [],
  41411. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  41412. }),
  41413. $globals.AIContext);
  41414. $core.addMethod(
  41415. $core.method({
  41416. selector: "localAt:put:",
  41417. protocol: 'accessing',
  41418. fn: function (aString,anObject){
  41419. var self=this;
  41420. var context;
  41421. return $core.withContext(function($ctx1) {
  41422. context=self._lookupContextForLocal_(aString);
  41423. $recv(context)._basicLocalAt_put_(aString,anObject);
  41424. return self;
  41425. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  41426. },
  41427. args: ["aString", "anObject"],
  41428. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  41429. referencedClasses: [],
  41430. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  41431. }),
  41432. $globals.AIContext);
  41433. $core.addMethod(
  41434. $core.method({
  41435. selector: "locals",
  41436. protocol: 'accessing',
  41437. fn: function (){
  41438. var self=this;
  41439. return $core.withContext(function($ctx1) {
  41440. var $1,$receiver;
  41441. $1=self["@locals"];
  41442. if(($receiver = $1) == null || $receiver.isNil){
  41443. self._initializeLocals();
  41444. } else {
  41445. $1;
  41446. };
  41447. return self["@locals"];
  41448. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  41449. },
  41450. args: [],
  41451. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  41452. referencedClasses: [],
  41453. messageSends: ["ifNil:", "initializeLocals"]
  41454. }),
  41455. $globals.AIContext);
  41456. $core.addMethod(
  41457. $core.method({
  41458. selector: "lookupContextForLocal:",
  41459. protocol: 'private',
  41460. fn: function (aString){
  41461. var self=this;
  41462. return $core.withContext(function($ctx1) {
  41463. return self._lookupContextForLocal_ifNone_(aString,(function(){
  41464. return $core.withContext(function($ctx2) {
  41465. return self._variableNotFound();
  41466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41467. }));
  41468. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  41469. },
  41470. args: ["aString"],
  41471. 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 ]",
  41472. referencedClasses: [],
  41473. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  41474. }),
  41475. $globals.AIContext);
  41476. $core.addMethod(
  41477. $core.method({
  41478. selector: "lookupContextForLocal:ifNone:",
  41479. protocol: 'private',
  41480. fn: function (aString,aBlock){
  41481. var self=this;
  41482. return $core.withContext(function($ctx1) {
  41483. var $1;
  41484. return $recv(self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  41485. return self;
  41486. }),(function(){
  41487. return $core.withContext(function($ctx2) {
  41488. $1=self._outerContext();
  41489. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  41490. return $core.withContext(function($ctx3) {
  41491. return $recv(context)._lookupContextForLocal_(aString);
  41492. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  41493. }));
  41494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41495. }));
  41496. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  41497. },
  41498. args: ["aString", "aBlock"],
  41499. 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 ] ]",
  41500. referencedClasses: [],
  41501. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  41502. }),
  41503. $globals.AIContext);
  41504. $core.addMethod(
  41505. $core.method({
  41506. selector: "newInnerContext",
  41507. protocol: 'factory',
  41508. fn: function (){
  41509. var self=this;
  41510. return $core.withContext(function($ctx1) {
  41511. var $1;
  41512. $1=$recv(self._class())._new();
  41513. $recv($1)._outerContext_(self);
  41514. return $recv($1)._yourself();
  41515. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  41516. },
  41517. args: [],
  41518. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  41519. referencedClasses: [],
  41520. messageSends: ["outerContext:", "new", "class", "yourself"]
  41521. }),
  41522. $globals.AIContext);
  41523. $core.addMethod(
  41524. $core.method({
  41525. selector: "outerContext",
  41526. protocol: 'accessing',
  41527. fn: function (){
  41528. var self=this;
  41529. return self["@outerContext"];
  41530. },
  41531. args: [],
  41532. source: "outerContext\x0a\x09^ outerContext",
  41533. referencedClasses: [],
  41534. messageSends: []
  41535. }),
  41536. $globals.AIContext);
  41537. $core.addMethod(
  41538. $core.method({
  41539. selector: "outerContext:",
  41540. protocol: 'accessing',
  41541. fn: function (anAIContext){
  41542. var self=this;
  41543. return $core.withContext(function($ctx1) {
  41544. var $1,$receiver;
  41545. self["@outerContext"]=anAIContext;
  41546. $1=self["@outerContext"];
  41547. if(($receiver = $1) == null || $receiver.isNil){
  41548. $1;
  41549. } else {
  41550. var context;
  41551. context=$receiver;
  41552. $recv(context)._innerContext_(self);
  41553. };
  41554. return self;
  41555. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  41556. },
  41557. args: ["anAIContext"],
  41558. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  41559. referencedClasses: [],
  41560. messageSends: ["ifNotNil:", "innerContext:"]
  41561. }),
  41562. $globals.AIContext);
  41563. $core.addMethod(
  41564. $core.method({
  41565. selector: "receiver:",
  41566. protocol: 'interpreting',
  41567. fn: function (anObject){
  41568. var self=this;
  41569. return $core.withContext(function($ctx1) {
  41570. $recv(self._locals())._at_put_("self",anObject);
  41571. return self;
  41572. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  41573. },
  41574. args: ["anObject"],
  41575. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  41576. referencedClasses: [],
  41577. messageSends: ["at:put:", "locals"]
  41578. }),
  41579. $globals.AIContext);
  41580. $core.addMethod(
  41581. $core.method({
  41582. selector: "selector",
  41583. protocol: 'accessing',
  41584. fn: function (){
  41585. var self=this;
  41586. return self["@selector"];
  41587. },
  41588. args: [],
  41589. source: "selector\x0a\x09^ selector",
  41590. referencedClasses: [],
  41591. messageSends: []
  41592. }),
  41593. $globals.AIContext);
  41594. $core.addMethod(
  41595. $core.method({
  41596. selector: "selector:",
  41597. protocol: 'accessing',
  41598. fn: function (aString){
  41599. var self=this;
  41600. self["@selector"]=aString;
  41601. return self;
  41602. },
  41603. args: ["aString"],
  41604. source: "selector: aString\x0a\x09selector := aString",
  41605. referencedClasses: [],
  41606. messageSends: []
  41607. }),
  41608. $globals.AIContext);
  41609. $core.addMethod(
  41610. $core.method({
  41611. selector: "sendIndexAt:",
  41612. protocol: 'accessing',
  41613. fn: function (aString){
  41614. var self=this;
  41615. return $core.withContext(function($ctx1) {
  41616. return $recv(self._sendIndexes())._at_ifAbsent_(aString,(function(){
  41617. return (0);
  41618. }));
  41619. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  41620. },
  41621. args: ["aString"],
  41622. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  41623. referencedClasses: [],
  41624. messageSends: ["at:ifAbsent:", "sendIndexes"]
  41625. }),
  41626. $globals.AIContext);
  41627. $core.addMethod(
  41628. $core.method({
  41629. selector: "sendIndexes",
  41630. protocol: 'accessing',
  41631. fn: function (){
  41632. var self=this;
  41633. return $core.withContext(function($ctx1) {
  41634. var $1,$receiver;
  41635. $1=self["@sendIndexes"];
  41636. if(($receiver = $1) == null || $receiver.isNil){
  41637. return $recv($globals.Dictionary)._new();
  41638. } else {
  41639. return $1;
  41640. };
  41641. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  41642. },
  41643. args: [],
  41644. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  41645. referencedClasses: ["Dictionary"],
  41646. messageSends: ["ifNil:", "new"]
  41647. }),
  41648. $globals.AIContext);
  41649. $core.addMethod(
  41650. $core.method({
  41651. selector: "sendIndexes:",
  41652. protocol: 'accessing',
  41653. fn: function (aDictionary){
  41654. var self=this;
  41655. self["@sendIndexes"]=aDictionary;
  41656. return self;
  41657. },
  41658. args: ["aDictionary"],
  41659. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  41660. referencedClasses: [],
  41661. messageSends: []
  41662. }),
  41663. $globals.AIContext);
  41664. $core.addMethod(
  41665. $core.method({
  41666. selector: "setupInterpreter:",
  41667. protocol: 'interpreting',
  41668. fn: function (anInterpreter){
  41669. var self=this;
  41670. var currentNode;
  41671. return $core.withContext(function($ctx1) {
  41672. var $1,$2,$3,$6,$5,$4,$receiver;
  41673. $1=$recv($globals.ASTPCNodeVisitor)._new();
  41674. $recv($1)._selector_(self._evaluatedSelector());
  41675. $recv($1)._context_(self);
  41676. $2=self._ast();
  41677. $ctx1.sendIdx["ast"]=1;
  41678. $recv($1)._visit_($2);
  41679. currentNode=$recv($1)._currentNode();
  41680. $3=$recv(self._ast())._sequenceNode();
  41681. if(($receiver = $3) == null || $receiver.isNil){
  41682. $3;
  41683. } else {
  41684. var sequence;
  41685. sequence=$receiver;
  41686. $recv($recv(sequence)._temps())._do_((function(each){
  41687. return $core.withContext(function($ctx2) {
  41688. return self._defineLocal_(each);
  41689. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  41690. }));
  41691. $ctx1.sendIdx["do:"]=1;
  41692. };
  41693. $recv(anInterpreter)._node_(currentNode);
  41694. $6=self._innerContext();
  41695. $ctx1.sendIdx["innerContext"]=1;
  41696. $5=$recv($6)._arguments();
  41697. $4=$recv($5)._reversed();
  41698. $recv($4)._do_((function(each){
  41699. return $core.withContext(function($ctx2) {
  41700. return $recv(anInterpreter)._push_(each);
  41701. $ctx2.sendIdx["push:"]=1;
  41702. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  41703. }));
  41704. $recv(anInterpreter)._push_($recv(self._innerContext())._receiver());
  41705. return self;
  41706. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  41707. },
  41708. args: ["anInterpreter"],
  41709. 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)",
  41710. referencedClasses: ["ASTPCNodeVisitor"],
  41711. messageSends: ["selector:", "new", "evaluatedSelector", "context:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  41712. }),
  41713. $globals.AIContext);
  41714. $core.addMethod(
  41715. $core.method({
  41716. selector: "supercall",
  41717. protocol: 'interpreting',
  41718. fn: function (){
  41719. var self=this;
  41720. return $core.withContext(function($ctx1) {
  41721. var $1,$receiver;
  41722. $1=self["@supercall"];
  41723. if(($receiver = $1) == null || $receiver.isNil){
  41724. return false;
  41725. } else {
  41726. return $1;
  41727. };
  41728. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  41729. },
  41730. args: [],
  41731. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  41732. referencedClasses: [],
  41733. messageSends: ["ifNil:"]
  41734. }),
  41735. $globals.AIContext);
  41736. $core.addMethod(
  41737. $core.method({
  41738. selector: "supercall:",
  41739. protocol: 'interpreting',
  41740. fn: function (aBoolean){
  41741. var self=this;
  41742. self["@supercall"]=aBoolean;
  41743. return self;
  41744. },
  41745. args: ["aBoolean"],
  41746. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  41747. referencedClasses: [],
  41748. messageSends: []
  41749. }),
  41750. $globals.AIContext);
  41751. $core.addMethod(
  41752. $core.method({
  41753. selector: "variableNotFound",
  41754. protocol: 'error handling',
  41755. fn: function (){
  41756. var self=this;
  41757. return $core.withContext(function($ctx1) {
  41758. self._error_("Variable missing");
  41759. return self;
  41760. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  41761. },
  41762. args: [],
  41763. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  41764. referencedClasses: [],
  41765. messageSends: ["error:"]
  41766. }),
  41767. $globals.AIContext);
  41768. $core.addMethod(
  41769. $core.method({
  41770. selector: "fromMethodContext:",
  41771. protocol: 'instance creation',
  41772. fn: function (aMethodContext){
  41773. var self=this;
  41774. return $core.withContext(function($ctx1) {
  41775. var $1;
  41776. $1=self._new();
  41777. $recv($1)._initializeFromMethodContext_(aMethodContext);
  41778. return $recv($1)._yourself();
  41779. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.klass)});
  41780. },
  41781. args: ["aMethodContext"],
  41782. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  41783. referencedClasses: [],
  41784. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  41785. }),
  41786. $globals.AIContext.klass);
  41787. $core.addClass('AISemanticAnalyzer', $globals.SemanticAnalyzer, ['context'], 'Compiler-Interpreter');
  41788. $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.";
  41789. $core.addMethod(
  41790. $core.method({
  41791. selector: "context",
  41792. protocol: 'accessing',
  41793. fn: function (){
  41794. var self=this;
  41795. return self["@context"];
  41796. },
  41797. args: [],
  41798. source: "context\x0a\x09^ context",
  41799. referencedClasses: [],
  41800. messageSends: []
  41801. }),
  41802. $globals.AISemanticAnalyzer);
  41803. $core.addMethod(
  41804. $core.method({
  41805. selector: "context:",
  41806. protocol: 'accessing',
  41807. fn: function (anAIContext){
  41808. var self=this;
  41809. self["@context"]=anAIContext;
  41810. return self;
  41811. },
  41812. args: ["anAIContext"],
  41813. source: "context: anAIContext\x0a\x09context := anAIContext",
  41814. referencedClasses: [],
  41815. messageSends: []
  41816. }),
  41817. $globals.AISemanticAnalyzer);
  41818. $core.addMethod(
  41819. $core.method({
  41820. selector: "visitVariableNode:",
  41821. protocol: 'visiting',
  41822. fn: function (aNode){
  41823. var self=this;
  41824. return $core.withContext(function($ctx1) {
  41825. var $1;
  41826. var $early={};
  41827. try {
  41828. $recv(self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  41829. return $core.withContext(function($ctx2) {
  41830. $1=(
  41831. $ctx2.supercall = true,
  41832. ($globals.AISemanticAnalyzer.superclass||$boot.dnu).fn.prototype._visitVariableNode_.apply($recv(self), [aNode]));
  41833. $ctx2.supercall = false;
  41834. throw $early=[$1];
  41835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41836. }));
  41837. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  41838. return self;
  41839. }
  41840. catch(e) {if(e===$early)return e[0]; throw e}
  41841. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  41842. },
  41843. args: ["aNode"],
  41844. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  41845. referencedClasses: ["ASTContextVar"],
  41846. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  41847. }),
  41848. $globals.AISemanticAnalyzer);
  41849. $core.addClass('ASTContextVar', $globals.ScopeVar, ['context'], 'Compiler-Interpreter');
  41850. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  41851. $core.addMethod(
  41852. $core.method({
  41853. selector: "context",
  41854. protocol: 'accessing',
  41855. fn: function (){
  41856. var self=this;
  41857. return self["@context"];
  41858. },
  41859. args: [],
  41860. source: "context\x0a\x09^ context",
  41861. referencedClasses: [],
  41862. messageSends: []
  41863. }),
  41864. $globals.ASTContextVar);
  41865. $core.addMethod(
  41866. $core.method({
  41867. selector: "context:",
  41868. protocol: 'accessing',
  41869. fn: function (anObject){
  41870. var self=this;
  41871. self["@context"]=anObject;
  41872. return self;
  41873. },
  41874. args: ["anObject"],
  41875. source: "context: anObject\x0a\x09context := anObject",
  41876. referencedClasses: [],
  41877. messageSends: []
  41878. }),
  41879. $globals.ASTContextVar);
  41880. $core.addClass('ASTDebugger', $globals.Object, ['interpreter', 'context', 'result'], 'Compiler-Interpreter');
  41881. $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.";
  41882. $core.addMethod(
  41883. $core.method({
  41884. selector: "atEnd",
  41885. protocol: 'testing',
  41886. fn: function (){
  41887. var self=this;
  41888. return $core.withContext(function($ctx1) {
  41889. var $1,$receiver;
  41890. $1=self._context();
  41891. $ctx1.sendIdx["context"]=1;
  41892. if(($receiver = $1) == null || $receiver.isNil){
  41893. return true;
  41894. } else {
  41895. $1;
  41896. };
  41897. return $recv($recv(self._interpreter())._atEnd())._and_((function(){
  41898. return $core.withContext(function($ctx2) {
  41899. return $recv(self._context())._isTopContext();
  41900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41901. }));
  41902. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  41903. },
  41904. args: [],
  41905. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  41906. referencedClasses: [],
  41907. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  41908. }),
  41909. $globals.ASTDebugger);
  41910. $core.addMethod(
  41911. $core.method({
  41912. selector: "context",
  41913. protocol: 'accessing',
  41914. fn: function (){
  41915. var self=this;
  41916. return self["@context"];
  41917. },
  41918. args: [],
  41919. source: "context\x0a\x09^ context",
  41920. referencedClasses: [],
  41921. messageSends: []
  41922. }),
  41923. $globals.ASTDebugger);
  41924. $core.addMethod(
  41925. $core.method({
  41926. selector: "context:",
  41927. protocol: 'accessing',
  41928. fn: function (aContext){
  41929. var self=this;
  41930. self["@context"]=aContext;
  41931. return self;
  41932. },
  41933. args: ["aContext"],
  41934. source: "context: aContext\x0a\x09context := aContext",
  41935. referencedClasses: [],
  41936. messageSends: []
  41937. }),
  41938. $globals.ASTDebugger);
  41939. $core.addMethod(
  41940. $core.method({
  41941. selector: "flushInnerContexts",
  41942. protocol: 'actions',
  41943. fn: function (){
  41944. var self=this;
  41945. return $core.withContext(function($ctx1) {
  41946. var $1,$receiver;
  41947. $1=self._context();
  41948. if(($receiver = $1) == null || $receiver.isNil){
  41949. $1;
  41950. } else {
  41951. var cxt;
  41952. cxt=$receiver;
  41953. $recv(cxt)._innerContext_(nil);
  41954. };
  41955. return self;
  41956. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  41957. },
  41958. args: [],
  41959. 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 ]",
  41960. referencedClasses: [],
  41961. messageSends: ["ifNotNil:", "context", "innerContext:"]
  41962. }),
  41963. $globals.ASTDebugger);
  41964. $core.addMethod(
  41965. $core.method({
  41966. selector: "interpreter",
  41967. protocol: 'accessing',
  41968. fn: function (){
  41969. var self=this;
  41970. return $core.withContext(function($ctx1) {
  41971. var $1,$receiver;
  41972. $1=self._context();
  41973. if(($receiver = $1) == null || $receiver.isNil){
  41974. return $1;
  41975. } else {
  41976. var ctx;
  41977. ctx=$receiver;
  41978. return $recv(ctx)._interpreter();
  41979. };
  41980. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  41981. },
  41982. args: [],
  41983. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  41984. referencedClasses: [],
  41985. messageSends: ["ifNotNil:", "context", "interpreter"]
  41986. }),
  41987. $globals.ASTDebugger);
  41988. $core.addMethod(
  41989. $core.method({
  41990. selector: "method",
  41991. protocol: 'accessing',
  41992. fn: function (){
  41993. var self=this;
  41994. return $core.withContext(function($ctx1) {
  41995. return $recv(self._context())._method();
  41996. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  41997. },
  41998. args: [],
  41999. source: "method\x0a\x09^ self context method",
  42000. referencedClasses: [],
  42001. messageSends: ["method", "context"]
  42002. }),
  42003. $globals.ASTDebugger);
  42004. $core.addMethod(
  42005. $core.method({
  42006. selector: "node",
  42007. protocol: 'accessing',
  42008. fn: function (){
  42009. var self=this;
  42010. return $core.withContext(function($ctx1) {
  42011. var $1,$receiver;
  42012. $1=self._interpreter();
  42013. $ctx1.sendIdx["interpreter"]=1;
  42014. if(($receiver = $1) == null || $receiver.isNil){
  42015. return $1;
  42016. } else {
  42017. return $recv(self._interpreter())._node();
  42018. };
  42019. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  42020. },
  42021. args: [],
  42022. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  42023. referencedClasses: [],
  42024. messageSends: ["ifNotNil:", "interpreter", "node"]
  42025. }),
  42026. $globals.ASTDebugger);
  42027. $core.addMethod(
  42028. $core.method({
  42029. selector: "onStep",
  42030. protocol: 'private',
  42031. fn: function (){
  42032. var self=this;
  42033. return $core.withContext(function($ctx1) {
  42034. var $1,$3,$2,$4,$6,$5,$receiver;
  42035. $1=self._interpreter();
  42036. $ctx1.sendIdx["interpreter"]=1;
  42037. self["@result"]=$recv($1)._result();
  42038. $3=self._interpreter();
  42039. $ctx1.sendIdx["interpreter"]=2;
  42040. $2=$recv($3)._atEnd();
  42041. $ctx1.sendIdx["atEnd"]=1;
  42042. if($core.assert($2)){
  42043. $4=$recv(self._context())._outerContext();
  42044. if(($receiver = $4) == null || $receiver.isNil){
  42045. $4;
  42046. } else {
  42047. var outerContext;
  42048. outerContext=$receiver;
  42049. self._context_(outerContext);
  42050. };
  42051. $6=self._interpreter();
  42052. $ctx1.sendIdx["interpreter"]=3;
  42053. $5=$recv($6)._atEnd();
  42054. if(!$core.assert($5)){
  42055. $recv(self._interpreter())._skip();
  42056. };
  42057. };
  42058. self._flushInnerContexts();
  42059. return self;
  42060. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  42061. },
  42062. args: [],
  42063. 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",
  42064. referencedClasses: [],
  42065. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  42066. }),
  42067. $globals.ASTDebugger);
  42068. $core.addMethod(
  42069. $core.method({
  42070. selector: "proceed",
  42071. protocol: 'stepping',
  42072. fn: function (){
  42073. var self=this;
  42074. return $core.withContext(function($ctx1) {
  42075. $recv((function(){
  42076. return $core.withContext(function($ctx2) {
  42077. return self._atEnd();
  42078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42079. }))._whileFalse_((function(){
  42080. return $core.withContext(function($ctx2) {
  42081. return self._stepOver();
  42082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42083. }));
  42084. return self;
  42085. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  42086. },
  42087. args: [],
  42088. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  42089. referencedClasses: [],
  42090. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  42091. }),
  42092. $globals.ASTDebugger);
  42093. $core.addMethod(
  42094. $core.method({
  42095. selector: "restart",
  42096. protocol: 'stepping',
  42097. fn: function (){
  42098. var self=this;
  42099. return $core.withContext(function($ctx1) {
  42100. $recv(self._interpreter())._restart();
  42101. self._flushInnerContexts();
  42102. return self;
  42103. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  42104. },
  42105. args: [],
  42106. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  42107. referencedClasses: [],
  42108. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  42109. }),
  42110. $globals.ASTDebugger);
  42111. $core.addMethod(
  42112. $core.method({
  42113. selector: "result",
  42114. protocol: 'accessing',
  42115. fn: function (){
  42116. var self=this;
  42117. return self["@result"];
  42118. },
  42119. args: [],
  42120. source: "result\x0a\x09^ result",
  42121. referencedClasses: [],
  42122. messageSends: []
  42123. }),
  42124. $globals.ASTDebugger);
  42125. $core.addMethod(
  42126. $core.method({
  42127. selector: "stepInto",
  42128. protocol: 'stepping',
  42129. fn: function (){
  42130. var self=this;
  42131. return $core.withContext(function($ctx1) {
  42132. self._shouldBeImplemented();
  42133. return self;
  42134. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  42135. },
  42136. args: [],
  42137. source: "stepInto\x0a\x09self shouldBeImplemented",
  42138. referencedClasses: [],
  42139. messageSends: ["shouldBeImplemented"]
  42140. }),
  42141. $globals.ASTDebugger);
  42142. $core.addMethod(
  42143. $core.method({
  42144. selector: "stepOver",
  42145. protocol: 'stepping',
  42146. fn: function (){
  42147. var self=this;
  42148. return $core.withContext(function($ctx1) {
  42149. var $1,$2;
  42150. $1=$recv(self._context())._isTopContext();
  42151. if($core.assert($1)){
  42152. $recv(self._interpreter())._stepOver();
  42153. } else {
  42154. $2=self._interpreter();
  42155. $ctx1.sendIdx["interpreter"]=1;
  42156. $recv($2)._skip();
  42157. };
  42158. self._onStep();
  42159. return self;
  42160. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  42161. },
  42162. args: [],
  42163. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  42164. referencedClasses: [],
  42165. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  42166. }),
  42167. $globals.ASTDebugger);
  42168. $core.addMethod(
  42169. $core.method({
  42170. selector: "context:",
  42171. protocol: 'instance creation',
  42172. fn: function (aContext){
  42173. var self=this;
  42174. return $core.withContext(function($ctx1) {
  42175. var $1;
  42176. $1=self._new();
  42177. $recv($1)._context_(aContext);
  42178. return $recv($1)._yourself();
  42179. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.klass)});
  42180. },
  42181. args: ["aContext"],
  42182. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  42183. referencedClasses: [],
  42184. messageSends: ["context:", "new", "yourself"]
  42185. }),
  42186. $globals.ASTDebugger.klass);
  42187. $core.addClass('ASTEnterNode', $globals.NodeVisitor, ['interpreter'], 'Compiler-Interpreter');
  42188. $core.addMethod(
  42189. $core.method({
  42190. selector: "interpreter",
  42191. protocol: 'accessing',
  42192. fn: function (){
  42193. var self=this;
  42194. return self["@interpreter"];
  42195. },
  42196. args: [],
  42197. source: "interpreter\x0a\x09^ interpreter",
  42198. referencedClasses: [],
  42199. messageSends: []
  42200. }),
  42201. $globals.ASTEnterNode);
  42202. $core.addMethod(
  42203. $core.method({
  42204. selector: "interpreter:",
  42205. protocol: 'accessing',
  42206. fn: function (anObject){
  42207. var self=this;
  42208. self["@interpreter"]=anObject;
  42209. return self;
  42210. },
  42211. args: ["anObject"],
  42212. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  42213. referencedClasses: [],
  42214. messageSends: []
  42215. }),
  42216. $globals.ASTEnterNode);
  42217. $core.addMethod(
  42218. $core.method({
  42219. selector: "visitBlockNode:",
  42220. protocol: 'visiting',
  42221. fn: function (aNode){
  42222. var self=this;
  42223. return aNode;
  42224. },
  42225. args: ["aNode"],
  42226. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  42227. referencedClasses: [],
  42228. messageSends: []
  42229. }),
  42230. $globals.ASTEnterNode);
  42231. $core.addMethod(
  42232. $core.method({
  42233. selector: "visitNode:",
  42234. protocol: 'visiting',
  42235. fn: function (aNode){
  42236. var self=this;
  42237. return $core.withContext(function($ctx1) {
  42238. var $early={};
  42239. try {
  42240. $recv($recv(aNode)._nodes())._ifEmpty_ifNotEmpty_((function(){
  42241. throw $early=[aNode];
  42242. }),(function(nodes){
  42243. return $core.withContext(function($ctx2) {
  42244. throw $early=[self._visit_($recv(nodes)._first())];
  42245. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  42246. }));
  42247. return self;
  42248. }
  42249. catch(e) {if(e===$early)return e[0]; throw e}
  42250. }, function($ctx1) {$ctx1.fill(self,"visitNode:",{aNode:aNode},$globals.ASTEnterNode)});
  42251. },
  42252. args: ["aNode"],
  42253. source: "visitNode: aNode\x0a\x09aNode nodes\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  42254. referencedClasses: [],
  42255. messageSends: ["ifEmpty:ifNotEmpty:", "nodes", "visit:", "first"]
  42256. }),
  42257. $globals.ASTEnterNode);
  42258. $core.addMethod(
  42259. $core.method({
  42260. selector: "visitSequenceNode:",
  42261. protocol: 'visiting',
  42262. fn: function (aNode){
  42263. var self=this;
  42264. return $core.withContext(function($ctx1) {
  42265. var $1;
  42266. $recv($recv(aNode)._temps())._do_((function(each){
  42267. return $core.withContext(function($ctx2) {
  42268. return $recv($recv(self._interpreter())._context())._defineLocal_(each);
  42269. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42270. }));
  42271. $1=(
  42272. $ctx1.supercall = true,
  42273. ($globals.ASTEnterNode.superclass||$boot.dnu).fn.prototype._visitSequenceNode_.apply($recv(self), [aNode]));
  42274. $ctx1.supercall = false;
  42275. return $1;
  42276. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  42277. },
  42278. args: ["aNode"],
  42279. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  42280. referencedClasses: [],
  42281. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  42282. }),
  42283. $globals.ASTEnterNode);
  42284. $core.addMethod(
  42285. $core.method({
  42286. selector: "on:",
  42287. protocol: 'instance creation',
  42288. fn: function (anInterpreter){
  42289. var self=this;
  42290. return $core.withContext(function($ctx1) {
  42291. var $1;
  42292. $1=self._new();
  42293. $recv($1)._interpreter_(anInterpreter);
  42294. return $recv($1)._yourself();
  42295. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.klass)});
  42296. },
  42297. args: ["anInterpreter"],
  42298. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  42299. referencedClasses: [],
  42300. messageSends: ["interpreter:", "new", "yourself"]
  42301. }),
  42302. $globals.ASTEnterNode.klass);
  42303. $core.addClass('ASTInterpreter', $globals.NodeVisitor, ['node', 'context', 'stack', 'returnValue', 'returned', 'forceAtEnd'], 'Compiler-Interpreter');
  42304. $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";
  42305. $core.addMethod(
  42306. $core.method({
  42307. selector: "assign:to:",
  42308. protocol: 'private',
  42309. fn: function (aNode,anObject){
  42310. var self=this;
  42311. return $core.withContext(function($ctx1) {
  42312. var $1,$3,$2,$4;
  42313. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  42314. if($core.assert($1)){
  42315. $3=self._context();
  42316. $ctx1.sendIdx["context"]=1;
  42317. $2=$recv($3)._receiver();
  42318. $4=$recv(aNode)._value();
  42319. $ctx1.sendIdx["value"]=1;
  42320. $recv($2)._instVarAt_put_($4,anObject);
  42321. } else {
  42322. $recv(self._context())._localAt_put_($recv(aNode)._value(),anObject);
  42323. };
  42324. return self;
  42325. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  42326. },
  42327. args: ["aNode", "anObject"],
  42328. 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 ]",
  42329. referencedClasses: [],
  42330. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  42331. }),
  42332. $globals.ASTInterpreter);
  42333. $core.addMethod(
  42334. $core.method({
  42335. selector: "atEnd",
  42336. protocol: 'testing',
  42337. fn: function (){
  42338. var self=this;
  42339. return $core.withContext(function($ctx1) {
  42340. var $1;
  42341. $1=self["@forceAtEnd"];
  42342. if($core.assert($1)){
  42343. return true;
  42344. };
  42345. return $recv(self._hasReturned())._or_((function(){
  42346. return $core.withContext(function($ctx2) {
  42347. return $recv(self._node())._isNil();
  42348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42349. }));
  42350. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  42351. },
  42352. args: [],
  42353. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  42354. referencedClasses: [],
  42355. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  42356. }),
  42357. $globals.ASTInterpreter);
  42358. $core.addMethod(
  42359. $core.method({
  42360. selector: "context",
  42361. protocol: 'accessing',
  42362. fn: function (){
  42363. var self=this;
  42364. return self["@context"];
  42365. },
  42366. args: [],
  42367. source: "context\x0a\x09^ context",
  42368. referencedClasses: [],
  42369. messageSends: []
  42370. }),
  42371. $globals.ASTInterpreter);
  42372. $core.addMethod(
  42373. $core.method({
  42374. selector: "context:",
  42375. protocol: 'accessing',
  42376. fn: function (aContext){
  42377. var self=this;
  42378. self["@context"]=aContext;
  42379. return self;
  42380. },
  42381. args: ["aContext"],
  42382. source: "context: aContext\x0a\x09context := aContext",
  42383. referencedClasses: [],
  42384. messageSends: []
  42385. }),
  42386. $globals.ASTInterpreter);
  42387. $core.addMethod(
  42388. $core.method({
  42389. selector: "enterNode",
  42390. protocol: 'interpreting',
  42391. fn: function (){
  42392. var self=this;
  42393. return $core.withContext(function($ctx1) {
  42394. self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_(self._node()));
  42395. return self;
  42396. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  42397. },
  42398. args: [],
  42399. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  42400. referencedClasses: ["ASTEnterNode"],
  42401. messageSends: ["node:", "visit:", "on:", "node"]
  42402. }),
  42403. $globals.ASTInterpreter);
  42404. $core.addMethod(
  42405. $core.method({
  42406. selector: "eval:",
  42407. protocol: 'private',
  42408. fn: function (aString){
  42409. var self=this;
  42410. var source,function_;
  42411. return $core.withContext(function($ctx1) {
  42412. var $3,$2,$1;
  42413. source=$recv($globals.String)._streamContents_((function(str){
  42414. return $core.withContext(function($ctx2) {
  42415. $recv(str)._nextPutAll_("0,(function(");
  42416. $ctx2.sendIdx["nextPutAll:"]=1;
  42417. $3=self._context();
  42418. $ctx2.sendIdx["context"]=1;
  42419. $2=$recv($3)._locals();
  42420. $ctx2.sendIdx["locals"]=1;
  42421. $1=$recv($2)._keys();
  42422. $recv($1)._do_separatedBy_((function(each){
  42423. return $core.withContext(function($ctx3) {
  42424. return $recv(str)._nextPutAll_(each);
  42425. $ctx3.sendIdx["nextPutAll:"]=2;
  42426. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42427. }),(function(){
  42428. return $core.withContext(function($ctx3) {
  42429. return $recv(str)._nextPutAll_(",");
  42430. $ctx3.sendIdx["nextPutAll:"]=3;
  42431. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42432. }));
  42433. $recv(str)._nextPutAll_("){ return (function() {");
  42434. $ctx2.sendIdx["nextPutAll:"]=4;
  42435. $recv(str)._nextPutAll_(aString);
  42436. $ctx2.sendIdx["nextPutAll:"]=5;
  42437. return $recv(str)._nextPutAll_("})()})");
  42438. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  42439. }));
  42440. function_=$recv($recv($globals.Compiler)._new())._eval_(source);
  42441. return $recv(function_)._valueWithPossibleArguments_($recv($recv(self._context())._locals())._values());
  42442. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  42443. },
  42444. args: ["aString"],
  42445. 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",
  42446. referencedClasses: ["String", "Compiler"],
  42447. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "new", "valueWithPossibleArguments:", "values"]
  42448. }),
  42449. $globals.ASTInterpreter);
  42450. $core.addMethod(
  42451. $core.method({
  42452. selector: "hasReturned",
  42453. protocol: 'testing',
  42454. fn: function (){
  42455. var self=this;
  42456. return $core.withContext(function($ctx1) {
  42457. var $1,$receiver;
  42458. $1=self["@returned"];
  42459. if(($receiver = $1) == null || $receiver.isNil){
  42460. return false;
  42461. } else {
  42462. return $1;
  42463. };
  42464. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  42465. },
  42466. args: [],
  42467. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  42468. referencedClasses: [],
  42469. messageSends: ["ifNil:"]
  42470. }),
  42471. $globals.ASTInterpreter);
  42472. $core.addMethod(
  42473. $core.method({
  42474. selector: "initialize",
  42475. protocol: 'initialization',
  42476. fn: function (){
  42477. var self=this;
  42478. return $core.withContext(function($ctx1) {
  42479. (
  42480. $ctx1.supercall = true,
  42481. ($globals.ASTInterpreter.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  42482. $ctx1.supercall = false;
  42483. self["@forceAtEnd"]=false;
  42484. return self;
  42485. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  42486. },
  42487. args: [],
  42488. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  42489. referencedClasses: [],
  42490. messageSends: ["initialize"]
  42491. }),
  42492. $globals.ASTInterpreter);
  42493. $core.addMethod(
  42494. $core.method({
  42495. selector: "interpret",
  42496. protocol: 'interpreting',
  42497. fn: function (){
  42498. var self=this;
  42499. return $core.withContext(function($ctx1) {
  42500. self._visit_(self._node());
  42501. return self;
  42502. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  42503. },
  42504. args: [],
  42505. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  42506. referencedClasses: [],
  42507. messageSends: ["visit:", "node"]
  42508. }),
  42509. $globals.ASTInterpreter);
  42510. $core.addMethod(
  42511. $core.method({
  42512. selector: "messageFromSendNode:arguments:",
  42513. protocol: 'private',
  42514. fn: function (aSendNode,aCollection){
  42515. var self=this;
  42516. return $core.withContext(function($ctx1) {
  42517. var $1;
  42518. $1=$recv($globals.Message)._new();
  42519. $recv($1)._selector_($recv(aSendNode)._selector());
  42520. $recv($1)._arguments_(aCollection);
  42521. return $recv($1)._yourself();
  42522. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  42523. },
  42524. args: ["aSendNode", "aCollection"],
  42525. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  42526. referencedClasses: ["Message"],
  42527. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  42528. }),
  42529. $globals.ASTInterpreter);
  42530. $core.addMethod(
  42531. $core.method({
  42532. selector: "messageNotUnderstood:receiver:",
  42533. protocol: 'private',
  42534. fn: function (aMessage,anObject){
  42535. var self=this;
  42536. return $core.withContext(function($ctx1) {
  42537. var $1;
  42538. $1=$recv($globals.MessageNotUnderstood)._new();
  42539. $recv($1)._message_(aMessage);
  42540. $recv($1)._receiver_(anObject);
  42541. $recv($1)._signal();
  42542. return self;
  42543. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  42544. },
  42545. args: ["aMessage", "anObject"],
  42546. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  42547. referencedClasses: ["MessageNotUnderstood"],
  42548. messageSends: ["message:", "new", "receiver:", "signal"]
  42549. }),
  42550. $globals.ASTInterpreter);
  42551. $core.addMethod(
  42552. $core.method({
  42553. selector: "next",
  42554. protocol: 'interpreting',
  42555. fn: function (){
  42556. var self=this;
  42557. var nd,nextNode;
  42558. return $core.withContext(function($ctx1) {
  42559. var $1,$2,$receiver;
  42560. nd=self._node();
  42561. $1=$recv(nd)._parent();
  42562. if(($receiver = $1) == null || $receiver.isNil){
  42563. nextNode=$1;
  42564. } else {
  42565. var parent;
  42566. parent=$receiver;
  42567. $2=$recv(parent)._nextSiblingNode_(nd);
  42568. if(($receiver = $2) == null || $receiver.isNil){
  42569. nextNode=parent;
  42570. } else {
  42571. var sibling;
  42572. sibling=$receiver;
  42573. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  42574. };
  42575. };
  42576. self._node_(nextNode);
  42577. return self;
  42578. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  42579. },
  42580. args: [],
  42581. 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",
  42582. referencedClasses: ["ASTEnterNode"],
  42583. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  42584. }),
  42585. $globals.ASTInterpreter);
  42586. $core.addMethod(
  42587. $core.method({
  42588. selector: "node",
  42589. protocol: 'accessing',
  42590. fn: function (){
  42591. var self=this;
  42592. return self["@node"];
  42593. },
  42594. args: [],
  42595. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  42596. referencedClasses: [],
  42597. messageSends: []
  42598. }),
  42599. $globals.ASTInterpreter);
  42600. $core.addMethod(
  42601. $core.method({
  42602. selector: "node:",
  42603. protocol: 'accessing',
  42604. fn: function (aNode){
  42605. var self=this;
  42606. self["@node"]=aNode;
  42607. return self;
  42608. },
  42609. args: ["aNode"],
  42610. source: "node: aNode\x0a\x09node := aNode",
  42611. referencedClasses: [],
  42612. messageSends: []
  42613. }),
  42614. $globals.ASTInterpreter);
  42615. $core.addMethod(
  42616. $core.method({
  42617. selector: "peek",
  42618. protocol: 'stack',
  42619. fn: function (){
  42620. var self=this;
  42621. return $core.withContext(function($ctx1) {
  42622. var $1;
  42623. var $early={};
  42624. try {
  42625. $1=self._stack();
  42626. $ctx1.sendIdx["stack"]=1;
  42627. $recv($1)._ifEmpty_((function(){
  42628. throw $early=[nil];
  42629. }));
  42630. return $recv(self._stack())._last();
  42631. }
  42632. catch(e) {if(e===$early)return e[0]; throw e}
  42633. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  42634. },
  42635. args: [],
  42636. 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",
  42637. referencedClasses: [],
  42638. messageSends: ["ifEmpty:", "stack", "last"]
  42639. }),
  42640. $globals.ASTInterpreter);
  42641. $core.addMethod(
  42642. $core.method({
  42643. selector: "pop",
  42644. protocol: 'stack',
  42645. fn: function (){
  42646. var self=this;
  42647. var peekedValue;
  42648. return $core.withContext(function($ctx1) {
  42649. peekedValue=self._peek();
  42650. $recv(self._stack())._removeLast();
  42651. return peekedValue;
  42652. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  42653. },
  42654. args: [],
  42655. 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",
  42656. referencedClasses: [],
  42657. messageSends: ["peek", "removeLast", "stack"]
  42658. }),
  42659. $globals.ASTInterpreter);
  42660. $core.addMethod(
  42661. $core.method({
  42662. selector: "proceed",
  42663. protocol: 'interpreting',
  42664. fn: function (){
  42665. var self=this;
  42666. return $core.withContext(function($ctx1) {
  42667. $recv((function(){
  42668. return $core.withContext(function($ctx2) {
  42669. return self._atEnd();
  42670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42671. }))._whileFalse_((function(){
  42672. return $core.withContext(function($ctx2) {
  42673. return self._step();
  42674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42675. }));
  42676. return self;
  42677. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  42678. },
  42679. args: [],
  42680. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  42681. referencedClasses: [],
  42682. messageSends: ["whileFalse:", "atEnd", "step"]
  42683. }),
  42684. $globals.ASTInterpreter);
  42685. $core.addMethod(
  42686. $core.method({
  42687. selector: "push:",
  42688. protocol: 'stack',
  42689. fn: function (anObject){
  42690. var self=this;
  42691. return $core.withContext(function($ctx1) {
  42692. return $recv(self._stack())._add_(anObject);
  42693. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  42694. },
  42695. args: ["anObject"],
  42696. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  42697. referencedClasses: [],
  42698. messageSends: ["add:", "stack"]
  42699. }),
  42700. $globals.ASTInterpreter);
  42701. $core.addMethod(
  42702. $core.method({
  42703. selector: "restart",
  42704. protocol: 'interpreting',
  42705. fn: function (){
  42706. var self=this;
  42707. return $core.withContext(function($ctx1) {
  42708. self._node_($recv(self._context())._ast());
  42709. self._enterNode();
  42710. return self;
  42711. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  42712. },
  42713. args: [],
  42714. source: "restart\x0a\x09self node: self context ast; enterNode",
  42715. referencedClasses: [],
  42716. messageSends: ["node:", "ast", "context", "enterNode"]
  42717. }),
  42718. $globals.ASTInterpreter);
  42719. $core.addMethod(
  42720. $core.method({
  42721. selector: "result",
  42722. protocol: 'accessing',
  42723. fn: function (){
  42724. var self=this;
  42725. return $core.withContext(function($ctx1) {
  42726. var $1;
  42727. $1=self._hasReturned();
  42728. if($core.assert($1)){
  42729. return self._returnValue();
  42730. } else {
  42731. return $recv(self._context())._receiver();
  42732. };
  42733. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  42734. },
  42735. args: [],
  42736. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  42737. referencedClasses: [],
  42738. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  42739. }),
  42740. $globals.ASTInterpreter);
  42741. $core.addMethod(
  42742. $core.method({
  42743. selector: "returnValue",
  42744. protocol: 'accessing',
  42745. fn: function (){
  42746. var self=this;
  42747. return self["@returnValue"];
  42748. },
  42749. args: [],
  42750. source: "returnValue\x0a\x09^ returnValue",
  42751. referencedClasses: [],
  42752. messageSends: []
  42753. }),
  42754. $globals.ASTInterpreter);
  42755. $core.addMethod(
  42756. $core.method({
  42757. selector: "returnValue:",
  42758. protocol: 'accessing',
  42759. fn: function (anObject){
  42760. var self=this;
  42761. self["@returnValue"]=anObject;
  42762. return self;
  42763. },
  42764. args: ["anObject"],
  42765. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  42766. referencedClasses: [],
  42767. messageSends: []
  42768. }),
  42769. $globals.ASTInterpreter);
  42770. $core.addMethod(
  42771. $core.method({
  42772. selector: "sendMessage:to:superSend:",
  42773. protocol: 'private',
  42774. fn: function (aMessage,anObject,aBoolean){
  42775. var self=this;
  42776. var method;
  42777. return $core.withContext(function($ctx1) {
  42778. var $2,$1,$3,$receiver;
  42779. var $early={};
  42780. try {
  42781. if(!$core.assert(aBoolean)){
  42782. return $recv(aMessage)._sendTo_(anObject);
  42783. };
  42784. $2=$recv(anObject)._class();
  42785. $ctx1.sendIdx["class"]=1;
  42786. $1=$recv($2)._superclass();
  42787. $ctx1.sendIdx["superclass"]=1;
  42788. if(($receiver = $1) == null || $receiver.isNil){
  42789. $3=self._messageNotUnderstood_receiver_(aMessage,anObject);
  42790. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  42791. return $3;
  42792. } else {
  42793. $1;
  42794. };
  42795. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  42796. return $core.withContext(function($ctx2) {
  42797. throw $early=[self._messageNotUnderstood_receiver_(aMessage,anObject)];
  42798. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42799. }));
  42800. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  42801. }
  42802. catch(e) {if(e===$early)return e[0]; throw e}
  42803. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  42804. },
  42805. args: ["aMessage", "anObject", "aBoolean"],
  42806. 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",
  42807. referencedClasses: [],
  42808. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  42809. }),
  42810. $globals.ASTInterpreter);
  42811. $core.addMethod(
  42812. $core.method({
  42813. selector: "setNonLocalReturnFromContext:",
  42814. protocol: 'interpreting',
  42815. fn: function (aContext){
  42816. var self=this;
  42817. return $core.withContext(function($ctx1) {
  42818. var $2,$1;
  42819. $2=$recv(aContext)._interpreter();
  42820. $ctx1.sendIdx["interpreter"]=1;
  42821. $1=$recv($2)._hasReturned();
  42822. if($core.assert($1)){
  42823. self["@returned"]=true;
  42824. self["@returned"];
  42825. self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  42826. };
  42827. return self;
  42828. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  42829. },
  42830. args: ["aContext"],
  42831. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  42832. referencedClasses: [],
  42833. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  42834. }),
  42835. $globals.ASTInterpreter);
  42836. $core.addMethod(
  42837. $core.method({
  42838. selector: "skip",
  42839. protocol: 'interpreting',
  42840. fn: function (){
  42841. var self=this;
  42842. return $core.withContext(function($ctx1) {
  42843. self._next();
  42844. return self;
  42845. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  42846. },
  42847. args: [],
  42848. source: "skip\x0a\x09self next",
  42849. referencedClasses: [],
  42850. messageSends: ["next"]
  42851. }),
  42852. $globals.ASTInterpreter);
  42853. $core.addMethod(
  42854. $core.method({
  42855. selector: "stack",
  42856. protocol: 'accessing',
  42857. fn: function (){
  42858. var self=this;
  42859. return $core.withContext(function($ctx1) {
  42860. var $1,$receiver;
  42861. $1=self["@stack"];
  42862. if(($receiver = $1) == null || $receiver.isNil){
  42863. self["@stack"]=$recv($globals.OrderedCollection)._new();
  42864. return self["@stack"];
  42865. } else {
  42866. return $1;
  42867. };
  42868. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  42869. },
  42870. args: [],
  42871. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  42872. referencedClasses: ["OrderedCollection"],
  42873. messageSends: ["ifNil:", "new"]
  42874. }),
  42875. $globals.ASTInterpreter);
  42876. $core.addMethod(
  42877. $core.method({
  42878. selector: "step",
  42879. protocol: 'interpreting',
  42880. fn: function (){
  42881. var self=this;
  42882. return $core.withContext(function($ctx1) {
  42883. self._interpret();
  42884. self._next();
  42885. return self;
  42886. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  42887. },
  42888. args: [],
  42889. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  42890. referencedClasses: [],
  42891. messageSends: ["interpret", "next"]
  42892. }),
  42893. $globals.ASTInterpreter);
  42894. $core.addMethod(
  42895. $core.method({
  42896. selector: "stepOver",
  42897. protocol: 'interpreting',
  42898. fn: function (){
  42899. var self=this;
  42900. return $core.withContext(function($ctx1) {
  42901. var $2,$1;
  42902. self._step();
  42903. $ctx1.sendIdx["step"]=1;
  42904. $recv((function(){
  42905. return $core.withContext(function($ctx2) {
  42906. $2=self._node();
  42907. $ctx2.sendIdx["node"]=1;
  42908. $1=$recv($2)._isNil();
  42909. return $recv($1)._or_((function(){
  42910. return $core.withContext(function($ctx3) {
  42911. return $recv(self._node())._isSteppingNode();
  42912. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42913. }));
  42914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42915. }))._whileFalse_((function(){
  42916. return $core.withContext(function($ctx2) {
  42917. return self._step();
  42918. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42919. }));
  42920. return self;
  42921. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  42922. },
  42923. args: [],
  42924. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  42925. referencedClasses: [],
  42926. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  42927. }),
  42928. $globals.ASTInterpreter);
  42929. $core.addMethod(
  42930. $core.method({
  42931. selector: "visit:",
  42932. protocol: 'visiting',
  42933. fn: function (aNode){
  42934. var self=this;
  42935. return $core.withContext(function($ctx1) {
  42936. var $1;
  42937. $1=self._hasReturned();
  42938. if(!$core.assert($1)){
  42939. (
  42940. $ctx1.supercall = true,
  42941. ($globals.ASTInterpreter.superclass||$boot.dnu).fn.prototype._visit_.apply($recv(self), [aNode]));
  42942. $ctx1.supercall = false;
  42943. };
  42944. return self;
  42945. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  42946. },
  42947. args: ["aNode"],
  42948. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  42949. referencedClasses: [],
  42950. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  42951. }),
  42952. $globals.ASTInterpreter);
  42953. $core.addMethod(
  42954. $core.method({
  42955. selector: "visitAssignmentNode:",
  42956. protocol: 'visiting',
  42957. fn: function (aNode){
  42958. var self=this;
  42959. var poppedValue;
  42960. return $core.withContext(function($ctx1) {
  42961. poppedValue=self._pop();
  42962. $ctx1.sendIdx["pop"]=1;
  42963. self._pop();
  42964. self._push_(poppedValue);
  42965. self._assign_to_($recv(aNode)._left(),poppedValue);
  42966. return self;
  42967. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  42968. },
  42969. args: ["aNode"],
  42970. 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",
  42971. referencedClasses: [],
  42972. messageSends: ["pop", "push:", "assign:to:", "left"]
  42973. }),
  42974. $globals.ASTInterpreter);
  42975. $core.addMethod(
  42976. $core.method({
  42977. selector: "visitBlockNode:",
  42978. protocol: 'visiting',
  42979. fn: function (aNode){
  42980. var self=this;
  42981. var block;
  42982. return $core.withContext(function($ctx1) {
  42983. block=$recv($globals.AIBlockClosure)._forContext_node_(self._context(),aNode);
  42984. self._push_(block);
  42985. return self;
  42986. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  42987. },
  42988. args: ["aNode"],
  42989. 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",
  42990. referencedClasses: ["AIBlockClosure"],
  42991. messageSends: ["forContext:node:", "context", "push:"]
  42992. }),
  42993. $globals.ASTInterpreter);
  42994. $core.addMethod(
  42995. $core.method({
  42996. selector: "visitBlockSequenceNode:",
  42997. protocol: 'visiting',
  42998. fn: function (aNode){
  42999. var self=this;
  43000. return $core.withContext(function($ctx1) {
  43001. (
  43002. $ctx1.supercall = true,
  43003. ($globals.ASTInterpreter.superclass||$boot.dnu).fn.prototype._visitBlockSequenceNode_.apply($recv(self), [aNode]));
  43004. $ctx1.supercall = false;
  43005. self["@forceAtEnd"]=true;
  43006. return self;
  43007. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43008. },
  43009. args: ["aNode"],
  43010. 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",
  43011. referencedClasses: [],
  43012. messageSends: ["visitBlockSequenceNode:"]
  43013. }),
  43014. $globals.ASTInterpreter);
  43015. $core.addMethod(
  43016. $core.method({
  43017. selector: "visitDynamicArrayNode:",
  43018. protocol: 'visiting',
  43019. fn: function (aNode){
  43020. var self=this;
  43021. var array;
  43022. return $core.withContext(function($ctx1) {
  43023. array=[];
  43024. $recv($recv(aNode)._nodes())._do_((function(each){
  43025. return $core.withContext(function($ctx2) {
  43026. return $recv(array)._addFirst_(self._pop());
  43027. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43028. }));
  43029. self._push_(array);
  43030. return self;
  43031. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  43032. },
  43033. args: ["aNode"],
  43034. 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",
  43035. referencedClasses: [],
  43036. messageSends: ["do:", "nodes", "addFirst:", "pop", "push:"]
  43037. }),
  43038. $globals.ASTInterpreter);
  43039. $core.addMethod(
  43040. $core.method({
  43041. selector: "visitDynamicDictionaryNode:",
  43042. protocol: 'visiting',
  43043. fn: function (aNode){
  43044. var self=this;
  43045. var keyValueList;
  43046. return $core.withContext(function($ctx1) {
  43047. keyValueList=$recv($globals.OrderedCollection)._new();
  43048. $recv($recv(aNode)._nodes())._do_((function(each){
  43049. return $core.withContext(function($ctx2) {
  43050. return $recv(keyValueList)._add_(self._pop());
  43051. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43052. }));
  43053. self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  43054. return self;
  43055. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  43056. },
  43057. args: ["aNode"],
  43058. 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)",
  43059. referencedClasses: ["OrderedCollection", "HashedCollection"],
  43060. messageSends: ["new", "do:", "nodes", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  43061. }),
  43062. $globals.ASTInterpreter);
  43063. $core.addMethod(
  43064. $core.method({
  43065. selector: "visitJSStatementNode:",
  43066. protocol: 'visiting',
  43067. fn: function (aNode){
  43068. var self=this;
  43069. return $core.withContext(function($ctx1) {
  43070. self["@returned"]=true;
  43071. self._returnValue_(self._eval_($recv(aNode)._source()));
  43072. return self;
  43073. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43074. },
  43075. args: ["aNode"],
  43076. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  43077. referencedClasses: [],
  43078. messageSends: ["returnValue:", "eval:", "source"]
  43079. }),
  43080. $globals.ASTInterpreter);
  43081. $core.addMethod(
  43082. $core.method({
  43083. selector: "visitNode:",
  43084. protocol: 'visiting',
  43085. fn: function (aNode){
  43086. var self=this;
  43087. return self;
  43088. },
  43089. args: ["aNode"],
  43090. source: "visitNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  43091. referencedClasses: [],
  43092. messageSends: []
  43093. }),
  43094. $globals.ASTInterpreter);
  43095. $core.addMethod(
  43096. $core.method({
  43097. selector: "visitReturnNode:",
  43098. protocol: 'visiting',
  43099. fn: function (aNode){
  43100. var self=this;
  43101. return $core.withContext(function($ctx1) {
  43102. self["@returned"]=true;
  43103. self._returnValue_(self._pop());
  43104. return self;
  43105. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43106. },
  43107. args: ["aNode"],
  43108. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  43109. referencedClasses: [],
  43110. messageSends: ["returnValue:", "pop"]
  43111. }),
  43112. $globals.ASTInterpreter);
  43113. $core.addMethod(
  43114. $core.method({
  43115. selector: "visitSendNode:",
  43116. protocol: 'visiting',
  43117. fn: function (aNode){
  43118. var self=this;
  43119. var receiver,args,message,result;
  43120. return $core.withContext(function($ctx1) {
  43121. var $1;
  43122. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  43123. return $core.withContext(function($ctx2) {
  43124. return self._pop();
  43125. $ctx2.sendIdx["pop"]=1;
  43126. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43127. }));
  43128. receiver=self._peek();
  43129. message=self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  43130. result=self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  43131. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  43132. return $core.withContext(function($ctx2) {
  43133. return $recv($recv(aNode)._isLastChild())._not();
  43134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43135. }));
  43136. if(!$core.assert($1)){
  43137. self._pop();
  43138. self._push_(result);
  43139. };
  43140. return self;
  43141. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  43142. },
  43143. args: ["aNode"],
  43144. 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 ]",
  43145. referencedClasses: [],
  43146. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  43147. }),
  43148. $globals.ASTInterpreter);
  43149. $core.addMethod(
  43150. $core.method({
  43151. selector: "visitValueNode:",
  43152. protocol: 'visiting',
  43153. fn: function (aNode){
  43154. var self=this;
  43155. return $core.withContext(function($ctx1) {
  43156. self._push_($recv(aNode)._value());
  43157. return self;
  43158. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43159. },
  43160. args: ["aNode"],
  43161. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  43162. referencedClasses: [],
  43163. messageSends: ["push:", "value"]
  43164. }),
  43165. $globals.ASTInterpreter);
  43166. $core.addMethod(
  43167. $core.method({
  43168. selector: "visitVariableNode:",
  43169. protocol: 'visiting',
  43170. fn: function (aNode){
  43171. var self=this;
  43172. return $core.withContext(function($ctx1) {
  43173. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  43174. $2=$recv(aNode)._binding();
  43175. $ctx1.sendIdx["binding"]=1;
  43176. $1=$recv($2)._isUnknownVar();
  43177. if($core.assert($1)){
  43178. $5=$recv($globals.Platform)._globals();
  43179. $ctx1.sendIdx["globals"]=1;
  43180. $6=$recv(aNode)._value();
  43181. $ctx1.sendIdx["value"]=1;
  43182. $4=$recv($5)._at_ifAbsent_($6,(function(){
  43183. return $core.withContext(function($ctx2) {
  43184. return self._error_("Unknown variable");
  43185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43186. }));
  43187. $ctx1.sendIdx["at:ifAbsent:"]=1;
  43188. $3=self._push_($4);
  43189. $ctx1.sendIdx["push:"]=1;
  43190. return $3;
  43191. };
  43192. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  43193. if($core.assert($8)){
  43194. $10=self._context();
  43195. $ctx1.sendIdx["context"]=1;
  43196. $9=$recv($10)._receiver();
  43197. $11=$recv(aNode)._value();
  43198. $ctx1.sendIdx["value"]=2;
  43199. $7=$recv($9)._instVarAt_($11);
  43200. } else {
  43201. $12=self._context();
  43202. $13=$recv(aNode)._value();
  43203. $ctx1.sendIdx["value"]=3;
  43204. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  43205. return $core.withContext(function($ctx2) {
  43206. $15=$recv(aNode)._value();
  43207. $ctx2.sendIdx["value"]=4;
  43208. $14=$recv($15)._isCapitalized();
  43209. if($core.assert($14)){
  43210. $16=$recv($globals.Smalltalk)._globals();
  43211. $ctx2.sendIdx["globals"]=2;
  43212. $17=$recv(aNode)._value();
  43213. $ctx2.sendIdx["value"]=5;
  43214. return $recv($16)._at_ifAbsent_($17,(function(){
  43215. return $core.withContext(function($ctx3) {
  43216. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  43217. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  43218. }));
  43219. };
  43220. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  43221. }));
  43222. };
  43223. self._push_($7);
  43224. return self;
  43225. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  43226. },
  43227. args: ["aNode"],
  43228. 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 ] ] ] ])",
  43229. referencedClasses: ["Platform", "Smalltalk"],
  43230. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  43231. }),
  43232. $globals.ASTInterpreter);
  43233. $core.addClass('ASTInterpreterError', $globals.Error, [], 'Compiler-Interpreter');
  43234. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  43235. $core.addClass('ASTPCNodeVisitor', $globals.NodeVisitor, ['context', 'index', 'selector', 'currentNode'], 'Compiler-Interpreter');
  43236. $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`";
  43237. $core.addMethod(
  43238. $core.method({
  43239. selector: "context",
  43240. protocol: 'accessing',
  43241. fn: function (){
  43242. var self=this;
  43243. return self["@context"];
  43244. },
  43245. args: [],
  43246. source: "context\x0a\x09^ context",
  43247. referencedClasses: [],
  43248. messageSends: []
  43249. }),
  43250. $globals.ASTPCNodeVisitor);
  43251. $core.addMethod(
  43252. $core.method({
  43253. selector: "context:",
  43254. protocol: 'accessing',
  43255. fn: function (aContext){
  43256. var self=this;
  43257. self["@context"]=aContext;
  43258. return self;
  43259. },
  43260. args: ["aContext"],
  43261. source: "context: aContext\x0a\x09context := aContext",
  43262. referencedClasses: [],
  43263. messageSends: []
  43264. }),
  43265. $globals.ASTPCNodeVisitor);
  43266. $core.addMethod(
  43267. $core.method({
  43268. selector: "currentNode",
  43269. protocol: 'accessing',
  43270. fn: function (){
  43271. var self=this;
  43272. return self["@currentNode"];
  43273. },
  43274. args: [],
  43275. source: "currentNode\x0a\x09^ currentNode",
  43276. referencedClasses: [],
  43277. messageSends: []
  43278. }),
  43279. $globals.ASTPCNodeVisitor);
  43280. $core.addMethod(
  43281. $core.method({
  43282. selector: "increaseIndex",
  43283. protocol: 'accessing',
  43284. fn: function (){
  43285. var self=this;
  43286. return $core.withContext(function($ctx1) {
  43287. self["@index"]=$recv(self._index()).__plus((1));
  43288. return self;
  43289. }, function($ctx1) {$ctx1.fill(self,"increaseIndex",{},$globals.ASTPCNodeVisitor)});
  43290. },
  43291. args: [],
  43292. source: "increaseIndex\x0a\x09index := self index + 1",
  43293. referencedClasses: [],
  43294. messageSends: ["+", "index"]
  43295. }),
  43296. $globals.ASTPCNodeVisitor);
  43297. $core.addMethod(
  43298. $core.method({
  43299. selector: "index",
  43300. protocol: 'accessing',
  43301. fn: function (){
  43302. var self=this;
  43303. return $core.withContext(function($ctx1) {
  43304. var $1,$receiver;
  43305. $1=self["@index"];
  43306. if(($receiver = $1) == null || $receiver.isNil){
  43307. self["@index"]=(0);
  43308. return self["@index"];
  43309. } else {
  43310. return $1;
  43311. };
  43312. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.ASTPCNodeVisitor)});
  43313. },
  43314. args: [],
  43315. source: "index\x0a\x09^ index ifNil: [ index := 0 ]",
  43316. referencedClasses: [],
  43317. messageSends: ["ifNil:"]
  43318. }),
  43319. $globals.ASTPCNodeVisitor);
  43320. $core.addMethod(
  43321. $core.method({
  43322. selector: "selector",
  43323. protocol: 'accessing',
  43324. fn: function (){
  43325. var self=this;
  43326. return self["@selector"];
  43327. },
  43328. args: [],
  43329. source: "selector\x0a\x09^ selector",
  43330. referencedClasses: [],
  43331. messageSends: []
  43332. }),
  43333. $globals.ASTPCNodeVisitor);
  43334. $core.addMethod(
  43335. $core.method({
  43336. selector: "selector:",
  43337. protocol: 'accessing',
  43338. fn: function (aString){
  43339. var self=this;
  43340. self["@selector"]=aString;
  43341. return self;
  43342. },
  43343. args: ["aString"],
  43344. source: "selector: aString\x0a\x09selector := aString",
  43345. referencedClasses: [],
  43346. messageSends: []
  43347. }),
  43348. $globals.ASTPCNodeVisitor);
  43349. $core.addMethod(
  43350. $core.method({
  43351. selector: "visitJSStatementNode:",
  43352. protocol: 'visiting',
  43353. fn: function (aNode){
  43354. var self=this;
  43355. self["@currentNode"]=aNode;
  43356. return self;
  43357. },
  43358. args: ["aNode"],
  43359. 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",
  43360. referencedClasses: [],
  43361. messageSends: []
  43362. }),
  43363. $globals.ASTPCNodeVisitor);
  43364. $core.addMethod(
  43365. $core.method({
  43366. selector: "visitSendNode:",
  43367. protocol: 'visiting',
  43368. fn: function (aNode){
  43369. var self=this;
  43370. var sendIndex;
  43371. return $core.withContext(function($ctx1) {
  43372. var $1,$2,$4,$3,$5;
  43373. $1=self._context();
  43374. $2=self._selector();
  43375. $ctx1.sendIdx["selector"]=1;
  43376. sendIndex=$recv($1)._sendIndexAt_($2);
  43377. (
  43378. $ctx1.supercall = true,
  43379. ($globals.ASTPCNodeVisitor.superclass||$boot.dnu).fn.prototype._visitSendNode_.apply($recv(self), [aNode]));
  43380. $ctx1.supercall = false;
  43381. $4=self._selector();
  43382. $ctx1.sendIdx["selector"]=2;
  43383. $3=$recv($4).__eq($recv(aNode)._selector());
  43384. $ctx1.sendIdx["="]=1;
  43385. if($core.assert($3)){
  43386. $5=$recv(self._index()).__eq(sendIndex);
  43387. if($core.assert($5)){
  43388. self["@currentNode"]=aNode;
  43389. self["@currentNode"];
  43390. };
  43391. self._increaseIndex();
  43392. };
  43393. return self;
  43394. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sendIndex:sendIndex},$globals.ASTPCNodeVisitor)});
  43395. },
  43396. args: ["aNode"],
  43397. 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 ]",
  43398. referencedClasses: [],
  43399. messageSends: ["sendIndexAt:", "context", "selector", "visitSendNode:", "ifTrue:", "=", "index", "increaseIndex"]
  43400. }),
  43401. $globals.ASTPCNodeVisitor);
  43402. $core.addMethod(
  43403. $core.method({
  43404. selector: "isSteppingNode",
  43405. protocol: '*Compiler-Interpreter',
  43406. fn: function (){
  43407. var self=this;
  43408. return true;
  43409. },
  43410. args: [],
  43411. source: "isSteppingNode\x0a\x09^ true",
  43412. referencedClasses: [],
  43413. messageSends: []
  43414. }),
  43415. $globals.AssignmentNode);
  43416. $core.addMethod(
  43417. $core.method({
  43418. selector: "isSteppingNode",
  43419. protocol: '*Compiler-Interpreter',
  43420. fn: function (){
  43421. var self=this;
  43422. return true;
  43423. },
  43424. args: [],
  43425. source: "isSteppingNode\x0a\x09^ true",
  43426. referencedClasses: [],
  43427. messageSends: []
  43428. }),
  43429. $globals.BlockNode);
  43430. $core.addMethod(
  43431. $core.method({
  43432. selector: "nextSiblingNode:",
  43433. protocol: '*Compiler-Interpreter',
  43434. fn: function (aNode){
  43435. var self=this;
  43436. return nil;
  43437. },
  43438. args: ["aNode"],
  43439. 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",
  43440. referencedClasses: [],
  43441. messageSends: []
  43442. }),
  43443. $globals.BlockNode);
  43444. $core.addMethod(
  43445. $core.method({
  43446. selector: "isSteppingNode",
  43447. protocol: '*Compiler-Interpreter',
  43448. fn: function (){
  43449. var self=this;
  43450. return true;
  43451. },
  43452. args: [],
  43453. source: "isSteppingNode\x0a\x09^ true",
  43454. referencedClasses: [],
  43455. messageSends: []
  43456. }),
  43457. $globals.DynamicArrayNode);
  43458. $core.addMethod(
  43459. $core.method({
  43460. selector: "isSteppingNode",
  43461. protocol: '*Compiler-Interpreter',
  43462. fn: function (){
  43463. var self=this;
  43464. return true;
  43465. },
  43466. args: [],
  43467. source: "isSteppingNode\x0a\x09^ true",
  43468. referencedClasses: [],
  43469. messageSends: []
  43470. }),
  43471. $globals.DynamicDictionaryNode);
  43472. $core.addMethod(
  43473. $core.method({
  43474. selector: "isSteppingNode",
  43475. protocol: '*Compiler-Interpreter',
  43476. fn: function (){
  43477. var self=this;
  43478. return true;
  43479. },
  43480. args: [],
  43481. source: "isSteppingNode\x0a\x09^ true",
  43482. referencedClasses: [],
  43483. messageSends: []
  43484. }),
  43485. $globals.JSStatementNode);
  43486. $core.addMethod(
  43487. $core.method({
  43488. selector: "isSteppingNode",
  43489. protocol: '*Compiler-Interpreter',
  43490. fn: function (){
  43491. var self=this;
  43492. return false;
  43493. },
  43494. args: [],
  43495. source: "isSteppingNode\x0a\x09^ false",
  43496. referencedClasses: [],
  43497. messageSends: []
  43498. }),
  43499. $globals.Node);
  43500. $core.addMethod(
  43501. $core.method({
  43502. selector: "nextSiblingNode:",
  43503. protocol: '*Compiler-Interpreter',
  43504. fn: function (aNode){
  43505. var self=this;
  43506. return $core.withContext(function($ctx1) {
  43507. var $1;
  43508. var $early={};
  43509. try {
  43510. $1=self._nodes();
  43511. $ctx1.sendIdx["nodes"]=1;
  43512. return $recv($1)._at_ifAbsent_($recv($recv(self._nodes())._indexOf_(aNode)).__plus((1)),(function(){
  43513. throw $early=[nil];
  43514. }));
  43515. }
  43516. catch(e) {if(e===$early)return e[0]; throw e}
  43517. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.Node)});
  43518. },
  43519. args: ["aNode"],
  43520. 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 ]",
  43521. referencedClasses: [],
  43522. messageSends: ["at:ifAbsent:", "nodes", "+", "indexOf:"]
  43523. }),
  43524. $globals.Node);
  43525. $core.addMethod(
  43526. $core.method({
  43527. selector: "isSteppingNode",
  43528. protocol: '*Compiler-Interpreter',
  43529. fn: function (){
  43530. var self=this;
  43531. return true;
  43532. },
  43533. args: [],
  43534. source: "isSteppingNode\x0a\x09^ true",
  43535. referencedClasses: [],
  43536. messageSends: []
  43537. }),
  43538. $globals.SendNode);
  43539. });
  43540. define('amber/lang',[
  43541. './helpers', // pre-fetch, dep of ./deploy
  43542. './deploy',
  43543. './parser',
  43544. // --- packages for the Amber reflection begin here ---
  43545. 'amber_core/Platform-ImportExport',
  43546. 'amber_core/Compiler-Core',
  43547. 'amber_core/Compiler-AST',
  43548. 'amber_core/Compiler-Semantic',
  43549. 'amber_core/Compiler-IR',
  43550. 'amber_core/Compiler-Inlining',
  43551. 'amber_core/Compiler-Interpreter'
  43552. // --- packages for the Amber reflection end here ---
  43553. ], function (amber) { return amber; });
  43554. define("amber_core/SUnit", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Classes"], function($boot){"use strict";
  43555. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  43556. $core.addPackage('SUnit');
  43557. $core.packages["SUnit"].innerEval = function (expr) { return eval(expr); };
  43558. $core.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  43559. $core.addClass('ResultAnnouncement', $globals.Object, ['result'], 'SUnit');
  43560. $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.";
  43561. $core.addMethod(
  43562. $core.method({
  43563. selector: "result",
  43564. protocol: 'accessing',
  43565. fn: function (){
  43566. var self=this;
  43567. return self["@result"];
  43568. },
  43569. args: [],
  43570. source: "result\x0a\x09^ result",
  43571. referencedClasses: [],
  43572. messageSends: []
  43573. }),
  43574. $globals.ResultAnnouncement);
  43575. $core.addMethod(
  43576. $core.method({
  43577. selector: "result:",
  43578. protocol: 'accessing',
  43579. fn: function (aTestResult){
  43580. var self=this;
  43581. self["@result"]=aTestResult;
  43582. return self;
  43583. },
  43584. args: ["aTestResult"],
  43585. source: "result: aTestResult\x0a\x09result := aTestResult",
  43586. referencedClasses: [],
  43587. messageSends: []
  43588. }),
  43589. $globals.ResultAnnouncement);
  43590. $core.addClass('TestCase', $globals.Object, ['testSelector', 'asyncTimeout', 'context'], 'SUnit');
  43591. $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.";
  43592. $core.addMethod(
  43593. $core.method({
  43594. selector: "assert:",
  43595. protocol: 'testing',
  43596. fn: function (aBoolean){
  43597. var self=this;
  43598. return $core.withContext(function($ctx1) {
  43599. self._assert_description_(aBoolean,"Assertion failed");
  43600. return self;
  43601. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  43602. },
  43603. args: ["aBoolean"],
  43604. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  43605. referencedClasses: [],
  43606. messageSends: ["assert:description:"]
  43607. }),
  43608. $globals.TestCase);
  43609. $core.addMethod(
  43610. $core.method({
  43611. selector: "assert:description:",
  43612. protocol: 'testing',
  43613. fn: function (aBoolean,aString){
  43614. var self=this;
  43615. return $core.withContext(function($ctx1) {
  43616. if(!$core.assert(aBoolean)){
  43617. self._signalFailure_(aString);
  43618. };
  43619. return self;
  43620. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  43621. },
  43622. args: ["aBoolean", "aString"],
  43623. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  43624. referencedClasses: [],
  43625. messageSends: ["ifFalse:", "signalFailure:"]
  43626. }),
  43627. $globals.TestCase);
  43628. $core.addMethod(
  43629. $core.method({
  43630. selector: "assert:equals:",
  43631. protocol: 'testing',
  43632. fn: function (actual,expected){
  43633. var self=this;
  43634. return $core.withContext(function($ctx1) {
  43635. var $1,$5,$4,$3,$2;
  43636. $1=$recv(actual).__eq(expected);
  43637. $5=$recv(expected)._printString();
  43638. $ctx1.sendIdx["printString"]=1;
  43639. $4="Expected: ".__comma($5);
  43640. $3=$recv($4).__comma(" but was: ");
  43641. $ctx1.sendIdx[","]=2;
  43642. $2=$recv($3).__comma($recv(actual)._printString());
  43643. $ctx1.sendIdx[","]=1;
  43644. return self._assert_description_($1,$2);
  43645. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  43646. },
  43647. args: ["actual", "expected"],
  43648. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  43649. referencedClasses: [],
  43650. messageSends: ["assert:description:", "=", ",", "printString"]
  43651. }),
  43652. $globals.TestCase);
  43653. $core.addMethod(
  43654. $core.method({
  43655. selector: "async:",
  43656. protocol: 'async',
  43657. fn: function (aBlock){
  43658. var self=this;
  43659. var c;
  43660. return $core.withContext(function($ctx1) {
  43661. var $1;
  43662. self._errorIfNotAsync_("#async");
  43663. c=self["@context"];
  43664. return (function(){
  43665. return $core.withContext(function($ctx2) {
  43666. $1=self._isAsync();
  43667. if($core.assert($1)){
  43668. return $recv(c)._execute_(aBlock);
  43669. };
  43670. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43671. });
  43672. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  43673. },
  43674. args: ["aBlock"],
  43675. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  43676. referencedClasses: [],
  43677. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  43678. }),
  43679. $globals.TestCase);
  43680. $core.addMethod(
  43681. $core.method({
  43682. selector: "context:",
  43683. protocol: 'accessing',
  43684. fn: function (aRunningTestContext){
  43685. var self=this;
  43686. self["@context"]=aRunningTestContext;
  43687. return self;
  43688. },
  43689. args: ["aRunningTestContext"],
  43690. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  43691. referencedClasses: [],
  43692. messageSends: []
  43693. }),
  43694. $globals.TestCase);
  43695. $core.addMethod(
  43696. $core.method({
  43697. selector: "deny:",
  43698. protocol: 'testing',
  43699. fn: function (aBoolean){
  43700. var self=this;
  43701. return $core.withContext(function($ctx1) {
  43702. self._assert_($recv(aBoolean)._not());
  43703. return self;
  43704. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  43705. },
  43706. args: ["aBoolean"],
  43707. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  43708. referencedClasses: [],
  43709. messageSends: ["assert:", "not"]
  43710. }),
  43711. $globals.TestCase);
  43712. $core.addMethod(
  43713. $core.method({
  43714. selector: "errorIfNotAsync:",
  43715. protocol: 'error handling',
  43716. fn: function (aString){
  43717. var self=this;
  43718. return $core.withContext(function($ctx1) {
  43719. var $1;
  43720. $1=self._isAsync();
  43721. if(!$core.assert($1)){
  43722. self._error_($recv(aString).__comma(" used without prior #timeout:"));
  43723. };
  43724. return self;
  43725. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  43726. },
  43727. args: ["aString"],
  43728. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  43729. referencedClasses: [],
  43730. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  43731. }),
  43732. $globals.TestCase);
  43733. $core.addMethod(
  43734. $core.method({
  43735. selector: "finished",
  43736. protocol: 'async',
  43737. fn: function (){
  43738. var self=this;
  43739. return $core.withContext(function($ctx1) {
  43740. self._errorIfNotAsync_("#finished");
  43741. self["@asyncTimeout"]=nil;
  43742. return self;
  43743. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  43744. },
  43745. args: [],
  43746. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  43747. referencedClasses: [],
  43748. messageSends: ["errorIfNotAsync:"]
  43749. }),
  43750. $globals.TestCase);
  43751. $core.addMethod(
  43752. $core.method({
  43753. selector: "isAsync",
  43754. protocol: 'testing',
  43755. fn: function (){
  43756. var self=this;
  43757. return $core.withContext(function($ctx1) {
  43758. return $recv(self["@asyncTimeout"])._notNil();
  43759. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  43760. },
  43761. args: [],
  43762. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  43763. referencedClasses: [],
  43764. messageSends: ["notNil"]
  43765. }),
  43766. $globals.TestCase);
  43767. $core.addMethod(
  43768. $core.method({
  43769. selector: "performTest",
  43770. protocol: 'running',
  43771. fn: function (){
  43772. var self=this;
  43773. return $core.withContext(function($ctx1) {
  43774. self["@asyncTimeout"]=nil;
  43775. self._perform_(self._selector());
  43776. return self;
  43777. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  43778. },
  43779. args: [],
  43780. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  43781. referencedClasses: [],
  43782. messageSends: ["perform:", "selector"]
  43783. }),
  43784. $globals.TestCase);
  43785. $core.addMethod(
  43786. $core.method({
  43787. selector: "runCase",
  43788. protocol: 'running',
  43789. fn: function (){
  43790. var self=this;
  43791. return $core.withContext(function($ctx1) {
  43792. $recv($recv($globals.TestContext)._testCase_(self))._start();
  43793. return self;
  43794. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  43795. },
  43796. args: [],
  43797. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  43798. referencedClasses: ["TestContext"],
  43799. messageSends: ["start", "testCase:"]
  43800. }),
  43801. $globals.TestCase);
  43802. $core.addMethod(
  43803. $core.method({
  43804. selector: "selector",
  43805. protocol: 'accessing',
  43806. fn: function (){
  43807. var self=this;
  43808. return self["@testSelector"];
  43809. },
  43810. args: [],
  43811. source: "selector\x0a\x09^ testSelector",
  43812. referencedClasses: [],
  43813. messageSends: []
  43814. }),
  43815. $globals.TestCase);
  43816. $core.addMethod(
  43817. $core.method({
  43818. selector: "setTestSelector:",
  43819. protocol: 'accessing',
  43820. fn: function (aSelector){
  43821. var self=this;
  43822. self["@testSelector"]=aSelector;
  43823. return self;
  43824. },
  43825. args: ["aSelector"],
  43826. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  43827. referencedClasses: [],
  43828. messageSends: []
  43829. }),
  43830. $globals.TestCase);
  43831. $core.addMethod(
  43832. $core.method({
  43833. selector: "setUp",
  43834. protocol: 'running',
  43835. fn: function (){
  43836. var self=this;
  43837. return self;
  43838. },
  43839. args: [],
  43840. source: "setUp",
  43841. referencedClasses: [],
  43842. messageSends: []
  43843. }),
  43844. $globals.TestCase);
  43845. $core.addMethod(
  43846. $core.method({
  43847. selector: "should:",
  43848. protocol: 'testing',
  43849. fn: function (aBlock){
  43850. var self=this;
  43851. return $core.withContext(function($ctx1) {
  43852. self._assert_($recv(aBlock)._value());
  43853. return self;
  43854. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  43855. },
  43856. args: ["aBlock"],
  43857. source: "should: aBlock\x0a\x09self assert: aBlock value",
  43858. referencedClasses: [],
  43859. messageSends: ["assert:", "value"]
  43860. }),
  43861. $globals.TestCase);
  43862. $core.addMethod(
  43863. $core.method({
  43864. selector: "should:raise:",
  43865. protocol: 'testing',
  43866. fn: function (aBlock,anExceptionClass){
  43867. var self=this;
  43868. return $core.withContext(function($ctx1) {
  43869. self._assert_($recv((function(){
  43870. return $core.withContext(function($ctx2) {
  43871. $recv(aBlock)._value();
  43872. return false;
  43873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43874. }))._on_do_(anExceptionClass,(function(ex){
  43875. return true;
  43876. })));
  43877. return self;
  43878. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  43879. },
  43880. args: ["aBlock", "anExceptionClass"],
  43881. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  43882. referencedClasses: [],
  43883. messageSends: ["assert:", "on:do:", "value"]
  43884. }),
  43885. $globals.TestCase);
  43886. $core.addMethod(
  43887. $core.method({
  43888. selector: "shouldnt:raise:",
  43889. protocol: 'testing',
  43890. fn: function (aBlock,anExceptionClass){
  43891. var self=this;
  43892. return $core.withContext(function($ctx1) {
  43893. self._assert_($recv((function(){
  43894. return $core.withContext(function($ctx2) {
  43895. $recv(aBlock)._value();
  43896. return true;
  43897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43898. }))._on_do_(anExceptionClass,(function(ex){
  43899. return false;
  43900. })));
  43901. return self;
  43902. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  43903. },
  43904. args: ["aBlock", "anExceptionClass"],
  43905. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  43906. referencedClasses: [],
  43907. messageSends: ["assert:", "on:do:", "value"]
  43908. }),
  43909. $globals.TestCase);
  43910. $core.addMethod(
  43911. $core.method({
  43912. selector: "signalFailure:",
  43913. protocol: 'private',
  43914. fn: function (aString){
  43915. var self=this;
  43916. return $core.withContext(function($ctx1) {
  43917. var $1;
  43918. $1=$recv($globals.TestFailure)._new();
  43919. $recv($1)._messageText_(aString);
  43920. $recv($1)._signal();
  43921. return self;
  43922. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  43923. },
  43924. args: ["aString"],
  43925. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  43926. referencedClasses: ["TestFailure"],
  43927. messageSends: ["messageText:", "new", "signal"]
  43928. }),
  43929. $globals.TestCase);
  43930. $core.addMethod(
  43931. $core.method({
  43932. selector: "tearDown",
  43933. protocol: 'running',
  43934. fn: function (){
  43935. var self=this;
  43936. return self;
  43937. },
  43938. args: [],
  43939. source: "tearDown",
  43940. referencedClasses: [],
  43941. messageSends: []
  43942. }),
  43943. $globals.TestCase);
  43944. $core.addMethod(
  43945. $core.method({
  43946. selector: "timeout:",
  43947. protocol: 'async',
  43948. fn: function (aNumber){
  43949. var self=this;
  43950. return $core.withContext(function($ctx1) {
  43951. var $1,$receiver;
  43952. $1=self["@asyncTimeout"];
  43953. if(($receiver = $1) == null || $receiver.isNil){
  43954. $1;
  43955. } else {
  43956. $recv(self["@asyncTimeout"])._clearTimeout();
  43957. };
  43958. self["@asyncTimeout"]=(0);
  43959. self["@asyncTimeout"]=$recv(self._async_((function(){
  43960. return $core.withContext(function($ctx2) {
  43961. return self._assert_description_(false,"SUnit grace time exhausted");
  43962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43963. })))._valueWithTimeout_(aNumber);
  43964. return self;
  43965. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  43966. },
  43967. args: ["aNumber"],
  43968. 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",
  43969. referencedClasses: [],
  43970. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  43971. }),
  43972. $globals.TestCase);
  43973. $core.addMethod(
  43974. $core.method({
  43975. selector: "allTestSelectors",
  43976. protocol: 'accessing',
  43977. fn: function (){
  43978. var self=this;
  43979. var selectors;
  43980. return $core.withContext(function($ctx1) {
  43981. var $1;
  43982. selectors=self._testSelectors();
  43983. $1=self._shouldInheritSelectors();
  43984. if($core.assert($1)){
  43985. $recv(selectors)._addAll_($recv(self._superclass())._allTestSelectors());
  43986. };
  43987. return selectors;
  43988. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.klass)});
  43989. },
  43990. args: [],
  43991. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  43992. referencedClasses: [],
  43993. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  43994. }),
  43995. $globals.TestCase.klass);
  43996. $core.addMethod(
  43997. $core.method({
  43998. selector: "buildSuite",
  43999. protocol: 'accessing',
  44000. fn: function (){
  44001. var self=this;
  44002. return $core.withContext(function($ctx1) {
  44003. return $recv(self._allTestSelectors())._collect_((function(each){
  44004. return $core.withContext(function($ctx2) {
  44005. return self._selector_(each);
  44006. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44007. }));
  44008. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.klass)});
  44009. },
  44010. args: [],
  44011. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  44012. referencedClasses: [],
  44013. messageSends: ["collect:", "allTestSelectors", "selector:"]
  44014. }),
  44015. $globals.TestCase.klass);
  44016. $core.addMethod(
  44017. $core.method({
  44018. selector: "classTag",
  44019. protocol: 'accessing',
  44020. fn: function (){
  44021. var self=this;
  44022. return "test";
  44023. },
  44024. args: [],
  44025. 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'",
  44026. referencedClasses: [],
  44027. messageSends: []
  44028. }),
  44029. $globals.TestCase.klass);
  44030. $core.addMethod(
  44031. $core.method({
  44032. selector: "isAbstract",
  44033. protocol: 'testing',
  44034. fn: function (){
  44035. var self=this;
  44036. return $core.withContext(function($ctx1) {
  44037. return $recv(self._name()).__eq("TestCase");
  44038. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.klass)});
  44039. },
  44040. args: [],
  44041. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  44042. referencedClasses: [],
  44043. messageSends: ["=", "name"]
  44044. }),
  44045. $globals.TestCase.klass);
  44046. $core.addMethod(
  44047. $core.method({
  44048. selector: "lookupHierarchyRoot",
  44049. protocol: 'accessing',
  44050. fn: function (){
  44051. var self=this;
  44052. return $globals.TestCase;
  44053. },
  44054. args: [],
  44055. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  44056. referencedClasses: ["TestCase"],
  44057. messageSends: []
  44058. }),
  44059. $globals.TestCase.klass);
  44060. $core.addMethod(
  44061. $core.method({
  44062. selector: "selector:",
  44063. protocol: 'accessing',
  44064. fn: function (aSelector){
  44065. var self=this;
  44066. return $core.withContext(function($ctx1) {
  44067. var $1;
  44068. $1=self._new();
  44069. $recv($1)._setTestSelector_(aSelector);
  44070. return $recv($1)._yourself();
  44071. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.klass)});
  44072. },
  44073. args: ["aSelector"],
  44074. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  44075. referencedClasses: [],
  44076. messageSends: ["setTestSelector:", "new", "yourself"]
  44077. }),
  44078. $globals.TestCase.klass);
  44079. $core.addMethod(
  44080. $core.method({
  44081. selector: "shouldInheritSelectors",
  44082. protocol: 'testing',
  44083. fn: function (){
  44084. var self=this;
  44085. return $core.withContext(function($ctx1) {
  44086. return self.__tild_eq(self._lookupHierarchyRoot());
  44087. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.klass)});
  44088. },
  44089. args: [],
  44090. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  44091. referencedClasses: [],
  44092. messageSends: ["~=", "lookupHierarchyRoot"]
  44093. }),
  44094. $globals.TestCase.klass);
  44095. $core.addMethod(
  44096. $core.method({
  44097. selector: "testSelectors",
  44098. protocol: 'accessing',
  44099. fn: function (){
  44100. var self=this;
  44101. return $core.withContext(function($ctx1) {
  44102. return $recv($recv(self._methodDictionary())._keys())._select_((function(each){
  44103. return $core.withContext(function($ctx2) {
  44104. return $recv(each)._match_("^test");
  44105. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44106. }));
  44107. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.klass)});
  44108. },
  44109. args: [],
  44110. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  44111. referencedClasses: [],
  44112. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  44113. }),
  44114. $globals.TestCase.klass);
  44115. $core.addClass('TestContext', $globals.Object, ['testCase'], 'SUnit');
  44116. $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).";
  44117. $core.addMethod(
  44118. $core.method({
  44119. selector: "execute:",
  44120. protocol: 'running',
  44121. fn: function (aBlock){
  44122. var self=this;
  44123. var failed;
  44124. return $core.withContext(function($ctx1) {
  44125. var $1,$2;
  44126. $recv(self["@testCase"])._context_(self);
  44127. $ctx1.sendIdx["context:"]=1;
  44128. $recv((function(){
  44129. return $core.withContext(function($ctx2) {
  44130. failed=true;
  44131. failed;
  44132. $recv(aBlock)._value();
  44133. failed=false;
  44134. return failed;
  44135. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44136. }))._ensure_((function(){
  44137. return $core.withContext(function($ctx2) {
  44138. $recv(self["@testCase"])._context_(nil);
  44139. $1=$recv(failed)._and_((function(){
  44140. return $core.withContext(function($ctx3) {
  44141. return $recv(self["@testCase"])._isAsync();
  44142. $ctx3.sendIdx["isAsync"]=1;
  44143. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  44144. }));
  44145. if($core.assert($1)){
  44146. $recv(self["@testCase"])._finished();
  44147. };
  44148. $2=$recv(self["@testCase"])._isAsync();
  44149. if(!$core.assert($2)){
  44150. return $recv(self["@testCase"])._tearDown();
  44151. };
  44152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  44153. }));
  44154. return self;
  44155. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  44156. },
  44157. args: ["aBlock"],
  44158. 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 ] ]",
  44159. referencedClasses: [],
  44160. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  44161. }),
  44162. $globals.TestContext);
  44163. $core.addMethod(
  44164. $core.method({
  44165. selector: "start",
  44166. protocol: 'running',
  44167. fn: function (){
  44168. var self=this;
  44169. return $core.withContext(function($ctx1) {
  44170. self._execute_((function(){
  44171. return $core.withContext(function($ctx2) {
  44172. $recv(self["@testCase"])._setUp();
  44173. return $recv(self["@testCase"])._performTest();
  44174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44175. }));
  44176. return self;
  44177. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  44178. },
  44179. args: [],
  44180. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  44181. referencedClasses: [],
  44182. messageSends: ["execute:", "setUp", "performTest"]
  44183. }),
  44184. $globals.TestContext);
  44185. $core.addMethod(
  44186. $core.method({
  44187. selector: "testCase:",
  44188. protocol: 'accessing',
  44189. fn: function (aTestCase){
  44190. var self=this;
  44191. self["@testCase"]=aTestCase;
  44192. return self;
  44193. },
  44194. args: ["aTestCase"],
  44195. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  44196. referencedClasses: [],
  44197. messageSends: []
  44198. }),
  44199. $globals.TestContext);
  44200. $core.addMethod(
  44201. $core.method({
  44202. selector: "testCase:",
  44203. protocol: 'instance creation',
  44204. fn: function (aTestCase){
  44205. var self=this;
  44206. return $core.withContext(function($ctx1) {
  44207. var $1;
  44208. $1=self._new();
  44209. $recv($1)._testCase_(aTestCase);
  44210. return $recv($1)._yourself();
  44211. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.klass)});
  44212. },
  44213. args: ["aTestCase"],
  44214. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  44215. referencedClasses: [],
  44216. messageSends: ["testCase:", "new", "yourself"]
  44217. }),
  44218. $globals.TestContext.klass);
  44219. $core.addClass('ReportingTestContext', $globals.TestContext, ['finished', 'result'], 'SUnit');
  44220. $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`.";
  44221. $core.addMethod(
  44222. $core.method({
  44223. selector: "execute:",
  44224. protocol: 'running',
  44225. fn: function (aBlock){
  44226. var self=this;
  44227. return $core.withContext(function($ctx1) {
  44228. var $1;
  44229. $recv((function(){
  44230. return $core.withContext(function($ctx2) {
  44231. return self._withErrorReporting_((function(){
  44232. return $core.withContext(function($ctx3) {
  44233. return (
  44234. $ctx3.supercall = true,
  44235. ($globals.ReportingTestContext.superclass||$boot.dnu).fn.prototype._execute_.apply($recv(self), [aBlock]));
  44236. $ctx3.supercall = false;
  44237. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44238. }));
  44239. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44240. }))._ensure_((function(){
  44241. return $core.withContext(function($ctx2) {
  44242. $1=$recv(self["@testCase"])._isAsync();
  44243. if(!$core.assert($1)){
  44244. $recv(self["@result"])._increaseRuns();
  44245. return $recv(self["@finished"])._value();
  44246. };
  44247. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  44248. }));
  44249. return self;
  44250. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  44251. },
  44252. args: ["aBlock"],
  44253. 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 ] ]",
  44254. referencedClasses: [],
  44255. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  44256. }),
  44257. $globals.ReportingTestContext);
  44258. $core.addMethod(
  44259. $core.method({
  44260. selector: "finished:",
  44261. protocol: 'accessing',
  44262. fn: function (aBlock){
  44263. var self=this;
  44264. self["@finished"]=aBlock;
  44265. return self;
  44266. },
  44267. args: ["aBlock"],
  44268. source: "finished: aBlock\x0a\x09finished := aBlock",
  44269. referencedClasses: [],
  44270. messageSends: []
  44271. }),
  44272. $globals.ReportingTestContext);
  44273. $core.addMethod(
  44274. $core.method({
  44275. selector: "result:",
  44276. protocol: 'accessing',
  44277. fn: function (aTestResult){
  44278. var self=this;
  44279. self["@result"]=aTestResult;
  44280. return self;
  44281. },
  44282. args: ["aTestResult"],
  44283. source: "result: aTestResult\x0a\x09result := aTestResult",
  44284. referencedClasses: [],
  44285. messageSends: []
  44286. }),
  44287. $globals.ReportingTestContext);
  44288. $core.addMethod(
  44289. $core.method({
  44290. selector: "withErrorReporting:",
  44291. protocol: 'private',
  44292. fn: function (aBlock){
  44293. var self=this;
  44294. return $core.withContext(function($ctx1) {
  44295. $recv((function(){
  44296. return $core.withContext(function($ctx2) {
  44297. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  44298. return $core.withContext(function($ctx3) {
  44299. return $recv(self["@result"])._addFailure_(self["@testCase"]);
  44300. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  44301. }));
  44302. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44303. }))._on_do_($globals.Error,(function(ex){
  44304. return $core.withContext(function($ctx2) {
  44305. return $recv(self["@result"])._addError_(self["@testCase"]);
  44306. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  44307. }));
  44308. $ctx1.sendIdx["on:do:"]=1;
  44309. return self;
  44310. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  44311. },
  44312. args: ["aBlock"],
  44313. 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 ]",
  44314. referencedClasses: ["TestFailure", "Error"],
  44315. messageSends: ["on:do:", "addFailure:", "addError:"]
  44316. }),
  44317. $globals.ReportingTestContext);
  44318. $core.addMethod(
  44319. $core.method({
  44320. selector: "testCase:result:finished:",
  44321. protocol: 'instance creation',
  44322. fn: function (aTestCase,aTestResult,aBlock){
  44323. var self=this;
  44324. return $core.withContext(function($ctx1) {
  44325. var $1;
  44326. $1=(
  44327. $ctx1.supercall = true,
  44328. ($globals.ReportingTestContext.klass.superclass||$boot.dnu).fn.prototype._testCase_.apply($recv(self), [aTestCase]));
  44329. $ctx1.supercall = false;
  44330. $recv($1)._result_(aTestResult);
  44331. $recv($1)._finished_(aBlock);
  44332. return $recv($1)._yourself();
  44333. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.klass)});
  44334. },
  44335. args: ["aTestCase", "aTestResult", "aBlock"],
  44336. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  44337. referencedClasses: [],
  44338. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  44339. }),
  44340. $globals.ReportingTestContext.klass);
  44341. $core.addClass('TestFailure', $globals.Error, [], 'SUnit');
  44342. $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.";
  44343. $core.addClass('TestResult', $globals.Object, ['timestamp', 'runs', 'errors', 'failures', 'total'], 'SUnit');
  44344. $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";
  44345. $core.addMethod(
  44346. $core.method({
  44347. selector: "addError:",
  44348. protocol: 'accessing',
  44349. fn: function (anError){
  44350. var self=this;
  44351. return $core.withContext(function($ctx1) {
  44352. $recv(self._errors())._add_(anError);
  44353. return self;
  44354. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  44355. },
  44356. args: ["anError"],
  44357. source: "addError: anError\x0a\x09self errors add: anError",
  44358. referencedClasses: [],
  44359. messageSends: ["add:", "errors"]
  44360. }),
  44361. $globals.TestResult);
  44362. $core.addMethod(
  44363. $core.method({
  44364. selector: "addFailure:",
  44365. protocol: 'accessing',
  44366. fn: function (aFailure){
  44367. var self=this;
  44368. return $core.withContext(function($ctx1) {
  44369. $recv(self._failures())._add_(aFailure);
  44370. return self;
  44371. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  44372. },
  44373. args: ["aFailure"],
  44374. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  44375. referencedClasses: [],
  44376. messageSends: ["add:", "failures"]
  44377. }),
  44378. $globals.TestResult);
  44379. $core.addMethod(
  44380. $core.method({
  44381. selector: "errors",
  44382. protocol: 'accessing',
  44383. fn: function (){
  44384. var self=this;
  44385. return self["@errors"];
  44386. },
  44387. args: [],
  44388. source: "errors\x0a\x09^ errors",
  44389. referencedClasses: [],
  44390. messageSends: []
  44391. }),
  44392. $globals.TestResult);
  44393. $core.addMethod(
  44394. $core.method({
  44395. selector: "failures",
  44396. protocol: 'accessing',
  44397. fn: function (){
  44398. var self=this;
  44399. return self["@failures"];
  44400. },
  44401. args: [],
  44402. source: "failures\x0a\x09^ failures",
  44403. referencedClasses: [],
  44404. messageSends: []
  44405. }),
  44406. $globals.TestResult);
  44407. $core.addMethod(
  44408. $core.method({
  44409. selector: "increaseRuns",
  44410. protocol: 'accessing',
  44411. fn: function (){
  44412. var self=this;
  44413. return $core.withContext(function($ctx1) {
  44414. self["@runs"]=$recv(self["@runs"]).__plus((1));
  44415. return self;
  44416. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  44417. },
  44418. args: [],
  44419. source: "increaseRuns\x0a\x09runs := runs + 1",
  44420. referencedClasses: [],
  44421. messageSends: ["+"]
  44422. }),
  44423. $globals.TestResult);
  44424. $core.addMethod(
  44425. $core.method({
  44426. selector: "initialize",
  44427. protocol: 'initialization',
  44428. fn: function (){
  44429. var self=this;
  44430. return $core.withContext(function($ctx1) {
  44431. (
  44432. $ctx1.supercall = true,
  44433. ($globals.TestResult.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  44434. $ctx1.supercall = false;
  44435. self["@timestamp"]=$recv($globals.Date)._now();
  44436. self["@runs"]=(0);
  44437. self["@errors"]=$recv($globals.Array)._new();
  44438. $ctx1.sendIdx["new"]=1;
  44439. self["@failures"]=$recv($globals.Array)._new();
  44440. self["@total"]=(0);
  44441. return self;
  44442. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  44443. },
  44444. args: [],
  44445. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  44446. referencedClasses: ["Date", "Array"],
  44447. messageSends: ["initialize", "now", "new"]
  44448. }),
  44449. $globals.TestResult);
  44450. $core.addMethod(
  44451. $core.method({
  44452. selector: "nextRunDo:",
  44453. protocol: 'running',
  44454. fn: function (aBlock){
  44455. var self=this;
  44456. return $core.withContext(function($ctx1) {
  44457. var $2,$1;
  44458. $2=self._runs();
  44459. $ctx1.sendIdx["runs"]=1;
  44460. $1=$recv($2).__eq_eq(self._total());
  44461. if(!$core.assert($1)){
  44462. return $recv(aBlock)._value_($recv(self._runs()).__plus((1)));
  44463. };
  44464. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  44465. },
  44466. args: ["aBlock"],
  44467. 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 ]",
  44468. referencedClasses: [],
  44469. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  44470. }),
  44471. $globals.TestResult);
  44472. $core.addMethod(
  44473. $core.method({
  44474. selector: "runCase:",
  44475. protocol: 'running',
  44476. fn: function (aTestCase){
  44477. var self=this;
  44478. return $core.withContext(function($ctx1) {
  44479. $recv((function(){
  44480. return $core.withContext(function($ctx2) {
  44481. return $recv((function(){
  44482. return $core.withContext(function($ctx3) {
  44483. self._increaseRuns();
  44484. return $recv(aTestCase)._runCase();
  44485. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44486. }))._on_do_($globals.TestFailure,(function(ex){
  44487. return $core.withContext(function($ctx3) {
  44488. return self._addFailure_(aTestCase);
  44489. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  44490. }));
  44491. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44492. }))._on_do_($globals.Error,(function(ex){
  44493. return $core.withContext(function($ctx2) {
  44494. return self._addError_(aTestCase);
  44495. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  44496. }));
  44497. $ctx1.sendIdx["on:do:"]=1;
  44498. return self;
  44499. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  44500. },
  44501. args: ["aTestCase"],
  44502. 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 ]",
  44503. referencedClasses: ["TestFailure", "Error"],
  44504. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  44505. }),
  44506. $globals.TestResult);
  44507. $core.addMethod(
  44508. $core.method({
  44509. selector: "runs",
  44510. protocol: 'accessing',
  44511. fn: function (){
  44512. var self=this;
  44513. return self["@runs"];
  44514. },
  44515. args: [],
  44516. source: "runs\x0a\x09^ runs",
  44517. referencedClasses: [],
  44518. messageSends: []
  44519. }),
  44520. $globals.TestResult);
  44521. $core.addMethod(
  44522. $core.method({
  44523. selector: "status",
  44524. protocol: 'accessing',
  44525. fn: function (){
  44526. var self=this;
  44527. return $core.withContext(function($ctx1) {
  44528. var $2,$3,$1;
  44529. $2=$recv(self._errors())._isEmpty();
  44530. $ctx1.sendIdx["isEmpty"]=1;
  44531. if($core.assert($2)){
  44532. $3=$recv(self._failures())._isEmpty();
  44533. if($core.assert($3)){
  44534. $1="success";
  44535. } else {
  44536. $1="failure";
  44537. };
  44538. } else {
  44539. $1="error";
  44540. };
  44541. return $1;
  44542. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  44543. },
  44544. args: [],
  44545. source: "status\x0a\x09^ self errors isEmpty\x0a\x09\x09ifTrue: [\x0a\x09\x09\x09self failures isEmpty\x0a\x09\x09\x09\x09ifTrue: [ 'success' ]\x0a\x09\x09\x09\x09ifFalse: [ 'failure' ]]\x0a\x09\x09ifFalse: [ 'error' ]",
  44546. referencedClasses: [],
  44547. messageSends: ["ifTrue:ifFalse:", "isEmpty", "errors", "failures"]
  44548. }),
  44549. $globals.TestResult);
  44550. $core.addMethod(
  44551. $core.method({
  44552. selector: "timestamp",
  44553. protocol: 'accessing',
  44554. fn: function (){
  44555. var self=this;
  44556. return self["@timestamp"];
  44557. },
  44558. args: [],
  44559. source: "timestamp\x0a\x09^ timestamp",
  44560. referencedClasses: [],
  44561. messageSends: []
  44562. }),
  44563. $globals.TestResult);
  44564. $core.addMethod(
  44565. $core.method({
  44566. selector: "total",
  44567. protocol: 'accessing',
  44568. fn: function (){
  44569. var self=this;
  44570. return self["@total"];
  44571. },
  44572. args: [],
  44573. source: "total\x0a\x09^ total",
  44574. referencedClasses: [],
  44575. messageSends: []
  44576. }),
  44577. $globals.TestResult);
  44578. $core.addMethod(
  44579. $core.method({
  44580. selector: "total:",
  44581. protocol: 'accessing',
  44582. fn: function (aNumber){
  44583. var self=this;
  44584. self["@total"]=aNumber;
  44585. return self;
  44586. },
  44587. args: ["aNumber"],
  44588. source: "total: aNumber\x0a\x09total := aNumber",
  44589. referencedClasses: [],
  44590. messageSends: []
  44591. }),
  44592. $globals.TestResult);
  44593. $core.addClass('TestSuiteRunner', $globals.Object, ['suite', 'result', 'announcer', 'runNextTest'], 'SUnit');
  44594. $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`.";
  44595. $core.addMethod(
  44596. $core.method({
  44597. selector: "announcer",
  44598. protocol: 'accessing',
  44599. fn: function (){
  44600. var self=this;
  44601. return self["@announcer"];
  44602. },
  44603. args: [],
  44604. source: "announcer\x0a\x09^ announcer",
  44605. referencedClasses: [],
  44606. messageSends: []
  44607. }),
  44608. $globals.TestSuiteRunner);
  44609. $core.addMethod(
  44610. $core.method({
  44611. selector: "contextOf:",
  44612. protocol: 'private',
  44613. fn: function (anInteger){
  44614. var self=this;
  44615. return $core.withContext(function($ctx1) {
  44616. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv(self["@suite"])._at_(anInteger),self["@result"],(function(){
  44617. return $core.withContext(function($ctx2) {
  44618. return self._resume();
  44619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44620. }));
  44621. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  44622. },
  44623. args: ["anInteger"],
  44624. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  44625. referencedClasses: ["ReportingTestContext"],
  44626. messageSends: ["testCase:result:finished:", "at:", "resume"]
  44627. }),
  44628. $globals.TestSuiteRunner);
  44629. $core.addMethod(
  44630. $core.method({
  44631. selector: "initialize",
  44632. protocol: 'initialization',
  44633. fn: function (){
  44634. var self=this;
  44635. return $core.withContext(function($ctx1) {
  44636. var $1;
  44637. (
  44638. $ctx1.supercall = true,
  44639. ($globals.TestSuiteRunner.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  44640. $ctx1.supercall = false;
  44641. self["@announcer"]=$recv($globals.Announcer)._new();
  44642. $ctx1.sendIdx["new"]=1;
  44643. self["@result"]=$recv($globals.TestResult)._new();
  44644. self["@runNextTest"]=(function(){
  44645. var runs;
  44646. return $core.withContext(function($ctx2) {
  44647. runs=$recv(self["@result"])._runs();
  44648. runs;
  44649. $1=$recv(runs).__lt($recv(self["@result"])._total());
  44650. if($core.assert($1)){
  44651. return $recv(self._contextOf_($recv(runs).__plus((1))))._start();
  44652. };
  44653. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  44654. });
  44655. return self;
  44656. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  44657. },
  44658. args: [],
  44659. 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 ] ].",
  44660. referencedClasses: ["Announcer", "TestResult"],
  44661. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  44662. }),
  44663. $globals.TestSuiteRunner);
  44664. $core.addMethod(
  44665. $core.method({
  44666. selector: "result",
  44667. protocol: 'accessing',
  44668. fn: function (){
  44669. var self=this;
  44670. return self["@result"];
  44671. },
  44672. args: [],
  44673. source: "result\x0a\x09^ result",
  44674. referencedClasses: [],
  44675. messageSends: []
  44676. }),
  44677. $globals.TestSuiteRunner);
  44678. $core.addMethod(
  44679. $core.method({
  44680. selector: "resume",
  44681. protocol: 'actions',
  44682. fn: function (){
  44683. var self=this;
  44684. return $core.withContext(function($ctx1) {
  44685. $recv(self["@runNextTest"])._fork();
  44686. $recv(self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_(self["@result"]));
  44687. return self;
  44688. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  44689. },
  44690. args: [],
  44691. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  44692. referencedClasses: ["ResultAnnouncement"],
  44693. messageSends: ["fork", "announce:", "result:", "new"]
  44694. }),
  44695. $globals.TestSuiteRunner);
  44696. $core.addMethod(
  44697. $core.method({
  44698. selector: "run",
  44699. protocol: 'actions',
  44700. fn: function (){
  44701. var self=this;
  44702. return $core.withContext(function($ctx1) {
  44703. $recv(self["@result"])._total_($recv(self["@suite"])._size());
  44704. self._resume();
  44705. return self;
  44706. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  44707. },
  44708. args: [],
  44709. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  44710. referencedClasses: [],
  44711. messageSends: ["total:", "size", "resume"]
  44712. }),
  44713. $globals.TestSuiteRunner);
  44714. $core.addMethod(
  44715. $core.method({
  44716. selector: "suite:",
  44717. protocol: 'accessing',
  44718. fn: function (aCollection){
  44719. var self=this;
  44720. self["@suite"]=aCollection;
  44721. return self;
  44722. },
  44723. args: ["aCollection"],
  44724. source: "suite: aCollection\x0a\x09suite := aCollection",
  44725. referencedClasses: [],
  44726. messageSends: []
  44727. }),
  44728. $globals.TestSuiteRunner);
  44729. $core.addMethod(
  44730. $core.method({
  44731. selector: "new",
  44732. protocol: 'instance creation',
  44733. fn: function (){
  44734. var self=this;
  44735. return $core.withContext(function($ctx1) {
  44736. self._shouldNotImplement();
  44737. return self;
  44738. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.klass)});
  44739. },
  44740. args: [],
  44741. source: "new\x0a\x09self shouldNotImplement",
  44742. referencedClasses: [],
  44743. messageSends: ["shouldNotImplement"]
  44744. }),
  44745. $globals.TestSuiteRunner.klass);
  44746. $core.addMethod(
  44747. $core.method({
  44748. selector: "on:",
  44749. protocol: 'instance creation',
  44750. fn: function (aCollection){
  44751. var self=this;
  44752. return $core.withContext(function($ctx1) {
  44753. var $1;
  44754. $1=(
  44755. $ctx1.supercall = true,
  44756. ($globals.TestSuiteRunner.klass.superclass||$boot.dnu).fn.prototype._new.apply($recv(self), []));
  44757. $ctx1.supercall = false;
  44758. return $recv($1)._suite_(aCollection);
  44759. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.klass)});
  44760. },
  44761. args: ["aCollection"],
  44762. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  44763. referencedClasses: [],
  44764. messageSends: ["suite:", "new"]
  44765. }),
  44766. $globals.TestSuiteRunner.klass);
  44767. $core.addMethod(
  44768. $core.method({
  44769. selector: "isTestClass",
  44770. protocol: '*SUnit',
  44771. fn: function (){
  44772. var self=this;
  44773. return $core.withContext(function($ctx1) {
  44774. return $recv(self._includesBehavior_($globals.TestCase))._and_((function(){
  44775. return $core.withContext(function($ctx2) {
  44776. return $recv(self._isAbstract())._not();
  44777. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  44778. }));
  44779. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.Behavior)});
  44780. },
  44781. args: [],
  44782. source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
  44783. referencedClasses: ["TestCase"],
  44784. messageSends: ["and:", "includesBehavior:", "not", "isAbstract"]
  44785. }),
  44786. $globals.Behavior);
  44787. $core.addMethod(
  44788. $core.method({
  44789. selector: "isTestPackage",
  44790. protocol: '*SUnit',
  44791. fn: function (){
  44792. var self=this;
  44793. return $core.withContext(function($ctx1) {
  44794. return $recv(self._classes())._anySatisfy_((function(each){
  44795. return $core.withContext(function($ctx2) {
  44796. return $recv(each)._isTestClass();
  44797. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44798. }));
  44799. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  44800. },
  44801. args: [],
  44802. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  44803. referencedClasses: [],
  44804. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  44805. }),
  44806. $globals.Package);
  44807. });
  44808. define("amber_core/Compiler-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  44809. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  44810. $core.addPackage('Compiler-Tests');
  44811. $core.packages["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  44812. $core.packages["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  44813. $core.addClass('ASTParsingTest', $globals.TestCase, [], 'Compiler-Tests');
  44814. $core.addMethod(
  44815. $core.method({
  44816. selector: "analyze:forClass:",
  44817. protocol: 'convenience',
  44818. fn: function (aNode,aClass){
  44819. var self=this;
  44820. return $core.withContext(function($ctx1) {
  44821. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  44822. return aNode;
  44823. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTParsingTest)});
  44824. },
  44825. args: ["aNode", "aClass"],
  44826. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  44827. referencedClasses: ["SemanticAnalyzer"],
  44828. messageSends: ["visit:", "on:"]
  44829. }),
  44830. $globals.ASTParsingTest);
  44831. $core.addMethod(
  44832. $core.method({
  44833. selector: "parse:",
  44834. protocol: 'parsing',
  44835. fn: function (aString){
  44836. var self=this;
  44837. return $core.withContext(function($ctx1) {
  44838. return $recv($globals.Smalltalk)._parse_(aString);
  44839. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTParsingTest)});
  44840. },
  44841. args: ["aString"],
  44842. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  44843. referencedClasses: ["Smalltalk"],
  44844. messageSends: ["parse:"]
  44845. }),
  44846. $globals.ASTParsingTest);
  44847. $core.addMethod(
  44848. $core.method({
  44849. selector: "parse:forClass:",
  44850. protocol: 'parsing',
  44851. fn: function (aString,aClass){
  44852. var self=this;
  44853. return $core.withContext(function($ctx1) {
  44854. return self._analyze_forClass_(self._parse_(aString),aClass);
  44855. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  44856. },
  44857. args: ["aString", "aClass"],
  44858. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  44859. referencedClasses: [],
  44860. messageSends: ["analyze:forClass:", "parse:"]
  44861. }),
  44862. $globals.ASTParsingTest);
  44863. $core.addClass('ASTPCNodeVisitorTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  44864. $core.addMethod(
  44865. $core.method({
  44866. selector: "astPCNodeVisitor",
  44867. protocol: 'factory',
  44868. fn: function (){
  44869. var self=this;
  44870. return $core.withContext(function($ctx1) {
  44871. var $1,$2;
  44872. $1=$recv($globals.ASTPCNodeVisitor)._new();
  44873. $ctx1.sendIdx["new"]=1;
  44874. $2=$recv($recv($globals.AIContext)._new())._yourself();
  44875. $ctx1.sendIdx["yourself"]=1;
  44876. $recv($1)._context_($2);
  44877. return $recv($1)._yourself();
  44878. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  44879. },
  44880. args: [],
  44881. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  44882. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  44883. messageSends: ["context:", "new", "yourself"]
  44884. }),
  44885. $globals.ASTPCNodeVisitorTest);
  44886. $core.addMethod(
  44887. $core.method({
  44888. selector: "astPCNodeVisitorForSelector:",
  44889. protocol: 'factory',
  44890. fn: function (aString){
  44891. var self=this;
  44892. return $core.withContext(function($ctx1) {
  44893. var $1,$2;
  44894. $1=$recv($globals.ASTPCNodeVisitor)._new();
  44895. $ctx1.sendIdx["new"]=1;
  44896. $recv($1)._selector_(aString);
  44897. $2=$recv($recv($globals.AIContext)._new())._yourself();
  44898. $ctx1.sendIdx["yourself"]=1;
  44899. $recv($1)._context_($2);
  44900. return $recv($1)._yourself();
  44901. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  44902. },
  44903. args: ["aString"],
  44904. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09context: (AIContext new\x0a\x09\x09\x09yourself);\x0a\x09\x09yourself",
  44905. referencedClasses: ["ASTPCNodeVisitor", "AIContext"],
  44906. messageSends: ["selector:", "new", "context:", "yourself"]
  44907. }),
  44908. $globals.ASTPCNodeVisitorTest);
  44909. $core.addMethod(
  44910. $core.method({
  44911. selector: "testJSStatementNode",
  44912. protocol: 'tests',
  44913. fn: function (){
  44914. var self=this;
  44915. var ast,visitor;
  44916. return $core.withContext(function($ctx1) {
  44917. var $3,$2,$1;
  44918. ast=self._parse_forClass_("foo <consolee.log(1)>",$globals.Object);
  44919. $3=self._astPCNodeVisitor();
  44920. $recv($3)._visit_(ast);
  44921. $2=$recv($3)._currentNode();
  44922. $1=$recv($2)._isJSStatementNode();
  44923. self._assert_($1);
  44924. return self;
  44925. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  44926. },
  44927. args: [],
  44928. 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",
  44929. referencedClasses: ["Object"],
  44930. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  44931. }),
  44932. $globals.ASTPCNodeVisitorTest);
  44933. $core.addMethod(
  44934. $core.method({
  44935. selector: "testMessageSend",
  44936. protocol: 'tests',
  44937. fn: function (){
  44938. var self=this;
  44939. var ast;
  44940. return $core.withContext(function($ctx1) {
  44941. var $3,$2,$1;
  44942. ast=self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  44943. $3=self._astPCNodeVisitorForSelector_("yourself");
  44944. $recv($3)._visit_(ast);
  44945. $2=$recv($3)._currentNode();
  44946. $1=$recv($2)._selector();
  44947. self._assert_equals_($1,"yourself");
  44948. return self;
  44949. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  44950. },
  44951. args: [],
  44952. 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'",
  44953. referencedClasses: ["Object"],
  44954. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  44955. }),
  44956. $globals.ASTPCNodeVisitorTest);
  44957. $core.addMethod(
  44958. $core.method({
  44959. selector: "testMessageSendWithBlocks",
  44960. protocol: 'tests',
  44961. fn: function (){
  44962. var self=this;
  44963. var ast;
  44964. return $core.withContext(function($ctx1) {
  44965. var $3,$2,$1;
  44966. ast=self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  44967. $3=self._astPCNodeVisitorForSelector_("yourself");
  44968. $recv($3)._visit_(ast);
  44969. $2=$recv($3)._currentNode();
  44970. $1=$recv($2)._selector();
  44971. self._assert_equals_($1,"yourself");
  44972. return self;
  44973. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  44974. },
  44975. args: [],
  44976. 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'",
  44977. referencedClasses: ["Object"],
  44978. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  44979. }),
  44980. $globals.ASTPCNodeVisitorTest);
  44981. $core.addMethod(
  44982. $core.method({
  44983. selector: "testMessageSendWithInlining",
  44984. protocol: 'tests',
  44985. fn: function (){
  44986. var self=this;
  44987. var ast;
  44988. return $core.withContext(function($ctx1) {
  44989. var $3,$4,$2,$1,$7,$6,$5;
  44990. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  44991. $ctx1.sendIdx["parse:forClass:"]=1;
  44992. $3=self._astPCNodeVisitorForSelector_("yourself");
  44993. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  44994. $recv($3)._visit_(ast);
  44995. $ctx1.sendIdx["visit:"]=1;
  44996. $4=$recv($3)._currentNode();
  44997. $ctx1.sendIdx["currentNode"]=1;
  44998. $2=$4;
  44999. $1=$recv($2)._selector();
  45000. $ctx1.sendIdx["selector"]=1;
  45001. self._assert_equals_($1,"yourself");
  45002. $ctx1.sendIdx["assert:equals:"]=1;
  45003. ast=self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  45004. $7=self._astPCNodeVisitorForSelector_("asBoolean");
  45005. $recv($7)._visit_(ast);
  45006. $6=$recv($7)._currentNode();
  45007. $5=$recv($6)._selector();
  45008. self._assert_equals_($5,"asBoolean");
  45009. return self;
  45010. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45011. },
  45012. args: [],
  45013. 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'",
  45014. referencedClasses: ["Object"],
  45015. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  45016. }),
  45017. $globals.ASTPCNodeVisitorTest);
  45018. $core.addMethod(
  45019. $core.method({
  45020. selector: "testNoMessageSend",
  45021. protocol: 'tests',
  45022. fn: function (){
  45023. var self=this;
  45024. var ast;
  45025. return $core.withContext(function($ctx1) {
  45026. var $3,$2,$1;
  45027. ast=self._parse_forClass_("foo ^ self",$globals.Object);
  45028. $3=self._astPCNodeVisitor();
  45029. $recv($3)._visit_(ast);
  45030. $2=$recv($3)._currentNode();
  45031. $1=$recv($2)._isNil();
  45032. self._assert_($1);
  45033. return self;
  45034. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  45035. },
  45036. args: [],
  45037. 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",
  45038. referencedClasses: ["Object"],
  45039. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  45040. }),
  45041. $globals.ASTPCNodeVisitorTest);
  45042. $core.addMethod(
  45043. $core.method({
  45044. selector: "testPC",
  45045. protocol: 'tests',
  45046. fn: function (){
  45047. var self=this;
  45048. var ast,visitor;
  45049. return $core.withContext(function($ctx1) {
  45050. var $3,$2,$1;
  45051. ast=self._parse_forClass_("foo <console.log(1)>",$globals.Object);
  45052. $3=self._astPCNodeVisitor();
  45053. $recv($3)._visit_(ast);
  45054. $2=$recv($3)._currentNode();
  45055. $1=$recv($2)._isJSStatementNode();
  45056. self._assert_($1);
  45057. return self;
  45058. }, function($ctx1) {$ctx1.fill(self,"testPC",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  45059. },
  45060. args: [],
  45061. 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",
  45062. referencedClasses: ["Object"],
  45063. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  45064. }),
  45065. $globals.ASTPCNodeVisitorTest);
  45066. $core.addClass('ASTPositionTest', $globals.ASTParsingTest, [], 'Compiler-Tests');
  45067. $core.addMethod(
  45068. $core.method({
  45069. selector: "testNodeAtPosition",
  45070. protocol: 'tests',
  45071. fn: function (){
  45072. var self=this;
  45073. var node;
  45074. return $core.withContext(function($ctx1) {
  45075. var $3,$4,$2,$1,$7,$8,$6,$5;
  45076. node=self._parse_("yourself\x0a\x09^ self");
  45077. $ctx1.sendIdx["parse:"]=1;
  45078. $3=node;
  45079. $4=(2).__at((4));
  45080. $ctx1.sendIdx["@"]=1;
  45081. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  45082. return nil;
  45083. }));
  45084. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  45085. $1=$recv($2)._source();
  45086. self._assert_equals_($1,"self");
  45087. $ctx1.sendIdx["assert:equals:"]=1;
  45088. node=self._parse_("foo\x0a\x09true ifTrue: [ 1 ]");
  45089. $ctx1.sendIdx["parse:"]=2;
  45090. $7=node;
  45091. $8=(2).__at((7));
  45092. $ctx1.sendIdx["@"]=2;
  45093. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  45094. return nil;
  45095. }));
  45096. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  45097. $5=$recv($6)._selector();
  45098. $ctx1.sendIdx["selector"]=1;
  45099. self._assert_equals_($5,"ifTrue:");
  45100. $ctx1.sendIdx["assert:equals:"]=2;
  45101. node=self._parse_("foo\x0a\x09self foo; bar; baz");
  45102. self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  45103. return nil;
  45104. })))._selector(),"foo");
  45105. return self;
  45106. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  45107. },
  45108. args: [],
  45109. 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'",
  45110. referencedClasses: [],
  45111. messageSends: ["parse:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  45112. }),
  45113. $globals.ASTPositionTest);
  45114. $core.addClass('CodeGeneratorTest', $globals.ASTParsingTest, ['receiver'], 'Compiler-Tests');
  45115. $core.addMethod(
  45116. $core.method({
  45117. selector: "codeGeneratorClass",
  45118. protocol: 'accessing',
  45119. fn: function (){
  45120. var self=this;
  45121. return $globals.CodeGenerator;
  45122. },
  45123. args: [],
  45124. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  45125. referencedClasses: ["CodeGenerator"],
  45126. messageSends: []
  45127. }),
  45128. $globals.CodeGeneratorTest);
  45129. $core.addMethod(
  45130. $core.method({
  45131. selector: "compiler",
  45132. protocol: 'factory',
  45133. fn: function (){
  45134. var self=this;
  45135. return $core.withContext(function($ctx1) {
  45136. var $1;
  45137. $1=$recv($globals.Compiler)._new();
  45138. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  45139. return $recv($1)._yourself();
  45140. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  45141. },
  45142. args: [],
  45143. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  45144. referencedClasses: ["Compiler"],
  45145. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  45146. }),
  45147. $globals.CodeGeneratorTest);
  45148. $core.addMethod(
  45149. $core.method({
  45150. selector: "setUp",
  45151. protocol: 'initialization',
  45152. fn: function (){
  45153. var self=this;
  45154. return $core.withContext(function($ctx1) {
  45155. self["@receiver"]=$recv($globals.DoIt)._new();
  45156. return self;
  45157. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  45158. },
  45159. args: [],
  45160. source: "setUp\x0a\x09receiver := DoIt new",
  45161. referencedClasses: ["DoIt"],
  45162. messageSends: ["new"]
  45163. }),
  45164. $globals.CodeGeneratorTest);
  45165. $core.addMethod(
  45166. $core.method({
  45167. selector: "should:receiver:raise:",
  45168. protocol: 'testing',
  45169. fn: function (aString,anObject,anErrorClass){
  45170. var self=this;
  45171. var method,result;
  45172. return $core.withContext(function($ctx1) {
  45173. var $1,$2,$3,$receiver;
  45174. self["@receiver"]=anObject;
  45175. $recv((function(){
  45176. return $core.withContext(function($ctx2) {
  45177. return self._should_raise_((function(){
  45178. return $core.withContext(function($ctx3) {
  45179. $1=self._compiler();
  45180. $2=$recv(anObject)._class();
  45181. $ctx3.sendIdx["class"]=1;
  45182. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  45183. method;
  45184. return $recv(self["@receiver"])._perform_($recv(method)._selector());
  45185. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  45186. }),anErrorClass);
  45187. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45188. }))._ensure_((function(){
  45189. return $core.withContext(function($ctx2) {
  45190. $3=method;
  45191. if(($receiver = $3) == null || $receiver.isNil){
  45192. return $3;
  45193. } else {
  45194. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  45195. };
  45196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  45197. }));
  45198. return self;
  45199. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  45200. },
  45201. args: ["aString", "anObject", "anErrorClass"],
  45202. 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 ] ]",
  45203. referencedClasses: [],
  45204. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  45205. }),
  45206. $globals.CodeGeneratorTest);
  45207. $core.addMethod(
  45208. $core.method({
  45209. selector: "should:receiver:return:",
  45210. protocol: 'testing',
  45211. fn: function (aString,anObject,aResult){
  45212. var self=this;
  45213. var method,result;
  45214. return $core.withContext(function($ctx1) {
  45215. var $1,$2;
  45216. self["@receiver"]=anObject;
  45217. $1=self._compiler();
  45218. $2=$recv(anObject)._class();
  45219. $ctx1.sendIdx["class"]=1;
  45220. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  45221. result=$recv(self["@receiver"])._perform_($recv(method)._selector());
  45222. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  45223. self._assert_equals_(aResult,result);
  45224. return self;
  45225. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  45226. },
  45227. args: ["aString", "anObject", "aResult"],
  45228. 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",
  45229. referencedClasses: [],
  45230. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  45231. }),
  45232. $globals.CodeGeneratorTest);
  45233. $core.addMethod(
  45234. $core.method({
  45235. selector: "should:return:",
  45236. protocol: 'testing',
  45237. fn: function (aString,anObject){
  45238. var self=this;
  45239. return $core.withContext(function($ctx1) {
  45240. return self._should_receiver_return_(aString,self["@receiver"],anObject);
  45241. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  45242. },
  45243. args: ["aString", "anObject"],
  45244. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  45245. referencedClasses: [],
  45246. messageSends: ["should:receiver:return:"]
  45247. }),
  45248. $globals.CodeGeneratorTest);
  45249. $core.addMethod(
  45250. $core.method({
  45251. selector: "tearDown",
  45252. protocol: 'initialization',
  45253. fn: function (){
  45254. var self=this;
  45255. return self;
  45256. },
  45257. args: [],
  45258. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  45259. referencedClasses: [],
  45260. messageSends: []
  45261. }),
  45262. $globals.CodeGeneratorTest);
  45263. $core.addMethod(
  45264. $core.method({
  45265. selector: "testAssignment",
  45266. protocol: 'tests',
  45267. fn: function (){
  45268. var self=this;
  45269. return $core.withContext(function($ctx1) {
  45270. self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  45271. $ctx1.sendIdx["should:return:"]=1;
  45272. self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  45273. $ctx1.sendIdx["should:return:"]=2;
  45274. self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  45275. return self;
  45276. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  45277. },
  45278. args: [],
  45279. 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",
  45280. referencedClasses: [],
  45281. messageSends: ["should:return:"]
  45282. }),
  45283. $globals.CodeGeneratorTest);
  45284. $core.addMethod(
  45285. $core.method({
  45286. selector: "testBackslashSelectors",
  45287. protocol: 'tests',
  45288. fn: function (){
  45289. var self=this;
  45290. return $core.withContext(function($ctx1) {
  45291. self._should_return_("\x5c arg ^ 4",(4));
  45292. $ctx1.sendIdx["should:return:"]=1;
  45293. self._should_return_("\x5c\x5c arg ^ 42",(42));
  45294. return self;
  45295. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  45296. },
  45297. args: [],
  45298. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  45299. referencedClasses: [],
  45300. messageSends: ["should:return:"]
  45301. }),
  45302. $globals.CodeGeneratorTest);
  45303. $core.addMethod(
  45304. $core.method({
  45305. selector: "testBlockReturn",
  45306. protocol: 'tests',
  45307. fn: function (){
  45308. var self=this;
  45309. return $core.withContext(function($ctx1) {
  45310. self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  45311. $ctx1.sendIdx["should:return:"]=1;
  45312. self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  45313. $ctx1.sendIdx["should:return:"]=2;
  45314. self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  45315. return self;
  45316. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  45317. },
  45318. args: [],
  45319. 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).",
  45320. referencedClasses: [],
  45321. messageSends: ["should:return:"]
  45322. }),
  45323. $globals.CodeGeneratorTest);
  45324. $core.addMethod(
  45325. $core.method({
  45326. selector: "testCascades",
  45327. protocol: 'tests',
  45328. fn: function (){
  45329. var self=this;
  45330. return $core.withContext(function($ctx1) {
  45331. self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  45332. return self;
  45333. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  45334. },
  45335. args: [],
  45336. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  45337. referencedClasses: [],
  45338. messageSends: ["should:return:"]
  45339. }),
  45340. $globals.CodeGeneratorTest);
  45341. $core.addMethod(
  45342. $core.method({
  45343. selector: "testCascadesInDynamicArray",
  45344. protocol: 'tests',
  45345. fn: function (){
  45346. var self=this;
  45347. return $core.withContext(function($ctx1) {
  45348. self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  45349. return self;
  45350. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  45351. },
  45352. args: [],
  45353. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  45354. referencedClasses: [],
  45355. messageSends: ["should:return:"]
  45356. }),
  45357. $globals.CodeGeneratorTest);
  45358. $core.addMethod(
  45359. $core.method({
  45360. selector: "testCascadesInDynamicDictioary",
  45361. protocol: 'tests',
  45362. fn: function (){
  45363. var self=this;
  45364. return $core.withContext(function($ctx1) {
  45365. self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  45366. return self;
  45367. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  45368. },
  45369. args: [],
  45370. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  45371. referencedClasses: [],
  45372. messageSends: ["should:return:"]
  45373. }),
  45374. $globals.CodeGeneratorTest);
  45375. $core.addMethod(
  45376. $core.method({
  45377. selector: "testCascadesInSend",
  45378. protocol: 'tests',
  45379. fn: function (){
  45380. var self=this;
  45381. return $core.withContext(function($ctx1) {
  45382. self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  45383. return self;
  45384. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  45385. },
  45386. args: [],
  45387. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  45388. referencedClasses: [],
  45389. messageSends: ["should:return:"]
  45390. }),
  45391. $globals.CodeGeneratorTest);
  45392. $core.addMethod(
  45393. $core.method({
  45394. selector: "testCascadesWithInlining",
  45395. protocol: 'tests',
  45396. fn: function (){
  45397. var self=this;
  45398. return $core.withContext(function($ctx1) {
  45399. self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  45400. $ctx1.sendIdx["should:return:"]=1;
  45401. self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  45402. return self;
  45403. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  45404. },
  45405. args: [],
  45406. 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",
  45407. referencedClasses: [],
  45408. messageSends: ["should:return:"]
  45409. }),
  45410. $globals.CodeGeneratorTest);
  45411. $core.addMethod(
  45412. $core.method({
  45413. selector: "testDynamicArrayElementsOrdered",
  45414. protocol: 'tests',
  45415. fn: function (){
  45416. var self=this;
  45417. return $core.withContext(function($ctx1) {
  45418. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  45419. $ctx1.sendIdx["should:return:"]=1;
  45420. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  45421. return self;
  45422. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  45423. },
  45424. args: [],
  45425. 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).",
  45426. referencedClasses: [],
  45427. messageSends: ["should:return:"]
  45428. }),
  45429. $globals.CodeGeneratorTest);
  45430. $core.addMethod(
  45431. $core.method({
  45432. selector: "testDynamicDictionaryElementsOrdered",
  45433. protocol: 'tests',
  45434. fn: function (){
  45435. var self=this;
  45436. return $core.withContext(function($ctx1) {
  45437. 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)]));
  45438. return self;
  45439. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  45440. },
  45441. args: [],
  45442. 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}.",
  45443. referencedClasses: [],
  45444. messageSends: ["should:return:"]
  45445. }),
  45446. $globals.CodeGeneratorTest);
  45447. $core.addMethod(
  45448. $core.method({
  45449. selector: "testDynamicDictionaryWithMoreArrows",
  45450. protocol: 'tests',
  45451. fn: function (){
  45452. var self=this;
  45453. return $core.withContext(function($ctx1) {
  45454. var $2,$1;
  45455. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  45456. $ctx1.sendIdx["->"]=1;
  45457. $1=$recv($globals.HashedCollection)._with_($2);
  45458. self._should_return_("foo ^ #{1->2->3}",$1);
  45459. return self;
  45460. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  45461. },
  45462. args: [],
  45463. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  45464. referencedClasses: ["HashedCollection"],
  45465. messageSends: ["should:return:", "with:", "->"]
  45466. }),
  45467. $globals.CodeGeneratorTest);
  45468. $core.addMethod(
  45469. $core.method({
  45470. selector: "testGlobalVar",
  45471. protocol: 'tests',
  45472. fn: function (){
  45473. var self=this;
  45474. return $core.withContext(function($ctx1) {
  45475. self._should_return_("foo ^ eval class",$globals.BlockClosure);
  45476. $ctx1.sendIdx["should:return:"]=1;
  45477. self._should_return_("foo ^ Math cos: 0",(1));
  45478. $ctx1.sendIdx["should:return:"]=2;
  45479. self._should_return_("foo ^ NonExistingVar",nil);
  45480. return self;
  45481. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  45482. },
  45483. args: [],
  45484. 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",
  45485. referencedClasses: ["BlockClosure"],
  45486. messageSends: ["should:return:"]
  45487. }),
  45488. $globals.CodeGeneratorTest);
  45489. $core.addMethod(
  45490. $core.method({
  45491. selector: "testInnerTemporalDependentElementsOrdered",
  45492. protocol: 'tests',
  45493. fn: function (){
  45494. var self=this;
  45495. return $core.withContext(function($ctx1) {
  45496. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  45497. $2="foo".__minus_gt($globals.Array);
  45498. $ctx1.sendIdx["->"]=1;
  45499. $3="bar".__minus_gt((2));
  45500. $ctx1.sendIdx["->"]=2;
  45501. $1=[$2,$3];
  45502. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  45503. $ctx1.sendIdx["should:return:"]=1;
  45504. $5="foo".__minus_gt($globals.Array);
  45505. $ctx1.sendIdx["->"]=3;
  45506. $6="bar".__minus_gt((2));
  45507. $ctx1.sendIdx["->"]=4;
  45508. $4=[$5,$6];
  45509. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  45510. $ctx1.sendIdx["should:return:"]=2;
  45511. $8="foo".__minus_gt((1));
  45512. $ctx1.sendIdx["->"]=5;
  45513. $9="bar".__minus_gt((2));
  45514. $ctx1.sendIdx["->"]=6;
  45515. $7=[$8,$9];
  45516. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  45517. $ctx1.sendIdx["should:return:"]=3;
  45518. $11="foo".__minus_gt((1));
  45519. $ctx1.sendIdx["->"]=7;
  45520. $10=[$11,"bar".__minus_gt((2))];
  45521. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  45522. $ctx1.sendIdx["should:return:"]=4;
  45523. 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)]));
  45524. return self;
  45525. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  45526. },
  45527. args: [],
  45528. 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}.",
  45529. referencedClasses: ["Array"],
  45530. messageSends: ["should:return:", "->"]
  45531. }),
  45532. $globals.CodeGeneratorTest);
  45533. $core.addMethod(
  45534. $core.method({
  45535. selector: "testJSStatement",
  45536. protocol: 'tests',
  45537. fn: function (){
  45538. var self=this;
  45539. return $core.withContext(function($ctx1) {
  45540. self._should_return_("foo <return 2+3>",(5));
  45541. return self;
  45542. }, function($ctx1) {$ctx1.fill(self,"testJSStatement",{},$globals.CodeGeneratorTest)});
  45543. },
  45544. args: [],
  45545. source: "testJSStatement\x0a\x09self should: 'foo <return 2+3>' return: 5",
  45546. referencedClasses: [],
  45547. messageSends: ["should:return:"]
  45548. }),
  45549. $globals.CodeGeneratorTest);
  45550. $core.addMethod(
  45551. $core.method({
  45552. selector: "testLexicalScope",
  45553. protocol: 'tests',
  45554. fn: function (){
  45555. var self=this;
  45556. return $core.withContext(function($ctx1) {
  45557. self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  45558. return self;
  45559. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  45560. },
  45561. args: [],
  45562. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  45563. referencedClasses: [],
  45564. messageSends: ["should:return:"]
  45565. }),
  45566. $globals.CodeGeneratorTest);
  45567. $core.addMethod(
  45568. $core.method({
  45569. selector: "testLiterals",
  45570. protocol: 'tests',
  45571. fn: function (){
  45572. var self=this;
  45573. return $core.withContext(function($ctx1) {
  45574. self._should_return_("foo ^ 1",(1));
  45575. $ctx1.sendIdx["should:return:"]=1;
  45576. self._should_return_("foo ^ 'hello'","hello");
  45577. $ctx1.sendIdx["should:return:"]=2;
  45578. self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  45579. $ctx1.sendIdx["should:return:"]=3;
  45580. self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  45581. $ctx1.sendIdx["should:return:"]=4;
  45582. self._should_return_("foo ^ true",true);
  45583. $ctx1.sendIdx["should:return:"]=5;
  45584. self._should_return_("foo ^ false",false);
  45585. $ctx1.sendIdx["should:return:"]=6;
  45586. self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  45587. $ctx1.sendIdx["should:return:"]=7;
  45588. self._should_return_("foo ^ #hello","hello");
  45589. $ctx1.sendIdx["should:return:"]=8;
  45590. self._should_return_("foo ^ $h","h");
  45591. $ctx1.sendIdx["should:return:"]=9;
  45592. self._should_return_("foo ^ -123.456",(-123.456));
  45593. $ctx1.sendIdx["should:return:"]=10;
  45594. self._should_return_("foo ^ -2.5e4",(-25000));
  45595. return self;
  45596. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  45597. },
  45598. args: [],
  45599. 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.",
  45600. referencedClasses: [],
  45601. messageSends: ["should:return:"]
  45602. }),
  45603. $globals.CodeGeneratorTest);
  45604. $core.addMethod(
  45605. $core.method({
  45606. selector: "testLocalReturn",
  45607. protocol: 'tests',
  45608. fn: function (){
  45609. var self=this;
  45610. return $core.withContext(function($ctx1) {
  45611. self._should_return_("foo ^ 1",(1));
  45612. $ctx1.sendIdx["should:return:"]=1;
  45613. self._should_return_("foo ^ 1 + 1",(2));
  45614. $ctx1.sendIdx["should:return:"]=2;
  45615. self._should_return_("foo ",self["@receiver"]);
  45616. $ctx1.sendIdx["should:return:"]=3;
  45617. self._should_return_("foo self asString",self["@receiver"]);
  45618. $ctx1.sendIdx["should:return:"]=4;
  45619. self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  45620. return self;
  45621. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  45622. },
  45623. args: [],
  45624. 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",
  45625. referencedClasses: [],
  45626. messageSends: ["should:return:"]
  45627. }),
  45628. $globals.CodeGeneratorTest);
  45629. $core.addMethod(
  45630. $core.method({
  45631. selector: "testMessageSends",
  45632. protocol: 'tests',
  45633. fn: function (){
  45634. var self=this;
  45635. return $core.withContext(function($ctx1) {
  45636. self._should_return_("foo ^ 1 asString","1");
  45637. $ctx1.sendIdx["should:return:"]=1;
  45638. self._should_return_("foo ^ 1 + 1",(2));
  45639. $ctx1.sendIdx["should:return:"]=2;
  45640. self._should_return_("foo ^ 1 + 2 * 3",(9));
  45641. $ctx1.sendIdx["should:return:"]=3;
  45642. self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  45643. $ctx1.sendIdx["should:return:"]=4;
  45644. self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  45645. return self;
  45646. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  45647. },
  45648. args: [],
  45649. 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)",
  45650. referencedClasses: [],
  45651. messageSends: ["should:return:"]
  45652. }),
  45653. $globals.CodeGeneratorTest);
  45654. $core.addMethod(
  45655. $core.method({
  45656. selector: "testMultipleSequences",
  45657. protocol: 'tests',
  45658. fn: function (){
  45659. var self=this;
  45660. return $core.withContext(function($ctx1) {
  45661. self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  45662. return self;
  45663. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  45664. },
  45665. args: [],
  45666. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  45667. referencedClasses: [],
  45668. messageSends: ["should:return:"]
  45669. }),
  45670. $globals.CodeGeneratorTest);
  45671. $core.addMethod(
  45672. $core.method({
  45673. selector: "testMutableLiterals",
  45674. protocol: 'tests',
  45675. fn: function (){
  45676. var self=this;
  45677. return $core.withContext(function($ctx1) {
  45678. self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  45679. return self;
  45680. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  45681. },
  45682. args: [],
  45683. source: "testMutableLiterals\x0a\x09\x22Mutable literals must be aliased in cascades.\x0a\x09See https://github.com/amber-smalltalk/amber/issues/428\x22\x0a\x09\x0a\x09self \x0a\x09\x09should: 'foo ^ #( 1 2 ) at: 1 put: 3; yourself' \x0a\x09\x09return: #(3 2)",
  45684. referencedClasses: [],
  45685. messageSends: ["should:return:"]
  45686. }),
  45687. $globals.CodeGeneratorTest);
  45688. $core.addMethod(
  45689. $core.method({
  45690. selector: "testNestedIfTrue",
  45691. protocol: 'tests',
  45692. fn: function (){
  45693. var self=this;
  45694. return $core.withContext(function($ctx1) {
  45695. self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  45696. $ctx1.sendIdx["should:return:"]=1;
  45697. self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  45698. $ctx1.sendIdx["should:return:"]=2;
  45699. self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  45700. $ctx1.sendIdx["should:return:"]=3;
  45701. self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",self["@receiver"]);
  45702. return self;
  45703. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  45704. },
  45705. args: [],
  45706. 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.",
  45707. referencedClasses: [],
  45708. messageSends: ["should:return:"]
  45709. }),
  45710. $globals.CodeGeneratorTest);
  45711. $core.addMethod(
  45712. $core.method({
  45713. selector: "testNestedSends",
  45714. protocol: 'tests',
  45715. fn: function (){
  45716. var self=this;
  45717. return $core.withContext(function($ctx1) {
  45718. 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());
  45719. return self;
  45720. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  45721. },
  45722. args: [],
  45723. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  45724. referencedClasses: ["Point"],
  45725. messageSends: ["should:return:", "asString", "x:y:", "@"]
  45726. }),
  45727. $globals.CodeGeneratorTest);
  45728. $core.addMethod(
  45729. $core.method({
  45730. selector: "testNonLocalReturn",
  45731. protocol: 'tests',
  45732. fn: function (){
  45733. var self=this;
  45734. return $core.withContext(function($ctx1) {
  45735. self._should_return_("foo [ ^ 1 ] value",(1));
  45736. $ctx1.sendIdx["should:return:"]=1;
  45737. self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  45738. $ctx1.sendIdx["should:return:"]=2;
  45739. self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  45740. $ctx1.sendIdx["should:return:"]=3;
  45741. self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  45742. return self;
  45743. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  45744. },
  45745. args: [],
  45746. 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",
  45747. referencedClasses: [],
  45748. messageSends: ["should:return:"]
  45749. }),
  45750. $globals.CodeGeneratorTest);
  45751. $core.addMethod(
  45752. $core.method({
  45753. selector: "testPascalCaseGlobal",
  45754. protocol: 'tests',
  45755. fn: function (){
  45756. var self=this;
  45757. return $core.withContext(function($ctx1) {
  45758. self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  45759. $ctx1.sendIdx["should:return:"]=1;
  45760. self._should_return_("foo ^NonExistent",nil);
  45761. return self;
  45762. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  45763. },
  45764. args: [],
  45765. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  45766. referencedClasses: ["Smalltalk"],
  45767. messageSends: ["should:return:", "at:", "globals"]
  45768. }),
  45769. $globals.CodeGeneratorTest);
  45770. $core.addMethod(
  45771. $core.method({
  45772. selector: "testRootSuperSend",
  45773. protocol: 'tests',
  45774. fn: function (){
  45775. var self=this;
  45776. return $core.withContext(function($ctx1) {
  45777. self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  45778. return self;
  45779. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  45780. },
  45781. args: [],
  45782. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  45783. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  45784. messageSends: ["should:receiver:raise:", "new"]
  45785. }),
  45786. $globals.CodeGeneratorTest);
  45787. $core.addMethod(
  45788. $core.method({
  45789. selector: "testSendReceiverAndArgumentsOrdered",
  45790. protocol: 'tests',
  45791. fn: function (){
  45792. var self=this;
  45793. return $core.withContext(function($ctx1) {
  45794. self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  45795. $ctx1.sendIdx["should:return:"]=1;
  45796. self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  45797. return self;
  45798. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  45799. },
  45800. args: [],
  45801. 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}.",
  45802. referencedClasses: ["Array"],
  45803. messageSends: ["should:return:"]
  45804. }),
  45805. $globals.CodeGeneratorTest);
  45806. $core.addMethod(
  45807. $core.method({
  45808. selector: "testSuperSend",
  45809. protocol: 'tests',
  45810. fn: function (){
  45811. var self=this;
  45812. return $core.withContext(function($ctx1) {
  45813. self._should_receiver_return_("foo ^ super isBoolean",true,false);
  45814. return self;
  45815. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  45816. },
  45817. args: [],
  45818. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  45819. referencedClasses: [],
  45820. messageSends: ["should:receiver:return:"]
  45821. }),
  45822. $globals.CodeGeneratorTest);
  45823. $core.addMethod(
  45824. $core.method({
  45825. selector: "testTempVariables",
  45826. protocol: 'tests',
  45827. fn: function (){
  45828. var self=this;
  45829. return $core.withContext(function($ctx1) {
  45830. self._should_return_("foo | a | ^ a",nil);
  45831. $ctx1.sendIdx["should:return:"]=1;
  45832. self._should_return_("foo | AVariable | ^ AVariable",nil);
  45833. $ctx1.sendIdx["should:return:"]=2;
  45834. self._should_return_("foo | a b c | ^ c",nil);
  45835. $ctx1.sendIdx["should:return:"]=3;
  45836. self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  45837. $ctx1.sendIdx["should:return:"]=4;
  45838. self._should_return_("foo | a | a:= 1. ^ a",(1));
  45839. $ctx1.sendIdx["should:return:"]=5;
  45840. self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  45841. return self;
  45842. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  45843. },
  45844. args: [],
  45845. 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.",
  45846. referencedClasses: [],
  45847. messageSends: ["should:return:"]
  45848. }),
  45849. $globals.CodeGeneratorTest);
  45850. $core.addMethod(
  45851. $core.method({
  45852. selector: "testThisContext",
  45853. protocol: 'tests',
  45854. fn: function (){
  45855. var self=this;
  45856. return $core.withContext(function($ctx1) {
  45857. self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  45858. return self;
  45859. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  45860. },
  45861. args: [],
  45862. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  45863. referencedClasses: [],
  45864. messageSends: ["should:return:"]
  45865. }),
  45866. $globals.CodeGeneratorTest);
  45867. $core.addMethod(
  45868. $core.method({
  45869. selector: "testifFalse",
  45870. protocol: 'tests',
  45871. fn: function (){
  45872. var self=this;
  45873. return $core.withContext(function($ctx1) {
  45874. self._should_return_("foo true ifFalse: [ ^ 1 ]",self["@receiver"]);
  45875. $ctx1.sendIdx["should:return:"]=1;
  45876. self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  45877. $ctx1.sendIdx["should:return:"]=2;
  45878. self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  45879. $ctx1.sendIdx["should:return:"]=3;
  45880. self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  45881. return self;
  45882. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  45883. },
  45884. args: [],
  45885. 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.",
  45886. referencedClasses: [],
  45887. messageSends: ["should:return:"]
  45888. }),
  45889. $globals.CodeGeneratorTest);
  45890. $core.addMethod(
  45891. $core.method({
  45892. selector: "testifFalseIfTrue",
  45893. protocol: 'tests',
  45894. fn: function (){
  45895. var self=this;
  45896. return $core.withContext(function($ctx1) {
  45897. self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  45898. $ctx1.sendIdx["should:return:"]=1;
  45899. self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  45900. $ctx1.sendIdx["should:return:"]=2;
  45901. self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  45902. $ctx1.sendIdx["should:return:"]=3;
  45903. self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  45904. return self;
  45905. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  45906. },
  45907. args: [],
  45908. 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.",
  45909. referencedClasses: [],
  45910. messageSends: ["should:return:"]
  45911. }),
  45912. $globals.CodeGeneratorTest);
  45913. $core.addMethod(
  45914. $core.method({
  45915. selector: "testifNil",
  45916. protocol: 'tests',
  45917. fn: function (){
  45918. var self=this;
  45919. return $core.withContext(function($ctx1) {
  45920. self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  45921. $ctx1.sendIdx["should:return:"]=1;
  45922. self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  45923. $ctx1.sendIdx["should:return:"]=2;
  45924. self._should_return_("foo 1 ifNil: [ ^ 2 ]",self["@receiver"]);
  45925. $ctx1.sendIdx["should:return:"]=3;
  45926. self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  45927. return self;
  45928. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  45929. },
  45930. args: [],
  45931. 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.",
  45932. referencedClasses: [],
  45933. messageSends: ["should:return:"]
  45934. }),
  45935. $globals.CodeGeneratorTest);
  45936. $core.addMethod(
  45937. $core.method({
  45938. selector: "testifNilIfNotNil",
  45939. protocol: 'tests',
  45940. fn: function (){
  45941. var self=this;
  45942. return $core.withContext(function($ctx1) {
  45943. self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  45944. $ctx1.sendIdx["should:return:"]=1;
  45945. self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  45946. $ctx1.sendIdx["should:return:"]=2;
  45947. self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  45948. $ctx1.sendIdx["should:return:"]=3;
  45949. self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  45950. return self;
  45951. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  45952. },
  45953. args: [],
  45954. 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.",
  45955. referencedClasses: [],
  45956. messageSends: ["should:return:"]
  45957. }),
  45958. $globals.CodeGeneratorTest);
  45959. $core.addMethod(
  45960. $core.method({
  45961. selector: "testifNotNil",
  45962. protocol: 'tests',
  45963. fn: function (){
  45964. var self=this;
  45965. return $core.withContext(function($ctx1) {
  45966. self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  45967. $ctx1.sendIdx["should:return:"]=1;
  45968. self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  45969. $ctx1.sendIdx["should:return:"]=2;
  45970. self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  45971. $ctx1.sendIdx["should:return:"]=3;
  45972. self._should_return_("foo nil ifNotNil: [ ^ 2 ]",self["@receiver"]);
  45973. return self;
  45974. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  45975. },
  45976. args: [],
  45977. 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.",
  45978. referencedClasses: [],
  45979. messageSends: ["should:return:"]
  45980. }),
  45981. $globals.CodeGeneratorTest);
  45982. $core.addMethod(
  45983. $core.method({
  45984. selector: "testifNotNilWithArgument",
  45985. protocol: 'tests',
  45986. fn: function (){
  45987. var self=this;
  45988. return $core.withContext(function($ctx1) {
  45989. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  45990. $ctx1.sendIdx["should:return:"]=1;
  45991. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  45992. $ctx1.sendIdx["should:return:"]=2;
  45993. self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  45994. $ctx1.sendIdx["should:return:"]=3;
  45995. self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  45996. $ctx1.sendIdx["should:return:"]=4;
  45997. self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  45998. $ctx1.sendIdx["should:return:"]=5;
  45999. self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  46000. return self;
  46001. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  46002. },
  46003. args: [],
  46004. 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",
  46005. referencedClasses: [],
  46006. messageSends: ["should:return:"]
  46007. }),
  46008. $globals.CodeGeneratorTest);
  46009. $core.addMethod(
  46010. $core.method({
  46011. selector: "testifTrue",
  46012. protocol: 'tests',
  46013. fn: function (){
  46014. var self=this;
  46015. return $core.withContext(function($ctx1) {
  46016. self._should_return_("foo false ifTrue: [ ^ 1 ]",self["@receiver"]);
  46017. $ctx1.sendIdx["should:return:"]=1;
  46018. self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  46019. $ctx1.sendIdx["should:return:"]=2;
  46020. self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  46021. $ctx1.sendIdx["should:return:"]=3;
  46022. self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  46023. return self;
  46024. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  46025. },
  46026. args: [],
  46027. 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.",
  46028. referencedClasses: [],
  46029. messageSends: ["should:return:"]
  46030. }),
  46031. $globals.CodeGeneratorTest);
  46032. $core.addMethod(
  46033. $core.method({
  46034. selector: "testifTrueIfFalse",
  46035. protocol: 'tests',
  46036. fn: function (){
  46037. var self=this;
  46038. return $core.withContext(function($ctx1) {
  46039. self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  46040. $ctx1.sendIdx["should:return:"]=1;
  46041. self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  46042. $ctx1.sendIdx["should:return:"]=2;
  46043. self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  46044. $ctx1.sendIdx["should:return:"]=3;
  46045. self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  46046. return self;
  46047. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  46048. },
  46049. args: [],
  46050. 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.",
  46051. referencedClasses: [],
  46052. messageSends: ["should:return:"]
  46053. }),
  46054. $globals.CodeGeneratorTest);
  46055. $core.addClass('ASTInterpreterTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  46056. $core.addMethod(
  46057. $core.method({
  46058. selector: "analyze:forClass:",
  46059. protocol: 'parsing',
  46060. fn: function (aNode,aClass){
  46061. var self=this;
  46062. return $core.withContext(function($ctx1) {
  46063. $recv($recv($globals.SemanticAnalyzer)._on_(aClass))._visit_(aNode);
  46064. return aNode;
  46065. }, function($ctx1) {$ctx1.fill(self,"analyze:forClass:",{aNode:aNode,aClass:aClass},$globals.ASTInterpreterTest)});
  46066. },
  46067. args: ["aNode", "aClass"],
  46068. source: "analyze: aNode forClass: aClass\x0a\x09(SemanticAnalyzer on: aClass) visit: aNode.\x0a\x09^ aNode",
  46069. referencedClasses: ["SemanticAnalyzer"],
  46070. messageSends: ["visit:", "on:"]
  46071. }),
  46072. $globals.ASTInterpreterTest);
  46073. $core.addMethod(
  46074. $core.method({
  46075. selector: "interpret:receiver:withArguments:",
  46076. protocol: 'private',
  46077. fn: function (aString,anObject,aDictionary){
  46078. var self=this;
  46079. var ctx,ast,interpreter;
  46080. return $core.withContext(function($ctx1) {
  46081. var $1,$2,$3,$receiver;
  46082. interpreter=$recv($globals.ASTInterpreter)._new();
  46083. $ctx1.sendIdx["new"]=1;
  46084. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  46085. $1=$recv($globals.AIContext)._new();
  46086. $recv($1)._receiver_(anObject);
  46087. $recv($1)._interpreter_(interpreter);
  46088. ctx=$recv($1)._yourself();
  46089. $2=$recv(ast)._sequenceNode();
  46090. if(($receiver = $2) == null || $receiver.isNil){
  46091. $2;
  46092. } else {
  46093. var sequence;
  46094. sequence=$receiver;
  46095. $recv($recv(sequence)._temps())._do_((function(each){
  46096. return $core.withContext(function($ctx2) {
  46097. return $recv(ctx)._defineLocal_(each);
  46098. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  46099. }));
  46100. };
  46101. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  46102. return $core.withContext(function($ctx2) {
  46103. return $recv(ctx)._localAt_put_(key,value);
  46104. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  46105. }));
  46106. $3=interpreter;
  46107. $recv($3)._context_(ctx);
  46108. $recv($3)._node_(ast);
  46109. $recv($3)._enterNode();
  46110. $recv($3)._proceed();
  46111. return $recv($3)._result();
  46112. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  46113. },
  46114. args: ["aString", "anObject", "aDictionary"],
  46115. 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",
  46116. referencedClasses: ["ASTInterpreter", "AIContext"],
  46117. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  46118. }),
  46119. $globals.ASTInterpreterTest);
  46120. $core.addMethod(
  46121. $core.method({
  46122. selector: "parse:",
  46123. protocol: 'parsing',
  46124. fn: function (aString){
  46125. var self=this;
  46126. return $core.withContext(function($ctx1) {
  46127. return $recv($globals.Smalltalk)._parse_(aString);
  46128. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.ASTInterpreterTest)});
  46129. },
  46130. args: ["aString"],
  46131. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  46132. referencedClasses: ["Smalltalk"],
  46133. messageSends: ["parse:"]
  46134. }),
  46135. $globals.ASTInterpreterTest);
  46136. $core.addMethod(
  46137. $core.method({
  46138. selector: "parse:forClass:",
  46139. protocol: 'parsing',
  46140. fn: function (aString,aClass){
  46141. var self=this;
  46142. return $core.withContext(function($ctx1) {
  46143. return self._analyze_forClass_(self._parse_(aString),aClass);
  46144. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTInterpreterTest)});
  46145. },
  46146. args: ["aString", "aClass"],
  46147. source: "parse: aString forClass: aClass\x0a\x09^ self analyze: (self parse: aString) forClass: aClass",
  46148. referencedClasses: [],
  46149. messageSends: ["analyze:forClass:", "parse:"]
  46150. }),
  46151. $globals.ASTInterpreterTest);
  46152. $core.addMethod(
  46153. $core.method({
  46154. selector: "should:receiver:return:",
  46155. protocol: 'testing',
  46156. fn: function (aString,anObject,aResult){
  46157. var self=this;
  46158. return $core.withContext(function($ctx1) {
  46159. self["@receiver"]=anObject;
  46160. return self._assert_equals_(self._interpret_receiver_withArguments_(aString,self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  46161. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  46162. },
  46163. args: ["aString", "anObject", "aResult"],
  46164. 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",
  46165. referencedClasses: [],
  46166. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  46167. }),
  46168. $globals.ASTInterpreterTest);
  46169. $core.addClass('ASTDebuggerTest', $globals.ASTInterpreterTest, [], 'Compiler-Tests');
  46170. $core.addMethod(
  46171. $core.method({
  46172. selector: "interpret:receiver:withArguments:",
  46173. protocol: 'private',
  46174. fn: function (aString,anObject,aDictionary){
  46175. var self=this;
  46176. var ctx,ast,debugger_;
  46177. return $core.withContext(function($ctx1) {
  46178. var $1,$2,$3,$4,$5,$receiver;
  46179. $1=$recv($globals.AIContext)._new();
  46180. $ctx1.sendIdx["new"]=1;
  46181. $recv($1)._receiver_(anObject);
  46182. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  46183. ctx=$recv($1)._yourself();
  46184. ast=self._parse_forClass_(aString,$recv(anObject)._class());
  46185. $2=$recv(ast)._sequenceNode();
  46186. if(($receiver = $2) == null || $receiver.isNil){
  46187. $2;
  46188. } else {
  46189. var sequence;
  46190. sequence=$receiver;
  46191. $recv($recv(sequence)._temps())._do_((function(each){
  46192. return $core.withContext(function($ctx2) {
  46193. return $recv(ctx)._defineLocal_(each);
  46194. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  46195. }));
  46196. };
  46197. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  46198. return $core.withContext(function($ctx2) {
  46199. return $recv(ctx)._localAt_put_(key,value);
  46200. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  46201. }));
  46202. $3=$recv(ctx)._interpreter();
  46203. $ctx1.sendIdx["interpreter"]=1;
  46204. $recv($3)._context_(ctx);
  46205. $ctx1.sendIdx["context:"]=1;
  46206. $4=$recv(ctx)._interpreter();
  46207. $recv($4)._node_(ast);
  46208. $recv($4)._enterNode();
  46209. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  46210. $5=debugger_;
  46211. $recv($5)._proceed();
  46212. return $recv($5)._result();
  46213. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  46214. },
  46215. args: ["aString", "anObject", "aDictionary"],
  46216. 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",
  46217. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  46218. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  46219. }),
  46220. $globals.ASTDebuggerTest);
  46221. $core.addClass('InliningCodeGeneratorTest', $globals.CodeGeneratorTest, [], 'Compiler-Tests');
  46222. $core.addMethod(
  46223. $core.method({
  46224. selector: "codeGeneratorClass",
  46225. protocol: 'accessing',
  46226. fn: function (){
  46227. var self=this;
  46228. return $globals.InliningCodeGenerator;
  46229. },
  46230. args: [],
  46231. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  46232. referencedClasses: ["InliningCodeGenerator"],
  46233. messageSends: []
  46234. }),
  46235. $globals.InliningCodeGeneratorTest);
  46236. $core.addClass('ScopeVarTest', $globals.TestCase, [], 'Compiler-Tests');
  46237. $core.addMethod(
  46238. $core.method({
  46239. selector: "testClassRefVar",
  46240. protocol: 'tests',
  46241. fn: function (){
  46242. var self=this;
  46243. var node;
  46244. return $core.withContext(function($ctx1) {
  46245. var $1,$2;
  46246. $1=$recv($globals.VariableNode)._new();
  46247. $ctx1.sendIdx["new"]=1;
  46248. $recv($1)._value_("Object");
  46249. node=$recv($1)._yourself();
  46250. $2=$recv($globals.SemanticAnalyzer)._new();
  46251. $ctx1.sendIdx["new"]=2;
  46252. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  46253. $recv($2)._visit_(node);
  46254. self._assert_($recv($recv(node)._binding())._isClassRefVar());
  46255. return self;
  46256. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  46257. },
  46258. args: [],
  46259. 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",
  46260. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  46261. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  46262. }),
  46263. $globals.ScopeVarTest);
  46264. $core.addMethod(
  46265. $core.method({
  46266. selector: "testInstanceVar",
  46267. protocol: 'tests',
  46268. fn: function (){
  46269. var self=this;
  46270. var node,scope;
  46271. return $core.withContext(function($ctx1) {
  46272. var $1;
  46273. $1=$recv($globals.VariableNode)._new();
  46274. $ctx1.sendIdx["new"]=1;
  46275. $recv($1)._value_("bzzz");
  46276. node=$recv($1)._yourself();
  46277. scope=$recv($globals.MethodLexicalScope)._new();
  46278. $recv(scope)._addIVar_("bzzz");
  46279. self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  46280. return self;
  46281. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  46282. },
  46283. args: [],
  46284. 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",
  46285. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46286. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  46287. }),
  46288. $globals.ScopeVarTest);
  46289. $core.addMethod(
  46290. $core.method({
  46291. selector: "testPseudoVar",
  46292. protocol: 'tests',
  46293. fn: function (){
  46294. var self=this;
  46295. var node,pseudoVars;
  46296. return $core.withContext(function($ctx1) {
  46297. var $1;
  46298. pseudoVars=["self", "super", "true", "false", "nil"];
  46299. $recv(pseudoVars)._do_((function(each){
  46300. return $core.withContext(function($ctx2) {
  46301. $1=$recv($globals.VariableNode)._new();
  46302. $ctx2.sendIdx["new"]=1;
  46303. $recv($1)._value_(each);
  46304. node=$recv($1)._yourself();
  46305. node;
  46306. return self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  46307. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46308. }));
  46309. return self;
  46310. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  46311. },
  46312. args: [],
  46313. 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]",
  46314. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46315. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  46316. }),
  46317. $globals.ScopeVarTest);
  46318. $core.addMethod(
  46319. $core.method({
  46320. selector: "testTempVar",
  46321. protocol: 'tests',
  46322. fn: function (){
  46323. var self=this;
  46324. var node,scope;
  46325. return $core.withContext(function($ctx1) {
  46326. var $1;
  46327. $1=$recv($globals.VariableNode)._new();
  46328. $ctx1.sendIdx["new"]=1;
  46329. $recv($1)._value_("bzzz");
  46330. node=$recv($1)._yourself();
  46331. scope=$recv($globals.MethodLexicalScope)._new();
  46332. $recv(scope)._addTemp_("bzzz");
  46333. self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  46334. return self;
  46335. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  46336. },
  46337. args: [],
  46338. 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",
  46339. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46340. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  46341. }),
  46342. $globals.ScopeVarTest);
  46343. $core.addMethod(
  46344. $core.method({
  46345. selector: "testUnknownVar",
  46346. protocol: 'tests',
  46347. fn: function (){
  46348. var self=this;
  46349. var node;
  46350. return $core.withContext(function($ctx1) {
  46351. var $1;
  46352. $1=$recv($globals.VariableNode)._new();
  46353. $ctx1.sendIdx["new"]=1;
  46354. $recv($1)._value_("bzzz");
  46355. node=$recv($1)._yourself();
  46356. self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  46357. return self;
  46358. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  46359. },
  46360. args: [],
  46361. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  46362. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  46363. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  46364. }),
  46365. $globals.ScopeVarTest);
  46366. $core.addClass('SemanticAnalyzerTest', $globals.TestCase, ['analyzer'], 'Compiler-Tests');
  46367. $core.addMethod(
  46368. $core.method({
  46369. selector: "setUp",
  46370. protocol: 'running',
  46371. fn: function (){
  46372. var self=this;
  46373. return $core.withContext(function($ctx1) {
  46374. self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  46375. return self;
  46376. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  46377. },
  46378. args: [],
  46379. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  46380. referencedClasses: ["SemanticAnalyzer", "Object"],
  46381. messageSends: ["on:"]
  46382. }),
  46383. $globals.SemanticAnalyzerTest);
  46384. $core.addMethod(
  46385. $core.method({
  46386. selector: "testAssignment",
  46387. protocol: 'tests',
  46388. fn: function (){
  46389. var self=this;
  46390. var src,ast;
  46391. return $core.withContext(function($ctx1) {
  46392. src="foo self := 1";
  46393. ast=$recv($globals.Smalltalk)._parse_(src);
  46394. self._should_raise_((function(){
  46395. return $core.withContext(function($ctx2) {
  46396. return $recv(self["@analyzer"])._visit_(ast);
  46397. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46398. }),$globals.InvalidAssignmentError);
  46399. return self;
  46400. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46401. },
  46402. args: [],
  46403. 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",
  46404. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  46405. messageSends: ["parse:", "should:raise:", "visit:"]
  46406. }),
  46407. $globals.SemanticAnalyzerTest);
  46408. $core.addMethod(
  46409. $core.method({
  46410. selector: "testNonLocalReturn",
  46411. protocol: 'tests',
  46412. fn: function (){
  46413. var self=this;
  46414. var src,ast;
  46415. return $core.withContext(function($ctx1) {
  46416. src="foo | a | a + 1. ^ a";
  46417. ast=$recv($globals.Smalltalk)._parse_(src);
  46418. $recv(self["@analyzer"])._visit_(ast);
  46419. self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  46420. return self;
  46421. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46422. },
  46423. args: [],
  46424. 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",
  46425. referencedClasses: ["Smalltalk"],
  46426. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  46427. }),
  46428. $globals.SemanticAnalyzerTest);
  46429. $core.addMethod(
  46430. $core.method({
  46431. selector: "testNonLocalReturn2",
  46432. protocol: 'tests',
  46433. fn: function (){
  46434. var self=this;
  46435. var src,ast;
  46436. return $core.withContext(function($ctx1) {
  46437. src="foo | a | a + 1. [ [ ^ a] ]";
  46438. ast=$recv($globals.Smalltalk)._parse_(src);
  46439. $recv(self["@analyzer"])._visit_(ast);
  46440. self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  46441. return self;
  46442. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46443. },
  46444. args: [],
  46445. 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",
  46446. referencedClasses: ["Smalltalk"],
  46447. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  46448. }),
  46449. $globals.SemanticAnalyzerTest);
  46450. $core.addMethod(
  46451. $core.method({
  46452. selector: "testScope",
  46453. protocol: 'tests',
  46454. fn: function (){
  46455. var self=this;
  46456. var src,ast;
  46457. return $core.withContext(function($ctx1) {
  46458. var $4,$3,$2,$1;
  46459. src="foo | a | a + 1. [ | b | b := a ]";
  46460. ast=$recv($globals.Smalltalk)._parse_(src);
  46461. $recv(self["@analyzer"])._visit_(ast);
  46462. $4=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46463. $ctx1.sendIdx["nodes"]=1;
  46464. $3=$recv($4)._last();
  46465. $2=$recv($3)._scope();
  46466. $ctx1.sendIdx["scope"]=1;
  46467. $1=$recv($2).__eq_eq($recv(ast)._scope());
  46468. self._deny_($1);
  46469. return self;
  46470. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46471. },
  46472. args: [],
  46473. 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.",
  46474. referencedClasses: ["Smalltalk"],
  46475. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "nodes", "first"]
  46476. }),
  46477. $globals.SemanticAnalyzerTest);
  46478. $core.addMethod(
  46479. $core.method({
  46480. selector: "testScope2",
  46481. protocol: 'tests',
  46482. fn: function (){
  46483. var self=this;
  46484. var src,ast;
  46485. return $core.withContext(function($ctx1) {
  46486. var $8,$7,$6,$5,$4,$3,$2,$1;
  46487. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  46488. ast=$recv($globals.Smalltalk)._parse_(src);
  46489. $recv(self["@analyzer"])._visit_(ast);
  46490. $8=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46491. $ctx1.sendIdx["nodes"]=3;
  46492. $7=$recv($8)._last();
  46493. $6=$recv($7)._nodes();
  46494. $ctx1.sendIdx["nodes"]=2;
  46495. $5=$recv($6)._first();
  46496. $ctx1.sendIdx["first"]=2;
  46497. $4=$recv($5)._nodes();
  46498. $ctx1.sendIdx["nodes"]=1;
  46499. $3=$recv($4)._first();
  46500. $ctx1.sendIdx["first"]=1;
  46501. $2=$recv($3)._scope();
  46502. $ctx1.sendIdx["scope"]=1;
  46503. $1=$recv($2).__eq_eq($recv(ast)._scope());
  46504. self._deny_($1);
  46505. return self;
  46506. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46507. },
  46508. args: [],
  46509. 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.",
  46510. referencedClasses: ["Smalltalk"],
  46511. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "nodes", "last"]
  46512. }),
  46513. $globals.SemanticAnalyzerTest);
  46514. $core.addMethod(
  46515. $core.method({
  46516. selector: "testScopeLevel",
  46517. protocol: 'tests',
  46518. fn: function (){
  46519. var self=this;
  46520. var src,ast;
  46521. return $core.withContext(function($ctx1) {
  46522. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  46523. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  46524. ast=$recv($globals.Smalltalk)._parse_(src);
  46525. $recv(self["@analyzer"])._visit_(ast);
  46526. $2=$recv(ast)._scope();
  46527. $ctx1.sendIdx["scope"]=1;
  46528. $1=$recv($2)._scopeLevel();
  46529. $ctx1.sendIdx["scopeLevel"]=1;
  46530. self._assert_equals_($1,(1));
  46531. $ctx1.sendIdx["assert:equals:"]=1;
  46532. $10=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46533. $ctx1.sendIdx["nodes"]=3;
  46534. $9=$recv($10)._last();
  46535. $8=$recv($9)._nodes();
  46536. $ctx1.sendIdx["nodes"]=2;
  46537. $7=$recv($8)._first();
  46538. $ctx1.sendIdx["first"]=2;
  46539. $6=$recv($7)._nodes();
  46540. $ctx1.sendIdx["nodes"]=1;
  46541. $5=$recv($6)._first();
  46542. $ctx1.sendIdx["first"]=1;
  46543. $4=$recv($5)._scope();
  46544. $3=$recv($4)._scopeLevel();
  46545. self._assert_equals_($3,(3));
  46546. return self;
  46547. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46548. },
  46549. args: [],
  46550. 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",
  46551. referencedClasses: ["Smalltalk"],
  46552. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "nodes", "last"]
  46553. }),
  46554. $globals.SemanticAnalyzerTest);
  46555. $core.addMethod(
  46556. $core.method({
  46557. selector: "testUnknownVariables",
  46558. protocol: 'tests',
  46559. fn: function (){
  46560. var self=this;
  46561. var src,ast;
  46562. return $core.withContext(function($ctx1) {
  46563. src="foo | a | b + a";
  46564. ast=$recv($globals.Smalltalk)._parse_(src);
  46565. self._should_raise_((function(){
  46566. return $core.withContext(function($ctx2) {
  46567. return $recv(self["@analyzer"])._visit_(ast);
  46568. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46569. }),$globals.UnknownVariableError);
  46570. return self;
  46571. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46572. },
  46573. args: [],
  46574. 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",
  46575. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46576. messageSends: ["parse:", "should:raise:", "visit:"]
  46577. }),
  46578. $globals.SemanticAnalyzerTest);
  46579. $core.addMethod(
  46580. $core.method({
  46581. selector: "testUnknownVariablesWithScope",
  46582. protocol: 'tests',
  46583. fn: function (){
  46584. var self=this;
  46585. var src,ast;
  46586. return $core.withContext(function($ctx1) {
  46587. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  46588. ast=$recv($globals.Smalltalk)._parse_(src);
  46589. self._should_raise_((function(){
  46590. return $core.withContext(function($ctx2) {
  46591. return $recv(self["@analyzer"])._visit_(ast);
  46592. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46593. }),$globals.UnknownVariableError);
  46594. return self;
  46595. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46596. },
  46597. args: [],
  46598. 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",
  46599. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46600. messageSends: ["parse:", "should:raise:", "visit:"]
  46601. }),
  46602. $globals.SemanticAnalyzerTest);
  46603. $core.addMethod(
  46604. $core.method({
  46605. selector: "testVariableShadowing",
  46606. protocol: 'tests',
  46607. fn: function (){
  46608. var self=this;
  46609. var src,ast;
  46610. return $core.withContext(function($ctx1) {
  46611. src="foo | a | a + 1";
  46612. ast=$recv($globals.Smalltalk)._parse_(src);
  46613. $recv(self["@analyzer"])._visit_(ast);
  46614. return self;
  46615. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46616. },
  46617. args: [],
  46618. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46619. referencedClasses: ["Smalltalk"],
  46620. messageSends: ["parse:", "visit:"]
  46621. }),
  46622. $globals.SemanticAnalyzerTest);
  46623. $core.addMethod(
  46624. $core.method({
  46625. selector: "testVariableShadowing2",
  46626. protocol: 'tests',
  46627. fn: function (){
  46628. var self=this;
  46629. var src,ast;
  46630. return $core.withContext(function($ctx1) {
  46631. src="foo | a | a + 1. [ | a | a := 2 ]";
  46632. ast=$recv($globals.Smalltalk)._parse_(src);
  46633. self._should_raise_((function(){
  46634. return $core.withContext(function($ctx2) {
  46635. return $recv(self["@analyzer"])._visit_(ast);
  46636. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46637. }),$globals.ShadowingVariableError);
  46638. return self;
  46639. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46640. },
  46641. args: [],
  46642. 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",
  46643. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  46644. messageSends: ["parse:", "should:raise:", "visit:"]
  46645. }),
  46646. $globals.SemanticAnalyzerTest);
  46647. $core.addMethod(
  46648. $core.method({
  46649. selector: "testVariableShadowing3",
  46650. protocol: 'tests',
  46651. fn: function (){
  46652. var self=this;
  46653. var src,ast;
  46654. return $core.withContext(function($ctx1) {
  46655. src="foo | a | a + 1. [ | b | b := 2 ]";
  46656. ast=$recv($globals.Smalltalk)._parse_(src);
  46657. $recv(self["@analyzer"])._visit_(ast);
  46658. return self;
  46659. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46660. },
  46661. args: [],
  46662. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46663. referencedClasses: ["Smalltalk"],
  46664. messageSends: ["parse:", "visit:"]
  46665. }),
  46666. $globals.SemanticAnalyzerTest);
  46667. $core.addMethod(
  46668. $core.method({
  46669. selector: "testVariableShadowing4",
  46670. protocol: 'tests',
  46671. fn: function (){
  46672. var self=this;
  46673. var src,ast;
  46674. return $core.withContext(function($ctx1) {
  46675. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  46676. ast=$recv($globals.Smalltalk)._parse_(src);
  46677. $recv(self["@analyzer"])._visit_(ast);
  46678. return self;
  46679. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46680. },
  46681. args: [],
  46682. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  46683. referencedClasses: ["Smalltalk"],
  46684. messageSends: ["parse:", "visit:"]
  46685. }),
  46686. $globals.SemanticAnalyzerTest);
  46687. $core.addMethod(
  46688. $core.method({
  46689. selector: "testVariableShadowing5",
  46690. protocol: 'tests',
  46691. fn: function (){
  46692. var self=this;
  46693. var src,ast;
  46694. return $core.withContext(function($ctx1) {
  46695. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  46696. ast=$recv($globals.Smalltalk)._parse_(src);
  46697. self._should_raise_((function(){
  46698. return $core.withContext(function($ctx2) {
  46699. return $recv(self["@analyzer"])._visit_(ast);
  46700. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46701. }),$globals.ShadowingVariableError);
  46702. return self;
  46703. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46704. },
  46705. args: [],
  46706. 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",
  46707. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  46708. messageSends: ["parse:", "should:raise:", "visit:"]
  46709. }),
  46710. $globals.SemanticAnalyzerTest);
  46711. $core.addMethod(
  46712. $core.method({
  46713. selector: "testVariablesLookup",
  46714. protocol: 'tests',
  46715. fn: function (){
  46716. var self=this;
  46717. var src,ast;
  46718. return $core.withContext(function($ctx1) {
  46719. 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;
  46720. src="foo | a | a + 1. [ | b | b := a ]";
  46721. ast=$recv($globals.Smalltalk)._parse_(src);
  46722. $recv(self["@analyzer"])._visit_(ast);
  46723. $7=$recv(ast)._nodes();
  46724. $ctx1.sendIdx["nodes"]=2;
  46725. $6=$recv($7)._first();
  46726. $ctx1.sendIdx["first"]=2;
  46727. $5=$recv($6)._nodes();
  46728. $ctx1.sendIdx["nodes"]=1;
  46729. $4=$recv($5)._first();
  46730. $ctx1.sendIdx["first"]=1;
  46731. $3=$recv($4)._receiver();
  46732. $ctx1.sendIdx["receiver"]=1;
  46733. $2=$recv($3)._binding();
  46734. $ctx1.sendIdx["binding"]=1;
  46735. $1=$recv($2)._isTempVar();
  46736. $ctx1.sendIdx["isTempVar"]=1;
  46737. self._assert_($1);
  46738. $ctx1.sendIdx["assert:"]=1;
  46739. $15=$recv(ast)._nodes();
  46740. $ctx1.sendIdx["nodes"]=4;
  46741. $14=$recv($15)._first();
  46742. $ctx1.sendIdx["first"]=4;
  46743. $13=$recv($14)._nodes();
  46744. $ctx1.sendIdx["nodes"]=3;
  46745. $12=$recv($13)._first();
  46746. $ctx1.sendIdx["first"]=3;
  46747. $11=$recv($12)._receiver();
  46748. $10=$recv($11)._binding();
  46749. $ctx1.sendIdx["binding"]=2;
  46750. $9=$recv($10)._scope();
  46751. $ctx1.sendIdx["scope"]=1;
  46752. $16=$recv(ast)._scope();
  46753. $ctx1.sendIdx["scope"]=2;
  46754. $8=$recv($9).__eq_eq($16);
  46755. $ctx1.sendIdx["=="]=1;
  46756. self._assert_($8);
  46757. $ctx1.sendIdx["assert:"]=2;
  46758. $27=$recv(ast)._nodes();
  46759. $ctx1.sendIdx["nodes"]=8;
  46760. $26=$recv($27)._first();
  46761. $ctx1.sendIdx["first"]=7;
  46762. $25=$recv($26)._nodes();
  46763. $ctx1.sendIdx["nodes"]=7;
  46764. $24=$recv($25)._last();
  46765. $ctx1.sendIdx["last"]=1;
  46766. $23=$recv($24)._nodes();
  46767. $ctx1.sendIdx["nodes"]=6;
  46768. $22=$recv($23)._first();
  46769. $ctx1.sendIdx["first"]=6;
  46770. $21=$recv($22)._nodes();
  46771. $ctx1.sendIdx["nodes"]=5;
  46772. $20=$recv($21)._first();
  46773. $ctx1.sendIdx["first"]=5;
  46774. $19=$recv($20)._left();
  46775. $ctx1.sendIdx["left"]=1;
  46776. $18=$recv($19)._binding();
  46777. $ctx1.sendIdx["binding"]=3;
  46778. $17=$recv($18)._isTempVar();
  46779. self._assert_($17);
  46780. $ctx1.sendIdx["assert:"]=3;
  46781. $39=$recv(ast)._nodes();
  46782. $ctx1.sendIdx["nodes"]=12;
  46783. $38=$recv($39)._first();
  46784. $ctx1.sendIdx["first"]=10;
  46785. $37=$recv($38)._nodes();
  46786. $ctx1.sendIdx["nodes"]=11;
  46787. $36=$recv($37)._last();
  46788. $ctx1.sendIdx["last"]=2;
  46789. $35=$recv($36)._nodes();
  46790. $ctx1.sendIdx["nodes"]=10;
  46791. $34=$recv($35)._first();
  46792. $ctx1.sendIdx["first"]=9;
  46793. $33=$recv($34)._nodes();
  46794. $ctx1.sendIdx["nodes"]=9;
  46795. $32=$recv($33)._first();
  46796. $ctx1.sendIdx["first"]=8;
  46797. $31=$recv($32)._left();
  46798. $30=$recv($31)._binding();
  46799. $29=$recv($30)._scope();
  46800. $ctx1.sendIdx["scope"]=3;
  46801. $42=$recv($recv($recv(ast)._nodes())._first())._nodes();
  46802. $ctx1.sendIdx["nodes"]=13;
  46803. $41=$recv($42)._last();
  46804. $40=$recv($41)._scope();
  46805. $28=$recv($29).__eq_eq($40);
  46806. self._assert_($28);
  46807. return self;
  46808. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  46809. },
  46810. args: [],
  46811. 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.",
  46812. referencedClasses: ["Smalltalk"],
  46813. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "nodes", "==", "scope", "left", "last"]
  46814. }),
  46815. $globals.SemanticAnalyzerTest);
  46816. $core.addClass('AISemanticAnalyzerTest', $globals.SemanticAnalyzerTest, [], 'Compiler-Tests');
  46817. $core.addMethod(
  46818. $core.method({
  46819. selector: "setUp",
  46820. protocol: 'running',
  46821. fn: function (){
  46822. var self=this;
  46823. return $core.withContext(function($ctx1) {
  46824. var $1,$3,$4,$2;
  46825. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  46826. $3=$recv($globals.AIContext)._new();
  46827. $recv($3)._defineLocal_("local");
  46828. $recv($3)._localAt_put_("local",(3));
  46829. $4=$recv($3)._yourself();
  46830. $ctx1.sendIdx["yourself"]=1;
  46831. $2=$4;
  46832. $recv($1)._context_($2);
  46833. self["@analyzer"]=$recv($1)._yourself();
  46834. return self;
  46835. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  46836. },
  46837. args: [],
  46838. 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",
  46839. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  46840. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  46841. }),
  46842. $globals.AISemanticAnalyzerTest);
  46843. $core.addMethod(
  46844. $core.method({
  46845. selector: "testContextVariables",
  46846. protocol: 'tests',
  46847. fn: function (){
  46848. var self=this;
  46849. var src,ast;
  46850. return $core.withContext(function($ctx1) {
  46851. src="foo | a | local + a";
  46852. ast=$recv($globals.Smalltalk)._parse_(src);
  46853. self._shouldnt_raise_((function(){
  46854. return $core.withContext(function($ctx2) {
  46855. return $recv(self["@analyzer"])._visit_(ast);
  46856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46857. }),$globals.UnknownVariableError);
  46858. return self;
  46859. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  46860. },
  46861. args: [],
  46862. 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",
  46863. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  46864. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  46865. }),
  46866. $globals.AISemanticAnalyzerTest);
  46867. });
  46868. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){"use strict";
  46869. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  46870. $core.addPackage('Kernel-Tests');
  46871. $core.packages["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  46872. $core.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  46873. $core.addClass('AnnouncementSubscriptionTest', $globals.TestCase, [], 'Kernel-Tests');
  46874. $core.addMethod(
  46875. $core.method({
  46876. selector: "testAddExtensionMethod",
  46877. protocol: 'tests',
  46878. fn: function (){
  46879. var self=this;
  46880. var method,dirty;
  46881. return $core.withContext(function($ctx1) {
  46882. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  46883. $2=self._class();
  46884. $ctx1.sendIdx["class"]=1;
  46885. $1=$recv($2)._package();
  46886. $ctx1.sendIdx["package"]=1;
  46887. dirty=$recv($1)._isDirty();
  46888. $ctx1.sendIdx["isDirty"]=1;
  46889. $4=self._class();
  46890. $ctx1.sendIdx["class"]=2;
  46891. $3=$recv($4)._package();
  46892. $ctx1.sendIdx["package"]=2;
  46893. $recv($3)._beClean();
  46894. $5=self._class();
  46895. $ctx1.sendIdx["class"]=3;
  46896. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  46897. $8=self._class();
  46898. $ctx1.sendIdx["class"]=4;
  46899. $7=$recv($8)._package();
  46900. $ctx1.sendIdx["package"]=3;
  46901. $6=$recv($7)._isDirty();
  46902. self._deny_($6);
  46903. $9=self._class();
  46904. $ctx1.sendIdx["class"]=5;
  46905. $recv($9)._removeCompiledMethod_(method);
  46906. $10=dirty;
  46907. if($core.assert($10)){
  46908. $recv($recv(self._class())._package())._beDirty();
  46909. };
  46910. return self;
  46911. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  46912. },
  46913. args: [],
  46914. 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 ]",
  46915. referencedClasses: [],
  46916. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  46917. }),
  46918. $globals.AnnouncementSubscriptionTest);
  46919. $core.addMethod(
  46920. $core.method({
  46921. selector: "testHandlesAnnouncement",
  46922. protocol: 'tests',
  46923. fn: function (){
  46924. var self=this;
  46925. var subscription,announcementClass1,announcementClass2,classBuilder;
  46926. return $core.withContext(function($ctx1) {
  46927. var $1,$2;
  46928. classBuilder=$recv($globals.ClassBuilder)._new();
  46929. $ctx1.sendIdx["new"]=1;
  46930. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  46931. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  46932. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  46933. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  46934. self._assert_equals_($1,true);
  46935. $ctx1.sendIdx["assert:equals:"]=1;
  46936. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  46937. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  46938. self._assert_equals_($2,true);
  46939. $ctx1.sendIdx["assert:equals:"]=2;
  46940. self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  46941. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  46942. return self;
  46943. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  46944. },
  46945. args: [],
  46946. 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.",
  46947. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  46948. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  46949. }),
  46950. $globals.AnnouncementSubscriptionTest);
  46951. $core.addClass('AnnouncerTest', $globals.TestCase, [], 'Kernel-Tests');
  46952. $core.addMethod(
  46953. $core.method({
  46954. selector: "testOnDo",
  46955. protocol: 'tests',
  46956. fn: function (){
  46957. var self=this;
  46958. var counter,announcer;
  46959. return $core.withContext(function($ctx1) {
  46960. var $1,$2;
  46961. counter=(0);
  46962. announcer=$recv($globals.Announcer)._new();
  46963. $ctx1.sendIdx["new"]=1;
  46964. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  46965. return $core.withContext(function($ctx2) {
  46966. counter=$recv(counter).__plus((1));
  46967. return counter;
  46968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46969. }));
  46970. $1=announcer;
  46971. $2=$recv($globals.SystemAnnouncement)._new();
  46972. $ctx1.sendIdx["new"]=2;
  46973. $recv($1)._announce_($2);
  46974. $ctx1.sendIdx["announce:"]=1;
  46975. self._assert_equals_(counter,(1));
  46976. $ctx1.sendIdx["assert:equals:"]=1;
  46977. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  46978. self._assert_equals_(counter,(2));
  46979. return self;
  46980. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  46981. },
  46982. args: [],
  46983. 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.",
  46984. referencedClasses: ["Announcer", "SystemAnnouncement"],
  46985. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  46986. }),
  46987. $globals.AnnouncerTest);
  46988. $core.addMethod(
  46989. $core.method({
  46990. selector: "testOnDoFor",
  46991. protocol: 'tests',
  46992. fn: function (){
  46993. var self=this;
  46994. var counter,announcer;
  46995. return $core.withContext(function($ctx1) {
  46996. var $1,$2,$3,$4;
  46997. counter=(0);
  46998. announcer=$recv($globals.Announcer)._new();
  46999. $ctx1.sendIdx["new"]=1;
  47000. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  47001. return $core.withContext(function($ctx2) {
  47002. counter=$recv(counter).__plus((1));
  47003. return counter;
  47004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47005. }),self);
  47006. $1=announcer;
  47007. $2=$recv($globals.SystemAnnouncement)._new();
  47008. $ctx1.sendIdx["new"]=2;
  47009. $recv($1)._announce_($2);
  47010. $ctx1.sendIdx["announce:"]=1;
  47011. self._assert_equals_(counter,(1));
  47012. $ctx1.sendIdx["assert:equals:"]=1;
  47013. $3=announcer;
  47014. $4=$recv($globals.SystemAnnouncement)._new();
  47015. $ctx1.sendIdx["new"]=3;
  47016. $recv($3)._announce_($4);
  47017. $ctx1.sendIdx["announce:"]=2;
  47018. self._assert_equals_(counter,(2));
  47019. $ctx1.sendIdx["assert:equals:"]=2;
  47020. $recv(announcer)._unsubscribe_(self);
  47021. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47022. self._assert_equals_(counter,(2));
  47023. return self;
  47024. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47025. },
  47026. args: [],
  47027. 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.",
  47028. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47029. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  47030. }),
  47031. $globals.AnnouncerTest);
  47032. $core.addMethod(
  47033. $core.method({
  47034. selector: "testOnDoOnce",
  47035. protocol: 'tests',
  47036. fn: function (){
  47037. var self=this;
  47038. var counter,announcer;
  47039. return $core.withContext(function($ctx1) {
  47040. var $1,$2;
  47041. counter=(0);
  47042. announcer=$recv($globals.Announcer)._new();
  47043. $ctx1.sendIdx["new"]=1;
  47044. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  47045. return $core.withContext(function($ctx2) {
  47046. counter=$recv(counter).__plus((1));
  47047. return counter;
  47048. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47049. }));
  47050. $1=announcer;
  47051. $2=$recv($globals.SystemAnnouncement)._new();
  47052. $ctx1.sendIdx["new"]=2;
  47053. $recv($1)._announce_($2);
  47054. $ctx1.sendIdx["announce:"]=1;
  47055. self._assert_equals_(counter,(1));
  47056. $ctx1.sendIdx["assert:equals:"]=1;
  47057. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  47058. self._assert_equals_(counter,(1));
  47059. return self;
  47060. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  47061. },
  47062. args: [],
  47063. 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.",
  47064. referencedClasses: ["Announcer", "SystemAnnouncement"],
  47065. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  47066. }),
  47067. $globals.AnnouncerTest);
  47068. $core.addClass('BlockClosureTest', $globals.TestCase, [], 'Kernel-Tests');
  47069. $core.addMethod(
  47070. $core.method({
  47071. selector: "localReturnOnDoCatch",
  47072. protocol: 'fixture',
  47073. fn: function (){
  47074. var self=this;
  47075. return $core.withContext(function($ctx1) {
  47076. var $early={};
  47077. try {
  47078. $recv((function(){
  47079. throw $early=[(2)];
  47080. }))._on_do_($globals.Error,(function(){
  47081. }));
  47082. return (3);
  47083. }
  47084. catch(e) {if(e===$early)return e[0]; throw e}
  47085. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  47086. },
  47087. args: [],
  47088. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  47089. referencedClasses: ["Error"],
  47090. messageSends: ["on:do:"]
  47091. }),
  47092. $globals.BlockClosureTest);
  47093. $core.addMethod(
  47094. $core.method({
  47095. selector: "localReturnOnDoMiss",
  47096. protocol: 'fixture',
  47097. fn: function (){
  47098. var self=this;
  47099. return $core.withContext(function($ctx1) {
  47100. var $early={};
  47101. try {
  47102. $recv((function(){
  47103. throw $early=[(2)];
  47104. }))._on_do_($globals.Class,(function(){
  47105. }));
  47106. return (3);
  47107. }
  47108. catch(e) {if(e===$early)return e[0]; throw e}
  47109. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  47110. },
  47111. args: [],
  47112. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  47113. referencedClasses: ["Class"],
  47114. messageSends: ["on:do:"]
  47115. }),
  47116. $globals.BlockClosureTest);
  47117. $core.addMethod(
  47118. $core.method({
  47119. selector: "testCanClearInterval",
  47120. protocol: 'tests',
  47121. fn: function (){
  47122. var self=this;
  47123. return $core.withContext(function($ctx1) {
  47124. self._shouldnt_raise_((function(){
  47125. return $core.withContext(function($ctx2) {
  47126. return $recv($recv((function(){
  47127. return $core.withContext(function($ctx3) {
  47128. return $recv($recv($globals.Error)._new())._signal();
  47129. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47130. }))._valueWithInterval_((0)))._clearInterval();
  47131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47132. }),$globals.Error);
  47133. return self;
  47134. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  47135. },
  47136. args: [],
  47137. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  47138. referencedClasses: ["Error"],
  47139. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  47140. }),
  47141. $globals.BlockClosureTest);
  47142. $core.addMethod(
  47143. $core.method({
  47144. selector: "testCanClearTimeout",
  47145. protocol: 'tests',
  47146. fn: function (){
  47147. var self=this;
  47148. return $core.withContext(function($ctx1) {
  47149. self._shouldnt_raise_((function(){
  47150. return $core.withContext(function($ctx2) {
  47151. return $recv($recv((function(){
  47152. return $core.withContext(function($ctx3) {
  47153. return $recv($recv($globals.Error)._new())._signal();
  47154. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47155. }))._valueWithTimeout_((0)))._clearTimeout();
  47156. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47157. }),$globals.Error);
  47158. return self;
  47159. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  47160. },
  47161. args: [],
  47162. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  47163. referencedClasses: ["Error"],
  47164. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  47165. }),
  47166. $globals.BlockClosureTest);
  47167. $core.addMethod(
  47168. $core.method({
  47169. selector: "testCompiledSource",
  47170. protocol: 'tests',
  47171. fn: function (){
  47172. var self=this;
  47173. return $core.withContext(function($ctx1) {
  47174. self._assert_($recv($recv((function(){
  47175. return $core.withContext(function($ctx2) {
  47176. return (1).__plus((1));
  47177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47178. }))._compiledSource())._includesSubString_("function"));
  47179. return self;
  47180. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  47181. },
  47182. args: [],
  47183. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  47184. referencedClasses: [],
  47185. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  47186. }),
  47187. $globals.BlockClosureTest);
  47188. $core.addMethod(
  47189. $core.method({
  47190. selector: "testCurrySelf",
  47191. protocol: 'tests',
  47192. fn: function (){
  47193. var self=this;
  47194. var curriedMethod,array;
  47195. return $core.withContext(function($ctx1) {
  47196. curriedMethod=$recv($recv((function(selfarg,x){
  47197. return $core.withContext(function($ctx2) {
  47198. return $recv(selfarg)._at_(x);
  47199. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  47200. }))._currySelf())._asCompiledMethod_("foo:");
  47201. array=[(3), (1), (4)];
  47202. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  47203. $recv((function(){
  47204. return $core.withContext(function($ctx2) {
  47205. return self._assert_equals_($recv(array)._foo_((2)),(1));
  47206. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47207. }))._ensure_((function(){
  47208. return $core.withContext(function($ctx2) {
  47209. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  47210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47211. }));
  47212. return self;
  47213. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  47214. },
  47215. args: [],
  47216. 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 ]",
  47217. referencedClasses: ["ClassBuilder", "Array"],
  47218. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  47219. }),
  47220. $globals.BlockClosureTest);
  47221. $core.addMethod(
  47222. $core.method({
  47223. selector: "testEnsure",
  47224. protocol: 'tests',
  47225. fn: function (){
  47226. var self=this;
  47227. return $core.withContext(function($ctx1) {
  47228. self._assert_equals_($recv((function(){
  47229. return (3);
  47230. }))._ensure_((function(){
  47231. return (4);
  47232. })),(3));
  47233. return self;
  47234. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  47235. },
  47236. args: [],
  47237. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  47238. referencedClasses: [],
  47239. messageSends: ["assert:equals:", "ensure:"]
  47240. }),
  47241. $globals.BlockClosureTest);
  47242. $core.addMethod(
  47243. $core.method({
  47244. selector: "testEnsureRaises",
  47245. protocol: 'tests',
  47246. fn: function (){
  47247. var self=this;
  47248. return $core.withContext(function($ctx1) {
  47249. self._should_raise_((function(){
  47250. return $core.withContext(function($ctx2) {
  47251. return $recv((function(){
  47252. return $core.withContext(function($ctx3) {
  47253. return $recv($recv($globals.Error)._new())._signal();
  47254. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47255. }))._ensure_((function(){
  47256. return true;
  47257. }));
  47258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47259. }),$globals.Error);
  47260. return self;
  47261. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  47262. },
  47263. args: [],
  47264. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  47265. referencedClasses: ["Error"],
  47266. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  47267. }),
  47268. $globals.BlockClosureTest);
  47269. $core.addMethod(
  47270. $core.method({
  47271. selector: "testExceptionSemantics",
  47272. protocol: 'tests',
  47273. fn: function (){
  47274. var self=this;
  47275. return $core.withContext(function($ctx1) {
  47276. self._timeout_((100));
  47277. $recv(self._async_((function(){
  47278. return $core.withContext(function($ctx2) {
  47279. return $recv((function(){
  47280. return $core.withContext(function($ctx3) {
  47281. self._assert_(true);
  47282. $recv($globals.Error)._signal();
  47283. self._deny_(true);
  47284. return self._finished();
  47285. $ctx3.sendIdx["finished"]=1;
  47286. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  47287. }))._on_do_($globals.Error,(function(ex){
  47288. return $core.withContext(function($ctx3) {
  47289. return self._finished();
  47290. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  47291. }));
  47292. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47293. })))._valueWithTimeout_((0));
  47294. return self;
  47295. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  47296. },
  47297. args: [],
  47298. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/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",
  47299. referencedClasses: ["Error"],
  47300. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  47301. }),
  47302. $globals.BlockClosureTest);
  47303. $core.addMethod(
  47304. $core.method({
  47305. selector: "testLocalReturnOnDoCatch",
  47306. protocol: 'tests',
  47307. fn: function (){
  47308. var self=this;
  47309. return $core.withContext(function($ctx1) {
  47310. self._assert_equals_(self._localReturnOnDoCatch(),(2));
  47311. return self;
  47312. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  47313. },
  47314. args: [],
  47315. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  47316. referencedClasses: [],
  47317. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  47318. }),
  47319. $globals.BlockClosureTest);
  47320. $core.addMethod(
  47321. $core.method({
  47322. selector: "testLocalReturnOnDoMiss",
  47323. protocol: 'tests',
  47324. fn: function (){
  47325. var self=this;
  47326. return $core.withContext(function($ctx1) {
  47327. self._assert_equals_(self._localReturnOnDoMiss(),(2));
  47328. return self;
  47329. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  47330. },
  47331. args: [],
  47332. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  47333. referencedClasses: [],
  47334. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  47335. }),
  47336. $globals.BlockClosureTest);
  47337. $core.addMethod(
  47338. $core.method({
  47339. selector: "testNewWithValues",
  47340. protocol: 'tests',
  47341. fn: function (){
  47342. var self=this;
  47343. return $core.withContext(function($ctx1) {
  47344. function TestConstructor(arg1, arg2, arg3) {}
  47345. TestConstructor.prototype.name = 'theTestPrototype';
  47346. var wrappedConstructor = $recv(TestConstructor);
  47347. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  47348. self._assert_(result instanceof TestConstructor);
  47349. self._assert_equals_(result.name, 'theTestPrototype');
  47350. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  47351. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, $globals.Error);;
  47352. return self;
  47353. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  47354. },
  47355. args: [],
  47356. 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>",
  47357. referencedClasses: [],
  47358. messageSends: []
  47359. }),
  47360. $globals.BlockClosureTest);
  47361. $core.addMethod(
  47362. $core.method({
  47363. selector: "testNumArgs",
  47364. protocol: 'tests',
  47365. fn: function (){
  47366. var self=this;
  47367. return $core.withContext(function($ctx1) {
  47368. var $1;
  47369. $1=$recv((function(){
  47370. }))._numArgs();
  47371. $ctx1.sendIdx["numArgs"]=1;
  47372. self._assert_equals_($1,(0));
  47373. $ctx1.sendIdx["assert:equals:"]=1;
  47374. self._assert_equals_($recv((function(a,b){
  47375. }))._numArgs(),(2));
  47376. return self;
  47377. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  47378. },
  47379. args: [],
  47380. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  47381. referencedClasses: [],
  47382. messageSends: ["assert:equals:", "numArgs"]
  47383. }),
  47384. $globals.BlockClosureTest);
  47385. $core.addMethod(
  47386. $core.method({
  47387. selector: "testOnDo",
  47388. protocol: 'tests',
  47389. fn: function (){
  47390. var self=this;
  47391. return $core.withContext(function($ctx1) {
  47392. self._assert_($recv((function(){
  47393. return $core.withContext(function($ctx2) {
  47394. return $recv($recv($globals.Error)._new())._signal();
  47395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47396. }))._on_do_($globals.Error,(function(ex){
  47397. return true;
  47398. })));
  47399. return self;
  47400. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  47401. },
  47402. args: [],
  47403. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  47404. referencedClasses: ["Error"],
  47405. messageSends: ["assert:", "on:do:", "signal", "new"]
  47406. }),
  47407. $globals.BlockClosureTest);
  47408. $core.addMethod(
  47409. $core.method({
  47410. selector: "testValue",
  47411. protocol: 'tests',
  47412. fn: function (){
  47413. var self=this;
  47414. return $core.withContext(function($ctx1) {
  47415. var $1;
  47416. $1=$recv((function(){
  47417. return $core.withContext(function($ctx2) {
  47418. return (1).__plus((1));
  47419. $ctx2.sendIdx["+"]=1;
  47420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47421. }))._value();
  47422. $ctx1.sendIdx["value"]=1;
  47423. self._assert_equals_($1,(2));
  47424. $ctx1.sendIdx["assert:equals:"]=1;
  47425. self._assert_equals_($recv((function(x){
  47426. return $core.withContext(function($ctx2) {
  47427. return $recv(x).__plus((1));
  47428. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  47429. }))._value_((2)),(3));
  47430. $ctx1.sendIdx["assert:equals:"]=2;
  47431. self._assert_equals_($recv((function(x,y){
  47432. return $core.withContext(function($ctx2) {
  47433. return $recv(x).__star(y);
  47434. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  47435. }))._value_value_((2),(4)),(8));
  47436. $ctx1.sendIdx["assert:equals:"]=3;
  47437. self._assert_equals_($recv((function(a,b,c){
  47438. return (1);
  47439. }))._value(),(1));
  47440. return self;
  47441. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  47442. },
  47443. args: [],
  47444. 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",
  47445. referencedClasses: [],
  47446. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  47447. }),
  47448. $globals.BlockClosureTest);
  47449. $core.addMethod(
  47450. $core.method({
  47451. selector: "testValueWithPossibleArguments",
  47452. protocol: 'tests',
  47453. fn: function (){
  47454. var self=this;
  47455. return $core.withContext(function($ctx1) {
  47456. var $1,$2;
  47457. $1=$recv((function(){
  47458. return (1);
  47459. }))._valueWithPossibleArguments_([(3), (4)]);
  47460. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  47461. self._assert_equals_($1,(1));
  47462. $ctx1.sendIdx["assert:equals:"]=1;
  47463. $2=$recv((function(a){
  47464. return $core.withContext(function($ctx2) {
  47465. return $recv(a).__plus((4));
  47466. $ctx2.sendIdx["+"]=1;
  47467. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  47468. }))._valueWithPossibleArguments_([(3), (4)]);
  47469. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  47470. self._assert_equals_($2,(7));
  47471. $ctx1.sendIdx["assert:equals:"]=2;
  47472. self._assert_equals_($recv((function(a,b){
  47473. return $core.withContext(function($ctx2) {
  47474. return $recv(a).__plus(b);
  47475. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  47476. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  47477. return self;
  47478. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  47479. },
  47480. args: [],
  47481. 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.",
  47482. referencedClasses: [],
  47483. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  47484. }),
  47485. $globals.BlockClosureTest);
  47486. $core.addMethod(
  47487. $core.method({
  47488. selector: "testWhileFalse",
  47489. protocol: 'tests',
  47490. fn: function (){
  47491. var self=this;
  47492. var i;
  47493. return $core.withContext(function($ctx1) {
  47494. i=(0);
  47495. $recv((function(){
  47496. return $core.withContext(function($ctx2) {
  47497. return $recv(i).__gt((5));
  47498. $ctx2.sendIdx[">"]=1;
  47499. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47500. }))._whileFalse_((function(){
  47501. return $core.withContext(function($ctx2) {
  47502. i=$recv(i).__plus((1));
  47503. $ctx2.sendIdx["+"]=1;
  47504. return i;
  47505. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47506. }));
  47507. self._assert_equals_(i,(6));
  47508. $ctx1.sendIdx["assert:equals:"]=1;
  47509. i=(0);
  47510. $recv((function(){
  47511. return $core.withContext(function($ctx2) {
  47512. i=$recv(i).__plus((1));
  47513. i;
  47514. return $recv(i).__gt((5));
  47515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47516. }))._whileFalse();
  47517. self._assert_equals_(i,(6));
  47518. return self;
  47519. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  47520. },
  47521. args: [],
  47522. 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",
  47523. referencedClasses: [],
  47524. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  47525. }),
  47526. $globals.BlockClosureTest);
  47527. $core.addMethod(
  47528. $core.method({
  47529. selector: "testWhileTrue",
  47530. protocol: 'tests',
  47531. fn: function (){
  47532. var self=this;
  47533. var i;
  47534. return $core.withContext(function($ctx1) {
  47535. i=(0);
  47536. $recv((function(){
  47537. return $core.withContext(function($ctx2) {
  47538. return $recv(i).__lt((5));
  47539. $ctx2.sendIdx["<"]=1;
  47540. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47541. }))._whileTrue_((function(){
  47542. return $core.withContext(function($ctx2) {
  47543. i=$recv(i).__plus((1));
  47544. $ctx2.sendIdx["+"]=1;
  47545. return i;
  47546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47547. }));
  47548. self._assert_equals_(i,(5));
  47549. $ctx1.sendIdx["assert:equals:"]=1;
  47550. i=(0);
  47551. $recv((function(){
  47552. return $core.withContext(function($ctx2) {
  47553. i=$recv(i).__plus((1));
  47554. i;
  47555. return $recv(i).__lt((5));
  47556. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  47557. }))._whileTrue();
  47558. self._assert_equals_(i,(5));
  47559. return self;
  47560. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  47561. },
  47562. args: [],
  47563. 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",
  47564. referencedClasses: [],
  47565. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  47566. }),
  47567. $globals.BlockClosureTest);
  47568. $core.addClass('BooleanTest', $globals.TestCase, [], 'Kernel-Tests');
  47569. $core.addMethod(
  47570. $core.method({
  47571. selector: "testEquality",
  47572. protocol: 'tests',
  47573. fn: function (){
  47574. var self=this;
  47575. return $core.withContext(function($ctx1) {
  47576. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  47577. $1=(0).__eq(false);
  47578. $ctx1.sendIdx["="]=1;
  47579. self._deny_($1);
  47580. $ctx1.sendIdx["deny:"]=1;
  47581. $2=false.__eq((0));
  47582. $ctx1.sendIdx["="]=2;
  47583. self._deny_($2);
  47584. $ctx1.sendIdx["deny:"]=2;
  47585. $3="".__eq(false);
  47586. $ctx1.sendIdx["="]=3;
  47587. self._deny_($3);
  47588. $ctx1.sendIdx["deny:"]=3;
  47589. $4=false.__eq("");
  47590. $ctx1.sendIdx["="]=4;
  47591. self._deny_($4);
  47592. $ctx1.sendIdx["deny:"]=4;
  47593. $5=true.__eq(true);
  47594. $ctx1.sendIdx["="]=5;
  47595. self._assert_($5);
  47596. $ctx1.sendIdx["assert:"]=1;
  47597. $6=false.__eq(true);
  47598. $ctx1.sendIdx["="]=6;
  47599. self._deny_($6);
  47600. $ctx1.sendIdx["deny:"]=5;
  47601. $7=true.__eq(false);
  47602. $ctx1.sendIdx["="]=7;
  47603. self._deny_($7);
  47604. $8=false.__eq(false);
  47605. $ctx1.sendIdx["="]=8;
  47606. self._assert_($8);
  47607. $ctx1.sendIdx["assert:"]=2;
  47608. $10=true._yourself();
  47609. $ctx1.sendIdx["yourself"]=1;
  47610. $9=$recv($10).__eq(true);
  47611. $ctx1.sendIdx["="]=9;
  47612. self._assert_($9);
  47613. $ctx1.sendIdx["assert:"]=3;
  47614. $12=true._yourself();
  47615. $ctx1.sendIdx["yourself"]=2;
  47616. $11=$recv($12).__eq(true._yourself());
  47617. self._assert_($11);
  47618. return self;
  47619. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  47620. },
  47621. args: [],
  47622. 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)",
  47623. referencedClasses: [],
  47624. messageSends: ["deny:", "=", "assert:", "yourself"]
  47625. }),
  47626. $globals.BooleanTest);
  47627. $core.addMethod(
  47628. $core.method({
  47629. selector: "testIdentity",
  47630. protocol: 'tests',
  47631. fn: function (){
  47632. var self=this;
  47633. return $core.withContext(function($ctx1) {
  47634. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  47635. $1=(0).__eq_eq(false);
  47636. $ctx1.sendIdx["=="]=1;
  47637. self._deny_($1);
  47638. $ctx1.sendIdx["deny:"]=1;
  47639. $2=false.__eq_eq((0));
  47640. $ctx1.sendIdx["=="]=2;
  47641. self._deny_($2);
  47642. $ctx1.sendIdx["deny:"]=2;
  47643. $3="".__eq_eq(false);
  47644. $ctx1.sendIdx["=="]=3;
  47645. self._deny_($3);
  47646. $ctx1.sendIdx["deny:"]=3;
  47647. $4=false.__eq_eq("");
  47648. $ctx1.sendIdx["=="]=4;
  47649. self._deny_($4);
  47650. $ctx1.sendIdx["deny:"]=4;
  47651. $5=true.__eq_eq(true);
  47652. $ctx1.sendIdx["=="]=5;
  47653. self._assert_($5);
  47654. $ctx1.sendIdx["assert:"]=1;
  47655. $6=false.__eq_eq(true);
  47656. $ctx1.sendIdx["=="]=6;
  47657. self._deny_($6);
  47658. $ctx1.sendIdx["deny:"]=5;
  47659. $7=true.__eq_eq(false);
  47660. $ctx1.sendIdx["=="]=7;
  47661. self._deny_($7);
  47662. $8=false.__eq_eq(false);
  47663. $ctx1.sendIdx["=="]=8;
  47664. self._assert_($8);
  47665. $ctx1.sendIdx["assert:"]=2;
  47666. $10=true._yourself();
  47667. $ctx1.sendIdx["yourself"]=1;
  47668. $9=$recv($10).__eq_eq(true);
  47669. $ctx1.sendIdx["=="]=9;
  47670. self._assert_($9);
  47671. $ctx1.sendIdx["assert:"]=3;
  47672. $12=true._yourself();
  47673. $ctx1.sendIdx["yourself"]=2;
  47674. $11=$recv($12).__eq_eq(true._yourself());
  47675. self._assert_($11);
  47676. return self;
  47677. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  47678. },
  47679. args: [],
  47680. 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",
  47681. referencedClasses: [],
  47682. messageSends: ["deny:", "==", "assert:", "yourself"]
  47683. }),
  47684. $globals.BooleanTest);
  47685. $core.addMethod(
  47686. $core.method({
  47687. selector: "testIfTrueIfFalse",
  47688. protocol: 'tests',
  47689. fn: function (){
  47690. var self=this;
  47691. return $core.withContext(function($ctx1) {
  47692. var $1,$2,$3,$4,$5,$6,$7,$8;
  47693. if($core.assert(true)){
  47694. $1="alternative block";
  47695. };
  47696. self._assert_equals_($1,"alternative block");
  47697. $ctx1.sendIdx["assert:equals:"]=1;
  47698. if(!$core.assert(true)){
  47699. $2="alternative block";
  47700. };
  47701. self._assert_equals_($2,nil);
  47702. $ctx1.sendIdx["assert:equals:"]=2;
  47703. if($core.assert(false)){
  47704. $3="alternative block";
  47705. };
  47706. self._assert_equals_($3,nil);
  47707. $ctx1.sendIdx["assert:equals:"]=3;
  47708. if(!$core.assert(false)){
  47709. $4="alternative block";
  47710. };
  47711. self._assert_equals_($4,"alternative block");
  47712. $ctx1.sendIdx["assert:equals:"]=4;
  47713. if($core.assert(false)){
  47714. $5="alternative block";
  47715. } else {
  47716. $5="alternative block2";
  47717. };
  47718. self._assert_equals_($5,"alternative block2");
  47719. $ctx1.sendIdx["assert:equals:"]=5;
  47720. if($core.assert(false)){
  47721. $6="alternative block2";
  47722. } else {
  47723. $6="alternative block";
  47724. };
  47725. self._assert_equals_($6,"alternative block");
  47726. $ctx1.sendIdx["assert:equals:"]=6;
  47727. if($core.assert(true)){
  47728. $7="alternative block";
  47729. } else {
  47730. $7="alternative block2";
  47731. };
  47732. self._assert_equals_($7,"alternative block");
  47733. $ctx1.sendIdx["assert:equals:"]=7;
  47734. if($core.assert(true)){
  47735. $8="alternative block2";
  47736. } else {
  47737. $8="alternative block";
  47738. };
  47739. self._assert_equals_($8,"alternative block2");
  47740. return self;
  47741. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  47742. },
  47743. args: [],
  47744. 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'.",
  47745. referencedClasses: [],
  47746. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  47747. }),
  47748. $globals.BooleanTest);
  47749. $core.addMethod(
  47750. $core.method({
  47751. selector: "testIfTrueIfFalseWithBoxing",
  47752. protocol: 'tests',
  47753. fn: function (){
  47754. var self=this;
  47755. return $core.withContext(function($ctx1) {
  47756. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  47757. $2=true._yourself();
  47758. $ctx1.sendIdx["yourself"]=1;
  47759. if($core.assert($2)){
  47760. $1="alternative block";
  47761. };
  47762. self._assert_equals_($1,"alternative block");
  47763. $ctx1.sendIdx["assert:equals:"]=1;
  47764. $4=true._yourself();
  47765. $ctx1.sendIdx["yourself"]=2;
  47766. if(!$core.assert($4)){
  47767. $3="alternative block";
  47768. };
  47769. self._assert_equals_($3,nil);
  47770. $ctx1.sendIdx["assert:equals:"]=2;
  47771. $6=false._yourself();
  47772. $ctx1.sendIdx["yourself"]=3;
  47773. if($core.assert($6)){
  47774. $5="alternative block";
  47775. };
  47776. self._assert_equals_($5,nil);
  47777. $ctx1.sendIdx["assert:equals:"]=3;
  47778. $8=false._yourself();
  47779. $ctx1.sendIdx["yourself"]=4;
  47780. if(!$core.assert($8)){
  47781. $7="alternative block";
  47782. };
  47783. self._assert_equals_($7,"alternative block");
  47784. $ctx1.sendIdx["assert:equals:"]=4;
  47785. $10=false._yourself();
  47786. $ctx1.sendIdx["yourself"]=5;
  47787. if($core.assert($10)){
  47788. $9="alternative block";
  47789. } else {
  47790. $9="alternative block2";
  47791. };
  47792. self._assert_equals_($9,"alternative block2");
  47793. $ctx1.sendIdx["assert:equals:"]=5;
  47794. $12=false._yourself();
  47795. $ctx1.sendIdx["yourself"]=6;
  47796. if($core.assert($12)){
  47797. $11="alternative block2";
  47798. } else {
  47799. $11="alternative block";
  47800. };
  47801. self._assert_equals_($11,"alternative block");
  47802. $ctx1.sendIdx["assert:equals:"]=6;
  47803. $14=true._yourself();
  47804. $ctx1.sendIdx["yourself"]=7;
  47805. if($core.assert($14)){
  47806. $13="alternative block";
  47807. } else {
  47808. $13="alternative block2";
  47809. };
  47810. self._assert_equals_($13,"alternative block");
  47811. $ctx1.sendIdx["assert:equals:"]=7;
  47812. $16=true._yourself();
  47813. if($core.assert($16)){
  47814. $15="alternative block2";
  47815. } else {
  47816. $15="alternative block";
  47817. };
  47818. self._assert_equals_($15,"alternative block2");
  47819. return self;
  47820. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  47821. },
  47822. args: [],
  47823. 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'.",
  47824. referencedClasses: [],
  47825. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  47826. }),
  47827. $globals.BooleanTest);
  47828. $core.addMethod(
  47829. $core.method({
  47830. selector: "testLogic",
  47831. protocol: 'tests',
  47832. fn: function (){
  47833. var self=this;
  47834. return $core.withContext(function($ctx1) {
  47835. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  47836. $1=true.__and(true);
  47837. $ctx1.sendIdx["&"]=1;
  47838. self._assert_($1);
  47839. $ctx1.sendIdx["assert:"]=1;
  47840. $2=true.__and(false);
  47841. $ctx1.sendIdx["&"]=2;
  47842. self._deny_($2);
  47843. $ctx1.sendIdx["deny:"]=1;
  47844. $3=false.__and(true);
  47845. $ctx1.sendIdx["&"]=3;
  47846. self._deny_($3);
  47847. $ctx1.sendIdx["deny:"]=2;
  47848. $5=false.__and(false);
  47849. $ctx1.sendIdx["&"]=4;
  47850. $4=self._deny_($5);
  47851. $ctx1.sendIdx["deny:"]=3;
  47852. $6=true.__or(true);
  47853. $ctx1.sendIdx["|"]=1;
  47854. self._assert_($6);
  47855. $ctx1.sendIdx["assert:"]=2;
  47856. $7=true.__or(false);
  47857. $ctx1.sendIdx["|"]=2;
  47858. self._assert_($7);
  47859. $ctx1.sendIdx["assert:"]=3;
  47860. $8=false.__or(true);
  47861. $ctx1.sendIdx["|"]=3;
  47862. self._assert_($8);
  47863. $ctx1.sendIdx["assert:"]=4;
  47864. $10=false.__or(false);
  47865. $ctx1.sendIdx["|"]=4;
  47866. $9=self._deny_($10);
  47867. $ctx1.sendIdx["deny:"]=4;
  47868. $12=(1).__gt((0));
  47869. $ctx1.sendIdx[">"]=1;
  47870. $11=true.__and($12);
  47871. $ctx1.sendIdx["&"]=5;
  47872. self._assert_($11);
  47873. $ctx1.sendIdx["assert:"]=5;
  47874. $14=(1).__gt((0));
  47875. $ctx1.sendIdx[">"]=2;
  47876. $13=$recv($14).__and(false);
  47877. $ctx1.sendIdx["&"]=6;
  47878. self._deny_($13);
  47879. $ctx1.sendIdx["deny:"]=5;
  47880. $16=(1).__gt((0));
  47881. $ctx1.sendIdx[">"]=3;
  47882. $17=(1).__gt((2));
  47883. $ctx1.sendIdx[">"]=4;
  47884. $15=$recv($16).__and($17);
  47885. self._deny_($15);
  47886. $19=(1).__gt((0));
  47887. $ctx1.sendIdx[">"]=5;
  47888. $18=false.__or($19);
  47889. $ctx1.sendIdx["|"]=5;
  47890. self._assert_($18);
  47891. $ctx1.sendIdx["assert:"]=6;
  47892. $21=(1).__gt((0));
  47893. $ctx1.sendIdx[">"]=6;
  47894. $20=$recv($21).__or(false);
  47895. $ctx1.sendIdx["|"]=6;
  47896. self._assert_($20);
  47897. $ctx1.sendIdx["assert:"]=7;
  47898. $23=(1).__gt((0));
  47899. $ctx1.sendIdx[">"]=7;
  47900. $22=$recv($23).__or((1).__gt((2)));
  47901. self._assert_($22);
  47902. return self;
  47903. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  47904. },
  47905. args: [],
  47906. 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))",
  47907. referencedClasses: [],
  47908. messageSends: ["assert:", "&", "deny:", "|", ">"]
  47909. }),
  47910. $globals.BooleanTest);
  47911. $core.addMethod(
  47912. $core.method({
  47913. selector: "testLogicKeywords",
  47914. protocol: 'tests',
  47915. fn: function (){
  47916. var self=this;
  47917. return $core.withContext(function($ctx1) {
  47918. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  47919. $1=true._and_((function(){
  47920. return true;
  47921. }));
  47922. $ctx1.sendIdx["and:"]=1;
  47923. self._assert_($1);
  47924. $ctx1.sendIdx["assert:"]=1;
  47925. $2=true._and_((function(){
  47926. return false;
  47927. }));
  47928. $ctx1.sendIdx["and:"]=2;
  47929. self._deny_($2);
  47930. $ctx1.sendIdx["deny:"]=1;
  47931. $3=false._and_((function(){
  47932. return true;
  47933. }));
  47934. $ctx1.sendIdx["and:"]=3;
  47935. self._deny_($3);
  47936. $ctx1.sendIdx["deny:"]=2;
  47937. $5=false._and_((function(){
  47938. return false;
  47939. }));
  47940. $ctx1.sendIdx["and:"]=4;
  47941. $4=self._deny_($5);
  47942. $ctx1.sendIdx["deny:"]=3;
  47943. $6=true._or_((function(){
  47944. return true;
  47945. }));
  47946. $ctx1.sendIdx["or:"]=1;
  47947. self._assert_($6);
  47948. $ctx1.sendIdx["assert:"]=2;
  47949. $7=true._or_((function(){
  47950. return false;
  47951. }));
  47952. $ctx1.sendIdx["or:"]=2;
  47953. self._assert_($7);
  47954. $ctx1.sendIdx["assert:"]=3;
  47955. $8=false._or_((function(){
  47956. return true;
  47957. }));
  47958. $ctx1.sendIdx["or:"]=3;
  47959. self._assert_($8);
  47960. $ctx1.sendIdx["assert:"]=4;
  47961. $10=false._or_((function(){
  47962. return false;
  47963. }));
  47964. $ctx1.sendIdx["or:"]=4;
  47965. $9=self._deny_($10);
  47966. $ctx1.sendIdx["deny:"]=4;
  47967. $11=true._and_((function(){
  47968. return $core.withContext(function($ctx2) {
  47969. return (1).__gt((0));
  47970. $ctx2.sendIdx[">"]=1;
  47971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  47972. }));
  47973. $ctx1.sendIdx["and:"]=5;
  47974. self._assert_($11);
  47975. $ctx1.sendIdx["assert:"]=5;
  47976. $13=(1).__gt((0));
  47977. $ctx1.sendIdx[">"]=2;
  47978. $12=$recv($13)._and_((function(){
  47979. return false;
  47980. }));
  47981. $ctx1.sendIdx["and:"]=6;
  47982. self._deny_($12);
  47983. $ctx1.sendIdx["deny:"]=5;
  47984. $15=(1).__gt((0));
  47985. $ctx1.sendIdx[">"]=3;
  47986. $14=$recv($15)._and_((function(){
  47987. return $core.withContext(function($ctx2) {
  47988. return (1).__gt((2));
  47989. $ctx2.sendIdx[">"]=4;
  47990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  47991. }));
  47992. self._deny_($14);
  47993. $16=false._or_((function(){
  47994. return $core.withContext(function($ctx2) {
  47995. return (1).__gt((0));
  47996. $ctx2.sendIdx[">"]=5;
  47997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  47998. }));
  47999. $ctx1.sendIdx["or:"]=5;
  48000. self._assert_($16);
  48001. $ctx1.sendIdx["assert:"]=6;
  48002. $18=(1).__gt((0));
  48003. $ctx1.sendIdx[">"]=6;
  48004. $17=$recv($18)._or_((function(){
  48005. return false;
  48006. }));
  48007. $ctx1.sendIdx["or:"]=6;
  48008. self._assert_($17);
  48009. $ctx1.sendIdx["assert:"]=7;
  48010. $20=(1).__gt((0));
  48011. $ctx1.sendIdx[">"]=7;
  48012. $19=$recv($20)._or_((function(){
  48013. return $core.withContext(function($ctx2) {
  48014. return (1).__gt((2));
  48015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  48016. }));
  48017. self._assert_($19);
  48018. return self;
  48019. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  48020. },
  48021. args: [],
  48022. 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 ])",
  48023. referencedClasses: [],
  48024. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  48025. }),
  48026. $globals.BooleanTest);
  48027. $core.addMethod(
  48028. $core.method({
  48029. selector: "testNonBooleanError",
  48030. protocol: 'tests',
  48031. fn: function (){
  48032. var self=this;
  48033. return $core.withContext(function($ctx1) {
  48034. self._should_raise_((function(){
  48035. return $core.withContext(function($ctx2) {
  48036. if($core.assert("")){
  48037. } else {
  48038. };
  48039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48040. }),$globals.NonBooleanReceiver);
  48041. return self;
  48042. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  48043. },
  48044. args: [],
  48045. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  48046. referencedClasses: ["NonBooleanReceiver"],
  48047. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  48048. }),
  48049. $globals.BooleanTest);
  48050. $core.addClass('ClassBuilderTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  48051. $core.addMethod(
  48052. $core.method({
  48053. selector: "setUp",
  48054. protocol: 'running',
  48055. fn: function (){
  48056. var self=this;
  48057. return $core.withContext(function($ctx1) {
  48058. self["@builder"]=$recv($globals.ClassBuilder)._new();
  48059. return self;
  48060. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  48061. },
  48062. args: [],
  48063. source: "setUp\x0a\x09builder := ClassBuilder new",
  48064. referencedClasses: ["ClassBuilder"],
  48065. messageSends: ["new"]
  48066. }),
  48067. $globals.ClassBuilderTest);
  48068. $core.addMethod(
  48069. $core.method({
  48070. selector: "tearDown",
  48071. protocol: 'running',
  48072. fn: function (){
  48073. var self=this;
  48074. return $core.withContext(function($ctx1) {
  48075. var $1,$receiver;
  48076. $1=self["@theClass"];
  48077. if(($receiver = $1) == null || $receiver.isNil){
  48078. $1;
  48079. } else {
  48080. $recv($globals.Smalltalk)._removeClass_(self["@theClass"]);
  48081. self["@theClass"]=nil;
  48082. self["@theClass"];
  48083. };
  48084. return self;
  48085. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  48086. },
  48087. args: [],
  48088. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  48089. referencedClasses: ["Smalltalk"],
  48090. messageSends: ["ifNotNil:", "removeClass:"]
  48091. }),
  48092. $globals.ClassBuilderTest);
  48093. $core.addMethod(
  48094. $core.method({
  48095. selector: "testClassCopy",
  48096. protocol: 'tests',
  48097. fn: function (){
  48098. var self=this;
  48099. return $core.withContext(function($ctx1) {
  48100. var $2,$1,$4,$3,$6,$5,$8,$7;
  48101. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48102. $2=$recv(self["@theClass"])._superclass();
  48103. $ctx1.sendIdx["superclass"]=1;
  48104. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48105. $ctx1.sendIdx["=="]=1;
  48106. self._assert_($1);
  48107. $ctx1.sendIdx["assert:"]=1;
  48108. $4=$recv(self["@theClass"])._instanceVariableNames();
  48109. $ctx1.sendIdx["instanceVariableNames"]=1;
  48110. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48111. $ctx1.sendIdx["=="]=2;
  48112. self._assert_($3);
  48113. $ctx1.sendIdx["assert:"]=2;
  48114. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48115. $ctx1.sendIdx["assert:equals:"]=1;
  48116. $6=$recv(self["@theClass"])._package();
  48117. $ctx1.sendIdx["package"]=1;
  48118. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48119. self._assert_($5);
  48120. $8=$recv(self["@theClass"])._methodDictionary();
  48121. $ctx1.sendIdx["methodDictionary"]=1;
  48122. $7=$recv($8)._keys();
  48123. $ctx1.sendIdx["keys"]=1;
  48124. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48125. return self;
  48126. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  48127. },
  48128. args: [],
  48129. 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",
  48130. referencedClasses: ["ObjectMock"],
  48131. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"]
  48132. }),
  48133. $globals.ClassBuilderTest);
  48134. $core.addMethod(
  48135. $core.method({
  48136. selector: "testClassMigration",
  48137. protocol: 'tests',
  48138. fn: function (){
  48139. var self=this;
  48140. var instance,oldClass;
  48141. return $core.withContext(function($ctx1) {
  48142. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  48143. oldClass=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48144. $2=$recv($globals.Smalltalk)._globals();
  48145. $ctx1.sendIdx["globals"]=1;
  48146. $1=$recv($2)._at_("ObjectMock2");
  48147. $ctx1.sendIdx["at:"]=1;
  48148. instance=$recv($1)._new();
  48149. $4=$recv($globals.Smalltalk)._globals();
  48150. $ctx1.sendIdx["globals"]=2;
  48151. $3=$recv($4)._at_("ObjectMock2");
  48152. $ctx1.sendIdx["at:"]=2;
  48153. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  48154. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  48155. $ctx1.sendIdx["=="]=1;
  48156. self._deny_($5);
  48157. $ctx1.sendIdx["deny:"]=1;
  48158. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  48159. $ctx1.sendIdx["=="]=2;
  48160. self._assert_($6);
  48161. $ctx1.sendIdx["assert:"]=1;
  48162. self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  48163. $ctx1.sendIdx["assert:"]=2;
  48164. $7=$recv($globals.ObjectMock2)._selectors();
  48165. $ctx1.sendIdx["selectors"]=1;
  48166. self._assert_equals_($7,$recv(oldClass)._selectors());
  48167. $ctx1.sendIdx["assert:equals:"]=1;
  48168. $8=$recv($globals.ObjectMock2)._comment();
  48169. $ctx1.sendIdx["comment"]=1;
  48170. self._assert_equals_($8,$recv(oldClass)._comment());
  48171. $ctx1.sendIdx["assert:equals:"]=2;
  48172. $9=$recv($recv($globals.ObjectMock2)._package())._name();
  48173. $ctx1.sendIdx["name"]=1;
  48174. self._assert_equals_($9,"Kernel-Tests");
  48175. $11=$recv(instance)._class();
  48176. $ctx1.sendIdx["class"]=1;
  48177. $10=$recv($11).__eq_eq($globals.ObjectMock2);
  48178. self._deny_($10);
  48179. self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  48180. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  48181. return self;
  48182. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  48183. },
  48184. args: [],
  48185. 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",
  48186. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  48187. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"]
  48188. }),
  48189. $globals.ClassBuilderTest);
  48190. $core.addMethod(
  48191. $core.method({
  48192. selector: "testClassMigrationWithClassInstanceVariables",
  48193. protocol: 'tests',
  48194. fn: function (){
  48195. var self=this;
  48196. return $core.withContext(function($ctx1) {
  48197. var $1;
  48198. $recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48199. $1=$recv($globals.ObjectMock2)._class();
  48200. $ctx1.sendIdx["class"]=1;
  48201. $recv($1)._instanceVariableNames_("foo bar");
  48202. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  48203. self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  48204. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  48205. return self;
  48206. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  48207. },
  48208. args: [],
  48209. 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",
  48210. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  48211. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  48212. }),
  48213. $globals.ClassBuilderTest);
  48214. $core.addMethod(
  48215. $core.method({
  48216. selector: "testClassMigrationWithSubclasses",
  48217. protocol: 'tests',
  48218. fn: function (){
  48219. var self=this;
  48220. return $core.withContext(function($ctx1) {
  48221. var $2,$1,$4,$3;
  48222. $recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48223. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  48224. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  48225. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  48226. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  48227. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  48228. $2=$recv($globals.ObjectMock)._subclasses();
  48229. $ctx1.sendIdx["subclasses"]=1;
  48230. $1=$recv($2)._includes_($globals.ObjectMock2);
  48231. $ctx1.sendIdx["includes:"]=1;
  48232. self._assert_($1);
  48233. $ctx1.sendIdx["assert:"]=1;
  48234. $4=$recv($globals.ObjectMock2)._subclasses();
  48235. $ctx1.sendIdx["subclasses"]=2;
  48236. $3=$recv($4)._includes_($globals.ObjectMock3);
  48237. $ctx1.sendIdx["includes:"]=2;
  48238. self._assert_($3);
  48239. $ctx1.sendIdx["assert:"]=2;
  48240. self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  48241. $recv($recv($globals.ObjectMock)._allSubclasses())._do_((function(each){
  48242. return $core.withContext(function($ctx2) {
  48243. return $recv($globals.Smalltalk)._removeClass_(each);
  48244. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48245. }));
  48246. return self;
  48247. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  48248. },
  48249. args: [],
  48250. 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 ]",
  48251. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  48252. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"]
  48253. }),
  48254. $globals.ClassBuilderTest);
  48255. $core.addMethod(
  48256. $core.method({
  48257. selector: "testInstanceVariableNames",
  48258. protocol: 'tests',
  48259. fn: function (){
  48260. var self=this;
  48261. return $core.withContext(function($ctx1) {
  48262. self._assert_equals_($recv(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  48263. return self;
  48264. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  48265. },
  48266. args: [],
  48267. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  48268. referencedClasses: [],
  48269. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  48270. }),
  48271. $globals.ClassBuilderTest);
  48272. $core.addClass('ClassTest', $globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  48273. $core.addMethod(
  48274. $core.method({
  48275. selector: "jsConstructor",
  48276. protocol: 'running',
  48277. fn: function (){
  48278. var self=this;
  48279. return $core.withContext(function($ctx1) {
  48280. function Foo(){}
  48281. Foo.prototype.valueOf = function () {return 4;};
  48282. return Foo;
  48283. ;
  48284. return self;
  48285. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  48286. },
  48287. args: [],
  48288. source: "jsConstructor\x0a\x09<\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09>",
  48289. referencedClasses: [],
  48290. messageSends: []
  48291. }),
  48292. $globals.ClassTest);
  48293. $core.addMethod(
  48294. $core.method({
  48295. selector: "setUp",
  48296. protocol: 'running',
  48297. fn: function (){
  48298. var self=this;
  48299. return $core.withContext(function($ctx1) {
  48300. self["@builder"]=$recv($globals.ClassBuilder)._new();
  48301. return self;
  48302. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  48303. },
  48304. args: [],
  48305. source: "setUp\x0a\x09builder := ClassBuilder new",
  48306. referencedClasses: ["ClassBuilder"],
  48307. messageSends: ["new"]
  48308. }),
  48309. $globals.ClassTest);
  48310. $core.addMethod(
  48311. $core.method({
  48312. selector: "tearDown",
  48313. protocol: 'running',
  48314. fn: function (){
  48315. var self=this;
  48316. return $core.withContext(function($ctx1) {
  48317. var $1,$receiver;
  48318. $1=self["@theClass"];
  48319. if(($receiver = $1) == null || $receiver.isNil){
  48320. $1;
  48321. } else {
  48322. $recv($globals.Smalltalk)._removeClass_(self["@theClass"]);
  48323. self["@theClass"]=nil;
  48324. self["@theClass"];
  48325. };
  48326. return self;
  48327. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  48328. },
  48329. args: [],
  48330. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  48331. referencedClasses: ["Smalltalk"],
  48332. messageSends: ["ifNotNil:", "removeClass:"]
  48333. }),
  48334. $globals.ClassTest);
  48335. $core.addMethod(
  48336. $core.method({
  48337. selector: "testSetJavaScriptConstructor",
  48338. protocol: 'tests',
  48339. fn: function (){
  48340. var self=this;
  48341. var instance;
  48342. return $core.withContext(function($ctx1) {
  48343. var $2,$1,$4,$3,$6,$5,$8,$7;
  48344. self["@theClass"]=$recv(self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  48345. $recv(self["@theClass"])._javascriptConstructor_(self._jsConstructor());
  48346. $2=$recv(self["@theClass"])._superclass();
  48347. $ctx1.sendIdx["superclass"]=1;
  48348. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  48349. $ctx1.sendIdx["=="]=1;
  48350. self._assert_($1);
  48351. $ctx1.sendIdx["assert:"]=1;
  48352. $4=$recv(self["@theClass"])._instanceVariableNames();
  48353. $ctx1.sendIdx["instanceVariableNames"]=1;
  48354. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  48355. $ctx1.sendIdx["=="]=2;
  48356. self._assert_($3);
  48357. $ctx1.sendIdx["assert:"]=2;
  48358. self._assert_equals_($recv(self["@theClass"])._name(),"ObjectMock2");
  48359. $ctx1.sendIdx["assert:equals:"]=1;
  48360. $6=$recv(self["@theClass"])._package();
  48361. $ctx1.sendIdx["package"]=1;
  48362. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  48363. $ctx1.sendIdx["=="]=3;
  48364. self._assert_($5);
  48365. $ctx1.sendIdx["assert:"]=3;
  48366. $8=$recv(self["@theClass"])._methodDictionary();
  48367. $ctx1.sendIdx["methodDictionary"]=1;
  48368. $7=$recv($8)._keys();
  48369. $ctx1.sendIdx["keys"]=1;
  48370. self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  48371. $ctx1.sendIdx["assert:equals:"]=2;
  48372. instance=$recv(self["@theClass"])._new();
  48373. self._assert_($recv($recv(instance)._class()).__eq_eq(self["@theClass"]));
  48374. self._assert_equals_($recv(instance)._value(),(4));
  48375. $ctx1.sendIdx["assert:equals:"]=3;
  48376. self._shouldnt_raise_((function(){
  48377. return $core.withContext(function($ctx2) {
  48378. return $recv(instance)._foo_((9));
  48379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48380. }),$globals.Error);
  48381. self._assert_equals_($recv(instance)._foo(),(9));
  48382. return self;
  48383. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  48384. },
  48385. args: [],
  48386. 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-wrapped 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",
  48387. referencedClasses: ["ObjectMock", "Error"],
  48388. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  48389. }),
  48390. $globals.ClassTest);
  48391. $core.addClass('CollectionTest', $globals.TestCase, ['sampleBlock'], 'Kernel-Tests');
  48392. $core.addMethod(
  48393. $core.method({
  48394. selector: "assertSameContents:as:",
  48395. protocol: 'convenience',
  48396. fn: function (aCollection,anotherCollection){
  48397. var self=this;
  48398. return $core.withContext(function($ctx1) {
  48399. var $2,$1,$4,$3;
  48400. $2=$recv(aCollection)._size();
  48401. $ctx1.sendIdx["size"]=1;
  48402. $1=$recv($2).__eq($recv(anotherCollection)._size());
  48403. $ctx1.sendIdx["="]=1;
  48404. self._assert_($1);
  48405. $ctx1.sendIdx["assert:"]=1;
  48406. $recv(aCollection)._do_((function(each){
  48407. return $core.withContext(function($ctx2) {
  48408. $4=$recv(aCollection)._occurrencesOf_(each);
  48409. $ctx2.sendIdx["occurrencesOf:"]=1;
  48410. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  48411. return self._assert_($3);
  48412. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48413. }));
  48414. return self;
  48415. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  48416. },
  48417. args: ["aCollection", "anotherCollection"],
  48418. 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)) ]",
  48419. referencedClasses: [],
  48420. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  48421. }),
  48422. $globals.CollectionTest);
  48423. $core.addMethod(
  48424. $core.method({
  48425. selector: "collection",
  48426. protocol: 'fixture',
  48427. fn: function (){
  48428. var self=this;
  48429. return $core.withContext(function($ctx1) {
  48430. self._subclassResponsibility();
  48431. return self;
  48432. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  48433. },
  48434. args: [],
  48435. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  48436. referencedClasses: [],
  48437. messageSends: ["subclassResponsibility"]
  48438. }),
  48439. $globals.CollectionTest);
  48440. $core.addMethod(
  48441. $core.method({
  48442. selector: "collectionClass",
  48443. protocol: 'fixture',
  48444. fn: function (){
  48445. var self=this;
  48446. return $core.withContext(function($ctx1) {
  48447. return $recv(self._class())._collectionClass();
  48448. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  48449. },
  48450. args: [],
  48451. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  48452. referencedClasses: [],
  48453. messageSends: ["collectionClass", "class"]
  48454. }),
  48455. $globals.CollectionTest);
  48456. $core.addMethod(
  48457. $core.method({
  48458. selector: "collectionOfPrintStrings",
  48459. protocol: 'fixture',
  48460. fn: function (){
  48461. var self=this;
  48462. return $core.withContext(function($ctx1) {
  48463. self._subclassResponsibility();
  48464. return self;
  48465. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  48466. },
  48467. args: [],
  48468. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  48469. referencedClasses: [],
  48470. messageSends: ["subclassResponsibility"]
  48471. }),
  48472. $globals.CollectionTest);
  48473. $core.addMethod(
  48474. $core.method({
  48475. selector: "collectionSize",
  48476. protocol: 'fixture',
  48477. fn: function (){
  48478. var self=this;
  48479. return $core.withContext(function($ctx1) {
  48480. self._subclassResponsibility();
  48481. return self;
  48482. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  48483. },
  48484. args: [],
  48485. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  48486. referencedClasses: [],
  48487. messageSends: ["subclassResponsibility"]
  48488. }),
  48489. $globals.CollectionTest);
  48490. $core.addMethod(
  48491. $core.method({
  48492. selector: "collectionWithDuplicates",
  48493. protocol: 'fixture',
  48494. fn: function (){
  48495. var self=this;
  48496. return $core.withContext(function($ctx1) {
  48497. self._subclassResponsibility();
  48498. return self;
  48499. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  48500. },
  48501. args: [],
  48502. 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",
  48503. referencedClasses: [],
  48504. messageSends: ["subclassResponsibility"]
  48505. }),
  48506. $globals.CollectionTest);
  48507. $core.addMethod(
  48508. $core.method({
  48509. selector: "collectionWithNewValue",
  48510. protocol: 'fixture',
  48511. fn: function (){
  48512. var self=this;
  48513. return $core.withContext(function($ctx1) {
  48514. self._subclassResponsibility();
  48515. return self;
  48516. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  48517. },
  48518. args: [],
  48519. 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",
  48520. referencedClasses: [],
  48521. messageSends: ["subclassResponsibility"]
  48522. }),
  48523. $globals.CollectionTest);
  48524. $core.addMethod(
  48525. $core.method({
  48526. selector: "initialize",
  48527. protocol: 'initialization',
  48528. fn: function (){
  48529. var self=this;
  48530. return $core.withContext(function($ctx1) {
  48531. (
  48532. $ctx1.supercall = true,
  48533. ($globals.CollectionTest.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  48534. $ctx1.supercall = false;
  48535. self["@sampleBlock"]=(function(){
  48536. });
  48537. return self;
  48538. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  48539. },
  48540. args: [],
  48541. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  48542. referencedClasses: [],
  48543. messageSends: ["initialize"]
  48544. }),
  48545. $globals.CollectionTest);
  48546. $core.addMethod(
  48547. $core.method({
  48548. selector: "isCollectionReadOnly",
  48549. protocol: 'testing',
  48550. fn: function (){
  48551. var self=this;
  48552. return false;
  48553. },
  48554. args: [],
  48555. source: "isCollectionReadOnly\x0a\x09^ false",
  48556. referencedClasses: [],
  48557. messageSends: []
  48558. }),
  48559. $globals.CollectionTest);
  48560. $core.addMethod(
  48561. $core.method({
  48562. selector: "sampleNewValue",
  48563. protocol: 'fixture',
  48564. fn: function (){
  48565. var self=this;
  48566. return "N";
  48567. },
  48568. args: [],
  48569. 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'",
  48570. referencedClasses: [],
  48571. messageSends: []
  48572. }),
  48573. $globals.CollectionTest);
  48574. $core.addMethod(
  48575. $core.method({
  48576. selector: "sampleNewValueAsCollection",
  48577. protocol: 'fixture',
  48578. fn: function (){
  48579. var self=this;
  48580. return $core.withContext(function($ctx1) {
  48581. return $recv(self._collectionClass())._with_(self._sampleNewValue());
  48582. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  48583. },
  48584. args: [],
  48585. 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",
  48586. referencedClasses: [],
  48587. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  48588. }),
  48589. $globals.CollectionTest);
  48590. $core.addMethod(
  48591. $core.method({
  48592. selector: "testAddAll",
  48593. protocol: 'tests',
  48594. fn: function (){
  48595. var self=this;
  48596. return $core.withContext(function($ctx1) {
  48597. 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;
  48598. $2=self._collection();
  48599. $ctx1.sendIdx["collection"]=1;
  48600. $4=self._collectionClass();
  48601. $ctx1.sendIdx["collectionClass"]=1;
  48602. $3=$recv($4)._new();
  48603. $ctx1.sendIdx["new"]=1;
  48604. $recv($2)._addAll_($3);
  48605. $ctx1.sendIdx["addAll:"]=1;
  48606. $5=$recv($2)._yourself();
  48607. $ctx1.sendIdx["yourself"]=1;
  48608. $1=$5;
  48609. $6=self._collection();
  48610. $ctx1.sendIdx["collection"]=2;
  48611. self._assert_equals_($1,$6);
  48612. $ctx1.sendIdx["assert:equals:"]=1;
  48613. $9=self._collectionClass();
  48614. $ctx1.sendIdx["collectionClass"]=2;
  48615. $8=$recv($9)._new();
  48616. $ctx1.sendIdx["new"]=2;
  48617. $10=self._collection();
  48618. $ctx1.sendIdx["collection"]=3;
  48619. $recv($8)._addAll_($10);
  48620. $ctx1.sendIdx["addAll:"]=2;
  48621. $11=$recv($8)._yourself();
  48622. $ctx1.sendIdx["yourself"]=2;
  48623. $7=$11;
  48624. $12=self._collection();
  48625. $ctx1.sendIdx["collection"]=4;
  48626. self._assert_equals_($7,$12);
  48627. $ctx1.sendIdx["assert:equals:"]=2;
  48628. $15=self._collectionClass();
  48629. $ctx1.sendIdx["collectionClass"]=3;
  48630. $14=$recv($15)._new();
  48631. $ctx1.sendIdx["new"]=3;
  48632. $17=self._collectionClass();
  48633. $ctx1.sendIdx["collectionClass"]=4;
  48634. $16=$recv($17)._new();
  48635. $ctx1.sendIdx["new"]=4;
  48636. $recv($14)._addAll_($16);
  48637. $ctx1.sendIdx["addAll:"]=3;
  48638. $18=$recv($14)._yourself();
  48639. $ctx1.sendIdx["yourself"]=3;
  48640. $13=$18;
  48641. self._assert_equals_($13,$recv(self._collectionClass())._new());
  48642. $ctx1.sendIdx["assert:equals:"]=3;
  48643. $20=self._collection();
  48644. $ctx1.sendIdx["collection"]=5;
  48645. $21=self._sampleNewValueAsCollection();
  48646. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  48647. $recv($20)._addAll_($21);
  48648. $ctx1.sendIdx["addAll:"]=4;
  48649. $22=$recv($20)._yourself();
  48650. $ctx1.sendIdx["yourself"]=4;
  48651. $19=$22;
  48652. $23=self._collectionWithNewValue();
  48653. $ctx1.sendIdx["collectionWithNewValue"]=1;
  48654. self._assert_equals_($19,$23);
  48655. $25=self._sampleNewValueAsCollection();
  48656. $recv($25)._addAll_(self._collection());
  48657. $24=$recv($25)._yourself();
  48658. self._assertSameContents_as_($24,self._collectionWithNewValue());
  48659. return self;
  48660. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  48661. },
  48662. args: [],
  48663. 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",
  48664. referencedClasses: [],
  48665. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  48666. }),
  48667. $globals.CollectionTest);
  48668. $core.addMethod(
  48669. $core.method({
  48670. selector: "testAllSatisfy",
  48671. protocol: 'tests',
  48672. fn: function (){
  48673. var self=this;
  48674. var collection,anyOne;
  48675. return $core.withContext(function($ctx1) {
  48676. var $1;
  48677. collection=self._collection();
  48678. anyOne=$recv(collection)._anyOne();
  48679. $1=$recv(collection)._allSatisfy_((function(each){
  48680. return $core.withContext(function($ctx2) {
  48681. return $recv(collection)._includes_(each);
  48682. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48683. }));
  48684. $ctx1.sendIdx["allSatisfy:"]=1;
  48685. self._assert_($1);
  48686. self._deny_($recv(collection)._allSatisfy_((function(each){
  48687. return $core.withContext(function($ctx2) {
  48688. return $recv(each).__tild_eq(anyOne);
  48689. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48690. })));
  48691. return self;
  48692. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  48693. },
  48694. args: [],
  48695. 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 ])",
  48696. referencedClasses: [],
  48697. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  48698. }),
  48699. $globals.CollectionTest);
  48700. $core.addMethod(
  48701. $core.method({
  48702. selector: "testAnyOne",
  48703. protocol: 'tests',
  48704. fn: function (){
  48705. var self=this;
  48706. return $core.withContext(function($ctx1) {
  48707. var $2,$1;
  48708. self._should_raise_((function(){
  48709. return $core.withContext(function($ctx2) {
  48710. return $recv($recv(self._collectionClass())._new())._anyOne();
  48711. $ctx2.sendIdx["anyOne"]=1;
  48712. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48713. }),$globals.Error);
  48714. $2=self._collection();
  48715. $ctx1.sendIdx["collection"]=1;
  48716. $1=$recv($2)._includes_($recv(self._collection())._anyOne());
  48717. self._assert_($1);
  48718. return self;
  48719. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  48720. },
  48721. args: [],
  48722. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  48723. referencedClasses: ["Error"],
  48724. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  48725. }),
  48726. $globals.CollectionTest);
  48727. $core.addMethod(
  48728. $core.method({
  48729. selector: "testAnySatisfy",
  48730. protocol: 'tests',
  48731. fn: function (){
  48732. var self=this;
  48733. var anyOne;
  48734. return $core.withContext(function($ctx1) {
  48735. var $1,$3,$2;
  48736. $1=self._collection();
  48737. $ctx1.sendIdx["collection"]=1;
  48738. anyOne=$recv($1)._anyOne();
  48739. $3=self._collection();
  48740. $ctx1.sendIdx["collection"]=2;
  48741. $2=$recv($3)._anySatisfy_((function(each){
  48742. return $core.withContext(function($ctx2) {
  48743. return $recv(each).__eq(anyOne);
  48744. $ctx2.sendIdx["="]=1;
  48745. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48746. }));
  48747. $ctx1.sendIdx["anySatisfy:"]=1;
  48748. self._assert_($2);
  48749. self._deny_($recv(self._collection())._anySatisfy_((function(each){
  48750. return $core.withContext(function($ctx2) {
  48751. return $recv(each).__eq($recv($globals.Object)._new());
  48752. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  48753. })));
  48754. return self;
  48755. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  48756. },
  48757. args: [],
  48758. 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 ])",
  48759. referencedClasses: ["Object"],
  48760. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  48761. }),
  48762. $globals.CollectionTest);
  48763. $core.addMethod(
  48764. $core.method({
  48765. selector: "testAsArray",
  48766. protocol: 'tests',
  48767. fn: function (){
  48768. var self=this;
  48769. return $core.withContext(function($ctx1) {
  48770. var $1;
  48771. $1=self._collection();
  48772. $ctx1.sendIdx["collection"]=1;
  48773. self._assertSameContents_as_($1,$recv(self._collection())._asArray());
  48774. return self;
  48775. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  48776. },
  48777. args: [],
  48778. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  48779. referencedClasses: [],
  48780. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  48781. }),
  48782. $globals.CollectionTest);
  48783. $core.addMethod(
  48784. $core.method({
  48785. selector: "testAsOrderedCollection",
  48786. protocol: 'tests',
  48787. fn: function (){
  48788. var self=this;
  48789. return $core.withContext(function($ctx1) {
  48790. var $1;
  48791. $1=self._collection();
  48792. $ctx1.sendIdx["collection"]=1;
  48793. self._assertSameContents_as_($1,$recv(self._collection())._asOrderedCollection());
  48794. return self;
  48795. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  48796. },
  48797. args: [],
  48798. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  48799. referencedClasses: [],
  48800. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  48801. }),
  48802. $globals.CollectionTest);
  48803. $core.addMethod(
  48804. $core.method({
  48805. selector: "testAsSet",
  48806. protocol: 'tests',
  48807. fn: function (){
  48808. var self=this;
  48809. var c,set;
  48810. return $core.withContext(function($ctx1) {
  48811. c=self._collectionWithDuplicates();
  48812. set=$recv(c)._asSet();
  48813. self._assert_equals_($recv(set)._size(),(6));
  48814. $recv(c)._do_((function(each){
  48815. return $core.withContext(function($ctx2) {
  48816. return self._assert_($recv(set)._includes_(each));
  48817. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48818. }));
  48819. return self;
  48820. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  48821. },
  48822. args: [],
  48823. 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) ]",
  48824. referencedClasses: [],
  48825. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  48826. }),
  48827. $globals.CollectionTest);
  48828. $core.addMethod(
  48829. $core.method({
  48830. selector: "testCollect",
  48831. protocol: 'tests',
  48832. fn: function (){
  48833. var self=this;
  48834. return $core.withContext(function($ctx1) {
  48835. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  48836. $2=self._collection();
  48837. $ctx1.sendIdx["collection"]=1;
  48838. $1=$recv($2)._collect_((function(each){
  48839. return each;
  48840. }));
  48841. $ctx1.sendIdx["collect:"]=1;
  48842. $3=self._collection();
  48843. $ctx1.sendIdx["collection"]=2;
  48844. self._assert_equals_($1,$3);
  48845. $ctx1.sendIdx["assert:equals:"]=1;
  48846. $5=self._collectionWithNewValue();
  48847. $ctx1.sendIdx["collectionWithNewValue"]=1;
  48848. $4=$recv($5)._collect_((function(each){
  48849. return each;
  48850. }));
  48851. $ctx1.sendIdx["collect:"]=2;
  48852. self._assert_equals_($4,self._collectionWithNewValue());
  48853. $ctx1.sendIdx["assert:equals:"]=2;
  48854. $8=self._collectionClass();
  48855. $ctx1.sendIdx["collectionClass"]=1;
  48856. $7=$recv($8)._new();
  48857. $ctx1.sendIdx["new"]=1;
  48858. $6=$recv($7)._collect_((function(each){
  48859. return $core.withContext(function($ctx2) {
  48860. return $recv(each)._printString();
  48861. $ctx2.sendIdx["printString"]=1;
  48862. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  48863. }));
  48864. $ctx1.sendIdx["collect:"]=3;
  48865. self._assert_equals_($6,$recv(self._collectionClass())._new());
  48866. $ctx1.sendIdx["assert:equals:"]=3;
  48867. $11=self._collection();
  48868. $ctx1.sendIdx["collection"]=3;
  48869. $10=$recv($11)._collect_((function(){
  48870. return $core.withContext(function($ctx2) {
  48871. return self._sampleNewValue();
  48872. $ctx2.sendIdx["sampleNewValue"]=1;
  48873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  48874. }));
  48875. $ctx1.sendIdx["collect:"]=4;
  48876. $9=$recv($10)._detect_((function(){
  48877. return true;
  48878. }));
  48879. self._assert_equals_($9,self._sampleNewValue());
  48880. $ctx1.sendIdx["assert:equals:"]=4;
  48881. self._assert_equals_($recv(self._collection())._collect_((function(each){
  48882. return $core.withContext(function($ctx2) {
  48883. return $recv(each)._printString();
  48884. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  48885. })),self._collectionOfPrintStrings());
  48886. return self;
  48887. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  48888. },
  48889. args: [],
  48890. 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",
  48891. referencedClasses: [],
  48892. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  48893. }),
  48894. $globals.CollectionTest);
  48895. $core.addMethod(
  48896. $core.method({
  48897. selector: "testComma",
  48898. protocol: 'tests',
  48899. fn: function (){
  48900. var self=this;
  48901. return $core.withContext(function($ctx1) {
  48902. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  48903. $2=self._collection();
  48904. $ctx1.sendIdx["collection"]=1;
  48905. $4=self._collectionClass();
  48906. $ctx1.sendIdx["collectionClass"]=1;
  48907. $3=$recv($4)._new();
  48908. $ctx1.sendIdx["new"]=1;
  48909. $1=$recv($2).__comma($3);
  48910. $ctx1.sendIdx[","]=1;
  48911. $5=self._collection();
  48912. $ctx1.sendIdx["collection"]=2;
  48913. self._assert_equals_($1,$5);
  48914. $ctx1.sendIdx["assert:equals:"]=1;
  48915. $8=self._collectionClass();
  48916. $ctx1.sendIdx["collectionClass"]=2;
  48917. $7=$recv($8)._new();
  48918. $ctx1.sendIdx["new"]=2;
  48919. $9=self._collection();
  48920. $ctx1.sendIdx["collection"]=3;
  48921. $6=$recv($7).__comma($9);
  48922. $ctx1.sendIdx[","]=2;
  48923. $10=self._collection();
  48924. $ctx1.sendIdx["collection"]=4;
  48925. self._assert_equals_($6,$10);
  48926. $ctx1.sendIdx["assert:equals:"]=2;
  48927. $13=self._collectionClass();
  48928. $ctx1.sendIdx["collectionClass"]=3;
  48929. $12=$recv($13)._new();
  48930. $ctx1.sendIdx["new"]=3;
  48931. $15=self._collectionClass();
  48932. $ctx1.sendIdx["collectionClass"]=4;
  48933. $14=$recv($15)._new();
  48934. $ctx1.sendIdx["new"]=4;
  48935. $11=$recv($12).__comma($14);
  48936. $ctx1.sendIdx[","]=3;
  48937. self._assert_equals_($11,$recv(self._collectionClass())._new());
  48938. $ctx1.sendIdx["assert:equals:"]=3;
  48939. $17=self._collection();
  48940. $ctx1.sendIdx["collection"]=5;
  48941. $18=self._sampleNewValueAsCollection();
  48942. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  48943. $16=$recv($17).__comma($18);
  48944. $ctx1.sendIdx[","]=4;
  48945. $19=self._collectionWithNewValue();
  48946. $ctx1.sendIdx["collectionWithNewValue"]=1;
  48947. self._assert_equals_($16,$19);
  48948. self._assertSameContents_as_($recv(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  48949. return self;
  48950. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  48951. },
  48952. args: [],
  48953. 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",
  48954. referencedClasses: [],
  48955. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  48956. }),
  48957. $globals.CollectionTest);
  48958. $core.addMethod(
  48959. $core.method({
  48960. selector: "testCopy",
  48961. protocol: 'tests',
  48962. fn: function (){
  48963. var self=this;
  48964. return $core.withContext(function($ctx1) {
  48965. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  48966. $3=self._collectionClass();
  48967. $ctx1.sendIdx["collectionClass"]=1;
  48968. $2=$recv($3)._new();
  48969. $ctx1.sendIdx["new"]=1;
  48970. $1=$recv($2)._copy();
  48971. $ctx1.sendIdx["copy"]=1;
  48972. $5=self._collectionClass();
  48973. $ctx1.sendIdx["collectionClass"]=2;
  48974. $4=$recv($5)._new();
  48975. $ctx1.sendIdx["new"]=2;
  48976. self._assert_equals_($1,$4);
  48977. $ctx1.sendIdx["assert:equals:"]=1;
  48978. $7=self._collection();
  48979. $ctx1.sendIdx["collection"]=1;
  48980. $6=$recv($7)._copy();
  48981. $ctx1.sendIdx["copy"]=2;
  48982. $8=self._collection();
  48983. $ctx1.sendIdx["collection"]=2;
  48984. self._assert_equals_($6,$8);
  48985. $ctx1.sendIdx["assert:equals:"]=2;
  48986. $10=self._collectionWithNewValue();
  48987. $ctx1.sendIdx["collectionWithNewValue"]=1;
  48988. $9=$recv($10)._copy();
  48989. $ctx1.sendIdx["copy"]=3;
  48990. $11=self._collectionWithNewValue();
  48991. $ctx1.sendIdx["collectionWithNewValue"]=2;
  48992. self._assert_equals_($9,$11);
  48993. $15=self._collectionClass();
  48994. $ctx1.sendIdx["collectionClass"]=3;
  48995. $14=$recv($15)._new();
  48996. $ctx1.sendIdx["new"]=3;
  48997. $13=$recv($14)._copy();
  48998. $ctx1.sendIdx["copy"]=4;
  48999. $16=self._collection();
  49000. $ctx1.sendIdx["collection"]=3;
  49001. $12=$recv($13).__eq($16);
  49002. $ctx1.sendIdx["="]=1;
  49003. self._deny_($12);
  49004. $ctx1.sendIdx["deny:"]=1;
  49005. $19=self._collection();
  49006. $ctx1.sendIdx["collection"]=4;
  49007. $18=$recv($19)._copy();
  49008. $ctx1.sendIdx["copy"]=5;
  49009. $17=$recv($18).__eq($recv(self._collectionClass())._new());
  49010. $ctx1.sendIdx["="]=2;
  49011. self._deny_($17);
  49012. $ctx1.sendIdx["deny:"]=2;
  49013. self._deny_($recv($recv(self._collection())._copy()).__eq(self._collectionWithNewValue()));
  49014. return self;
  49015. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  49016. },
  49017. args: [],
  49018. 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",
  49019. referencedClasses: [],
  49020. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  49021. }),
  49022. $globals.CollectionTest);
  49023. $core.addMethod(
  49024. $core.method({
  49025. selector: "testCopySeparates",
  49026. protocol: 'tests',
  49027. fn: function (){
  49028. var self=this;
  49029. var original,copy;
  49030. return $core.withContext(function($ctx1) {
  49031. original=self._collection();
  49032. $ctx1.sendIdx["collection"]=1;
  49033. copy=$recv(original)._copy();
  49034. $recv(copy)._addAll_(self._sampleNewValueAsCollection());
  49035. self._assert_($recv(original).__eq(self._collection()));
  49036. return self;
  49037. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  49038. },
  49039. args: [],
  49040. 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",
  49041. referencedClasses: [],
  49042. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  49043. }),
  49044. $globals.CollectionTest);
  49045. $core.addMethod(
  49046. $core.method({
  49047. selector: "testDetect",
  49048. protocol: 'tests',
  49049. fn: function (){
  49050. var self=this;
  49051. return $core.withContext(function($ctx1) {
  49052. var $1,$2,$3,$4,$6,$5,$7;
  49053. self._shouldnt_raise_((function(){
  49054. return $core.withContext(function($ctx2) {
  49055. $1=self._collection();
  49056. $ctx2.sendIdx["collection"]=1;
  49057. return $recv($1)._detect_((function(){
  49058. return true;
  49059. }));
  49060. $ctx2.sendIdx["detect:"]=1;
  49061. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49062. }),$globals.Error);
  49063. self._should_raise_((function(){
  49064. return $core.withContext(function($ctx2) {
  49065. $2=self._collection();
  49066. $ctx2.sendIdx["collection"]=2;
  49067. return $recv($2)._detect_((function(){
  49068. return false;
  49069. }));
  49070. $ctx2.sendIdx["detect:"]=2;
  49071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49072. }),$globals.Error);
  49073. $ctx1.sendIdx["should:raise:"]=1;
  49074. $3=$recv(self._sampleNewValueAsCollection())._detect_((function(){
  49075. return true;
  49076. }));
  49077. $ctx1.sendIdx["detect:"]=3;
  49078. $4=self._sampleNewValue();
  49079. $ctx1.sendIdx["sampleNewValue"]=1;
  49080. self._assert_equals_($3,$4);
  49081. $ctx1.sendIdx["assert:equals:"]=1;
  49082. $5=$recv(self._collectionWithNewValue())._detect_((function(each){
  49083. return $core.withContext(function($ctx2) {
  49084. $6=self._sampleNewValue();
  49085. $ctx2.sendIdx["sampleNewValue"]=2;
  49086. return $recv(each).__eq($6);
  49087. $ctx2.sendIdx["="]=1;
  49088. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49089. }));
  49090. $ctx1.sendIdx["detect:"]=4;
  49091. $7=self._sampleNewValue();
  49092. $ctx1.sendIdx["sampleNewValue"]=3;
  49093. self._assert_equals_($5,$7);
  49094. self._should_raise_((function(){
  49095. return $core.withContext(function($ctx2) {
  49096. return $recv(self._collection())._detect_((function(each){
  49097. return $core.withContext(function($ctx3) {
  49098. return $recv(each).__eq(self._sampleNewValue());
  49099. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  49100. }));
  49101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  49102. }),$globals.Error);
  49103. return self;
  49104. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  49105. },
  49106. args: [],
  49107. 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",
  49108. referencedClasses: ["Error"],
  49109. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  49110. }),
  49111. $globals.CollectionTest);
  49112. $core.addMethod(
  49113. $core.method({
  49114. selector: "testDetectIfNone",
  49115. protocol: 'tests',
  49116. fn: function (){
  49117. var self=this;
  49118. var sentinel;
  49119. return $core.withContext(function($ctx1) {
  49120. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  49121. sentinel=$recv($globals.Object)._new();
  49122. $3=self._collection();
  49123. $ctx1.sendIdx["collection"]=1;
  49124. $2=$recv($3)._detect_ifNone_((function(){
  49125. return true;
  49126. }),(function(){
  49127. return sentinel;
  49128. }));
  49129. $ctx1.sendIdx["detect:ifNone:"]=1;
  49130. $1=$recv($2).__tild_eq(sentinel);
  49131. self._assert_($1);
  49132. $5=self._collection();
  49133. $ctx1.sendIdx["collection"]=2;
  49134. $4=$recv($5)._detect_ifNone_((function(){
  49135. return false;
  49136. }),(function(){
  49137. return sentinel;
  49138. }));
  49139. $ctx1.sendIdx["detect:ifNone:"]=2;
  49140. self._assert_equals_($4,sentinel);
  49141. $ctx1.sendIdx["assert:equals:"]=1;
  49142. $6=$recv(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  49143. return true;
  49144. }),(function(){
  49145. return sentinel;
  49146. }));
  49147. $ctx1.sendIdx["detect:ifNone:"]=3;
  49148. $7=self._sampleNewValue();
  49149. $ctx1.sendIdx["sampleNewValue"]=1;
  49150. self._assert_equals_($6,$7);
  49151. $ctx1.sendIdx["assert:equals:"]=2;
  49152. $8=$recv(self._collectionWithNewValue())._detect_ifNone_((function(each){
  49153. return $core.withContext(function($ctx2) {
  49154. $9=self._sampleNewValue();
  49155. $ctx2.sendIdx["sampleNewValue"]=2;
  49156. return $recv(each).__eq($9);
  49157. $ctx2.sendIdx["="]=1;
  49158. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  49159. }),(function(){
  49160. return sentinel;
  49161. }));
  49162. $ctx1.sendIdx["detect:ifNone:"]=4;
  49163. $10=self._sampleNewValue();
  49164. $ctx1.sendIdx["sampleNewValue"]=3;
  49165. self._assert_equals_($8,$10);
  49166. $ctx1.sendIdx["assert:equals:"]=3;
  49167. self._assert_equals_($recv(self._collection())._detect_ifNone_((function(each){
  49168. return $core.withContext(function($ctx2) {
  49169. return $recv(each).__eq(self._sampleNewValue());
  49170. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  49171. }),(function(){
  49172. return sentinel;
  49173. })),sentinel);
  49174. return self;
  49175. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  49176. },
  49177. args: [],
  49178. 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",
  49179. referencedClasses: ["Object"],
  49180. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  49181. }),
  49182. $globals.CollectionTest);
  49183. $core.addMethod(
  49184. $core.method({
  49185. selector: "testDo",
  49186. protocol: 'tests',
  49187. fn: function (){
  49188. var self=this;
  49189. var newCollection;
  49190. return $core.withContext(function($ctx1) {
  49191. var $1,$2;
  49192. newCollection=$recv($globals.OrderedCollection)._new();
  49193. $ctx1.sendIdx["new"]=1;
  49194. $1=self._collection();
  49195. $ctx1.sendIdx["collection"]=1;
  49196. $recv($1)._do_((function(each){
  49197. return $core.withContext(function($ctx2) {
  49198. return $recv(newCollection)._add_(each);
  49199. $ctx2.sendIdx["add:"]=1;
  49200. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49201. }));
  49202. $ctx1.sendIdx["do:"]=1;
  49203. self._assertSameContents_as_(self._collection(),newCollection);
  49204. $ctx1.sendIdx["assertSameContents:as:"]=1;
  49205. newCollection=$recv($globals.OrderedCollection)._new();
  49206. $2=self._collectionWithDuplicates();
  49207. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  49208. $recv($2)._do_((function(each){
  49209. return $core.withContext(function($ctx2) {
  49210. return $recv(newCollection)._add_(each);
  49211. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49212. }));
  49213. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  49214. return self;
  49215. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  49216. },
  49217. args: [],
  49218. 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",
  49219. referencedClasses: ["OrderedCollection"],
  49220. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  49221. }),
  49222. $globals.CollectionTest);
  49223. $core.addMethod(
  49224. $core.method({
  49225. selector: "testEquality",
  49226. protocol: 'tests',
  49227. fn: function (){
  49228. var self=this;
  49229. return $core.withContext(function($ctx1) {
  49230. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  49231. $2=self._collectionClass();
  49232. $ctx1.sendIdx["collectionClass"]=1;
  49233. $1=$recv($2)._new();
  49234. $ctx1.sendIdx["new"]=1;
  49235. $4=self._collectionClass();
  49236. $ctx1.sendIdx["collectionClass"]=2;
  49237. $3=$recv($4)._new();
  49238. $ctx1.sendIdx["new"]=2;
  49239. self._assert_equals_($1,$3);
  49240. $ctx1.sendIdx["assert:equals:"]=1;
  49241. $5=self._collection();
  49242. $ctx1.sendIdx["collection"]=1;
  49243. $6=self._collection();
  49244. $ctx1.sendIdx["collection"]=2;
  49245. self._assert_equals_($5,$6);
  49246. $ctx1.sendIdx["assert:equals:"]=2;
  49247. $7=self._collectionWithNewValue();
  49248. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49249. $8=self._collectionWithNewValue();
  49250. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49251. self._assert_equals_($7,$8);
  49252. $11=self._collectionClass();
  49253. $ctx1.sendIdx["collectionClass"]=3;
  49254. $10=$recv($11)._new();
  49255. $ctx1.sendIdx["new"]=3;
  49256. $12=self._collection();
  49257. $ctx1.sendIdx["collection"]=3;
  49258. $9=$recv($10).__eq($12);
  49259. $ctx1.sendIdx["="]=1;
  49260. self._deny_($9);
  49261. $ctx1.sendIdx["deny:"]=1;
  49262. $14=self._collection();
  49263. $ctx1.sendIdx["collection"]=4;
  49264. $13=$recv($14).__eq($recv(self._collectionClass())._new());
  49265. $ctx1.sendIdx["="]=2;
  49266. self._deny_($13);
  49267. $ctx1.sendIdx["deny:"]=2;
  49268. self._deny_($recv(self._collection()).__eq(self._collectionWithNewValue()));
  49269. return self;
  49270. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  49271. },
  49272. args: [],
  49273. 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",
  49274. referencedClasses: [],
  49275. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  49276. }),
  49277. $globals.CollectionTest);
  49278. $core.addMethod(
  49279. $core.method({
  49280. selector: "testIfEmptyFamily",
  49281. protocol: 'tests',
  49282. fn: function (){
  49283. var self=this;
  49284. return $core.withContext(function($ctx1) {
  49285. 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;
  49286. $3=self._collectionClass();
  49287. $ctx1.sendIdx["collectionClass"]=1;
  49288. $2=$recv($3)._new();
  49289. $ctx1.sendIdx["new"]=1;
  49290. $1=$recv($2)._ifEmpty_((function(){
  49291. return (42);
  49292. }));
  49293. $ctx1.sendIdx["ifEmpty:"]=1;
  49294. self._assert_equals_($1,(42));
  49295. $ctx1.sendIdx["assert:equals:"]=1;
  49296. $5=self._collection();
  49297. $ctx1.sendIdx["collection"]=1;
  49298. $4=$recv($5)._ifEmpty_((function(){
  49299. return (42);
  49300. }));
  49301. $6=self._collection();
  49302. $ctx1.sendIdx["collection"]=2;
  49303. self._assert_equals_($4,$6);
  49304. $ctx1.sendIdx["assert:equals:"]=2;
  49305. $9=self._collectionClass();
  49306. $ctx1.sendIdx["collectionClass"]=2;
  49307. $8=$recv($9)._new();
  49308. $ctx1.sendIdx["new"]=2;
  49309. $7=$recv($8)._ifNotEmpty_((function(){
  49310. return (42);
  49311. }));
  49312. $ctx1.sendIdx["ifNotEmpty:"]=1;
  49313. $11=self._collectionClass();
  49314. $ctx1.sendIdx["collectionClass"]=3;
  49315. $10=$recv($11)._new();
  49316. $ctx1.sendIdx["new"]=3;
  49317. self._assert_equals_($7,$10);
  49318. $ctx1.sendIdx["assert:equals:"]=3;
  49319. $13=self._collection();
  49320. $ctx1.sendIdx["collection"]=3;
  49321. $12=$recv($13)._ifNotEmpty_((function(){
  49322. return (42);
  49323. }));
  49324. $ctx1.sendIdx["ifNotEmpty:"]=2;
  49325. self._assert_equals_($12,(42));
  49326. $ctx1.sendIdx["assert:equals:"]=4;
  49327. $15=self._collection();
  49328. $ctx1.sendIdx["collection"]=4;
  49329. $14=$recv($15)._ifNotEmpty_((function(col){
  49330. return col;
  49331. }));
  49332. $16=self._collection();
  49333. $ctx1.sendIdx["collection"]=5;
  49334. self._assert_equals_($14,$16);
  49335. $ctx1.sendIdx["assert:equals:"]=5;
  49336. $19=self._collectionClass();
  49337. $ctx1.sendIdx["collectionClass"]=4;
  49338. $18=$recv($19)._new();
  49339. $ctx1.sendIdx["new"]=4;
  49340. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  49341. return (42);
  49342. }),(function(){
  49343. return (999);
  49344. }));
  49345. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  49346. self._assert_equals_($17,(42));
  49347. $ctx1.sendIdx["assert:equals:"]=6;
  49348. $21=self._collection();
  49349. $ctx1.sendIdx["collection"]=6;
  49350. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  49351. return (42);
  49352. }),(function(){
  49353. return (999);
  49354. }));
  49355. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  49356. self._assert_equals_($20,(999));
  49357. $ctx1.sendIdx["assert:equals:"]=7;
  49358. $23=self._collection();
  49359. $ctx1.sendIdx["collection"]=7;
  49360. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  49361. return (42);
  49362. }),(function(col){
  49363. return col;
  49364. }));
  49365. $24=self._collection();
  49366. $ctx1.sendIdx["collection"]=8;
  49367. self._assert_equals_($22,$24);
  49368. $ctx1.sendIdx["assert:equals:"]=8;
  49369. $25=$recv($recv(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  49370. return (42);
  49371. }),(function(){
  49372. return (999);
  49373. }));
  49374. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  49375. self._assert_equals_($25,(999));
  49376. $ctx1.sendIdx["assert:equals:"]=9;
  49377. $27=self._collection();
  49378. $ctx1.sendIdx["collection"]=9;
  49379. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  49380. return (42);
  49381. }),(function(){
  49382. return (999);
  49383. }));
  49384. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  49385. self._assert_equals_($26,(42));
  49386. $ctx1.sendIdx["assert:equals:"]=10;
  49387. $29=self._collection();
  49388. $ctx1.sendIdx["collection"]=10;
  49389. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  49390. return col;
  49391. }),(function(){
  49392. return (999);
  49393. }));
  49394. self._assert_equals_($28,self._collection());
  49395. return self;
  49396. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  49397. },
  49398. args: [],
  49399. 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.",
  49400. referencedClasses: [],
  49401. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  49402. }),
  49403. $globals.CollectionTest);
  49404. $core.addMethod(
  49405. $core.method({
  49406. selector: "testIsEmpty",
  49407. protocol: 'tests',
  49408. fn: function (){
  49409. var self=this;
  49410. return $core.withContext(function($ctx1) {
  49411. var $1;
  49412. $1=$recv($recv(self._collectionClass())._new())._isEmpty();
  49413. $ctx1.sendIdx["isEmpty"]=1;
  49414. self._assert_($1);
  49415. self._deny_($recv(self._collection())._isEmpty());
  49416. return self;
  49417. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  49418. },
  49419. args: [],
  49420. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  49421. referencedClasses: [],
  49422. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  49423. }),
  49424. $globals.CollectionTest);
  49425. $core.addMethod(
  49426. $core.method({
  49427. selector: "testNoneSatisfy",
  49428. protocol: 'tests',
  49429. fn: function (){
  49430. var self=this;
  49431. var anyOne;
  49432. return $core.withContext(function($ctx1) {
  49433. var $1,$3,$2;
  49434. $1=self._collection();
  49435. $ctx1.sendIdx["collection"]=1;
  49436. anyOne=$recv($1)._anyOne();
  49437. $3=self._collection();
  49438. $ctx1.sendIdx["collection"]=2;
  49439. $2=$recv($3)._noneSatisfy_((function(each){
  49440. return $core.withContext(function($ctx2) {
  49441. return $recv(each).__eq(anyOne);
  49442. $ctx2.sendIdx["="]=1;
  49443. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49444. }));
  49445. $ctx1.sendIdx["noneSatisfy:"]=1;
  49446. self._deny_($2);
  49447. self._assert_($recv(self._collection())._noneSatisfy_((function(each){
  49448. return $core.withContext(function($ctx2) {
  49449. return $recv(each).__eq($recv($globals.Object)._new());
  49450. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49451. })));
  49452. return self;
  49453. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  49454. },
  49455. args: [],
  49456. 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 ])",
  49457. referencedClasses: ["Object"],
  49458. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  49459. }),
  49460. $globals.CollectionTest);
  49461. $core.addMethod(
  49462. $core.method({
  49463. selector: "testRemoveAll",
  49464. protocol: 'tests',
  49465. fn: function (){
  49466. var self=this;
  49467. return $core.withContext(function($ctx1) {
  49468. var $2,$1;
  49469. $2=self._collection();
  49470. $recv($2)._removeAll();
  49471. $1=$recv($2)._yourself();
  49472. self._assert_equals_($1,$recv(self._collectionClass())._new());
  49473. return self;
  49474. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  49475. },
  49476. args: [],
  49477. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  49478. referencedClasses: [],
  49479. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  49480. }),
  49481. $globals.CollectionTest);
  49482. $core.addMethod(
  49483. $core.method({
  49484. selector: "testSelect",
  49485. protocol: 'tests',
  49486. fn: function (){
  49487. var self=this;
  49488. return $core.withContext(function($ctx1) {
  49489. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  49490. $2=self._collection();
  49491. $ctx1.sendIdx["collection"]=1;
  49492. $1=$recv($2)._select_((function(){
  49493. return false;
  49494. }));
  49495. $ctx1.sendIdx["select:"]=1;
  49496. $4=self._collectionClass();
  49497. $ctx1.sendIdx["collectionClass"]=1;
  49498. $3=$recv($4)._new();
  49499. $ctx1.sendIdx["new"]=1;
  49500. self._assert_equals_($1,$3);
  49501. $ctx1.sendIdx["assert:equals:"]=1;
  49502. $6=self._collection();
  49503. $ctx1.sendIdx["collection"]=2;
  49504. $5=$recv($6)._select_((function(){
  49505. return true;
  49506. }));
  49507. $ctx1.sendIdx["select:"]=2;
  49508. $7=self._collection();
  49509. $ctx1.sendIdx["collection"]=3;
  49510. self._assert_equals_($5,$7);
  49511. $ctx1.sendIdx["assert:equals:"]=2;
  49512. $9=self._collectionWithNewValue();
  49513. $ctx1.sendIdx["collectionWithNewValue"]=1;
  49514. $8=$recv($9)._select_((function(each){
  49515. return $core.withContext(function($ctx2) {
  49516. $10=self._sampleNewValue();
  49517. $ctx2.sendIdx["sampleNewValue"]=1;
  49518. return $recv(each).__eq($10);
  49519. $ctx2.sendIdx["="]=1;
  49520. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  49521. }));
  49522. $ctx1.sendIdx["select:"]=3;
  49523. self._assert_equals_($8,self._sampleNewValueAsCollection());
  49524. $ctx1.sendIdx["assert:equals:"]=3;
  49525. $12=self._collectionWithNewValue();
  49526. $ctx1.sendIdx["collectionWithNewValue"]=2;
  49527. $11=$recv($12)._select_((function(each){
  49528. return $core.withContext(function($ctx2) {
  49529. $13=self._sampleNewValue();
  49530. $ctx2.sendIdx["sampleNewValue"]=2;
  49531. return $recv(each).__tild_eq($13);
  49532. $ctx2.sendIdx["~="]=1;
  49533. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  49534. }));
  49535. $ctx1.sendIdx["select:"]=4;
  49536. $14=self._collection();
  49537. $ctx1.sendIdx["collection"]=4;
  49538. self._assert_equals_($11,$14);
  49539. $ctx1.sendIdx["assert:equals:"]=4;
  49540. $16=self._collection();
  49541. $ctx1.sendIdx["collection"]=5;
  49542. $15=$recv($16)._select_((function(each){
  49543. return $core.withContext(function($ctx2) {
  49544. $17=self._sampleNewValue();
  49545. $ctx2.sendIdx["sampleNewValue"]=3;
  49546. return $recv(each).__eq($17);
  49547. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  49548. }));
  49549. $ctx1.sendIdx["select:"]=5;
  49550. self._assert_equals_($15,$recv(self._collectionClass())._new());
  49551. $ctx1.sendIdx["assert:equals:"]=5;
  49552. self._assert_equals_($recv(self._collectionWithNewValue())._select_((function(each){
  49553. return $core.withContext(function($ctx2) {
  49554. return $recv(each).__tild_eq(self._sampleNewValue());
  49555. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  49556. })),self._collection());
  49557. return self;
  49558. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  49559. },
  49560. args: [],
  49561. 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",
  49562. referencedClasses: [],
  49563. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  49564. }),
  49565. $globals.CollectionTest);
  49566. $core.addMethod(
  49567. $core.method({
  49568. selector: "testSize",
  49569. protocol: 'tests',
  49570. fn: function (){
  49571. var self=this;
  49572. return $core.withContext(function($ctx1) {
  49573. var $1,$2;
  49574. $1=$recv($recv(self._collectionClass())._new())._size();
  49575. $ctx1.sendIdx["size"]=1;
  49576. self._assert_equals_($1,(0));
  49577. $ctx1.sendIdx["assert:equals:"]=1;
  49578. $2=$recv(self._sampleNewValueAsCollection())._size();
  49579. $ctx1.sendIdx["size"]=2;
  49580. self._assert_equals_($2,(1));
  49581. $ctx1.sendIdx["assert:equals:"]=2;
  49582. self._assert_equals_($recv(self._collection())._size(),self._collectionSize());
  49583. return self;
  49584. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  49585. },
  49586. args: [],
  49587. 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",
  49588. referencedClasses: [],
  49589. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  49590. }),
  49591. $globals.CollectionTest);
  49592. $core.addMethod(
  49593. $core.method({
  49594. selector: "collectionClass",
  49595. protocol: 'fixture',
  49596. fn: function (){
  49597. var self=this;
  49598. return nil;
  49599. },
  49600. args: [],
  49601. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  49602. referencedClasses: [],
  49603. messageSends: []
  49604. }),
  49605. $globals.CollectionTest.klass);
  49606. $core.addMethod(
  49607. $core.method({
  49608. selector: "isAbstract",
  49609. protocol: 'testing',
  49610. fn: function (){
  49611. var self=this;
  49612. return $core.withContext(function($ctx1) {
  49613. return $recv(self._collectionClass())._isNil();
  49614. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.klass)});
  49615. },
  49616. args: [],
  49617. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  49618. referencedClasses: [],
  49619. messageSends: ["isNil", "collectionClass"]
  49620. }),
  49621. $globals.CollectionTest.klass);
  49622. $core.addClass('IndexableCollectionTest', $globals.CollectionTest, [], 'Kernel-Tests');
  49623. $core.addMethod(
  49624. $core.method({
  49625. selector: "collectionWithNewValue",
  49626. protocol: 'fixture',
  49627. fn: function (){
  49628. var self=this;
  49629. return $core.withContext(function($ctx1) {
  49630. self._subclassResponsibility();
  49631. return self;
  49632. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  49633. },
  49634. args: [],
  49635. 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",
  49636. referencedClasses: [],
  49637. messageSends: ["subclassResponsibility"]
  49638. }),
  49639. $globals.IndexableCollectionTest);
  49640. $core.addMethod(
  49641. $core.method({
  49642. selector: "sampleNewIndex",
  49643. protocol: 'fixture',
  49644. fn: function (){
  49645. var self=this;
  49646. return $core.withContext(function($ctx1) {
  49647. self._subclassResponsibility();
  49648. return self;
  49649. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  49650. },
  49651. args: [],
  49652. 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",
  49653. referencedClasses: [],
  49654. messageSends: ["subclassResponsibility"]
  49655. }),
  49656. $globals.IndexableCollectionTest);
  49657. $core.addMethod(
  49658. $core.method({
  49659. selector: "sampleNonIndexesDo:",
  49660. protocol: 'fixture',
  49661. fn: function (aBlock){
  49662. var self=this;
  49663. return $core.withContext(function($ctx1) {
  49664. self._subclassResponsibility();
  49665. return self;
  49666. }, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  49667. },
  49668. args: ["aBlock"],
  49669. 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",
  49670. referencedClasses: [],
  49671. messageSends: ["subclassResponsibility"]
  49672. }),
  49673. $globals.IndexableCollectionTest);
  49674. $core.addMethod(
  49675. $core.method({
  49676. selector: "samplesDo:",
  49677. protocol: 'fixture',
  49678. fn: function (aBlock){
  49679. var self=this;
  49680. return $core.withContext(function($ctx1) {
  49681. self._subclassResponsibility();
  49682. return self;
  49683. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  49684. },
  49685. args: ["aBlock"],
  49686. 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",
  49687. referencedClasses: [],
  49688. messageSends: ["subclassResponsibility"]
  49689. }),
  49690. $globals.IndexableCollectionTest);
  49691. $core.addMethod(
  49692. $core.method({
  49693. selector: "testAt",
  49694. protocol: 'tests',
  49695. fn: function (){
  49696. var self=this;
  49697. return $core.withContext(function($ctx1) {
  49698. var $1;
  49699. self._nonIndexesDo_((function(each){
  49700. return $core.withContext(function($ctx2) {
  49701. return self._should_raise_((function(){
  49702. return $core.withContext(function($ctx3) {
  49703. $1=self._collection();
  49704. $ctx3.sendIdx["collection"]=1;
  49705. return $recv($1)._at_(each);
  49706. $ctx3.sendIdx["at:"]=1;
  49707. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49708. }),$globals.Error);
  49709. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49710. }));
  49711. self._samplesDo_((function(index,value){
  49712. return $core.withContext(function($ctx2) {
  49713. return self._assert_equals_($recv(self._collection())._at_(index),value);
  49714. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  49715. }));
  49716. return self;
  49717. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  49718. },
  49719. args: [],
  49720. 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 ]",
  49721. referencedClasses: ["Error"],
  49722. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  49723. }),
  49724. $globals.IndexableCollectionTest);
  49725. $core.addMethod(
  49726. $core.method({
  49727. selector: "testAtIfAbsent",
  49728. protocol: 'tests',
  49729. fn: function (){
  49730. var self=this;
  49731. return $core.withContext(function($ctx1) {
  49732. var $2,$1,$3;
  49733. self._nonIndexesDo_((function(each){
  49734. return $core.withContext(function($ctx2) {
  49735. $2=self._collection();
  49736. $ctx2.sendIdx["collection"]=1;
  49737. $1=$recv($2)._at_ifAbsent_(each,(function(){
  49738. return $core.withContext(function($ctx3) {
  49739. return self._sampleNewValue();
  49740. $ctx3.sendIdx["sampleNewValue"]=1;
  49741. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49742. }));
  49743. $ctx2.sendIdx["at:ifAbsent:"]=1;
  49744. $3=self._sampleNewValue();
  49745. $ctx2.sendIdx["sampleNewValue"]=2;
  49746. return self._assert_equals_($1,$3);
  49747. $ctx2.sendIdx["assert:equals:"]=1;
  49748. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49749. }));
  49750. self._samplesDo_((function(index,value){
  49751. return $core.withContext(function($ctx2) {
  49752. return self._assert_equals_($recv(self._collection())._at_ifAbsent_(index,(function(){
  49753. return $core.withContext(function($ctx3) {
  49754. return self._sampleNewValue();
  49755. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  49756. })),value);
  49757. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  49758. }));
  49759. return self;
  49760. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  49761. },
  49762. args: [],
  49763. 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 ].",
  49764. referencedClasses: [],
  49765. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  49766. }),
  49767. $globals.IndexableCollectionTest);
  49768. $core.addMethod(
  49769. $core.method({
  49770. selector: "testAtIfAbsentPut",
  49771. protocol: 'tests',
  49772. fn: function (){
  49773. var self=this;
  49774. var newCollection;
  49775. return $core.withContext(function($ctx1) {
  49776. var $1;
  49777. newCollection=self._collection();
  49778. $ctx1.sendIdx["collection"]=1;
  49779. self._samplesDo_((function(index,value){
  49780. return $core.withContext(function($ctx2) {
  49781. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  49782. return $core.withContext(function($ctx3) {
  49783. return self._sampleNewValue();
  49784. $ctx3.sendIdx["sampleNewValue"]=1;
  49785. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49786. }));
  49787. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  49788. return self._assert_equals_($1,value);
  49789. $ctx2.sendIdx["assert:equals:"]=1;
  49790. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  49791. }));
  49792. self._assert_equals_(newCollection,self._collection());
  49793. $ctx1.sendIdx["assert:equals:"]=2;
  49794. self._assert_equals_($recv(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  49795. return $core.withContext(function($ctx2) {
  49796. return self._sampleNewValue();
  49797. $ctx2.sendIdx["sampleNewValue"]=2;
  49798. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49799. })),self._sampleNewValue());
  49800. $ctx1.sendIdx["assert:equals:"]=3;
  49801. self._assert_equals_(newCollection,self._collectionWithNewValue());
  49802. return self;
  49803. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  49804. },
  49805. args: [],
  49806. 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",
  49807. referencedClasses: [],
  49808. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  49809. }),
  49810. $globals.IndexableCollectionTest);
  49811. $core.addMethod(
  49812. $core.method({
  49813. selector: "testAtIfPresent",
  49814. protocol: 'tests',
  49815. fn: function (){
  49816. var self=this;
  49817. var visited,sentinel;
  49818. return $core.withContext(function($ctx1) {
  49819. var $2,$1,$4,$3;
  49820. sentinel=$recv($globals.Object)._new();
  49821. self._nonIndexesDo_((function(each){
  49822. return $core.withContext(function($ctx2) {
  49823. visited=nil;
  49824. visited;
  49825. $2=self._collection();
  49826. $ctx2.sendIdx["collection"]=1;
  49827. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  49828. visited=value1;
  49829. visited;
  49830. return sentinel;
  49831. }));
  49832. $ctx2.sendIdx["at:ifPresent:"]=1;
  49833. self._assert_equals_($1,nil);
  49834. $ctx2.sendIdx["assert:equals:"]=1;
  49835. return self._assert_($recv(visited)._isNil());
  49836. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49837. }));
  49838. self._samplesDo_((function(index,value){
  49839. return $core.withContext(function($ctx2) {
  49840. visited=nil;
  49841. visited;
  49842. $4=self._collection();
  49843. $ctx2.sendIdx["collection"]=2;
  49844. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  49845. visited=value2;
  49846. visited;
  49847. return sentinel;
  49848. }));
  49849. self._assert_equals_($3,sentinel);
  49850. $ctx2.sendIdx["assert:equals:"]=2;
  49851. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  49852. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  49853. }));
  49854. return self;
  49855. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  49856. },
  49857. args: [],
  49858. 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) ]",
  49859. referencedClasses: ["Object"],
  49860. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  49861. }),
  49862. $globals.IndexableCollectionTest);
  49863. $core.addMethod(
  49864. $core.method({
  49865. selector: "testAtIfPresentIfAbsent",
  49866. protocol: 'tests',
  49867. fn: function (){
  49868. var self=this;
  49869. var visited,sentinel;
  49870. return $core.withContext(function($ctx1) {
  49871. var $2,$1,$3,$5,$4;
  49872. sentinel=$recv($globals.Object)._new();
  49873. self._nonIndexesDo_((function(each){
  49874. return $core.withContext(function($ctx2) {
  49875. visited=nil;
  49876. visited;
  49877. $2=self._collection();
  49878. $ctx2.sendIdx["collection"]=1;
  49879. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  49880. visited=value1;
  49881. visited;
  49882. return sentinel;
  49883. }),(function(){
  49884. return $core.withContext(function($ctx3) {
  49885. return self._sampleNewValue();
  49886. $ctx3.sendIdx["sampleNewValue"]=1;
  49887. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  49888. }));
  49889. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  49890. $3=self._sampleNewValue();
  49891. $ctx2.sendIdx["sampleNewValue"]=2;
  49892. self._assert_equals_($1,$3);
  49893. $ctx2.sendIdx["assert:equals:"]=1;
  49894. return self._assert_($recv(visited)._isNil());
  49895. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  49896. }));
  49897. self._samplesDo_((function(index,value){
  49898. return $core.withContext(function($ctx2) {
  49899. visited=nil;
  49900. visited;
  49901. $5=self._collection();
  49902. $ctx2.sendIdx["collection"]=2;
  49903. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  49904. visited=value2;
  49905. visited;
  49906. return sentinel;
  49907. }),(function(){
  49908. return $core.withContext(function($ctx3) {
  49909. return self._sampleNewValue();
  49910. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  49911. }));
  49912. self._assert_equals_($4,sentinel);
  49913. $ctx2.sendIdx["assert:equals:"]=2;
  49914. return self._assert_equals_(visited,$recv(self._collection())._at_(index));
  49915. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  49916. }));
  49917. return self;
  49918. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  49919. },
  49920. args: [],
  49921. 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) ]",
  49922. referencedClasses: ["Object"],
  49923. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  49924. }),
  49925. $globals.IndexableCollectionTest);
  49926. $core.addMethod(
  49927. $core.method({
  49928. selector: "testAtPut",
  49929. protocol: 'tests',
  49930. fn: function (){
  49931. var self=this;
  49932. var newCollection;
  49933. return $core.withContext(function($ctx1) {
  49934. newCollection=self._collection();
  49935. $ctx1.sendIdx["collection"]=1;
  49936. self._samplesDo_((function(index,value){
  49937. return $core.withContext(function($ctx2) {
  49938. return $recv(newCollection)._at_put_(index,value);
  49939. $ctx2.sendIdx["at:put:"]=1;
  49940. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  49941. }));
  49942. self._assert_equals_(newCollection,self._collection());
  49943. $ctx1.sendIdx["assert:equals:"]=1;
  49944. $recv(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  49945. self._assert_equals_(newCollection,self._collectionWithNewValue());
  49946. return self;
  49947. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  49948. },
  49949. args: [],
  49950. 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",
  49951. referencedClasses: [],
  49952. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  49953. }),
  49954. $globals.IndexableCollectionTest);
  49955. $core.addMethod(
  49956. $core.method({
  49957. selector: "testIndexOf",
  49958. protocol: 'tests',
  49959. fn: function (){
  49960. var self=this;
  49961. return $core.withContext(function($ctx1) {
  49962. var $1;
  49963. self._should_raise_((function(){
  49964. return $core.withContext(function($ctx2) {
  49965. $1=self._collection();
  49966. $ctx2.sendIdx["collection"]=1;
  49967. return $recv($1)._indexOf_(self._sampleNewValue());
  49968. $ctx2.sendIdx["indexOf:"]=1;
  49969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49970. }),$globals.Error);
  49971. self._samplesDo_((function(index,value){
  49972. return $core.withContext(function($ctx2) {
  49973. return self._assert_equals_($recv(self._collection())._indexOf_(value),index);
  49974. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  49975. }));
  49976. return self;
  49977. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  49978. },
  49979. args: [],
  49980. 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 ]",
  49981. referencedClasses: ["Error"],
  49982. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  49983. }),
  49984. $globals.IndexableCollectionTest);
  49985. $core.addMethod(
  49986. $core.method({
  49987. selector: "testIndexOfWithNull",
  49988. protocol: 'tests',
  49989. fn: function (){
  49990. var self=this;
  49991. var jsNull;
  49992. return $core.withContext(function($ctx1) {
  49993. var $2,$1;
  49994. jsNull=$recv($globals.JSON)._parse_("null");
  49995. self._samplesDo_((function(index,value){
  49996. return $core.withContext(function($ctx2) {
  49997. $2=self._collection();
  49998. $recv($2)._at_put_(index,jsNull);
  49999. $1=$recv($2)._indexOf_(jsNull);
  50000. return self._assert_equals_($1,index);
  50001. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  50002. }));
  50003. return self;
  50004. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  50005. },
  50006. args: [],
  50007. 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 ]",
  50008. referencedClasses: ["JSON"],
  50009. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  50010. }),
  50011. $globals.IndexableCollectionTest);
  50012. $core.addMethod(
  50013. $core.method({
  50014. selector: "testWithIndexDo",
  50015. protocol: 'tests',
  50016. fn: function (){
  50017. var self=this;
  50018. var collection;
  50019. return $core.withContext(function($ctx1) {
  50020. collection=self._collection();
  50021. $ctx1.sendIdx["collection"]=1;
  50022. $recv(self._collection())._withIndexDo_((function(each,index){
  50023. return $core.withContext(function($ctx2) {
  50024. return self._assert_equals_($recv(collection)._at_(index),each);
  50025. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  50026. }));
  50027. return self;
  50028. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  50029. },
  50030. args: [],
  50031. 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 ]",
  50032. referencedClasses: [],
  50033. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  50034. }),
  50035. $globals.IndexableCollectionTest);
  50036. $core.addClass('AssociativeCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  50037. $core.addMethod(
  50038. $core.method({
  50039. selector: "collectionKeys",
  50040. protocol: 'fixture',
  50041. fn: function (){
  50042. var self=this;
  50043. return $core.withContext(function($ctx1) {
  50044. self._subclassResponsibility();
  50045. return self;
  50046. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  50047. },
  50048. args: [],
  50049. source: "collectionKeys\x0a\x09self subclassResponsibility",
  50050. referencedClasses: [],
  50051. messageSends: ["subclassResponsibility"]
  50052. }),
  50053. $globals.AssociativeCollectionTest);
  50054. $core.addMethod(
  50055. $core.method({
  50056. selector: "collectionValues",
  50057. protocol: 'fixture',
  50058. fn: function (){
  50059. var self=this;
  50060. return $core.withContext(function($ctx1) {
  50061. self._subclassResponsibility();
  50062. return self;
  50063. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  50064. },
  50065. args: [],
  50066. source: "collectionValues\x0a\x09self subclassResponsibility",
  50067. referencedClasses: [],
  50068. messageSends: ["subclassResponsibility"]
  50069. }),
  50070. $globals.AssociativeCollectionTest);
  50071. $core.addMethod(
  50072. $core.method({
  50073. selector: "nonIndexesDo:",
  50074. protocol: 'fixture',
  50075. fn: function (aBlock){
  50076. var self=this;
  50077. return $core.withContext(function($ctx1) {
  50078. $recv(aBlock)._value_((5));
  50079. $ctx1.sendIdx["value:"]=1;
  50080. $recv(aBlock)._value_((function(){
  50081. }));
  50082. $ctx1.sendIdx["value:"]=2;
  50083. $recv(aBlock)._value_($recv($globals.Object)._new());
  50084. $ctx1.sendIdx["value:"]=3;
  50085. $recv(aBlock)._value_("z");
  50086. return self;
  50087. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  50088. },
  50089. args: ["aBlock"],
  50090. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  50091. referencedClasses: ["Object"],
  50092. messageSends: ["value:", "new"]
  50093. }),
  50094. $globals.AssociativeCollectionTest);
  50095. $core.addMethod(
  50096. $core.method({
  50097. selector: "sampleNewIndex",
  50098. protocol: 'fixture',
  50099. fn: function (){
  50100. var self=this;
  50101. return "new";
  50102. },
  50103. args: [],
  50104. source: "sampleNewIndex\x0a\x09^ 'new'",
  50105. referencedClasses: [],
  50106. messageSends: []
  50107. }),
  50108. $globals.AssociativeCollectionTest);
  50109. $core.addMethod(
  50110. $core.method({
  50111. selector: "samplesDo:",
  50112. protocol: 'fixture',
  50113. fn: function (aBlock){
  50114. var self=this;
  50115. return $core.withContext(function($ctx1) {
  50116. $recv(aBlock)._value_value_("a",(2));
  50117. return self;
  50118. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  50119. },
  50120. args: ["aBlock"],
  50121. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  50122. referencedClasses: [],
  50123. messageSends: ["value:value:"]
  50124. }),
  50125. $globals.AssociativeCollectionTest);
  50126. $core.addMethod(
  50127. $core.method({
  50128. selector: "testAddAll",
  50129. protocol: 'tests',
  50130. fn: function (){
  50131. var self=this;
  50132. return $core.withContext(function($ctx1) {
  50133. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  50134. (
  50135. $ctx1.supercall = true,
  50136. ($globals.AssociativeCollectionTest.superclass||$boot.dnu).fn.prototype._testAddAll.apply($recv(self), []));
  50137. $ctx1.supercall = false;
  50138. $2=self._collection();
  50139. $ctx1.sendIdx["collection"]=1;
  50140. $3=self._collection();
  50141. $ctx1.sendIdx["collection"]=2;
  50142. $recv($2)._addAll_($3);
  50143. $ctx1.sendIdx["addAll:"]=1;
  50144. $4=$recv($2)._yourself();
  50145. $ctx1.sendIdx["yourself"]=1;
  50146. $1=$4;
  50147. $5=self._collection();
  50148. $ctx1.sendIdx["collection"]=3;
  50149. self._assert_equals_($1,$5);
  50150. $ctx1.sendIdx["assert:equals:"]=1;
  50151. $7=self._collection();
  50152. $ctx1.sendIdx["collection"]=4;
  50153. $8=self._collectionWithNewValue();
  50154. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50155. $recv($7)._addAll_($8);
  50156. $ctx1.sendIdx["addAll:"]=2;
  50157. $9=$recv($7)._yourself();
  50158. $ctx1.sendIdx["yourself"]=2;
  50159. $6=$9;
  50160. $10=self._collectionWithNewValue();
  50161. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50162. self._assert_equals_($6,$10);
  50163. $ctx1.sendIdx["assert:equals:"]=2;
  50164. $12=self._collectionWithNewValue();
  50165. $ctx1.sendIdx["collectionWithNewValue"]=3;
  50166. $recv($12)._addAll_(self._collection());
  50167. $11=$recv($12)._yourself();
  50168. self._assert_equals_($11,self._collectionWithNewValue());
  50169. return self;
  50170. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  50171. },
  50172. args: [],
  50173. 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",
  50174. referencedClasses: [],
  50175. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  50176. }),
  50177. $globals.AssociativeCollectionTest);
  50178. $core.addMethod(
  50179. $core.method({
  50180. selector: "testAsDictionary",
  50181. protocol: 'tests',
  50182. fn: function (){
  50183. var self=this;
  50184. return $core.withContext(function($ctx1) {
  50185. self._assert_($recv($recv($recv(self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  50186. return self;
  50187. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  50188. },
  50189. args: [],
  50190. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  50191. referencedClasses: ["Dictionary"],
  50192. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  50193. }),
  50194. $globals.AssociativeCollectionTest);
  50195. $core.addMethod(
  50196. $core.method({
  50197. selector: "testAsHashedCollection",
  50198. protocol: 'tests',
  50199. fn: function (){
  50200. var self=this;
  50201. return $core.withContext(function($ctx1) {
  50202. self._assert_($recv($recv($recv(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  50203. return self;
  50204. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  50205. },
  50206. args: [],
  50207. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  50208. referencedClasses: ["HashedCollection"],
  50209. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  50210. }),
  50211. $globals.AssociativeCollectionTest);
  50212. $core.addMethod(
  50213. $core.method({
  50214. selector: "testComma",
  50215. protocol: 'tests',
  50216. fn: function (){
  50217. var self=this;
  50218. return $core.withContext(function($ctx1) {
  50219. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  50220. (
  50221. $ctx1.supercall = true,
  50222. ($globals.AssociativeCollectionTest.superclass||$boot.dnu).fn.prototype._testComma.apply($recv(self), []));
  50223. $ctx1.supercall = false;
  50224. $2=self._collection();
  50225. $ctx1.sendIdx["collection"]=1;
  50226. $3=self._collection();
  50227. $ctx1.sendIdx["collection"]=2;
  50228. $1=$recv($2).__comma($3);
  50229. $ctx1.sendIdx[","]=1;
  50230. $4=self._collection();
  50231. $ctx1.sendIdx["collection"]=3;
  50232. self._assert_equals_($1,$4);
  50233. $ctx1.sendIdx["assert:equals:"]=1;
  50234. $6=self._collection();
  50235. $ctx1.sendIdx["collection"]=4;
  50236. $7=self._collectionWithNewValue();
  50237. $ctx1.sendIdx["collectionWithNewValue"]=1;
  50238. $5=$recv($6).__comma($7);
  50239. $ctx1.sendIdx[","]=2;
  50240. $8=self._collectionWithNewValue();
  50241. $ctx1.sendIdx["collectionWithNewValue"]=2;
  50242. self._assert_equals_($5,$8);
  50243. $ctx1.sendIdx["assert:equals:"]=2;
  50244. $10=self._collectionWithNewValue();
  50245. $ctx1.sendIdx["collectionWithNewValue"]=3;
  50246. $9=$recv($10).__comma(self._collection());
  50247. self._assert_equals_($9,self._collectionWithNewValue());
  50248. return self;
  50249. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  50250. },
  50251. args: [],
  50252. 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",
  50253. referencedClasses: [],
  50254. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  50255. }),
  50256. $globals.AssociativeCollectionTest);
  50257. $core.addMethod(
  50258. $core.method({
  50259. selector: "testFrom",
  50260. protocol: 'tests',
  50261. fn: function (){
  50262. var self=this;
  50263. var associations;
  50264. return $core.withContext(function($ctx1) {
  50265. var $1;
  50266. $1="a".__minus_gt((1));
  50267. $ctx1.sendIdx["->"]=1;
  50268. associations=[$1,"b".__minus_gt((2))];
  50269. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  50270. return self;
  50271. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  50272. },
  50273. args: [],
  50274. 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 }.",
  50275. referencedClasses: [],
  50276. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  50277. }),
  50278. $globals.AssociativeCollectionTest);
  50279. $core.addMethod(
  50280. $core.method({
  50281. selector: "testKeys",
  50282. protocol: 'tests',
  50283. fn: function (){
  50284. var self=this;
  50285. return $core.withContext(function($ctx1) {
  50286. var $2,$1,$3,$4;
  50287. $2=$recv($recv(self._collectionClass())._new())._keys();
  50288. $ctx1.sendIdx["keys"]=1;
  50289. $1=$recv($2)._isEmpty();
  50290. self._assert_($1);
  50291. $3=$recv(self._collection())._keys();
  50292. $ctx1.sendIdx["keys"]=2;
  50293. $4=self._collectionKeys();
  50294. $ctx1.sendIdx["collectionKeys"]=1;
  50295. self._assertSameContents_as_($3,$4);
  50296. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50297. self._assertSameContents_as_($recv(self._collectionWithNewValue())._keys(),$recv(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  50298. return self;
  50299. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  50300. },
  50301. args: [],
  50302. 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 }",
  50303. referencedClasses: [],
  50304. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  50305. }),
  50306. $globals.AssociativeCollectionTest);
  50307. $core.addMethod(
  50308. $core.method({
  50309. selector: "testNewFromPairs",
  50310. protocol: 'tests',
  50311. fn: function (){
  50312. var self=this;
  50313. var flattenedAssociations;
  50314. return $core.withContext(function($ctx1) {
  50315. flattenedAssociations=["a",(1),"b",(2)];
  50316. self._assertSameContents_as_($recv($recv(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  50317. return self;
  50318. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  50319. },
  50320. args: [],
  50321. 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 }.",
  50322. referencedClasses: [],
  50323. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  50324. }),
  50325. $globals.AssociativeCollectionTest);
  50326. $core.addMethod(
  50327. $core.method({
  50328. selector: "testPrintString",
  50329. protocol: 'tests',
  50330. fn: function (){
  50331. var self=this;
  50332. return $core.withContext(function($ctx1) {
  50333. var $3,$2,$1,$4;
  50334. $3=self._collectionClass();
  50335. $ctx1.sendIdx["collectionClass"]=1;
  50336. $2=$recv($3)._new();
  50337. $recv($2)._at_put_("firstname","James");
  50338. $ctx1.sendIdx["at:put:"]=1;
  50339. $recv($2)._at_put_("lastname","Bond");
  50340. $1=$recv($2)._printString();
  50341. $4=$recv("a ".__comma($recv(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  50342. $ctx1.sendIdx[","]=1;
  50343. self._assert_equals_($1,$4);
  50344. return self;
  50345. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  50346. },
  50347. args: [],
  50348. 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'')'",
  50349. referencedClasses: [],
  50350. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  50351. }),
  50352. $globals.AssociativeCollectionTest);
  50353. $core.addMethod(
  50354. $core.method({
  50355. selector: "testRemoveKey",
  50356. protocol: 'tests',
  50357. fn: function (){
  50358. var self=this;
  50359. return $core.withContext(function($ctx1) {
  50360. var $1,$2,$3,$5,$6,$4,$8,$7;
  50361. self._nonIndexesDo_((function(each){
  50362. var collection;
  50363. return $core.withContext(function($ctx2) {
  50364. collection=self._collection();
  50365. $ctx2.sendIdx["collection"]=1;
  50366. collection;
  50367. self._should_raise_((function(){
  50368. return $core.withContext(function($ctx3) {
  50369. return $recv(collection)._removeKey_(each);
  50370. $ctx3.sendIdx["removeKey:"]=1;
  50371. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50372. }),$globals.Error);
  50373. $1=collection;
  50374. $2=self._collection();
  50375. $ctx2.sendIdx["collection"]=2;
  50376. return self._assert_equals_($1,$2);
  50377. $ctx2.sendIdx["assert:equals:"]=1;
  50378. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  50379. }));
  50380. self._samplesDo_((function(index,value){
  50381. var collection;
  50382. return $core.withContext(function($ctx2) {
  50383. collection=self._collection();
  50384. $ctx2.sendIdx["collection"]=3;
  50385. collection;
  50386. $3=$recv(collection)._removeKey_(index);
  50387. $ctx2.sendIdx["removeKey:"]=2;
  50388. self._assert_equals_($3,value);
  50389. $ctx2.sendIdx["assert:equals:"]=2;
  50390. $5=collection;
  50391. $6=self._collection();
  50392. $ctx2.sendIdx["collection"]=4;
  50393. $4=$recv($5).__eq($6);
  50394. return self._deny_($4);
  50395. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  50396. }));
  50397. $8=self._collectionWithNewValue();
  50398. $recv($8)._removeKey_(self._sampleNewIndex());
  50399. $7=$recv($8)._yourself();
  50400. self._assert_equals_($7,self._collection());
  50401. return self;
  50402. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  50403. },
  50404. args: [],
  50405. 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",
  50406. referencedClasses: ["Error"],
  50407. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  50408. }),
  50409. $globals.AssociativeCollectionTest);
  50410. $core.addMethod(
  50411. $core.method({
  50412. selector: "testRemoveKeyIfAbsent",
  50413. protocol: 'tests',
  50414. fn: function (){
  50415. var self=this;
  50416. return $core.withContext(function($ctx1) {
  50417. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  50418. self._nonIndexesDo_((function(each){
  50419. var collection;
  50420. return $core.withContext(function($ctx2) {
  50421. collection=self._collection();
  50422. $ctx2.sendIdx["collection"]=1;
  50423. collection;
  50424. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  50425. return $core.withContext(function($ctx3) {
  50426. return self._sampleNewValue();
  50427. $ctx3.sendIdx["sampleNewValue"]=1;
  50428. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50429. }));
  50430. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  50431. $2=self._sampleNewValue();
  50432. $ctx2.sendIdx["sampleNewValue"]=2;
  50433. self._assert_equals_($1,$2);
  50434. $ctx2.sendIdx["assert:equals:"]=1;
  50435. $3=collection;
  50436. $4=self._collection();
  50437. $ctx2.sendIdx["collection"]=2;
  50438. return self._assert_equals_($3,$4);
  50439. $ctx2.sendIdx["assert:equals:"]=2;
  50440. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  50441. }));
  50442. self._samplesDo_((function(index,value){
  50443. var collection;
  50444. return $core.withContext(function($ctx2) {
  50445. collection=self._collection();
  50446. $ctx2.sendIdx["collection"]=3;
  50447. collection;
  50448. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  50449. return $core.withContext(function($ctx3) {
  50450. return self._sampleNewValue();
  50451. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  50452. }));
  50453. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  50454. self._assert_equals_($5,value);
  50455. $ctx2.sendIdx["assert:equals:"]=3;
  50456. $7=collection;
  50457. $8=self._collection();
  50458. $ctx2.sendIdx["collection"]=4;
  50459. $6=$recv($7).__eq($8);
  50460. return self._deny_($6);
  50461. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  50462. }));
  50463. $10=self._collectionWithNewValue();
  50464. $recv($10)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  50465. return $core.withContext(function($ctx2) {
  50466. return self._assert_(false);
  50467. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  50468. }));
  50469. $9=$recv($10)._yourself();
  50470. self._assert_equals_($9,self._collection());
  50471. return self;
  50472. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  50473. },
  50474. args: [],
  50475. 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",
  50476. referencedClasses: [],
  50477. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  50478. }),
  50479. $globals.AssociativeCollectionTest);
  50480. $core.addMethod(
  50481. $core.method({
  50482. selector: "testValues",
  50483. protocol: 'tests',
  50484. fn: function (){
  50485. var self=this;
  50486. return $core.withContext(function($ctx1) {
  50487. var $2,$1,$3,$4;
  50488. $2=$recv($recv(self._collectionClass())._new())._values();
  50489. $ctx1.sendIdx["values"]=1;
  50490. $1=$recv($2)._isEmpty();
  50491. self._assert_($1);
  50492. $3=$recv(self._collection())._values();
  50493. $ctx1.sendIdx["values"]=2;
  50494. $4=self._collectionValues();
  50495. $ctx1.sendIdx["collectionValues"]=1;
  50496. self._assertSameContents_as_($3,$4);
  50497. $ctx1.sendIdx["assertSameContents:as:"]=1;
  50498. self._assertSameContents_as_($recv(self._collectionWithNewValue())._values(),$recv(self._collectionValues()).__comma([self._sampleNewValue()]));
  50499. return self;
  50500. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  50501. },
  50502. args: [],
  50503. 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 }",
  50504. referencedClasses: [],
  50505. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  50506. }),
  50507. $globals.AssociativeCollectionTest);
  50508. $core.addClass('DictionaryTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  50509. $core.addMethod(
  50510. $core.method({
  50511. selector: "collection",
  50512. protocol: 'fixture',
  50513. fn: function (){
  50514. var self=this;
  50515. return $core.withContext(function($ctx1) {
  50516. var $1;
  50517. $1=$recv($globals.Dictionary)._new();
  50518. $recv($1)._at_put_((1),(1));
  50519. $ctx1.sendIdx["at:put:"]=1;
  50520. $recv($1)._at_put_("a",(2));
  50521. $ctx1.sendIdx["at:put:"]=2;
  50522. $recv($1)._at_put_(true,(3));
  50523. $ctx1.sendIdx["at:put:"]=3;
  50524. $recv($1)._at_put_((1).__at((3)),(-4));
  50525. $ctx1.sendIdx["at:put:"]=4;
  50526. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50527. return $recv($1)._yourself();
  50528. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  50529. },
  50530. args: [],
  50531. 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",
  50532. referencedClasses: ["Dictionary"],
  50533. messageSends: ["at:put:", "new", "@", "yourself"]
  50534. }),
  50535. $globals.DictionaryTest);
  50536. $core.addMethod(
  50537. $core.method({
  50538. selector: "collectionKeys",
  50539. protocol: 'fixture',
  50540. fn: function (){
  50541. var self=this;
  50542. return $core.withContext(function($ctx1) {
  50543. return [(1),"a",true,(1).__at((3)),self["@sampleBlock"]];
  50544. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  50545. },
  50546. args: [],
  50547. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  50548. referencedClasses: [],
  50549. messageSends: ["@"]
  50550. }),
  50551. $globals.DictionaryTest);
  50552. $core.addMethod(
  50553. $core.method({
  50554. selector: "collectionOfPrintStrings",
  50555. protocol: 'fixture',
  50556. fn: function (){
  50557. var self=this;
  50558. return $core.withContext(function($ctx1) {
  50559. var $1;
  50560. $1=$recv($globals.Dictionary)._new();
  50561. $recv($1)._at_put_((1),"1");
  50562. $ctx1.sendIdx["at:put:"]=1;
  50563. $recv($1)._at_put_("a","2");
  50564. $ctx1.sendIdx["at:put:"]=2;
  50565. $recv($1)._at_put_(true,"3");
  50566. $ctx1.sendIdx["at:put:"]=3;
  50567. $recv($1)._at_put_((1).__at((3)),"-4");
  50568. $ctx1.sendIdx["at:put:"]=4;
  50569. $recv($1)._at_put_(self["@sampleBlock"],"9");
  50570. return $recv($1)._yourself();
  50571. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  50572. },
  50573. args: [],
  50574. 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",
  50575. referencedClasses: ["Dictionary"],
  50576. messageSends: ["at:put:", "new", "@", "yourself"]
  50577. }),
  50578. $globals.DictionaryTest);
  50579. $core.addMethod(
  50580. $core.method({
  50581. selector: "collectionSize",
  50582. protocol: 'fixture',
  50583. fn: function (){
  50584. var self=this;
  50585. return (5);
  50586. },
  50587. args: [],
  50588. source: "collectionSize\x0a\x09^ 5",
  50589. referencedClasses: [],
  50590. messageSends: []
  50591. }),
  50592. $globals.DictionaryTest);
  50593. $core.addMethod(
  50594. $core.method({
  50595. selector: "collectionValues",
  50596. protocol: 'fixture',
  50597. fn: function (){
  50598. var self=this;
  50599. return [(1),(2),(3),(-4),(9)];
  50600. },
  50601. args: [],
  50602. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  50603. referencedClasses: [],
  50604. messageSends: []
  50605. }),
  50606. $globals.DictionaryTest);
  50607. $core.addMethod(
  50608. $core.method({
  50609. selector: "collectionWithDuplicates",
  50610. protocol: 'fixture',
  50611. fn: function (){
  50612. var self=this;
  50613. return $core.withContext(function($ctx1) {
  50614. var $1;
  50615. $1=$recv($globals.Dictionary)._new();
  50616. $recv($1)._at_put_((1),(1));
  50617. $ctx1.sendIdx["at:put:"]=1;
  50618. $recv($1)._at_put_("a",(2));
  50619. $ctx1.sendIdx["at:put:"]=2;
  50620. $recv($1)._at_put_(true,(3));
  50621. $ctx1.sendIdx["at:put:"]=3;
  50622. $recv($1)._at_put_((4),(-4));
  50623. $ctx1.sendIdx["at:put:"]=4;
  50624. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50625. $ctx1.sendIdx["at:put:"]=5;
  50626. $recv($1)._at_put_("b",(1));
  50627. $ctx1.sendIdx["at:put:"]=6;
  50628. $recv($1)._at_put_((3),(3));
  50629. $ctx1.sendIdx["at:put:"]=7;
  50630. $recv($1)._at_put_(false,(12));
  50631. return $recv($1)._yourself();
  50632. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  50633. },
  50634. args: [],
  50635. 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",
  50636. referencedClasses: ["Dictionary"],
  50637. messageSends: ["at:put:", "new", "yourself"]
  50638. }),
  50639. $globals.DictionaryTest);
  50640. $core.addMethod(
  50641. $core.method({
  50642. selector: "collectionWithNewValue",
  50643. protocol: 'fixture',
  50644. fn: function (){
  50645. var self=this;
  50646. return $core.withContext(function($ctx1) {
  50647. var $1;
  50648. $1=$recv($globals.Dictionary)._new();
  50649. $recv($1)._at_put_((1),(1));
  50650. $ctx1.sendIdx["at:put:"]=1;
  50651. $recv($1)._at_put_("a",(2));
  50652. $ctx1.sendIdx["at:put:"]=2;
  50653. $recv($1)._at_put_(true,(3));
  50654. $ctx1.sendIdx["at:put:"]=3;
  50655. $recv($1)._at_put_((1).__at((3)),(-4));
  50656. $ctx1.sendIdx["at:put:"]=4;
  50657. $recv($1)._at_put_(self["@sampleBlock"],(9));
  50658. $ctx1.sendIdx["at:put:"]=5;
  50659. $recv($1)._at_put_("new","N");
  50660. return $recv($1)._yourself();
  50661. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  50662. },
  50663. args: [],
  50664. 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",
  50665. referencedClasses: ["Dictionary"],
  50666. messageSends: ["at:put:", "new", "@", "yourself"]
  50667. }),
  50668. $globals.DictionaryTest);
  50669. $core.addMethod(
  50670. $core.method({
  50671. selector: "sampleNewValueAsCollection",
  50672. protocol: 'fixture',
  50673. fn: function (){
  50674. var self=this;
  50675. return $core.withContext(function($ctx1) {
  50676. var $1;
  50677. $1=$recv($globals.Dictionary)._new();
  50678. $recv($1)._at_put_("new","N");
  50679. return $recv($1)._yourself();
  50680. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  50681. },
  50682. args: [],
  50683. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  50684. referencedClasses: ["Dictionary"],
  50685. messageSends: ["at:put:", "new", "yourself"]
  50686. }),
  50687. $globals.DictionaryTest);
  50688. $core.addMethod(
  50689. $core.method({
  50690. selector: "samplesDo:",
  50691. protocol: 'fixture',
  50692. fn: function (aBlock){
  50693. var self=this;
  50694. return $core.withContext(function($ctx1) {
  50695. (
  50696. $ctx1.supercall = true,
  50697. ($globals.DictionaryTest.superclass||$boot.dnu).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  50698. $ctx1.supercall = false;
  50699. $recv(aBlock)._value_value_(true,(3));
  50700. $ctx1.sendIdx["value:value:"]=1;
  50701. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  50702. $ctx1.sendIdx["value:value:"]=2;
  50703. $recv(aBlock)._value_value_(self["@sampleBlock"],(9));
  50704. return self;
  50705. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  50706. },
  50707. args: ["aBlock"],
  50708. 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",
  50709. referencedClasses: [],
  50710. messageSends: ["samplesDo:", "value:value:", "@"]
  50711. }),
  50712. $globals.DictionaryTest);
  50713. $core.addMethod(
  50714. $core.method({
  50715. selector: "testAccessing",
  50716. protocol: 'tests',
  50717. fn: function (){
  50718. var self=this;
  50719. var d;
  50720. return $core.withContext(function($ctx1) {
  50721. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  50722. d=$recv($globals.Dictionary)._new();
  50723. $recv(d)._at_put_("hello","world");
  50724. $ctx1.sendIdx["at:put:"]=1;
  50725. $1=$recv(d)._at_("hello");
  50726. $ctx1.sendIdx["at:"]=1;
  50727. self._assert_equals_($1,"world");
  50728. $ctx1.sendIdx["assert:equals:"]=1;
  50729. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  50730. return nil;
  50731. }));
  50732. $ctx1.sendIdx["at:ifAbsent:"]=1;
  50733. self._assert_equals_($2,"world");
  50734. $ctx1.sendIdx["assert:equals:"]=2;
  50735. self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  50736. return nil;
  50737. }))).__eq("world"));
  50738. $ctx1.sendIdx["deny:"]=1;
  50739. $3=$recv(d)._includesKey_("hello");
  50740. $ctx1.sendIdx["includesKey:"]=1;
  50741. self._assert_($3);
  50742. $ctx1.sendIdx["assert:"]=1;
  50743. $4=$recv(d)._includesKey_("foo");
  50744. $ctx1.sendIdx["includesKey:"]=2;
  50745. self._deny_($4);
  50746. $ctx1.sendIdx["deny:"]=2;
  50747. $recv(d)._at_put_((1),(2));
  50748. $ctx1.sendIdx["at:put:"]=2;
  50749. $5=$recv(d)._at_((1));
  50750. $ctx1.sendIdx["at:"]=2;
  50751. self._assert_equals_($5,(2));
  50752. $ctx1.sendIdx["assert:equals:"]=3;
  50753. $6=d;
  50754. $7=(1).__at((3));
  50755. $ctx1.sendIdx["@"]=1;
  50756. $recv($6)._at_put_($7,(3));
  50757. $9=d;
  50758. $10=(1).__at((3));
  50759. $ctx1.sendIdx["@"]=2;
  50760. $8=$recv($9)._at_($10);
  50761. self._assert_equals_($8,(3));
  50762. $12=d;
  50763. $13=(1).__at((3));
  50764. $ctx1.sendIdx["@"]=3;
  50765. $11=$recv($12)._includesKey_($13);
  50766. $ctx1.sendIdx["includesKey:"]=3;
  50767. self._assert_($11);
  50768. self._deny_($recv(d)._includesKey_((3).__at((1))));
  50769. return self;
  50770. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  50771. },
  50772. args: [],
  50773. 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)",
  50774. referencedClasses: ["Dictionary"],
  50775. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  50776. }),
  50777. $globals.DictionaryTest);
  50778. $core.addMethod(
  50779. $core.method({
  50780. selector: "testDynamicDictionaries",
  50781. protocol: 'tests',
  50782. fn: function (){
  50783. var self=this;
  50784. return $core.withContext(function($ctx1) {
  50785. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  50786. return self;
  50787. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  50788. },
  50789. args: [],
  50790. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  50791. referencedClasses: ["Dictionary"],
  50792. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  50793. }),
  50794. $globals.DictionaryTest);
  50795. $core.addMethod(
  50796. $core.method({
  50797. selector: "collectionClass",
  50798. protocol: 'fixture',
  50799. fn: function (){
  50800. var self=this;
  50801. return $globals.Dictionary;
  50802. },
  50803. args: [],
  50804. source: "collectionClass\x0a\x09^ Dictionary",
  50805. referencedClasses: ["Dictionary"],
  50806. messageSends: []
  50807. }),
  50808. $globals.DictionaryTest.klass);
  50809. $core.addClass('HashedCollectionTest', $globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  50810. $core.addMethod(
  50811. $core.method({
  50812. selector: "collection",
  50813. protocol: 'fixture',
  50814. fn: function (){
  50815. var self=this;
  50816. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  50817. },
  50818. args: [],
  50819. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  50820. referencedClasses: [],
  50821. messageSends: []
  50822. }),
  50823. $globals.HashedCollectionTest);
  50824. $core.addMethod(
  50825. $core.method({
  50826. selector: "collectionKeys",
  50827. protocol: 'fixture',
  50828. fn: function (){
  50829. var self=this;
  50830. return ["b","a","c","d"];
  50831. },
  50832. args: [],
  50833. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  50834. referencedClasses: [],
  50835. messageSends: []
  50836. }),
  50837. $globals.HashedCollectionTest);
  50838. $core.addMethod(
  50839. $core.method({
  50840. selector: "collectionOfPrintStrings",
  50841. protocol: 'fixture',
  50842. fn: function (){
  50843. var self=this;
  50844. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  50845. },
  50846. args: [],
  50847. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  50848. referencedClasses: [],
  50849. messageSends: []
  50850. }),
  50851. $globals.HashedCollectionTest);
  50852. $core.addMethod(
  50853. $core.method({
  50854. selector: "collectionSize",
  50855. protocol: 'fixture',
  50856. fn: function (){
  50857. var self=this;
  50858. return (4);
  50859. },
  50860. args: [],
  50861. source: "collectionSize\x0a\x09^ 4",
  50862. referencedClasses: [],
  50863. messageSends: []
  50864. }),
  50865. $globals.HashedCollectionTest);
  50866. $core.addMethod(
  50867. $core.method({
  50868. selector: "collectionValues",
  50869. protocol: 'fixture',
  50870. fn: function (){
  50871. var self=this;
  50872. return [(1),(2),(3),(-4)];
  50873. },
  50874. args: [],
  50875. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  50876. referencedClasses: [],
  50877. messageSends: []
  50878. }),
  50879. $globals.HashedCollectionTest);
  50880. $core.addMethod(
  50881. $core.method({
  50882. selector: "collectionWithDuplicates",
  50883. protocol: 'fixture',
  50884. fn: function (){
  50885. var self=this;
  50886. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  50887. },
  50888. args: [],
  50889. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  50890. referencedClasses: [],
  50891. messageSends: []
  50892. }),
  50893. $globals.HashedCollectionTest);
  50894. $core.addMethod(
  50895. $core.method({
  50896. selector: "collectionWithNewValue",
  50897. protocol: 'fixture',
  50898. fn: function (){
  50899. var self=this;
  50900. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  50901. },
  50902. args: [],
  50903. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  50904. referencedClasses: [],
  50905. messageSends: []
  50906. }),
  50907. $globals.HashedCollectionTest);
  50908. $core.addMethod(
  50909. $core.method({
  50910. selector: "sampleNewValueAsCollection",
  50911. protocol: 'fixture',
  50912. fn: function (){
  50913. var self=this;
  50914. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  50915. },
  50916. args: [],
  50917. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  50918. referencedClasses: [],
  50919. messageSends: []
  50920. }),
  50921. $globals.HashedCollectionTest);
  50922. $core.addMethod(
  50923. $core.method({
  50924. selector: "testDynamicDictionaries",
  50925. protocol: 'tests',
  50926. fn: function (){
  50927. var self=this;
  50928. return $core.withContext(function($ctx1) {
  50929. self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  50930. return self;
  50931. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  50932. },
  50933. args: [],
  50934. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  50935. referencedClasses: ["HashedCollection"],
  50936. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  50937. }),
  50938. $globals.HashedCollectionTest);
  50939. $core.addMethod(
  50940. $core.method({
  50941. selector: "collectionClass",
  50942. protocol: 'fixture',
  50943. fn: function (){
  50944. var self=this;
  50945. return $globals.HashedCollection;
  50946. },
  50947. args: [],
  50948. source: "collectionClass\x0a\x09^ HashedCollection",
  50949. referencedClasses: ["HashedCollection"],
  50950. messageSends: []
  50951. }),
  50952. $globals.HashedCollectionTest.klass);
  50953. $core.addClass('SequenceableCollectionTest', $globals.IndexableCollectionTest, [], 'Kernel-Tests');
  50954. $core.addMethod(
  50955. $core.method({
  50956. selector: "collectionFirst",
  50957. protocol: 'fixture',
  50958. fn: function (){
  50959. var self=this;
  50960. return $core.withContext(function($ctx1) {
  50961. self._subclassResponsibility();
  50962. return self;
  50963. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  50964. },
  50965. args: [],
  50966. source: "collectionFirst\x0a\x09self subclassResponsibility",
  50967. referencedClasses: [],
  50968. messageSends: ["subclassResponsibility"]
  50969. }),
  50970. $globals.SequenceableCollectionTest);
  50971. $core.addMethod(
  50972. $core.method({
  50973. selector: "collectionFirstTwo",
  50974. protocol: 'fixture',
  50975. fn: function (){
  50976. var self=this;
  50977. return $core.withContext(function($ctx1) {
  50978. self._subclassResponsibility();
  50979. return self;
  50980. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  50981. },
  50982. args: [],
  50983. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  50984. referencedClasses: [],
  50985. messageSends: ["subclassResponsibility"]
  50986. }),
  50987. $globals.SequenceableCollectionTest);
  50988. $core.addMethod(
  50989. $core.method({
  50990. selector: "collectionLast",
  50991. protocol: 'fixture',
  50992. fn: function (){
  50993. var self=this;
  50994. return $core.withContext(function($ctx1) {
  50995. self._subclassResponsibility();
  50996. return self;
  50997. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  50998. },
  50999. args: [],
  51000. source: "collectionLast\x0a\x09self subclassResponsibility",
  51001. referencedClasses: [],
  51002. messageSends: ["subclassResponsibility"]
  51003. }),
  51004. $globals.SequenceableCollectionTest);
  51005. $core.addMethod(
  51006. $core.method({
  51007. selector: "collectionLastTwo",
  51008. protocol: 'fixture',
  51009. fn: function (){
  51010. var self=this;
  51011. return $core.withContext(function($ctx1) {
  51012. self._subclassResponsibility();
  51013. return self;
  51014. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  51015. },
  51016. args: [],
  51017. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  51018. referencedClasses: [],
  51019. messageSends: ["subclassResponsibility"]
  51020. }),
  51021. $globals.SequenceableCollectionTest);
  51022. $core.addMethod(
  51023. $core.method({
  51024. selector: "nonIndexesDo:",
  51025. protocol: 'fixture',
  51026. fn: function (aBlock){
  51027. var self=this;
  51028. return $core.withContext(function($ctx1) {
  51029. $recv(aBlock)._value_((0));
  51030. $ctx1.sendIdx["value:"]=1;
  51031. $recv(aBlock)._value_($recv(self._collectionSize()).__plus((1)));
  51032. $ctx1.sendIdx["value:"]=2;
  51033. $recv(aBlock)._value_("z");
  51034. return self;
  51035. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  51036. },
  51037. args: ["aBlock"],
  51038. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  51039. referencedClasses: [],
  51040. messageSends: ["value:", "+", "collectionSize"]
  51041. }),
  51042. $globals.SequenceableCollectionTest);
  51043. $core.addMethod(
  51044. $core.method({
  51045. selector: "samplesDo:",
  51046. protocol: 'fixture',
  51047. fn: function (aBlock){
  51048. var self=this;
  51049. return $core.withContext(function($ctx1) {
  51050. $recv(aBlock)._value_value_((1),self._collectionFirst());
  51051. $ctx1.sendIdx["value:value:"]=1;
  51052. $recv(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  51053. return self;
  51054. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  51055. },
  51056. args: ["aBlock"],
  51057. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  51058. referencedClasses: [],
  51059. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  51060. }),
  51061. $globals.SequenceableCollectionTest);
  51062. $core.addMethod(
  51063. $core.method({
  51064. selector: "testBeginsWith",
  51065. protocol: 'tests',
  51066. fn: function (){
  51067. var self=this;
  51068. return $core.withContext(function($ctx1) {
  51069. var $2,$1,$4,$5,$3,$7,$6;
  51070. $2=self._collection();
  51071. $ctx1.sendIdx["collection"]=1;
  51072. $1=$recv($2)._beginsWith_($recv(self._collectionClass())._new());
  51073. $ctx1.sendIdx["beginsWith:"]=1;
  51074. self._assert_($1);
  51075. $ctx1.sendIdx["assert:"]=1;
  51076. $4=self._collection();
  51077. $ctx1.sendIdx["collection"]=2;
  51078. $5=self._collection();
  51079. $ctx1.sendIdx["collection"]=3;
  51080. $3=$recv($4)._beginsWith_($5);
  51081. $ctx1.sendIdx["beginsWith:"]=2;
  51082. self._assert_($3);
  51083. $ctx1.sendIdx["assert:"]=2;
  51084. $7=self._collection();
  51085. $ctx1.sendIdx["collection"]=4;
  51086. $6=$recv($7)._beginsWith_(self._collectionFirstTwo());
  51087. $ctx1.sendIdx["beginsWith:"]=3;
  51088. self._assert_($6);
  51089. self._deny_($recv(self._collection())._beginsWith_(self._collectionLastTwo()));
  51090. return self;
  51091. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  51092. },
  51093. args: [],
  51094. 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)",
  51095. referencedClasses: [],
  51096. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  51097. }),
  51098. $globals.SequenceableCollectionTest);
  51099. $core.addMethod(
  51100. $core.method({
  51101. selector: "testEndsWith",
  51102. protocol: 'tests',
  51103. fn: function (){
  51104. var self=this;
  51105. return $core.withContext(function($ctx1) {
  51106. var $2,$1,$4,$5,$3,$7,$6;
  51107. $2=self._collection();
  51108. $ctx1.sendIdx["collection"]=1;
  51109. $1=$recv($2)._endsWith_($recv(self._collectionClass())._new());
  51110. $ctx1.sendIdx["endsWith:"]=1;
  51111. self._assert_($1);
  51112. $ctx1.sendIdx["assert:"]=1;
  51113. $4=self._collection();
  51114. $ctx1.sendIdx["collection"]=2;
  51115. $5=self._collection();
  51116. $ctx1.sendIdx["collection"]=3;
  51117. $3=$recv($4)._endsWith_($5);
  51118. $ctx1.sendIdx["endsWith:"]=2;
  51119. self._assert_($3);
  51120. $ctx1.sendIdx["assert:"]=2;
  51121. $7=self._collection();
  51122. $ctx1.sendIdx["collection"]=4;
  51123. $6=$recv($7)._endsWith_(self._collectionLastTwo());
  51124. $ctx1.sendIdx["endsWith:"]=3;
  51125. self._assert_($6);
  51126. self._deny_($recv(self._collection())._endsWith_(self._collectionFirstTwo()));
  51127. return self;
  51128. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  51129. },
  51130. args: [],
  51131. 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)",
  51132. referencedClasses: [],
  51133. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  51134. }),
  51135. $globals.SequenceableCollectionTest);
  51136. $core.addMethod(
  51137. $core.method({
  51138. selector: "testFirst",
  51139. protocol: 'tests',
  51140. fn: function (){
  51141. var self=this;
  51142. return $core.withContext(function($ctx1) {
  51143. self._assert_equals_($recv(self._collection())._first(),self._collectionFirst());
  51144. return self;
  51145. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  51146. },
  51147. args: [],
  51148. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  51149. referencedClasses: [],
  51150. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  51151. }),
  51152. $globals.SequenceableCollectionTest);
  51153. $core.addMethod(
  51154. $core.method({
  51155. selector: "testFirstN",
  51156. protocol: 'tests',
  51157. fn: function (){
  51158. var self=this;
  51159. return $core.withContext(function($ctx1) {
  51160. var $2,$1,$4,$3,$6,$5,$7;
  51161. $2=self._collection();
  51162. $ctx1.sendIdx["collection"]=1;
  51163. $1=$recv($2)._first_((2));
  51164. $ctx1.sendIdx["first:"]=1;
  51165. self._assert_equals_($1,self._collectionFirstTwo());
  51166. $ctx1.sendIdx["assert:equals:"]=1;
  51167. $4=self._collection();
  51168. $ctx1.sendIdx["collection"]=2;
  51169. $3=$recv($4)._first_((0));
  51170. $ctx1.sendIdx["first:"]=2;
  51171. self._assert_equals_($3,$recv(self._collectionClass())._new());
  51172. $ctx1.sendIdx["assert:equals:"]=2;
  51173. $6=self._collection();
  51174. $ctx1.sendIdx["collection"]=3;
  51175. $5=$recv($6)._first_(self._collectionSize());
  51176. $ctx1.sendIdx["first:"]=3;
  51177. $7=self._collection();
  51178. $ctx1.sendIdx["collection"]=4;
  51179. self._assert_equals_($5,$7);
  51180. self._should_raise_((function(){
  51181. return $core.withContext(function($ctx2) {
  51182. return $recv(self._collection())._first_((33));
  51183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51184. }),$globals.Error);
  51185. return self;
  51186. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  51187. },
  51188. args: [],
  51189. 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",
  51190. referencedClasses: ["Error"],
  51191. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  51192. }),
  51193. $globals.SequenceableCollectionTest);
  51194. $core.addMethod(
  51195. $core.method({
  51196. selector: "testFourth",
  51197. protocol: 'tests',
  51198. fn: function (){
  51199. var self=this;
  51200. return $core.withContext(function($ctx1) {
  51201. var $2,$1;
  51202. $2=self._collection();
  51203. $ctx1.sendIdx["collection"]=1;
  51204. $1=$recv($2)._fourth();
  51205. self._assert_equals_($1,$recv(self._collection())._at_((4)));
  51206. return self;
  51207. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  51208. },
  51209. args: [],
  51210. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  51211. referencedClasses: [],
  51212. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  51213. }),
  51214. $globals.SequenceableCollectionTest);
  51215. $core.addMethod(
  51216. $core.method({
  51217. selector: "testIndexOfStartingAt",
  51218. protocol: 'tests',
  51219. fn: function (){
  51220. var self=this;
  51221. var jsNull;
  51222. return $core.withContext(function($ctx1) {
  51223. var $2,$1,$4,$3;
  51224. jsNull=$recv($globals.JSON)._parse_("null");
  51225. self._samplesDo_((function(index,value){
  51226. return $core.withContext(function($ctx2) {
  51227. $2=self._collection();
  51228. $ctx2.sendIdx["collection"]=1;
  51229. $1=$recv($2)._indexOf_startingAt_(value,(1));
  51230. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  51231. self._assert_equals_($1,index);
  51232. $ctx2.sendIdx["assert:equals:"]=1;
  51233. $4=self._collection();
  51234. $ctx2.sendIdx["collection"]=2;
  51235. $3=$recv($4)._indexOf_startingAt_(value,index);
  51236. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  51237. self._assert_equals_($3,index);
  51238. $ctx2.sendIdx["assert:equals:"]=2;
  51239. return self._assert_equals_($recv(self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  51240. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  51241. }));
  51242. return self;
  51243. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  51244. },
  51245. args: [],
  51246. 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 ]",
  51247. referencedClasses: ["JSON"],
  51248. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  51249. }),
  51250. $globals.SequenceableCollectionTest);
  51251. $core.addMethod(
  51252. $core.method({
  51253. selector: "testIndexOfStartingAtWithNull",
  51254. protocol: 'tests',
  51255. fn: function (){
  51256. var self=this;
  51257. var jsNull;
  51258. return $core.withContext(function($ctx1) {
  51259. var $1,$2;
  51260. jsNull=$recv($globals.JSON)._parse_("null");
  51261. self._samplesDo_((function(index,value){
  51262. var collection;
  51263. return $core.withContext(function($ctx2) {
  51264. collection=self._collection();
  51265. collection;
  51266. $recv(collection)._at_put_(index,jsNull);
  51267. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  51268. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  51269. self._assert_equals_($1,index);
  51270. $ctx2.sendIdx["assert:equals:"]=1;
  51271. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  51272. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  51273. self._assert_equals_($2,index);
  51274. $ctx2.sendIdx["assert:equals:"]=2;
  51275. return self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  51276. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  51277. }));
  51278. return self;
  51279. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  51280. },
  51281. args: [],
  51282. 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 ]",
  51283. referencedClasses: ["JSON"],
  51284. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  51285. }),
  51286. $globals.SequenceableCollectionTest);
  51287. $core.addMethod(
  51288. $core.method({
  51289. selector: "testLast",
  51290. protocol: 'tests',
  51291. fn: function (){
  51292. var self=this;
  51293. return $core.withContext(function($ctx1) {
  51294. self._assert_equals_($recv(self._collection())._last(),self._collectionLast());
  51295. return self;
  51296. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  51297. },
  51298. args: [],
  51299. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  51300. referencedClasses: [],
  51301. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  51302. }),
  51303. $globals.SequenceableCollectionTest);
  51304. $core.addMethod(
  51305. $core.method({
  51306. selector: "testLastN",
  51307. protocol: 'tests',
  51308. fn: function (){
  51309. var self=this;
  51310. return $core.withContext(function($ctx1) {
  51311. var $2,$1,$4,$3,$6,$5,$7;
  51312. $2=self._collection();
  51313. $ctx1.sendIdx["collection"]=1;
  51314. $1=$recv($2)._last_((2));
  51315. $ctx1.sendIdx["last:"]=1;
  51316. self._assert_equals_($1,self._collectionLastTwo());
  51317. $ctx1.sendIdx["assert:equals:"]=1;
  51318. $4=self._collection();
  51319. $ctx1.sendIdx["collection"]=2;
  51320. $3=$recv($4)._last_((0));
  51321. $ctx1.sendIdx["last:"]=2;
  51322. self._assert_equals_($3,$recv(self._collectionClass())._new());
  51323. $ctx1.sendIdx["assert:equals:"]=2;
  51324. $6=self._collection();
  51325. $ctx1.sendIdx["collection"]=3;
  51326. $5=$recv($6)._last_(self._collectionSize());
  51327. $ctx1.sendIdx["last:"]=3;
  51328. $7=self._collection();
  51329. $ctx1.sendIdx["collection"]=4;
  51330. self._assert_equals_($5,$7);
  51331. self._should_raise_((function(){
  51332. return $core.withContext(function($ctx2) {
  51333. return $recv(self._collection())._last_((33));
  51334. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51335. }),$globals.Error);
  51336. return self;
  51337. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  51338. },
  51339. args: [],
  51340. 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",
  51341. referencedClasses: ["Error"],
  51342. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  51343. }),
  51344. $globals.SequenceableCollectionTest);
  51345. $core.addMethod(
  51346. $core.method({
  51347. selector: "testSecond",
  51348. protocol: 'tests',
  51349. fn: function (){
  51350. var self=this;
  51351. return $core.withContext(function($ctx1) {
  51352. var $2,$1;
  51353. $2=self._collection();
  51354. $ctx1.sendIdx["collection"]=1;
  51355. $1=$recv($2)._second();
  51356. self._assert_equals_($1,$recv(self._collection())._at_((2)));
  51357. return self;
  51358. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  51359. },
  51360. args: [],
  51361. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  51362. referencedClasses: [],
  51363. messageSends: ["assert:equals:", "second", "collection", "at:"]
  51364. }),
  51365. $globals.SequenceableCollectionTest);
  51366. $core.addMethod(
  51367. $core.method({
  51368. selector: "testThird",
  51369. protocol: 'tests',
  51370. fn: function (){
  51371. var self=this;
  51372. return $core.withContext(function($ctx1) {
  51373. var $2,$1;
  51374. $2=self._collection();
  51375. $ctx1.sendIdx["collection"]=1;
  51376. $1=$recv($2)._third();
  51377. self._assert_equals_($1,$recv(self._collection())._at_((3)));
  51378. return self;
  51379. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  51380. },
  51381. args: [],
  51382. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  51383. referencedClasses: [],
  51384. messageSends: ["assert:equals:", "third", "collection", "at:"]
  51385. }),
  51386. $globals.SequenceableCollectionTest);
  51387. $core.addClass('ArrayTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  51388. $core.addMethod(
  51389. $core.method({
  51390. selector: "collection",
  51391. protocol: 'fixture',
  51392. fn: function (){
  51393. var self=this;
  51394. return [(1), (2), (3), (-4)];
  51395. },
  51396. args: [],
  51397. source: "collection\x0a\x09^ #(1 2 3 -4)",
  51398. referencedClasses: [],
  51399. messageSends: []
  51400. }),
  51401. $globals.ArrayTest);
  51402. $core.addMethod(
  51403. $core.method({
  51404. selector: "collectionFirst",
  51405. protocol: 'fixture',
  51406. fn: function (){
  51407. var self=this;
  51408. return (1);
  51409. },
  51410. args: [],
  51411. source: "collectionFirst\x0a\x09^ 1",
  51412. referencedClasses: [],
  51413. messageSends: []
  51414. }),
  51415. $globals.ArrayTest);
  51416. $core.addMethod(
  51417. $core.method({
  51418. selector: "collectionFirstTwo",
  51419. protocol: 'fixture',
  51420. fn: function (){
  51421. var self=this;
  51422. return [(1), (2)];
  51423. },
  51424. args: [],
  51425. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  51426. referencedClasses: [],
  51427. messageSends: []
  51428. }),
  51429. $globals.ArrayTest);
  51430. $core.addMethod(
  51431. $core.method({
  51432. selector: "collectionLast",
  51433. protocol: 'fixture',
  51434. fn: function (){
  51435. var self=this;
  51436. return (-4);
  51437. },
  51438. args: [],
  51439. source: "collectionLast\x0a\x09^ -4",
  51440. referencedClasses: [],
  51441. messageSends: []
  51442. }),
  51443. $globals.ArrayTest);
  51444. $core.addMethod(
  51445. $core.method({
  51446. selector: "collectionLastTwo",
  51447. protocol: 'fixture',
  51448. fn: function (){
  51449. var self=this;
  51450. return [(3), (-4)];
  51451. },
  51452. args: [],
  51453. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  51454. referencedClasses: [],
  51455. messageSends: []
  51456. }),
  51457. $globals.ArrayTest);
  51458. $core.addMethod(
  51459. $core.method({
  51460. selector: "collectionOfPrintStrings",
  51461. protocol: 'fixture',
  51462. fn: function (){
  51463. var self=this;
  51464. return ["1", "2", "3", "-4"];
  51465. },
  51466. args: [],
  51467. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  51468. referencedClasses: [],
  51469. messageSends: []
  51470. }),
  51471. $globals.ArrayTest);
  51472. $core.addMethod(
  51473. $core.method({
  51474. selector: "collectionSize",
  51475. protocol: 'fixture',
  51476. fn: function (){
  51477. var self=this;
  51478. return (4);
  51479. },
  51480. args: [],
  51481. source: "collectionSize\x0a\x09^ 4",
  51482. referencedClasses: [],
  51483. messageSends: []
  51484. }),
  51485. $globals.ArrayTest);
  51486. $core.addMethod(
  51487. $core.method({
  51488. selector: "collectionWithDuplicates",
  51489. protocol: 'fixture',
  51490. fn: function (){
  51491. var self=this;
  51492. return ["a", "b", "c", (1), (2), (1), "a", []];
  51493. },
  51494. args: [],
  51495. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  51496. referencedClasses: [],
  51497. messageSends: []
  51498. }),
  51499. $globals.ArrayTest);
  51500. $core.addMethod(
  51501. $core.method({
  51502. selector: "collectionWithNewValue",
  51503. protocol: 'fixture',
  51504. fn: function (){
  51505. var self=this;
  51506. return [(1), (2), (3), (-4), "N"];
  51507. },
  51508. args: [],
  51509. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  51510. referencedClasses: [],
  51511. messageSends: []
  51512. }),
  51513. $globals.ArrayTest);
  51514. $core.addMethod(
  51515. $core.method({
  51516. selector: "sampleNewIndex",
  51517. protocol: 'fixture',
  51518. fn: function (){
  51519. var self=this;
  51520. return (5);
  51521. },
  51522. args: [],
  51523. source: "sampleNewIndex\x0a\x09^ 5",
  51524. referencedClasses: [],
  51525. messageSends: []
  51526. }),
  51527. $globals.ArrayTest);
  51528. $core.addMethod(
  51529. $core.method({
  51530. selector: "samplesDo:",
  51531. protocol: 'fixture',
  51532. fn: function (aBlock){
  51533. var self=this;
  51534. return $core.withContext(function($ctx1) {
  51535. (
  51536. $ctx1.supercall = true,
  51537. ($globals.ArrayTest.superclass||$boot.dnu).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  51538. $ctx1.supercall = false;
  51539. $recv(aBlock)._value_value_((3),(3));
  51540. return self;
  51541. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  51542. },
  51543. args: ["aBlock"],
  51544. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  51545. referencedClasses: [],
  51546. messageSends: ["samplesDo:", "value:value:"]
  51547. }),
  51548. $globals.ArrayTest);
  51549. $core.addMethod(
  51550. $core.method({
  51551. selector: "testAdd",
  51552. protocol: 'tests',
  51553. fn: function (){
  51554. var self=this;
  51555. var array;
  51556. return $core.withContext(function($ctx1) {
  51557. array=self._collection();
  51558. $recv(array)._add_((6));
  51559. self._assert_equals_($recv(array)._last(),(6));
  51560. return self;
  51561. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  51562. },
  51563. args: [],
  51564. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  51565. referencedClasses: [],
  51566. messageSends: ["collection", "add:", "assert:equals:", "last"]
  51567. }),
  51568. $globals.ArrayTest);
  51569. $core.addMethod(
  51570. $core.method({
  51571. selector: "testAddFirst",
  51572. protocol: 'tests',
  51573. fn: function (){
  51574. var self=this;
  51575. return $core.withContext(function($ctx1) {
  51576. var $3,$2,$1;
  51577. $3=self._collection();
  51578. $recv($3)._addFirst_((0));
  51579. $2=$recv($3)._yourself();
  51580. $1=$recv($2)._first();
  51581. self._assert_equals_($1,(0));
  51582. return self;
  51583. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  51584. },
  51585. args: [],
  51586. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  51587. referencedClasses: [],
  51588. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  51589. }),
  51590. $globals.ArrayTest);
  51591. $core.addMethod(
  51592. $core.method({
  51593. selector: "testPrintString",
  51594. protocol: 'tests',
  51595. fn: function (){
  51596. var self=this;
  51597. var array;
  51598. return $core.withContext(function($ctx1) {
  51599. var $1,$2,$3,$4,$5,$6,$7,$8;
  51600. array=$recv($globals.Array)._new();
  51601. $1=$recv(array)._printString();
  51602. $ctx1.sendIdx["printString"]=1;
  51603. self._assert_equals_($1,"an Array ()");
  51604. $ctx1.sendIdx["assert:equals:"]=1;
  51605. $2=array;
  51606. $recv($2)._add_((1));
  51607. $ctx1.sendIdx["add:"]=1;
  51608. $3=$recv($2)._add_((3));
  51609. $ctx1.sendIdx["add:"]=2;
  51610. $4=$recv(array)._printString();
  51611. $ctx1.sendIdx["printString"]=2;
  51612. self._assert_equals_($4,"an Array (1 3)");
  51613. $ctx1.sendIdx["assert:equals:"]=2;
  51614. $recv(array)._add_("foo");
  51615. $5=$recv(array)._printString();
  51616. $ctx1.sendIdx["printString"]=3;
  51617. self._assert_equals_($5,"an Array (1 3 'foo')");
  51618. $ctx1.sendIdx["assert:equals:"]=3;
  51619. $6=array;
  51620. $recv($6)._remove_((1));
  51621. $ctx1.sendIdx["remove:"]=1;
  51622. $recv($6)._remove_((3));
  51623. $7=$recv(array)._printString();
  51624. $ctx1.sendIdx["printString"]=4;
  51625. self._assert_equals_($7,"an Array ('foo')");
  51626. $ctx1.sendIdx["assert:equals:"]=4;
  51627. $recv(array)._addLast_((3));
  51628. $ctx1.sendIdx["addLast:"]=1;
  51629. $8=$recv(array)._printString();
  51630. $ctx1.sendIdx["printString"]=5;
  51631. self._assert_equals_($8,"an Array ('foo' 3)");
  51632. $ctx1.sendIdx["assert:equals:"]=5;
  51633. $recv(array)._addLast_((3));
  51634. self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  51635. return self;
  51636. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  51637. },
  51638. args: [],
  51639. 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)'.",
  51640. referencedClasses: ["Array"],
  51641. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  51642. }),
  51643. $globals.ArrayTest);
  51644. $core.addMethod(
  51645. $core.method({
  51646. selector: "testRemove",
  51647. protocol: 'tests',
  51648. fn: function (){
  51649. var self=this;
  51650. var array;
  51651. return $core.withContext(function($ctx1) {
  51652. array=[(1), (2), (3), (4), (5)];
  51653. $recv(array)._remove_((3));
  51654. $ctx1.sendIdx["remove:"]=1;
  51655. self._assert_equals_(array,[(1), (2), (4), (5)]);
  51656. self._should_raise_((function(){
  51657. return $core.withContext(function($ctx2) {
  51658. return $recv(array)._remove_((3));
  51659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51660. }),$globals.Error);
  51661. return self;
  51662. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  51663. },
  51664. args: [],
  51665. 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",
  51666. referencedClasses: ["Error"],
  51667. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  51668. }),
  51669. $globals.ArrayTest);
  51670. $core.addMethod(
  51671. $core.method({
  51672. selector: "testRemoveFromTo",
  51673. protocol: 'tests',
  51674. fn: function (){
  51675. var self=this;
  51676. return $core.withContext(function($ctx1) {
  51677. var $1,$2;
  51678. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  51679. $ctx1.sendIdx["removeFrom:to:"]=1;
  51680. self._assert_equals_($1,[(4)]);
  51681. $ctx1.sendIdx["assert:equals:"]=1;
  51682. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  51683. $ctx1.sendIdx["removeFrom:to:"]=2;
  51684. self._assert_equals_($2,[(1), (4)]);
  51685. $ctx1.sendIdx["assert:equals:"]=2;
  51686. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  51687. return self;
  51688. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  51689. },
  51690. args: [],
  51691. 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)",
  51692. referencedClasses: [],
  51693. messageSends: ["assert:equals:", "removeFrom:to:"]
  51694. }),
  51695. $globals.ArrayTest);
  51696. $core.addMethod(
  51697. $core.method({
  51698. selector: "testRemoveIndex",
  51699. protocol: 'tests',
  51700. fn: function (){
  51701. var self=this;
  51702. return $core.withContext(function($ctx1) {
  51703. var $1,$2;
  51704. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  51705. $ctx1.sendIdx["removeIndex:"]=1;
  51706. self._assert_equals_($1,[(1), (3), (4)]);
  51707. $ctx1.sendIdx["assert:equals:"]=1;
  51708. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  51709. $ctx1.sendIdx["removeIndex:"]=2;
  51710. self._assert_equals_($2,[(2), (3), (4)]);
  51711. $ctx1.sendIdx["assert:equals:"]=2;
  51712. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  51713. return self;
  51714. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  51715. },
  51716. args: [],
  51717. 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: #()",
  51718. referencedClasses: [],
  51719. messageSends: ["assert:equals:", "removeIndex:"]
  51720. }),
  51721. $globals.ArrayTest);
  51722. $core.addMethod(
  51723. $core.method({
  51724. selector: "testRemoveLast",
  51725. protocol: 'tests',
  51726. fn: function (){
  51727. var self=this;
  51728. var array;
  51729. return $core.withContext(function($ctx1) {
  51730. array=[(1), (2)];
  51731. $recv(array)._removeLast();
  51732. self._assert_equals_($recv(array)._last(),(1));
  51733. return self;
  51734. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  51735. },
  51736. args: [],
  51737. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  51738. referencedClasses: [],
  51739. messageSends: ["removeLast", "assert:equals:", "last"]
  51740. }),
  51741. $globals.ArrayTest);
  51742. $core.addMethod(
  51743. $core.method({
  51744. selector: "testReversed",
  51745. protocol: 'tests',
  51746. fn: function (){
  51747. var self=this;
  51748. var array;
  51749. return $core.withContext(function($ctx1) {
  51750. array=[(5), (4), (3), (2), (1)];
  51751. self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  51752. return self;
  51753. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  51754. },
  51755. args: [],
  51756. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  51757. referencedClasses: [],
  51758. messageSends: ["assert:equals:", "reversed"]
  51759. }),
  51760. $globals.ArrayTest);
  51761. $core.addMethod(
  51762. $core.method({
  51763. selector: "testSort",
  51764. protocol: 'tests',
  51765. fn: function (){
  51766. var self=this;
  51767. var array;
  51768. return $core.withContext(function($ctx1) {
  51769. array=[(10), (1), (5)];
  51770. $recv(array)._sort();
  51771. self._assert_equals_(array,[(1), (5), (10)]);
  51772. return self;
  51773. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  51774. },
  51775. args: [],
  51776. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  51777. referencedClasses: [],
  51778. messageSends: ["sort", "assert:equals:"]
  51779. }),
  51780. $globals.ArrayTest);
  51781. $core.addMethod(
  51782. $core.method({
  51783. selector: "collectionClass",
  51784. protocol: 'fixture',
  51785. fn: function (){
  51786. var self=this;
  51787. return $globals.Array;
  51788. },
  51789. args: [],
  51790. source: "collectionClass\x0a\x09^ Array",
  51791. referencedClasses: ["Array"],
  51792. messageSends: []
  51793. }),
  51794. $globals.ArrayTest.klass);
  51795. $core.addClass('StringTest', $globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  51796. $core.addMethod(
  51797. $core.method({
  51798. selector: "collection",
  51799. protocol: 'fixture',
  51800. fn: function (){
  51801. var self=this;
  51802. return "helLo";
  51803. },
  51804. args: [],
  51805. source: "collection\x0a\x09^ 'helLo'",
  51806. referencedClasses: [],
  51807. messageSends: []
  51808. }),
  51809. $globals.StringTest);
  51810. $core.addMethod(
  51811. $core.method({
  51812. selector: "collectionFirst",
  51813. protocol: 'fixture',
  51814. fn: function (){
  51815. var self=this;
  51816. return "h";
  51817. },
  51818. args: [],
  51819. source: "collectionFirst\x0a\x09^ 'h'",
  51820. referencedClasses: [],
  51821. messageSends: []
  51822. }),
  51823. $globals.StringTest);
  51824. $core.addMethod(
  51825. $core.method({
  51826. selector: "collectionFirstTwo",
  51827. protocol: 'fixture',
  51828. fn: function (){
  51829. var self=this;
  51830. return "he";
  51831. },
  51832. args: [],
  51833. source: "collectionFirstTwo\x0a\x09^ 'he'",
  51834. referencedClasses: [],
  51835. messageSends: []
  51836. }),
  51837. $globals.StringTest);
  51838. $core.addMethod(
  51839. $core.method({
  51840. selector: "collectionLast",
  51841. protocol: 'fixture',
  51842. fn: function (){
  51843. var self=this;
  51844. return "o";
  51845. },
  51846. args: [],
  51847. source: "collectionLast\x0a\x09^ 'o'",
  51848. referencedClasses: [],
  51849. messageSends: []
  51850. }),
  51851. $globals.StringTest);
  51852. $core.addMethod(
  51853. $core.method({
  51854. selector: "collectionLastTwo",
  51855. protocol: 'fixture',
  51856. fn: function (){
  51857. var self=this;
  51858. return "Lo";
  51859. },
  51860. args: [],
  51861. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  51862. referencedClasses: [],
  51863. messageSends: []
  51864. }),
  51865. $globals.StringTest);
  51866. $core.addMethod(
  51867. $core.method({
  51868. selector: "collectionOfPrintStrings",
  51869. protocol: 'fixture',
  51870. fn: function (){
  51871. var self=this;
  51872. return "'h''e''l''L''o'";
  51873. },
  51874. args: [],
  51875. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  51876. referencedClasses: [],
  51877. messageSends: []
  51878. }),
  51879. $globals.StringTest);
  51880. $core.addMethod(
  51881. $core.method({
  51882. selector: "collectionSize",
  51883. protocol: 'fixture',
  51884. fn: function (){
  51885. var self=this;
  51886. return (5);
  51887. },
  51888. args: [],
  51889. source: "collectionSize\x0a\x09^ 5",
  51890. referencedClasses: [],
  51891. messageSends: []
  51892. }),
  51893. $globals.StringTest);
  51894. $core.addMethod(
  51895. $core.method({
  51896. selector: "collectionWithDuplicates",
  51897. protocol: 'fixture',
  51898. fn: function (){
  51899. var self=this;
  51900. return "abbaerten";
  51901. },
  51902. args: [],
  51903. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  51904. referencedClasses: [],
  51905. messageSends: []
  51906. }),
  51907. $globals.StringTest);
  51908. $core.addMethod(
  51909. $core.method({
  51910. selector: "collectionWithNewValue",
  51911. protocol: 'fixture',
  51912. fn: function (){
  51913. var self=this;
  51914. return "helLoN";
  51915. },
  51916. args: [],
  51917. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  51918. referencedClasses: [],
  51919. messageSends: []
  51920. }),
  51921. $globals.StringTest);
  51922. $core.addMethod(
  51923. $core.method({
  51924. selector: "sampleNewValueAsCollection",
  51925. protocol: 'fixture',
  51926. fn: function (){
  51927. var self=this;
  51928. return "N";
  51929. },
  51930. args: [],
  51931. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  51932. referencedClasses: [],
  51933. messageSends: []
  51934. }),
  51935. $globals.StringTest);
  51936. $core.addMethod(
  51937. $core.method({
  51938. selector: "samplesDo:",
  51939. protocol: 'fixture',
  51940. fn: function (aBlock){
  51941. var self=this;
  51942. return $core.withContext(function($ctx1) {
  51943. (
  51944. $ctx1.supercall = true,
  51945. ($globals.StringTest.superclass||$boot.dnu).fn.prototype._samplesDo_.apply($recv(self), [aBlock]));
  51946. $ctx1.supercall = false;
  51947. $recv(aBlock)._value_value_((3),"l");
  51948. return self;
  51949. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  51950. },
  51951. args: ["aBlock"],
  51952. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  51953. referencedClasses: [],
  51954. messageSends: ["samplesDo:", "value:value:"]
  51955. }),
  51956. $globals.StringTest);
  51957. $core.addMethod(
  51958. $core.method({
  51959. selector: "testAddAll",
  51960. protocol: 'tests',
  51961. fn: function (){
  51962. var self=this;
  51963. return $core.withContext(function($ctx1) {
  51964. var $1;
  51965. self._should_raise_((function(){
  51966. return $core.withContext(function($ctx2) {
  51967. $1=self._collection();
  51968. $ctx2.sendIdx["collection"]=1;
  51969. return $recv($1)._addAll_(self._collection());
  51970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51971. }),$globals.Error);
  51972. return self;
  51973. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  51974. },
  51975. args: [],
  51976. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  51977. referencedClasses: ["Error"],
  51978. messageSends: ["should:raise:", "addAll:", "collection"]
  51979. }),
  51980. $globals.StringTest);
  51981. $core.addMethod(
  51982. $core.method({
  51983. selector: "testAddRemove",
  51984. protocol: 'tests',
  51985. fn: function (){
  51986. var self=this;
  51987. return $core.withContext(function($ctx1) {
  51988. self._should_raise_((function(){
  51989. return $core.withContext(function($ctx2) {
  51990. return "hello"._add_("a");
  51991. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51992. }),$globals.Error);
  51993. $ctx1.sendIdx["should:raise:"]=1;
  51994. self._should_raise_((function(){
  51995. return $core.withContext(function($ctx2) {
  51996. return "hello"._remove_("h");
  51997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51998. }),$globals.Error);
  51999. return self;
  52000. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  52001. },
  52002. args: [],
  52003. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  52004. referencedClasses: ["Error"],
  52005. messageSends: ["should:raise:", "add:", "remove:"]
  52006. }),
  52007. $globals.StringTest);
  52008. $core.addMethod(
  52009. $core.method({
  52010. selector: "testAsArray",
  52011. protocol: 'tests',
  52012. fn: function (){
  52013. var self=this;
  52014. return $core.withContext(function($ctx1) {
  52015. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  52016. return self;
  52017. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  52018. },
  52019. args: [],
  52020. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  52021. referencedClasses: [],
  52022. messageSends: ["assert:equals:", "asArray"]
  52023. }),
  52024. $globals.StringTest);
  52025. $core.addMethod(
  52026. $core.method({
  52027. selector: "testAsLowerCase",
  52028. protocol: 'tests',
  52029. fn: function (){
  52030. var self=this;
  52031. return $core.withContext(function($ctx1) {
  52032. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  52033. return self;
  52034. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  52035. },
  52036. args: [],
  52037. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  52038. referencedClasses: [],
  52039. messageSends: ["assert:equals:", "asLowercase"]
  52040. }),
  52041. $globals.StringTest);
  52042. $core.addMethod(
  52043. $core.method({
  52044. selector: "testAsNumber",
  52045. protocol: 'tests',
  52046. fn: function (){
  52047. var self=this;
  52048. return $core.withContext(function($ctx1) {
  52049. var $1,$2;
  52050. $1="3"._asNumber();
  52051. $ctx1.sendIdx["asNumber"]=1;
  52052. self._assert_equals_($1,(3));
  52053. $ctx1.sendIdx["assert:equals:"]=1;
  52054. $2="-3"._asNumber();
  52055. $ctx1.sendIdx["asNumber"]=2;
  52056. self._assert_equals_($2,(-3));
  52057. $ctx1.sendIdx["assert:equals:"]=2;
  52058. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  52059. return self;
  52060. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  52061. },
  52062. args: [],
  52063. 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.",
  52064. referencedClasses: [],
  52065. messageSends: ["assert:equals:", "asNumber"]
  52066. }),
  52067. $globals.StringTest);
  52068. $core.addMethod(
  52069. $core.method({
  52070. selector: "testAsUpperCase",
  52071. protocol: 'tests',
  52072. fn: function (){
  52073. var self=this;
  52074. return $core.withContext(function($ctx1) {
  52075. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  52076. return self;
  52077. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  52078. },
  52079. args: [],
  52080. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  52081. referencedClasses: [],
  52082. messageSends: ["assert:equals:", "asUppercase"]
  52083. }),
  52084. $globals.StringTest);
  52085. $core.addMethod(
  52086. $core.method({
  52087. selector: "testAsciiValue",
  52088. protocol: 'tests',
  52089. fn: function (){
  52090. var self=this;
  52091. var characterA,characterU;
  52092. return $core.withContext(function($ctx1) {
  52093. var $1;
  52094. characterA="A";
  52095. characterU="U";
  52096. $1=$recv(characterA)._asciiValue();
  52097. $ctx1.sendIdx["asciiValue"]=1;
  52098. self._assert_equals_($1,(65));
  52099. $ctx1.sendIdx["assert:equals:"]=1;
  52100. self._assert_equals_($recv(characterU)._asciiValue(),(85));
  52101. return self;
  52102. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  52103. },
  52104. args: [],
  52105. 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",
  52106. referencedClasses: [],
  52107. messageSends: ["assert:equals:", "asciiValue"]
  52108. }),
  52109. $globals.StringTest);
  52110. $core.addMethod(
  52111. $core.method({
  52112. selector: "testAtIfAbsentPut",
  52113. protocol: 'tests',
  52114. fn: function (){
  52115. var self=this;
  52116. return $core.withContext(function($ctx1) {
  52117. self._should_raise_((function(){
  52118. return $core.withContext(function($ctx2) {
  52119. return "hello"._at_ifAbsentPut_((6),(function(){
  52120. return "a";
  52121. }));
  52122. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52123. }),$globals.Error);
  52124. return self;
  52125. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  52126. },
  52127. args: [],
  52128. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  52129. referencedClasses: ["Error"],
  52130. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  52131. }),
  52132. $globals.StringTest);
  52133. $core.addMethod(
  52134. $core.method({
  52135. selector: "testAtPut",
  52136. protocol: 'tests',
  52137. fn: function (){
  52138. var self=this;
  52139. return $core.withContext(function($ctx1) {
  52140. self._should_raise_((function(){
  52141. return $core.withContext(function($ctx2) {
  52142. return "hello"._at_put_((1),"a");
  52143. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52144. }),$globals.Error);
  52145. return self;
  52146. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  52147. },
  52148. args: [],
  52149. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  52150. referencedClasses: ["Error"],
  52151. messageSends: ["should:raise:", "at:put:"]
  52152. }),
  52153. $globals.StringTest);
  52154. $core.addMethod(
  52155. $core.method({
  52156. selector: "testCapitalized",
  52157. protocol: 'tests',
  52158. fn: function (){
  52159. var self=this;
  52160. return $core.withContext(function($ctx1) {
  52161. var $1,$2,$3;
  52162. $1="test"._capitalized();
  52163. $ctx1.sendIdx["capitalized"]=1;
  52164. self._assert_equals_($1,"Test");
  52165. $ctx1.sendIdx["assert:equals:"]=1;
  52166. $2="Test"._capitalized();
  52167. $ctx1.sendIdx["capitalized"]=2;
  52168. self._assert_equals_($2,"Test");
  52169. $ctx1.sendIdx["assert:equals:"]=2;
  52170. self._assert_equals_(""._capitalized(),"");
  52171. $ctx1.sendIdx["assert:equals:"]=3;
  52172. $3="Test"._isCapitalized();
  52173. $ctx1.sendIdx["isCapitalized"]=1;
  52174. self._assert_equals_($3,true);
  52175. $ctx1.sendIdx["assert:equals:"]=4;
  52176. self._assert_equals_("test"._isCapitalized(),false);
  52177. return self;
  52178. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  52179. },
  52180. args: [],
  52181. 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.",
  52182. referencedClasses: [],
  52183. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  52184. }),
  52185. $globals.StringTest);
  52186. $core.addMethod(
  52187. $core.method({
  52188. selector: "testCharCodeAt",
  52189. protocol: 'tests',
  52190. fn: function (){
  52191. var self=this;
  52192. return $core.withContext(function($ctx1) {
  52193. var $1,$2,$3,$4,$5;
  52194. $1="jackie"._charCodeAt_((1));
  52195. $ctx1.sendIdx["charCodeAt:"]=1;
  52196. self._assert_equals_($1,(106));
  52197. $ctx1.sendIdx["assert:equals:"]=1;
  52198. $2="jackie"._charCodeAt_((2));
  52199. $ctx1.sendIdx["charCodeAt:"]=2;
  52200. self._assert_equals_($2,(97));
  52201. $ctx1.sendIdx["assert:equals:"]=2;
  52202. $3="jackie"._charCodeAt_((3));
  52203. $ctx1.sendIdx["charCodeAt:"]=3;
  52204. self._assert_equals_($3,(99));
  52205. $ctx1.sendIdx["assert:equals:"]=3;
  52206. $4="jackie"._charCodeAt_((4));
  52207. $ctx1.sendIdx["charCodeAt:"]=4;
  52208. self._assert_equals_($4,(107));
  52209. $ctx1.sendIdx["assert:equals:"]=4;
  52210. $5="jackie"._charCodeAt_((5));
  52211. $ctx1.sendIdx["charCodeAt:"]=5;
  52212. self._assert_equals_($5,(105));
  52213. $ctx1.sendIdx["assert:equals:"]=5;
  52214. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  52215. return self;
  52216. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  52217. },
  52218. args: [],
  52219. 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",
  52220. referencedClasses: [],
  52221. messageSends: ["assert:equals:", "charCodeAt:"]
  52222. }),
  52223. $globals.StringTest);
  52224. $core.addMethod(
  52225. $core.method({
  52226. selector: "testCopyFromTo",
  52227. protocol: 'tests',
  52228. fn: function (){
  52229. var self=this;
  52230. return $core.withContext(function($ctx1) {
  52231. var $1;
  52232. $1="jackie"._copyFrom_to_((1),(3));
  52233. $ctx1.sendIdx["copyFrom:to:"]=1;
  52234. self._assert_equals_($1,"jac");
  52235. $ctx1.sendIdx["assert:equals:"]=1;
  52236. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  52237. return self;
  52238. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  52239. },
  52240. args: [],
  52241. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  52242. referencedClasses: [],
  52243. messageSends: ["assert:equals:", "copyFrom:to:"]
  52244. }),
  52245. $globals.StringTest);
  52246. $core.addMethod(
  52247. $core.method({
  52248. selector: "testCopySeparates",
  52249. protocol: 'tests',
  52250. fn: function (){
  52251. var self=this;
  52252. return $core.withContext(function($ctx1) {
  52253. var $3,$2,$1;
  52254. $3=self._collection();
  52255. $ctx1.sendIdx["collection"]=1;
  52256. $2=$recv($3)._copy();
  52257. $1=$recv($2).__eq_eq(self._collection());
  52258. self._assert_($1);
  52259. return self;
  52260. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  52261. },
  52262. args: [],
  52263. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  52264. referencedClasses: [],
  52265. messageSends: ["assert:", "==", "copy", "collection"]
  52266. }),
  52267. $globals.StringTest);
  52268. $core.addMethod(
  52269. $core.method({
  52270. selector: "testCopyWithoutAll",
  52271. protocol: 'tests',
  52272. fn: function (){
  52273. var self=this;
  52274. return $core.withContext(function($ctx1) {
  52275. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  52276. return self;
  52277. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  52278. },
  52279. args: [],
  52280. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  52281. referencedClasses: [],
  52282. messageSends: ["assert:equals:", "copyWithoutAll:"]
  52283. }),
  52284. $globals.StringTest);
  52285. $core.addMethod(
  52286. $core.method({
  52287. selector: "testEquality",
  52288. protocol: 'tests',
  52289. fn: function (){
  52290. var self=this;
  52291. return $core.withContext(function($ctx1) {
  52292. var $1,$2,$3;
  52293. self._assert_equals_("hello","hello");
  52294. $ctx1.sendIdx["assert:equals:"]=1;
  52295. $1="hello".__eq("world");
  52296. $ctx1.sendIdx["="]=1;
  52297. self._deny_($1);
  52298. $ctx1.sendIdx["deny:"]=1;
  52299. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  52300. })));
  52301. $ctx1.sendIdx["="]=2;
  52302. self._deny_($2);
  52303. $ctx1.sendIdx["deny:"]=2;
  52304. $3="hello"._yourself();
  52305. $ctx1.sendIdx["yourself"]=1;
  52306. self._assert_equals_("hello",$3);
  52307. $ctx1.sendIdx["assert:equals:"]=2;
  52308. self._assert_equals_("hello"._yourself(),"hello");
  52309. self._deny_("".__eq((0)));
  52310. return self;
  52311. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  52312. },
  52313. args: [],
  52314. 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",
  52315. referencedClasses: [],
  52316. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  52317. }),
  52318. $globals.StringTest);
  52319. $core.addMethod(
  52320. $core.method({
  52321. selector: "testIdentity",
  52322. protocol: 'tests',
  52323. fn: function (){
  52324. var self=this;
  52325. return $core.withContext(function($ctx1) {
  52326. var $1,$2,$4,$3,$5;
  52327. $1="hello".__eq_eq("hello");
  52328. $ctx1.sendIdx["=="]=1;
  52329. self._assert_($1);
  52330. $ctx1.sendIdx["assert:"]=1;
  52331. $2="hello".__eq_eq("world");
  52332. $ctx1.sendIdx["=="]=2;
  52333. self._deny_($2);
  52334. $ctx1.sendIdx["deny:"]=1;
  52335. $4="hello"._yourself();
  52336. $ctx1.sendIdx["yourself"]=1;
  52337. $3="hello".__eq_eq($4);
  52338. $ctx1.sendIdx["=="]=3;
  52339. self._assert_($3);
  52340. $ctx1.sendIdx["assert:"]=2;
  52341. $5=$recv("hello"._yourself()).__eq_eq("hello");
  52342. $ctx1.sendIdx["=="]=4;
  52343. self._assert_($5);
  52344. self._deny_("".__eq_eq((0)));
  52345. return self;
  52346. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  52347. },
  52348. args: [],
  52349. 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",
  52350. referencedClasses: [],
  52351. messageSends: ["assert:", "==", "deny:", "yourself"]
  52352. }),
  52353. $globals.StringTest);
  52354. $core.addMethod(
  52355. $core.method({
  52356. selector: "testIncludesSubString",
  52357. protocol: 'tests',
  52358. fn: function (){
  52359. var self=this;
  52360. return $core.withContext(function($ctx1) {
  52361. var $1;
  52362. $1="amber"._includesSubString_("ber");
  52363. $ctx1.sendIdx["includesSubString:"]=1;
  52364. self._assert_($1);
  52365. self._deny_("amber"._includesSubString_("zork"));
  52366. return self;
  52367. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  52368. },
  52369. args: [],
  52370. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  52371. referencedClasses: [],
  52372. messageSends: ["assert:", "includesSubString:", "deny:"]
  52373. }),
  52374. $globals.StringTest);
  52375. $core.addMethod(
  52376. $core.method({
  52377. selector: "testIndexOfStartingAtWithNull",
  52378. protocol: 'tests',
  52379. fn: function (){
  52380. var self=this;
  52381. return self;
  52382. },
  52383. args: [],
  52384. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  52385. referencedClasses: [],
  52386. messageSends: []
  52387. }),
  52388. $globals.StringTest);
  52389. $core.addMethod(
  52390. $core.method({
  52391. selector: "testIndexOfWithNull",
  52392. protocol: 'tests',
  52393. fn: function (){
  52394. var self=this;
  52395. return self;
  52396. },
  52397. args: [],
  52398. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  52399. referencedClasses: [],
  52400. messageSends: []
  52401. }),
  52402. $globals.StringTest);
  52403. $core.addMethod(
  52404. $core.method({
  52405. selector: "testIsVowel",
  52406. protocol: 'tests',
  52407. fn: function (){
  52408. var self=this;
  52409. var vowel,consonant;
  52410. return $core.withContext(function($ctx1) {
  52411. var $1;
  52412. vowel="u";
  52413. consonant="z";
  52414. $1=$recv(vowel)._isVowel();
  52415. $ctx1.sendIdx["isVowel"]=1;
  52416. self._assert_equals_($1,true);
  52417. $ctx1.sendIdx["assert:equals:"]=1;
  52418. self._assert_equals_($recv(consonant)._isVowel(),false);
  52419. return self;
  52420. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  52421. },
  52422. args: [],
  52423. 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",
  52424. referencedClasses: [],
  52425. messageSends: ["assert:equals:", "isVowel"]
  52426. }),
  52427. $globals.StringTest);
  52428. $core.addMethod(
  52429. $core.method({
  52430. selector: "testJoin",
  52431. protocol: 'tests',
  52432. fn: function (){
  52433. var self=this;
  52434. return $core.withContext(function($ctx1) {
  52435. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  52436. return self;
  52437. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  52438. },
  52439. args: [],
  52440. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  52441. referencedClasses: [],
  52442. messageSends: ["assert:equals:", "join:"]
  52443. }),
  52444. $globals.StringTest);
  52445. $core.addMethod(
  52446. $core.method({
  52447. selector: "testRemoveAll",
  52448. protocol: 'tests',
  52449. fn: function (){
  52450. var self=this;
  52451. return $core.withContext(function($ctx1) {
  52452. self._should_raise_((function(){
  52453. return $core.withContext(function($ctx2) {
  52454. return $recv(self._collection())._removeAll();
  52455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52456. }),$globals.Error);
  52457. return self;
  52458. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  52459. },
  52460. args: [],
  52461. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  52462. referencedClasses: ["Error"],
  52463. messageSends: ["should:raise:", "removeAll", "collection"]
  52464. }),
  52465. $globals.StringTest);
  52466. $core.addMethod(
  52467. $core.method({
  52468. selector: "testReversed",
  52469. protocol: 'tests',
  52470. fn: function (){
  52471. var self=this;
  52472. return $core.withContext(function($ctx1) {
  52473. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  52474. return self;
  52475. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  52476. },
  52477. args: [],
  52478. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  52479. referencedClasses: [],
  52480. messageSends: ["assert:equals:", "reversed"]
  52481. }),
  52482. $globals.StringTest);
  52483. $core.addMethod(
  52484. $core.method({
  52485. selector: "testStreamContents",
  52486. protocol: 'tests',
  52487. fn: function (){
  52488. var self=this;
  52489. return $core.withContext(function($ctx1) {
  52490. self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  52491. return $core.withContext(function($ctx2) {
  52492. $recv(aStream)._nextPutAll_("hello");
  52493. $ctx2.sendIdx["nextPutAll:"]=1;
  52494. $recv(aStream)._space();
  52495. return $recv(aStream)._nextPutAll_("world");
  52496. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  52497. })),"hello world");
  52498. return self;
  52499. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  52500. },
  52501. args: [],
  52502. 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'",
  52503. referencedClasses: ["String"],
  52504. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  52505. }),
  52506. $globals.StringTest);
  52507. $core.addMethod(
  52508. $core.method({
  52509. selector: "testSubStrings",
  52510. protocol: 'tests',
  52511. fn: function (){
  52512. var self=this;
  52513. return $core.withContext(function($ctx1) {
  52514. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  52515. return self;
  52516. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  52517. },
  52518. args: [],
  52519. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  52520. referencedClasses: [],
  52521. messageSends: ["assert:equals:", "subStrings:"]
  52522. }),
  52523. $globals.StringTest);
  52524. $core.addMethod(
  52525. $core.method({
  52526. selector: "testTrim",
  52527. protocol: 'tests',
  52528. fn: function (){
  52529. var self=this;
  52530. return $core.withContext(function($ctx1) {
  52531. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  52532. $ctx1.sendIdx["assert:equals:"]=1;
  52533. self._assert_equals_("jackie "._trimRight(),"jackie");
  52534. return self;
  52535. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  52536. },
  52537. args: [],
  52538. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  52539. referencedClasses: [],
  52540. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  52541. }),
  52542. $globals.StringTest);
  52543. $core.addMethod(
  52544. $core.method({
  52545. selector: "testValue",
  52546. protocol: 'tests',
  52547. fn: function (){
  52548. var self=this;
  52549. return $core.withContext(function($ctx1) {
  52550. self._assert_equals_("asString"._value_((1)),"1");
  52551. $ctx1.sendIdx["assert:equals:"]=1;
  52552. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  52553. return self;
  52554. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  52555. },
  52556. args: [],
  52557. 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')",
  52558. referencedClasses: [],
  52559. messageSends: ["assert:equals:", "value:", "collect:"]
  52560. }),
  52561. $globals.StringTest);
  52562. $core.addMethod(
  52563. $core.method({
  52564. selector: "collectionClass",
  52565. protocol: 'fixture',
  52566. fn: function (){
  52567. var self=this;
  52568. return $globals.String;
  52569. },
  52570. args: [],
  52571. source: "collectionClass\x0a\x09^ String",
  52572. referencedClasses: ["String"],
  52573. messageSends: []
  52574. }),
  52575. $globals.StringTest.klass);
  52576. $core.addClass('SetTest', $globals.CollectionTest, [], 'Kernel-Tests');
  52577. $core.addMethod(
  52578. $core.method({
  52579. selector: "collection",
  52580. protocol: 'fixture',
  52581. fn: function (){
  52582. var self=this;
  52583. return $core.withContext(function($ctx1) {
  52584. var $1;
  52585. $1=$recv($globals.Set)._new();
  52586. $recv($1)._add_($globals.Smalltalk);
  52587. $ctx1.sendIdx["add:"]=1;
  52588. $recv($1)._add_(nil);
  52589. $ctx1.sendIdx["add:"]=2;
  52590. $recv($1)._add_((3).__at((3)));
  52591. $ctx1.sendIdx["add:"]=3;
  52592. $recv($1)._add_(false);
  52593. $ctx1.sendIdx["add:"]=4;
  52594. $recv($1)._add_(self["@sampleBlock"]);
  52595. return $recv($1)._yourself();
  52596. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  52597. },
  52598. args: [],
  52599. 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",
  52600. referencedClasses: ["Set", "Smalltalk"],
  52601. messageSends: ["add:", "new", "@", "yourself"]
  52602. }),
  52603. $globals.SetTest);
  52604. $core.addMethod(
  52605. $core.method({
  52606. selector: "collectionOfPrintStrings",
  52607. protocol: 'fixture',
  52608. fn: function (){
  52609. var self=this;
  52610. return $core.withContext(function($ctx1) {
  52611. var $1;
  52612. $1=$recv($globals.Set)._new();
  52613. $recv($1)._add_("a SmalltalkImage");
  52614. $ctx1.sendIdx["add:"]=1;
  52615. $recv($1)._add_("nil");
  52616. $ctx1.sendIdx["add:"]=2;
  52617. $recv($1)._add_("3@3");
  52618. $ctx1.sendIdx["add:"]=3;
  52619. $recv($1)._add_("false");
  52620. $ctx1.sendIdx["add:"]=4;
  52621. $recv($1)._add_("a BlockClosure");
  52622. return $recv($1)._yourself();
  52623. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  52624. },
  52625. args: [],
  52626. 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",
  52627. referencedClasses: ["Set"],
  52628. messageSends: ["add:", "new", "yourself"]
  52629. }),
  52630. $globals.SetTest);
  52631. $core.addMethod(
  52632. $core.method({
  52633. selector: "collectionSize",
  52634. protocol: 'fixture',
  52635. fn: function (){
  52636. var self=this;
  52637. return (5);
  52638. },
  52639. args: [],
  52640. source: "collectionSize\x0a\x09^ 5",
  52641. referencedClasses: [],
  52642. messageSends: []
  52643. }),
  52644. $globals.SetTest);
  52645. $core.addMethod(
  52646. $core.method({
  52647. selector: "collectionWithDuplicates",
  52648. protocol: 'fixture',
  52649. fn: function (){
  52650. var self=this;
  52651. return $core.withContext(function($ctx1) {
  52652. var $1;
  52653. $1=self._collection();
  52654. $recv($1)._add_((0));
  52655. return $recv($1)._yourself();
  52656. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  52657. },
  52658. args: [],
  52659. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  52660. referencedClasses: [],
  52661. messageSends: ["add:", "collection", "yourself"]
  52662. }),
  52663. $globals.SetTest);
  52664. $core.addMethod(
  52665. $core.method({
  52666. selector: "collectionWithNewValue",
  52667. protocol: 'fixture',
  52668. fn: function (){
  52669. var self=this;
  52670. return $core.withContext(function($ctx1) {
  52671. var $1;
  52672. $1=$recv($globals.Set)._new();
  52673. $recv($1)._add_($globals.Smalltalk);
  52674. $ctx1.sendIdx["add:"]=1;
  52675. $recv($1)._add_(nil);
  52676. $ctx1.sendIdx["add:"]=2;
  52677. $recv($1)._add_((3).__at((3)));
  52678. $ctx1.sendIdx["add:"]=3;
  52679. $recv($1)._add_("N");
  52680. $ctx1.sendIdx["add:"]=4;
  52681. $recv($1)._add_(false);
  52682. $ctx1.sendIdx["add:"]=5;
  52683. $recv($1)._add_(self["@sampleBlock"]);
  52684. return $recv($1)._yourself();
  52685. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  52686. },
  52687. args: [],
  52688. 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",
  52689. referencedClasses: ["Set", "Smalltalk"],
  52690. messageSends: ["add:", "new", "@", "yourself"]
  52691. }),
  52692. $globals.SetTest);
  52693. $core.addMethod(
  52694. $core.method({
  52695. selector: "testAddAll",
  52696. protocol: 'tests',
  52697. fn: function (){
  52698. var self=this;
  52699. return $core.withContext(function($ctx1) {
  52700. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  52701. (
  52702. $ctx1.supercall = true,
  52703. ($globals.SetTest.superclass||$boot.dnu).fn.prototype._testAddAll.apply($recv(self), []));
  52704. $ctx1.supercall = false;
  52705. $2=self._collection();
  52706. $ctx1.sendIdx["collection"]=1;
  52707. $3=self._collection();
  52708. $ctx1.sendIdx["collection"]=2;
  52709. $recv($2)._addAll_($3);
  52710. $ctx1.sendIdx["addAll:"]=1;
  52711. $4=$recv($2)._yourself();
  52712. $ctx1.sendIdx["yourself"]=1;
  52713. $1=$4;
  52714. $5=self._collection();
  52715. $ctx1.sendIdx["collection"]=3;
  52716. self._assert_equals_($1,$5);
  52717. $ctx1.sendIdx["assert:equals:"]=1;
  52718. $7=self._collection();
  52719. $ctx1.sendIdx["collection"]=4;
  52720. $8=self._collectionWithNewValue();
  52721. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52722. $recv($7)._addAll_($8);
  52723. $ctx1.sendIdx["addAll:"]=2;
  52724. $9=$recv($7)._yourself();
  52725. $ctx1.sendIdx["yourself"]=2;
  52726. $6=$9;
  52727. $10=self._collectionWithNewValue();
  52728. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52729. self._assert_equals_($6,$10);
  52730. $ctx1.sendIdx["assert:equals:"]=2;
  52731. $12=self._collectionWithNewValue();
  52732. $ctx1.sendIdx["collectionWithNewValue"]=3;
  52733. $recv($12)._addAll_(self._collection());
  52734. $11=$recv($12)._yourself();
  52735. self._assert_equals_($11,self._collectionWithNewValue());
  52736. return self;
  52737. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  52738. },
  52739. args: [],
  52740. 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",
  52741. referencedClasses: [],
  52742. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  52743. }),
  52744. $globals.SetTest);
  52745. $core.addMethod(
  52746. $core.method({
  52747. selector: "testAddRemove",
  52748. protocol: 'tests',
  52749. fn: function (){
  52750. var self=this;
  52751. var set;
  52752. return $core.withContext(function($ctx1) {
  52753. var $1,$2;
  52754. set=$recv($globals.Set)._new();
  52755. self._assert_($recv(set)._isEmpty());
  52756. $ctx1.sendIdx["assert:"]=1;
  52757. $recv(set)._add_((3));
  52758. $ctx1.sendIdx["add:"]=1;
  52759. $1=$recv(set)._includes_((3));
  52760. $ctx1.sendIdx["includes:"]=1;
  52761. self._assert_($1);
  52762. $ctx1.sendIdx["assert:"]=2;
  52763. $recv(set)._add_((5));
  52764. $2=$recv(set)._includes_((5));
  52765. $ctx1.sendIdx["includes:"]=2;
  52766. self._assert_($2);
  52767. $recv(set)._remove_((3));
  52768. self._deny_($recv(set)._includes_((3)));
  52769. return self;
  52770. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  52771. },
  52772. args: [],
  52773. 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)",
  52774. referencedClasses: ["Set"],
  52775. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  52776. }),
  52777. $globals.SetTest);
  52778. $core.addMethod(
  52779. $core.method({
  52780. selector: "testAt",
  52781. protocol: 'tests',
  52782. fn: function (){
  52783. var self=this;
  52784. return $core.withContext(function($ctx1) {
  52785. self._should_raise_((function(){
  52786. return $core.withContext(function($ctx2) {
  52787. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  52788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52789. }),$globals.Error);
  52790. return self;
  52791. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  52792. },
  52793. args: [],
  52794. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  52795. referencedClasses: ["Set", "Error"],
  52796. messageSends: ["should:raise:", "at:put:", "new"]
  52797. }),
  52798. $globals.SetTest);
  52799. $core.addMethod(
  52800. $core.method({
  52801. selector: "testCollect",
  52802. protocol: 'tests',
  52803. fn: function (){
  52804. var self=this;
  52805. return $core.withContext(function($ctx1) {
  52806. var $2,$1;
  52807. (
  52808. $ctx1.supercall = true,
  52809. ($globals.SetTest.superclass||$boot.dnu).fn.prototype._testCollect.apply($recv(self), []));
  52810. $ctx1.supercall = false;
  52811. $2=[(5), (6), (8)]._asSet();
  52812. $ctx1.sendIdx["asSet"]=1;
  52813. $1=$recv($2)._collect_((function(x){
  52814. return $core.withContext(function($ctx2) {
  52815. return $recv(x).__backslash_backslash((3));
  52816. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  52817. }));
  52818. self._assert_equals_($1,[(0), (2)]._asSet());
  52819. return self;
  52820. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  52821. },
  52822. args: [],
  52823. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  52824. referencedClasses: [],
  52825. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  52826. }),
  52827. $globals.SetTest);
  52828. $core.addMethod(
  52829. $core.method({
  52830. selector: "testComma",
  52831. protocol: 'tests',
  52832. fn: function (){
  52833. var self=this;
  52834. return $core.withContext(function($ctx1) {
  52835. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  52836. (
  52837. $ctx1.supercall = true,
  52838. ($globals.SetTest.superclass||$boot.dnu).fn.prototype._testComma.apply($recv(self), []));
  52839. $ctx1.supercall = false;
  52840. $2=self._collection();
  52841. $ctx1.sendIdx["collection"]=1;
  52842. $3=self._collection();
  52843. $ctx1.sendIdx["collection"]=2;
  52844. $1=$recv($2).__comma($3);
  52845. $ctx1.sendIdx[","]=1;
  52846. $4=self._collection();
  52847. $ctx1.sendIdx["collection"]=3;
  52848. self._assert_equals_($1,$4);
  52849. $ctx1.sendIdx["assert:equals:"]=1;
  52850. $6=self._collection();
  52851. $ctx1.sendIdx["collection"]=4;
  52852. $7=self._collectionWithNewValue();
  52853. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52854. $5=$recv($6).__comma($7);
  52855. $ctx1.sendIdx[","]=2;
  52856. $8=self._collectionWithNewValue();
  52857. $ctx1.sendIdx["collectionWithNewValue"]=2;
  52858. self._assert_equals_($5,$8);
  52859. $ctx1.sendIdx["assert:equals:"]=2;
  52860. $10=self._collectionWithNewValue();
  52861. $ctx1.sendIdx["collectionWithNewValue"]=3;
  52862. $9=$recv($10).__comma(self._collection());
  52863. self._assert_equals_($9,self._collectionWithNewValue());
  52864. return self;
  52865. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  52866. },
  52867. args: [],
  52868. 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",
  52869. referencedClasses: [],
  52870. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  52871. }),
  52872. $globals.SetTest);
  52873. $core.addMethod(
  52874. $core.method({
  52875. selector: "testComparing",
  52876. protocol: 'tests',
  52877. fn: function (){
  52878. var self=this;
  52879. return $core.withContext(function($ctx1) {
  52880. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  52881. $1=[(0), (2)]._asSet();
  52882. $ctx1.sendIdx["asSet"]=1;
  52883. $2=[(0), (2)]._asSet();
  52884. $ctx1.sendIdx["asSet"]=2;
  52885. self._assert_equals_($1,$2);
  52886. $ctx1.sendIdx["assert:equals:"]=1;
  52887. $3=[(2), (0)]._asSet();
  52888. $ctx1.sendIdx["asSet"]=3;
  52889. $4=[(0), (2)]._asSet();
  52890. $ctx1.sendIdx["asSet"]=4;
  52891. self._assert_equals_($3,$4);
  52892. $6=[(0), (2), (3)]._asSet();
  52893. $ctx1.sendIdx["asSet"]=5;
  52894. $7=[(0), (2)]._asSet();
  52895. $ctx1.sendIdx["asSet"]=6;
  52896. $5=$recv($6).__eq($7);
  52897. $ctx1.sendIdx["="]=1;
  52898. self._deny_($5);
  52899. $ctx1.sendIdx["deny:"]=1;
  52900. $9=[(1), (2)]._asSet();
  52901. $ctx1.sendIdx["asSet"]=7;
  52902. $8=$recv($9).__eq([(0), (2)]._asSet());
  52903. self._deny_($8);
  52904. return self;
  52905. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  52906. },
  52907. args: [],
  52908. 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",
  52909. referencedClasses: [],
  52910. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  52911. }),
  52912. $globals.SetTest);
  52913. $core.addMethod(
  52914. $core.method({
  52915. selector: "testPrintString",
  52916. protocol: 'tests',
  52917. fn: function (){
  52918. var self=this;
  52919. var set;
  52920. return $core.withContext(function($ctx1) {
  52921. var $1,$2,$3,$4,$5,$6,$7,$8;
  52922. set=$recv($globals.Set)._new();
  52923. $1=$recv(set)._printString();
  52924. $ctx1.sendIdx["printString"]=1;
  52925. self._assert_equals_($1,"a Set ()");
  52926. $ctx1.sendIdx["assert:equals:"]=1;
  52927. $2=set;
  52928. $recv($2)._add_((1));
  52929. $ctx1.sendIdx["add:"]=1;
  52930. $3=$recv($2)._add_((3));
  52931. $ctx1.sendIdx["add:"]=2;
  52932. $4=$recv(set)._printString();
  52933. $ctx1.sendIdx["printString"]=2;
  52934. self._assert_equals_($4,"a Set (1 3)");
  52935. $ctx1.sendIdx["assert:equals:"]=2;
  52936. $recv(set)._add_("foo");
  52937. $ctx1.sendIdx["add:"]=3;
  52938. $5=$recv(set)._printString();
  52939. $ctx1.sendIdx["printString"]=3;
  52940. self._assert_equals_($5,"a Set (1 3 'foo')");
  52941. $ctx1.sendIdx["assert:equals:"]=3;
  52942. $6=set;
  52943. $recv($6)._remove_((1));
  52944. $ctx1.sendIdx["remove:"]=1;
  52945. $recv($6)._remove_((3));
  52946. $7=$recv(set)._printString();
  52947. $ctx1.sendIdx["printString"]=4;
  52948. self._assert_equals_($7,"a Set ('foo')");
  52949. $ctx1.sendIdx["assert:equals:"]=4;
  52950. $recv(set)._add_((3));
  52951. $ctx1.sendIdx["add:"]=4;
  52952. $8=$recv(set)._printString();
  52953. $ctx1.sendIdx["printString"]=5;
  52954. self._assert_equals_($8,"a Set (3 'foo')");
  52955. $ctx1.sendIdx["assert:equals:"]=5;
  52956. $recv(set)._add_((3));
  52957. self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  52958. return self;
  52959. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  52960. },
  52961. args: [],
  52962. 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'')'",
  52963. referencedClasses: ["Set"],
  52964. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  52965. }),
  52966. $globals.SetTest);
  52967. $core.addMethod(
  52968. $core.method({
  52969. selector: "testUnboxedObjects",
  52970. protocol: 'tests',
  52971. fn: function (){
  52972. var self=this;
  52973. return $core.withContext(function($ctx1) {
  52974. var $4,$3,$2,$1;
  52975. $4="foo"._yourself();
  52976. $ctx1.sendIdx["yourself"]=1;
  52977. $3=[$4,"foo"._yourself()];
  52978. $2=$recv($3)._asSet();
  52979. $1=$recv($2)._asArray();
  52980. self._assert_equals_($1,["foo"]);
  52981. return self;
  52982. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  52983. },
  52984. args: [],
  52985. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  52986. referencedClasses: [],
  52987. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  52988. }),
  52989. $globals.SetTest);
  52990. $core.addMethod(
  52991. $core.method({
  52992. selector: "testUnicity",
  52993. protocol: 'tests',
  52994. fn: function (){
  52995. var self=this;
  52996. var set;
  52997. return $core.withContext(function($ctx1) {
  52998. var $1;
  52999. set=$recv($globals.Set)._new();
  53000. $recv(set)._add_((21));
  53001. $ctx1.sendIdx["add:"]=1;
  53002. $recv(set)._add_("hello");
  53003. $ctx1.sendIdx["add:"]=2;
  53004. $recv(set)._add_((21));
  53005. $ctx1.sendIdx["add:"]=3;
  53006. $1=$recv(set)._size();
  53007. $ctx1.sendIdx["size"]=1;
  53008. self._assert_equals_($1,(2));
  53009. $ctx1.sendIdx["assert:equals:"]=1;
  53010. $recv(set)._add_("hello");
  53011. self._assert_equals_($recv(set)._size(),(2));
  53012. $ctx1.sendIdx["assert:equals:"]=2;
  53013. self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  53014. return self;
  53015. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  53016. },
  53017. args: [],
  53018. 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')",
  53019. referencedClasses: ["Set"],
  53020. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  53021. }),
  53022. $globals.SetTest);
  53023. $core.addMethod(
  53024. $core.method({
  53025. selector: "collectionClass",
  53026. protocol: 'fixture',
  53027. fn: function (){
  53028. var self=this;
  53029. return $globals.Set;
  53030. },
  53031. args: [],
  53032. source: "collectionClass\x0a\x09^ Set",
  53033. referencedClasses: ["Set"],
  53034. messageSends: []
  53035. }),
  53036. $globals.SetTest.klass);
  53037. $core.addClass('ConsoleTranscriptTest', $globals.TestCase, [], 'Kernel-Tests');
  53038. $core.addMethod(
  53039. $core.method({
  53040. selector: "testShow",
  53041. protocol: 'tests',
  53042. fn: function (){
  53043. var self=this;
  53044. var originalTranscript;
  53045. return $core.withContext(function($ctx1) {
  53046. originalTranscript=$recv($globals.Transcript)._current();
  53047. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  53048. $ctx1.sendIdx["register:"]=1;
  53049. self._shouldnt_raise_((function(){
  53050. return $core.withContext(function($ctx2) {
  53051. return $recv($globals.Transcript)._show_("Hello console!");
  53052. $ctx2.sendIdx["show:"]=1;
  53053. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53054. }),$globals.Error);
  53055. $ctx1.sendIdx["shouldnt:raise:"]=1;
  53056. self._shouldnt_raise_((function(){
  53057. return $core.withContext(function($ctx2) {
  53058. return $recv($globals.Transcript)._show_(console);
  53059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53060. }),$globals.Error);
  53061. $recv($globals.Transcript)._register_(originalTranscript);
  53062. return self;
  53063. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  53064. },
  53065. args: [],
  53066. 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.",
  53067. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  53068. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  53069. }),
  53070. $globals.ConsoleTranscriptTest);
  53071. $core.addClass('DateTest', $globals.TestCase, [], 'Kernel-Tests');
  53072. $core.addMethod(
  53073. $core.method({
  53074. selector: "testEquality",
  53075. protocol: 'tests',
  53076. fn: function (){
  53077. var self=this;
  53078. var now;
  53079. return $core.withContext(function($ctx1) {
  53080. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  53081. now=$recv($globals.Date)._new();
  53082. $1=$recv(now).__eq(now);
  53083. $ctx1.sendIdx["="]=1;
  53084. self._assert_($1);
  53085. $ctx1.sendIdx["assert:"]=1;
  53086. $3=now;
  53087. $4=$recv($globals.Date)._fromMilliseconds_((0));
  53088. $ctx1.sendIdx["fromMilliseconds:"]=1;
  53089. $2=$recv($3).__eq($4);
  53090. $ctx1.sendIdx["="]=2;
  53091. self._deny_($2);
  53092. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  53093. $ctx1.sendIdx["fromMilliseconds:"]=2;
  53094. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  53095. $ctx1.sendIdx["fromMilliseconds:"]=3;
  53096. $5=$recv($6).__eq($7);
  53097. $ctx1.sendIdx["="]=3;
  53098. self._assert_($5);
  53099. $ctx1.sendIdx["assert:"]=2;
  53100. $9=now;
  53101. $11=$recv(now)._asMilliseconds();
  53102. $ctx1.sendIdx["asMilliseconds"]=1;
  53103. $10=$recv($globals.Date)._fromMilliseconds_($11);
  53104. $ctx1.sendIdx["fromMilliseconds:"]=4;
  53105. $8=$recv($9).__eq($10);
  53106. $ctx1.sendIdx["="]=4;
  53107. self._assert_($8);
  53108. $ctx1.sendIdx["assert:"]=3;
  53109. self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  53110. return self;
  53111. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  53112. },
  53113. args: [],
  53114. 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",
  53115. referencedClasses: ["Date"],
  53116. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  53117. }),
  53118. $globals.DateTest);
  53119. $core.addMethod(
  53120. $core.method({
  53121. selector: "testIdentity",
  53122. protocol: 'tests',
  53123. fn: function (){
  53124. var self=this;
  53125. var now;
  53126. return $core.withContext(function($ctx1) {
  53127. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  53128. now=$recv($globals.Date)._new();
  53129. $1=$recv(now).__eq_eq(now);
  53130. $ctx1.sendIdx["=="]=1;
  53131. self._assert_($1);
  53132. $3=now;
  53133. $4=$recv($globals.Date)._fromMilliseconds_((0));
  53134. $ctx1.sendIdx["fromMilliseconds:"]=1;
  53135. $2=$recv($3).__eq_eq($4);
  53136. $ctx1.sendIdx["=="]=2;
  53137. self._deny_($2);
  53138. $ctx1.sendIdx["deny:"]=1;
  53139. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  53140. $ctx1.sendIdx["fromMilliseconds:"]=2;
  53141. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  53142. $ctx1.sendIdx["fromMilliseconds:"]=3;
  53143. $5=$recv($6).__eq_eq($7);
  53144. $ctx1.sendIdx["=="]=3;
  53145. self._deny_($5);
  53146. $ctx1.sendIdx["deny:"]=2;
  53147. $9=now;
  53148. $11=$recv(now)._asMilliseconds();
  53149. $ctx1.sendIdx["asMilliseconds"]=1;
  53150. $10=$recv($globals.Date)._fromMilliseconds_($11);
  53151. $ctx1.sendIdx["fromMilliseconds:"]=4;
  53152. $8=$recv($9).__eq_eq($10);
  53153. $ctx1.sendIdx["=="]=4;
  53154. self._deny_($8);
  53155. $ctx1.sendIdx["deny:"]=3;
  53156. self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  53157. return self;
  53158. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  53159. },
  53160. args: [],
  53161. 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",
  53162. referencedClasses: ["Date"],
  53163. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  53164. }),
  53165. $globals.DateTest);
  53166. $core.addClass('JSObjectProxyTest', $globals.TestCase, [], 'Kernel-Tests');
  53167. $core.addMethod(
  53168. $core.method({
  53169. selector: "jsNull",
  53170. protocol: 'accessing',
  53171. fn: function (){
  53172. var self=this;
  53173. return $core.withContext(function($ctx1) {
  53174. return null;
  53175. return self;
  53176. }, function($ctx1) {$ctx1.fill(self,"jsNull",{},$globals.JSObjectProxyTest)});
  53177. },
  53178. args: [],
  53179. source: "jsNull\x0a\x09<return null>",
  53180. referencedClasses: [],
  53181. messageSends: []
  53182. }),
  53183. $globals.JSObjectProxyTest);
  53184. $core.addMethod(
  53185. $core.method({
  53186. selector: "jsObject",
  53187. protocol: 'accessing',
  53188. fn: function (){
  53189. var self=this;
  53190. return $core.withContext(function($ctx1) {
  53191. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  53192. return self;
  53193. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  53194. },
  53195. args: [],
  53196. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  53197. referencedClasses: [],
  53198. messageSends: []
  53199. }),
  53200. $globals.JSObjectProxyTest);
  53201. $core.addMethod(
  53202. $core.method({
  53203. selector: "jsUndefined",
  53204. protocol: 'accessing',
  53205. fn: function (){
  53206. var self=this;
  53207. return $core.withContext(function($ctx1) {
  53208. return;
  53209. return self;
  53210. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  53211. },
  53212. args: [],
  53213. source: "jsUndefined\x0a\x09<return>",
  53214. referencedClasses: [],
  53215. messageSends: []
  53216. }),
  53217. $globals.JSObjectProxyTest);
  53218. $core.addMethod(
  53219. $core.method({
  53220. selector: "testAtIfAbsent",
  53221. protocol: 'tests',
  53222. fn: function (){
  53223. var self=this;
  53224. var testObject;
  53225. return $core.withContext(function($ctx1) {
  53226. var $1,$2,$3;
  53227. testObject=self._jsObject();
  53228. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  53229. return "Property does not exist";
  53230. }));
  53231. $ctx1.sendIdx["at:ifAbsent:"]=1;
  53232. self._assert_equals_($1,"Property does not exist");
  53233. $ctx1.sendIdx["assert:equals:"]=1;
  53234. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  53235. return "Property does not exist";
  53236. }));
  53237. $ctx1.sendIdx["at:ifAbsent:"]=2;
  53238. self._assert_equals_($2,nil);
  53239. $ctx1.sendIdx["assert:equals:"]=2;
  53240. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  53241. return "Property does not exist";
  53242. }));
  53243. $ctx1.sendIdx["at:ifAbsent:"]=3;
  53244. self._assert_equals_($3,(1));
  53245. $ctx1.sendIdx["assert:equals:"]=3;
  53246. self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  53247. return "Property does not exist";
  53248. })),nil);
  53249. return self;
  53250. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53251. },
  53252. args: [],
  53253. 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.",
  53254. referencedClasses: [],
  53255. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  53256. }),
  53257. $globals.JSObjectProxyTest);
  53258. $core.addMethod(
  53259. $core.method({
  53260. selector: "testAtIfPresent",
  53261. protocol: 'tests',
  53262. fn: function (){
  53263. var self=this;
  53264. var testObject;
  53265. return $core.withContext(function($ctx1) {
  53266. var $2,$1,$4,$3,$6,$5;
  53267. testObject=self._jsObject();
  53268. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  53269. return $core.withContext(function($ctx2) {
  53270. $2=$recv(x)._asString();
  53271. $ctx2.sendIdx["asString"]=1;
  53272. return "hello ".__comma($2);
  53273. $ctx2.sendIdx[","]=1;
  53274. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53275. }));
  53276. $ctx1.sendIdx["at:ifPresent:"]=1;
  53277. self._assert_equals_($1,nil);
  53278. $ctx1.sendIdx["assert:equals:"]=1;
  53279. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  53280. return $core.withContext(function($ctx2) {
  53281. $4=$recv(x)._asString();
  53282. $ctx2.sendIdx["asString"]=2;
  53283. return "hello ".__comma($4);
  53284. $ctx2.sendIdx[","]=2;
  53285. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  53286. }));
  53287. $ctx1.sendIdx["at:ifPresent:"]=2;
  53288. self._assert_equals_($3,"hello nil");
  53289. $ctx1.sendIdx["assert:equals:"]=2;
  53290. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  53291. return $core.withContext(function($ctx2) {
  53292. $6=$recv(x)._asString();
  53293. $ctx2.sendIdx["asString"]=3;
  53294. return "hello ".__comma($6);
  53295. $ctx2.sendIdx[","]=3;
  53296. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  53297. }));
  53298. $ctx1.sendIdx["at:ifPresent:"]=3;
  53299. self._assert_equals_($5,"hello 1");
  53300. $ctx1.sendIdx["assert:equals:"]=3;
  53301. self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  53302. return $core.withContext(function($ctx2) {
  53303. return "hello ".__comma($recv(x)._asString());
  53304. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  53305. })),"hello nil");
  53306. return self;
  53307. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53308. },
  53309. args: [],
  53310. 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'.",
  53311. referencedClasses: [],
  53312. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  53313. }),
  53314. $globals.JSObjectProxyTest);
  53315. $core.addMethod(
  53316. $core.method({
  53317. selector: "testAtIfPresentIfAbsent",
  53318. protocol: 'tests',
  53319. fn: function (){
  53320. var self=this;
  53321. var testObject;
  53322. return $core.withContext(function($ctx1) {
  53323. var $2,$1,$4,$3,$6,$5;
  53324. testObject=self._jsObject();
  53325. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  53326. return $core.withContext(function($ctx2) {
  53327. $2=$recv(x)._asString();
  53328. $ctx2.sendIdx["asString"]=1;
  53329. return "hello ".__comma($2);
  53330. $ctx2.sendIdx[","]=1;
  53331. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  53332. }),(function(){
  53333. return "not present";
  53334. }));
  53335. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  53336. self._assert_equals_($1,"not present");
  53337. $ctx1.sendIdx["assert:equals:"]=1;
  53338. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  53339. return $core.withContext(function($ctx2) {
  53340. $4=$recv(x)._asString();
  53341. $ctx2.sendIdx["asString"]=2;
  53342. return "hello ".__comma($4);
  53343. $ctx2.sendIdx[","]=2;
  53344. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  53345. }),(function(){
  53346. return "not present";
  53347. }));
  53348. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  53349. self._assert_equals_($3,"hello nil");
  53350. $ctx1.sendIdx["assert:equals:"]=2;
  53351. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  53352. return $core.withContext(function($ctx2) {
  53353. $6=$recv(x)._asString();
  53354. $ctx2.sendIdx["asString"]=3;
  53355. return "hello ".__comma($6);
  53356. $ctx2.sendIdx[","]=3;
  53357. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  53358. }),(function(){
  53359. return "not present";
  53360. }));
  53361. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  53362. self._assert_equals_($5,"hello 1");
  53363. $ctx1.sendIdx["assert:equals:"]=3;
  53364. self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  53365. return $core.withContext(function($ctx2) {
  53366. return "hello ".__comma($recv(x)._asString());
  53367. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  53368. }),(function(){
  53369. return "not present";
  53370. })),"hello nil");
  53371. return self;
  53372. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  53373. },
  53374. args: [],
  53375. 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'.",
  53376. referencedClasses: [],
  53377. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  53378. }),
  53379. $globals.JSObjectProxyTest);
  53380. $core.addMethod(
  53381. $core.method({
  53382. selector: "testAtPut",
  53383. protocol: 'tests',
  53384. fn: function (){
  53385. var self=this;
  53386. var testObject;
  53387. return $core.withContext(function($ctx1) {
  53388. var $2,$1;
  53389. testObject=self._jsObject();
  53390. $2=$recv(testObject)._at_("abc");
  53391. $ctx1.sendIdx["at:"]=1;
  53392. $1=$recv($2).__tild_eq("xyz");
  53393. self._assert_($1);
  53394. self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  53395. $ctx1.sendIdx["assert:equals:"]=1;
  53396. self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  53397. return self;
  53398. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  53399. },
  53400. args: [],
  53401. 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'",
  53402. referencedClasses: [],
  53403. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  53404. }),
  53405. $globals.JSObjectProxyTest);
  53406. $core.addMethod(
  53407. $core.method({
  53408. selector: "testComparison",
  53409. protocol: 'tests',
  53410. fn: function (){
  53411. var self=this;
  53412. return $core.withContext(function($ctx1) {
  53413. var $1,$2;
  53414. self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  53415. $1=$recv(console).__eq(console);
  53416. $ctx1.sendIdx["="]=1;
  53417. self._assert_($1);
  53418. $2=$recv(console).__eq($recv($globals.Object)._new());
  53419. $ctx1.sendIdx["="]=2;
  53420. self._deny_($2);
  53421. $ctx1.sendIdx["deny:"]=1;
  53422. self._deny_($recv(console).__eq(self._jsObject()));
  53423. return self;
  53424. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  53425. },
  53426. args: [],
  53427. 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",
  53428. referencedClasses: ["Object"],
  53429. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  53430. }),
  53431. $globals.JSObjectProxyTest);
  53432. $core.addMethod(
  53433. $core.method({
  53434. selector: "testDNU",
  53435. protocol: 'tests',
  53436. fn: function (){
  53437. var self=this;
  53438. return $core.withContext(function($ctx1) {
  53439. self._should_raise_((function(){
  53440. return $core.withContext(function($ctx2) {
  53441. return $recv(self._jsObject())._foo();
  53442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53443. }),$globals.MessageNotUnderstood);
  53444. return self;
  53445. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  53446. },
  53447. args: [],
  53448. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  53449. referencedClasses: ["MessageNotUnderstood"],
  53450. messageSends: ["should:raise:", "foo", "jsObject"]
  53451. }),
  53452. $globals.JSObjectProxyTest);
  53453. $core.addMethod(
  53454. $core.method({
  53455. selector: "testDNURegression1057",
  53456. protocol: 'tests',
  53457. fn: function (){
  53458. var self=this;
  53459. var jsObject;
  53460. return $core.withContext(function($ctx1) {
  53461. var $1;
  53462. jsObject=[];
  53463. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53464. $ctx1.sendIdx["basicAt:put:"]=1;
  53465. $recv(jsObject)._basicAt_put_("foo",(3));
  53466. self._shouldnt_raise_((function(){
  53467. return $core.withContext(function($ctx2) {
  53468. return $recv(jsObject)._foo();
  53469. $ctx2.sendIdx["foo"]=1;
  53470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53471. }),$globals.Error);
  53472. $ctx1.sendIdx["shouldnt:raise:"]=1;
  53473. $1=$recv(jsObject)._foo();
  53474. $ctx1.sendIdx["foo"]=2;
  53475. self._assert_equals_($1,(3));
  53476. $ctx1.sendIdx["assert:equals:"]=1;
  53477. self._shouldnt_raise_((function(){
  53478. return $core.withContext(function($ctx2) {
  53479. return $recv(jsObject)._foo_((4));
  53480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53481. }),$globals.Error);
  53482. self._assert_equals_($recv(jsObject)._foo(),(4));
  53483. return self;
  53484. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1057",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53485. },
  53486. args: [],
  53487. 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",
  53488. referencedClasses: ["Error"],
  53489. messageSends: ["basicAt:put:", "shouldnt:raise:", "foo", "assert:equals:", "foo:"]
  53490. }),
  53491. $globals.JSObjectProxyTest);
  53492. $core.addMethod(
  53493. $core.method({
  53494. selector: "testDNURegression1059",
  53495. protocol: 'tests',
  53496. fn: function (){
  53497. var self=this;
  53498. var jsObject;
  53499. return $core.withContext(function($ctx1) {
  53500. jsObject=[];
  53501. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53502. $ctx1.sendIdx["basicAt:put:"]=1;
  53503. $recv(jsObject)._basicAt_put_("x",(3));
  53504. $ctx1.sendIdx["basicAt:put:"]=2;
  53505. $recv(jsObject)._basicAt_put_("x:",(function(){
  53506. return $core.withContext(function($ctx2) {
  53507. return self._error();
  53508. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53509. }));
  53510. self._shouldnt_raise_((function(){
  53511. return $core.withContext(function($ctx2) {
  53512. return $recv(jsObject)._x_((4));
  53513. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53514. }),$globals.Error);
  53515. self._assert_equals_($recv(jsObject)._x(),(4));
  53516. return self;
  53517. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1059",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53518. },
  53519. args: [],
  53520. 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",
  53521. referencedClasses: ["Error"],
  53522. messageSends: ["basicAt:put:", "error", "shouldnt:raise:", "x:", "assert:equals:", "x"]
  53523. }),
  53524. $globals.JSObjectProxyTest);
  53525. $core.addMethod(
  53526. $core.method({
  53527. selector: "testDNURegression1062",
  53528. protocol: 'tests',
  53529. fn: function (){
  53530. var self=this;
  53531. var jsObject,stored;
  53532. return $core.withContext(function($ctx1) {
  53533. jsObject=[];
  53534. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53535. $ctx1.sendIdx["basicAt:put:"]=1;
  53536. $recv(jsObject)._basicAt_put_("x",(function(v){
  53537. stored=v;
  53538. return stored;
  53539. }));
  53540. self._shouldnt_raise_((function(){
  53541. return $core.withContext(function($ctx2) {
  53542. return $recv(jsObject)._x_((4));
  53543. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53544. }),$globals.Error);
  53545. self._assert_equals_(stored,(4));
  53546. return self;
  53547. }, function($ctx1) {$ctx1.fill(self,"testDNURegression1062",{jsObject:jsObject,stored:stored},$globals.JSObjectProxyTest)});
  53548. },
  53549. args: [],
  53550. 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",
  53551. referencedClasses: ["Error"],
  53552. messageSends: ["basicAt:put:", "shouldnt:raise:", "x:", "assert:equals:"]
  53553. }),
  53554. $globals.JSObjectProxyTest);
  53555. $core.addMethod(
  53556. $core.method({
  53557. selector: "testDNUWithAllowJavaScriptCalls",
  53558. protocol: 'tests',
  53559. fn: function (){
  53560. var self=this;
  53561. var jsObject;
  53562. return $core.withContext(function($ctx1) {
  53563. jsObject=[];
  53564. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  53565. self._should_raise_((function(){
  53566. return $core.withContext(function($ctx2) {
  53567. return $recv(jsObject)._foo();
  53568. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53569. }),$globals.MessageNotUnderstood);
  53570. return self;
  53571. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53572. },
  53573. args: [],
  53574. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  53575. referencedClasses: ["MessageNotUnderstood"],
  53576. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  53577. }),
  53578. $globals.JSObjectProxyTest);
  53579. $core.addMethod(
  53580. $core.method({
  53581. selector: "testMessageSend",
  53582. protocol: 'tests',
  53583. fn: function (){
  53584. var self=this;
  53585. return $core.withContext(function($ctx1) {
  53586. var $2,$1,$4,$3;
  53587. $2=self._jsObject();
  53588. $ctx1.sendIdx["jsObject"]=1;
  53589. $1=$recv($2)._a();
  53590. self._assert_equals_($1,(1));
  53591. $ctx1.sendIdx["assert:equals:"]=1;
  53592. $4=self._jsObject();
  53593. $ctx1.sendIdx["jsObject"]=2;
  53594. $3=$recv($4)._b();
  53595. self._assert_equals_($3,(2));
  53596. $ctx1.sendIdx["assert:equals:"]=2;
  53597. self._assert_equals_($recv(self._jsObject())._c_((3)),(3));
  53598. return self;
  53599. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  53600. },
  53601. args: [],
  53602. 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",
  53603. referencedClasses: [],
  53604. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  53605. }),
  53606. $globals.JSObjectProxyTest);
  53607. $core.addMethod(
  53608. $core.method({
  53609. selector: "testMethodWithArguments",
  53610. protocol: 'tests',
  53611. fn: function (){
  53612. var self=this;
  53613. return $core.withContext(function($ctx1) {
  53614. self._assert_equals_($recv(self._jsObject())._c_((1)),(1));
  53615. return self;
  53616. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  53617. },
  53618. args: [],
  53619. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  53620. referencedClasses: [],
  53621. messageSends: ["assert:equals:", "c:", "jsObject"]
  53622. }),
  53623. $globals.JSObjectProxyTest);
  53624. $core.addMethod(
  53625. $core.method({
  53626. selector: "testPrinting",
  53627. protocol: 'tests',
  53628. fn: function (){
  53629. var self=this;
  53630. return $core.withContext(function($ctx1) {
  53631. self._assert_equals_($recv(self._jsObject())._printString(),"[object Object]");
  53632. return self;
  53633. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  53634. },
  53635. args: [],
  53636. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  53637. referencedClasses: [],
  53638. messageSends: ["assert:equals:", "printString", "jsObject"]
  53639. }),
  53640. $globals.JSObjectProxyTest);
  53641. $core.addMethod(
  53642. $core.method({
  53643. selector: "testPropertyThatReturnsEmptyString",
  53644. protocol: 'tests',
  53645. fn: function (){
  53646. var self=this;
  53647. var object;
  53648. return $core.withContext(function($ctx1) {
  53649. var $1;
  53650. object=self._jsObject();
  53651. $1=$recv(object)._d();
  53652. $ctx1.sendIdx["d"]=1;
  53653. self._assert_equals_($1,"");
  53654. $ctx1.sendIdx["assert:equals:"]=1;
  53655. $recv(object)._d_("hello");
  53656. self._assert_equals_($recv(object)._d(),"hello");
  53657. return self;
  53658. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  53659. },
  53660. args: [],
  53661. 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'",
  53662. referencedClasses: [],
  53663. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  53664. }),
  53665. $globals.JSObjectProxyTest);
  53666. $core.addMethod(
  53667. $core.method({
  53668. selector: "testPropertyThatReturnsUndefined",
  53669. protocol: 'tests',
  53670. fn: function (){
  53671. var self=this;
  53672. var object;
  53673. return $core.withContext(function($ctx1) {
  53674. object=self._jsObject();
  53675. self._shouldnt_raise_((function(){
  53676. return $core.withContext(function($ctx2) {
  53677. return $recv(object)._e();
  53678. $ctx2.sendIdx["e"]=1;
  53679. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53680. }),$globals.MessageNotUnderstood);
  53681. self._assert_($recv($recv(object)._e())._isNil());
  53682. return self;
  53683. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  53684. },
  53685. args: [],
  53686. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  53687. referencedClasses: ["MessageNotUnderstood"],
  53688. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  53689. }),
  53690. $globals.JSObjectProxyTest);
  53691. $core.addMethod(
  53692. $core.method({
  53693. selector: "testSetPropertyWithFalsyValue",
  53694. protocol: 'tests',
  53695. fn: function (){
  53696. var self=this;
  53697. var jsObject;
  53698. return $core.withContext(function($ctx1) {
  53699. var $1,$2,$3,$4,$5;
  53700. jsObject=self._jsObject();
  53701. $1=$recv(jsObject)._a();
  53702. $ctx1.sendIdx["a"]=1;
  53703. self._assert_equals_($1,(1));
  53704. $ctx1.sendIdx["assert:equals:"]=1;
  53705. $recv(jsObject)._a_(self._jsNull());
  53706. $ctx1.sendIdx["a:"]=1;
  53707. $2=$recv(jsObject)._a();
  53708. $ctx1.sendIdx["a"]=2;
  53709. self._assert_equals_($2,nil);
  53710. $ctx1.sendIdx["assert:equals:"]=2;
  53711. $recv(jsObject)._a_((0));
  53712. $ctx1.sendIdx["a:"]=2;
  53713. $3=$recv(jsObject)._a();
  53714. $ctx1.sendIdx["a"]=3;
  53715. self._assert_equals_($3,(0));
  53716. $ctx1.sendIdx["assert:equals:"]=3;
  53717. $recv(jsObject)._a_(self._jsUndefined());
  53718. $ctx1.sendIdx["a:"]=3;
  53719. $4=$recv(jsObject)._a();
  53720. $ctx1.sendIdx["a"]=4;
  53721. self._assert_equals_($4,nil);
  53722. $ctx1.sendIdx["assert:equals:"]=4;
  53723. $recv(jsObject)._a_("");
  53724. $ctx1.sendIdx["a:"]=4;
  53725. $5=$recv(jsObject)._a();
  53726. $ctx1.sendIdx["a"]=5;
  53727. self._assert_equals_($5,"");
  53728. $ctx1.sendIdx["assert:equals:"]=5;
  53729. $recv(jsObject)._a_(false);
  53730. self._assert_equals_($recv(jsObject)._a(),false);
  53731. return self;
  53732. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  53733. },
  53734. args: [],
  53735. 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",
  53736. referencedClasses: [],
  53737. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"]
  53738. }),
  53739. $globals.JSObjectProxyTest);
  53740. $core.addMethod(
  53741. $core.method({
  53742. selector: "testValue",
  53743. protocol: 'tests',
  53744. fn: function (){
  53745. var self=this;
  53746. var testObject;
  53747. return $core.withContext(function($ctx1) {
  53748. testObject=self._jsObject();
  53749. $recv(testObject)._at_put_("value","aValue");
  53750. self._assert_equals_($recv(testObject)._value(),"aValue");
  53751. return self;
  53752. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  53753. },
  53754. args: [],
  53755. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  53756. referencedClasses: [],
  53757. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  53758. }),
  53759. $globals.JSObjectProxyTest);
  53760. $core.addMethod(
  53761. $core.method({
  53762. selector: "testYourself",
  53763. protocol: 'tests',
  53764. fn: function (){
  53765. var self=this;
  53766. var object;
  53767. return $core.withContext(function($ctx1) {
  53768. var $1;
  53769. $1=self._jsObject();
  53770. $recv($1)._d_("test");
  53771. object=$recv($1)._yourself();
  53772. self._assert_equals_($recv(object)._d(),"test");
  53773. return self;
  53774. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  53775. },
  53776. args: [],
  53777. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  53778. referencedClasses: [],
  53779. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  53780. }),
  53781. $globals.JSObjectProxyTest);
  53782. $core.addClass('JavaScriptExceptionTest', $globals.TestCase, [], 'Kernel-Tests');
  53783. $core.addMethod(
  53784. $core.method({
  53785. selector: "testCatchingException",
  53786. protocol: 'tests',
  53787. fn: function (){
  53788. var self=this;
  53789. return $core.withContext(function($ctx1) {
  53790. $recv((function(){
  53791. return $core.withContext(function($ctx2) {
  53792. return self._throwException();
  53793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53794. }))._on_do_($globals.Error,(function(error){
  53795. return $core.withContext(function($ctx2) {
  53796. return self._assert_($recv($recv(error)._exception()).__eq("test"));
  53797. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  53798. }));
  53799. return self;
  53800. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  53801. },
  53802. args: [],
  53803. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  53804. referencedClasses: ["Error"],
  53805. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  53806. }),
  53807. $globals.JavaScriptExceptionTest);
  53808. $core.addMethod(
  53809. $core.method({
  53810. selector: "testRaisingException",
  53811. protocol: 'tests',
  53812. fn: function (){
  53813. var self=this;
  53814. return $core.withContext(function($ctx1) {
  53815. self._should_raise_((function(){
  53816. return $core.withContext(function($ctx2) {
  53817. return self._throwException();
  53818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53819. }),$globals.JavaScriptException);
  53820. return self;
  53821. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  53822. },
  53823. args: [],
  53824. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  53825. referencedClasses: ["JavaScriptException"],
  53826. messageSends: ["should:raise:", "throwException"]
  53827. }),
  53828. $globals.JavaScriptExceptionTest);
  53829. $core.addMethod(
  53830. $core.method({
  53831. selector: "throwException",
  53832. protocol: 'helpers',
  53833. fn: function (){
  53834. var self=this;
  53835. return $core.withContext(function($ctx1) {
  53836. throw 'test';
  53837. return self;
  53838. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  53839. },
  53840. args: [],
  53841. source: "throwException\x0a\x09<throw 'test'>",
  53842. referencedClasses: [],
  53843. messageSends: []
  53844. }),
  53845. $globals.JavaScriptExceptionTest);
  53846. $core.addClass('MessageSendTest', $globals.TestCase, [], 'Kernel-Tests');
  53847. $core.addMethod(
  53848. $core.method({
  53849. selector: "testValue",
  53850. protocol: 'tests',
  53851. fn: function (){
  53852. var self=this;
  53853. var messageSend;
  53854. return $core.withContext(function($ctx1) {
  53855. var $1;
  53856. $1=$recv($globals.MessageSend)._new();
  53857. $ctx1.sendIdx["new"]=1;
  53858. $recv($1)._receiver_($recv($globals.Object)._new());
  53859. $recv($1)._selector_("asString");
  53860. messageSend=$recv($1)._yourself();
  53861. self._assert_equals_($recv(messageSend)._value(),"an Object");
  53862. return self;
  53863. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  53864. },
  53865. args: [],
  53866. 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'",
  53867. referencedClasses: ["MessageSend", "Object"],
  53868. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  53869. }),
  53870. $globals.MessageSendTest);
  53871. $core.addMethod(
  53872. $core.method({
  53873. selector: "testValueWithArguments",
  53874. protocol: 'tests',
  53875. fn: function (){
  53876. var self=this;
  53877. var messageSend;
  53878. return $core.withContext(function($ctx1) {
  53879. var $1;
  53880. $1=$recv($globals.MessageSend)._new();
  53881. $recv($1)._receiver_((2));
  53882. $recv($1)._selector_("+");
  53883. messageSend=$recv($1)._yourself();
  53884. self._assert_equals_($recv(messageSend)._value_((3)),(5));
  53885. $ctx1.sendIdx["assert:equals:"]=1;
  53886. self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  53887. return self;
  53888. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  53889. },
  53890. args: [],
  53891. 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",
  53892. referencedClasses: ["MessageSend"],
  53893. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  53894. }),
  53895. $globals.MessageSendTest);
  53896. $core.addClass('MethodInheritanceTest', $globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  53897. $core.addMethod(
  53898. $core.method({
  53899. selector: "codeGeneratorClass",
  53900. protocol: 'accessing',
  53901. fn: function (){
  53902. var self=this;
  53903. return $globals.CodeGenerator;
  53904. },
  53905. args: [],
  53906. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  53907. referencedClasses: ["CodeGenerator"],
  53908. messageSends: []
  53909. }),
  53910. $globals.MethodInheritanceTest);
  53911. $core.addMethod(
  53912. $core.method({
  53913. selector: "compiler",
  53914. protocol: 'factory',
  53915. fn: function (){
  53916. var self=this;
  53917. return $core.withContext(function($ctx1) {
  53918. var $1;
  53919. $1=$recv($globals.Compiler)._new();
  53920. $recv($1)._codeGeneratorClass_(self._codeGeneratorClass());
  53921. return $recv($1)._yourself();
  53922. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  53923. },
  53924. args: [],
  53925. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  53926. referencedClasses: ["Compiler"],
  53927. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  53928. }),
  53929. $globals.MethodInheritanceTest);
  53930. $core.addMethod(
  53931. $core.method({
  53932. selector: "deinstallBottom",
  53933. protocol: 'testing',
  53934. fn: function (){
  53935. var self=this;
  53936. return $core.withContext(function($ctx1) {
  53937. $recv(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  53938. return self;
  53939. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  53940. },
  53941. args: [],
  53942. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  53943. referencedClasses: [],
  53944. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  53945. }),
  53946. $globals.MethodInheritanceTest);
  53947. $core.addMethod(
  53948. $core.method({
  53949. selector: "deinstallMiddle",
  53950. protocol: 'testing',
  53951. fn: function (){
  53952. var self=this;
  53953. return $core.withContext(function($ctx1) {
  53954. $recv(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  53955. return self;
  53956. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  53957. },
  53958. args: [],
  53959. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  53960. referencedClasses: [],
  53961. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  53962. }),
  53963. $globals.MethodInheritanceTest);
  53964. $core.addMethod(
  53965. $core.method({
  53966. selector: "deinstallTop",
  53967. protocol: 'testing',
  53968. fn: function (){
  53969. var self=this;
  53970. return $core.withContext(function($ctx1) {
  53971. $recv(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  53972. return self;
  53973. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  53974. },
  53975. args: [],
  53976. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  53977. referencedClasses: [],
  53978. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  53979. }),
  53980. $globals.MethodInheritanceTest);
  53981. $core.addMethod(
  53982. $core.method({
  53983. selector: "installBottom:",
  53984. protocol: 'testing',
  53985. fn: function (aString){
  53986. var self=this;
  53987. return $core.withContext(function($ctx1) {
  53988. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  53989. return self;
  53990. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  53991. },
  53992. args: ["aString"],
  53993. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  53994. referencedClasses: [],
  53995. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  53996. }),
  53997. $globals.MethodInheritanceTest);
  53998. $core.addMethod(
  53999. $core.method({
  54000. selector: "installMiddle:",
  54001. protocol: 'testing',
  54002. fn: function (aString){
  54003. var self=this;
  54004. return $core.withContext(function($ctx1) {
  54005. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  54006. return self;
  54007. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  54008. },
  54009. args: ["aString"],
  54010. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  54011. referencedClasses: [],
  54012. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  54013. }),
  54014. $globals.MethodInheritanceTest);
  54015. $core.addMethod(
  54016. $core.method({
  54017. selector: "installTop:",
  54018. protocol: 'testing',
  54019. fn: function (aString){
  54020. var self=this;
  54021. return $core.withContext(function($ctx1) {
  54022. self["@method"]=$recv(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  54023. return self;
  54024. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  54025. },
  54026. args: ["aString"],
  54027. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  54028. referencedClasses: [],
  54029. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  54030. }),
  54031. $globals.MethodInheritanceTest);
  54032. $core.addMethod(
  54033. $core.method({
  54034. selector: "setUp",
  54035. protocol: 'initialization',
  54036. fn: function (){
  54037. var self=this;
  54038. return $core.withContext(function($ctx1) {
  54039. self["@receiverTop"]=$recv(self._targetClassTop())._new();
  54040. $ctx1.sendIdx["new"]=1;
  54041. self["@receiverMiddle"]=$recv(self._targetClassMiddle())._new();
  54042. $ctx1.sendIdx["new"]=2;
  54043. self["@receiverBottom"]=$recv(self._targetClassBottom())._new();
  54044. self["@method"]=nil;
  54045. self["@performBlock"]=(function(){
  54046. return $core.withContext(function($ctx2) {
  54047. return self._error_("performBlock not initialized");
  54048. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54049. });
  54050. return self;
  54051. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  54052. },
  54053. args: [],
  54054. 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' ]",
  54055. referencedClasses: [],
  54056. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  54057. }),
  54058. $globals.MethodInheritanceTest);
  54059. $core.addMethod(
  54060. $core.method({
  54061. selector: "shouldMNU",
  54062. protocol: 'testing',
  54063. fn: function (){
  54064. var self=this;
  54065. return $core.withContext(function($ctx1) {
  54066. self._shouldMNUTop();
  54067. self._shouldMNUMiddle();
  54068. self._shouldMNUBottom();
  54069. return self;
  54070. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  54071. },
  54072. args: [],
  54073. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  54074. referencedClasses: [],
  54075. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  54076. }),
  54077. $globals.MethodInheritanceTest);
  54078. $core.addMethod(
  54079. $core.method({
  54080. selector: "shouldMNUBottom",
  54081. protocol: 'testing',
  54082. fn: function (){
  54083. var self=this;
  54084. return $core.withContext(function($ctx1) {
  54085. self._should_raise_((function(){
  54086. return $core.withContext(function($ctx2) {
  54087. return $recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54089. }),$globals.MessageNotUnderstood);
  54090. return self;
  54091. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  54092. },
  54093. args: [],
  54094. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  54095. referencedClasses: ["MessageNotUnderstood"],
  54096. messageSends: ["should:raise:", "value:"]
  54097. }),
  54098. $globals.MethodInheritanceTest);
  54099. $core.addMethod(
  54100. $core.method({
  54101. selector: "shouldMNUMiddle",
  54102. protocol: 'testing',
  54103. fn: function (){
  54104. var self=this;
  54105. return $core.withContext(function($ctx1) {
  54106. self._should_raise_((function(){
  54107. return $core.withContext(function($ctx2) {
  54108. return $recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54110. }),$globals.MessageNotUnderstood);
  54111. return self;
  54112. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  54113. },
  54114. args: [],
  54115. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  54116. referencedClasses: ["MessageNotUnderstood"],
  54117. messageSends: ["should:raise:", "value:"]
  54118. }),
  54119. $globals.MethodInheritanceTest);
  54120. $core.addMethod(
  54121. $core.method({
  54122. selector: "shouldMNUTop",
  54123. protocol: 'testing',
  54124. fn: function (){
  54125. var self=this;
  54126. return $core.withContext(function($ctx1) {
  54127. self._should_raise_((function(){
  54128. return $core.withContext(function($ctx2) {
  54129. return $recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54131. }),$globals.MessageNotUnderstood);
  54132. return self;
  54133. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  54134. },
  54135. args: [],
  54136. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  54137. referencedClasses: ["MessageNotUnderstood"],
  54138. messageSends: ["should:raise:", "value:"]
  54139. }),
  54140. $globals.MethodInheritanceTest);
  54141. $core.addMethod(
  54142. $core.method({
  54143. selector: "shouldReturn:",
  54144. protocol: 'testing',
  54145. fn: function (anObject){
  54146. var self=this;
  54147. var result;
  54148. return $core.withContext(function($ctx1) {
  54149. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54150. $ctx1.sendIdx["value:"]=1;
  54151. self._assert_equals_(["top",anObject],["top",result]);
  54152. $ctx1.sendIdx["assert:equals:"]=1;
  54153. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54154. $ctx1.sendIdx["value:"]=2;
  54155. self._assert_equals_(["middle",anObject],["middle",result]);
  54156. $ctx1.sendIdx["assert:equals:"]=2;
  54157. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54158. self._assert_equals_(["bottom",anObject],["bottom",result]);
  54159. return self;
  54160. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  54161. },
  54162. args: ["anObject"],
  54163. 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 }",
  54164. referencedClasses: [],
  54165. messageSends: ["value:", "assert:equals:"]
  54166. }),
  54167. $globals.MethodInheritanceTest);
  54168. $core.addMethod(
  54169. $core.method({
  54170. selector: "shouldReturn:and:and:",
  54171. protocol: 'testing',
  54172. fn: function (anObject,anObject2,anObject3){
  54173. var self=this;
  54174. var result;
  54175. return $core.withContext(function($ctx1) {
  54176. result=$recv(self["@performBlock"])._value_(self["@receiverTop"]);
  54177. $ctx1.sendIdx["value:"]=1;
  54178. self._assert_equals_(["top",anObject],["top",result]);
  54179. $ctx1.sendIdx["assert:equals:"]=1;
  54180. result=$recv(self["@performBlock"])._value_(self["@receiverMiddle"]);
  54181. $ctx1.sendIdx["value:"]=2;
  54182. self._assert_equals_(["middle",anObject2],["middle",result]);
  54183. $ctx1.sendIdx["assert:equals:"]=2;
  54184. result=$recv(self["@performBlock"])._value_(self["@receiverBottom"]);
  54185. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  54186. return self;
  54187. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  54188. },
  54189. args: ["anObject", "anObject2", "anObject3"],
  54190. 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 }",
  54191. referencedClasses: [],
  54192. messageSends: ["value:", "assert:equals:"]
  54193. }),
  54194. $globals.MethodInheritanceTest);
  54195. $core.addMethod(
  54196. $core.method({
  54197. selector: "targetClassBottom",
  54198. protocol: 'accessing',
  54199. fn: function (){
  54200. var self=this;
  54201. return $globals.JavaScriptException;
  54202. },
  54203. args: [],
  54204. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  54205. referencedClasses: ["JavaScriptException"],
  54206. messageSends: []
  54207. }),
  54208. $globals.MethodInheritanceTest);
  54209. $core.addMethod(
  54210. $core.method({
  54211. selector: "targetClassMiddle",
  54212. protocol: 'accessing',
  54213. fn: function (){
  54214. var self=this;
  54215. return $globals.Error;
  54216. },
  54217. args: [],
  54218. source: "targetClassMiddle\x0a\x09^ Error",
  54219. referencedClasses: ["Error"],
  54220. messageSends: []
  54221. }),
  54222. $globals.MethodInheritanceTest);
  54223. $core.addMethod(
  54224. $core.method({
  54225. selector: "targetClassTop",
  54226. protocol: 'accessing',
  54227. fn: function (){
  54228. var self=this;
  54229. return $globals.Object;
  54230. },
  54231. args: [],
  54232. source: "targetClassTop\x0a\x09^ Object",
  54233. referencedClasses: ["Object"],
  54234. messageSends: []
  54235. }),
  54236. $globals.MethodInheritanceTest);
  54237. $core.addMethod(
  54238. $core.method({
  54239. selector: "tearDown",
  54240. protocol: 'initialization',
  54241. fn: function (){
  54242. var self=this;
  54243. return $core.withContext(function($ctx1) {
  54244. $recv((function(){
  54245. return $core.withContext(function($ctx2) {
  54246. return self._deinstallTop();
  54247. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54248. }))._on_do_($globals.Error,(function(){
  54249. }));
  54250. $ctx1.sendIdx["on:do:"]=1;
  54251. $recv((function(){
  54252. return $core.withContext(function($ctx2) {
  54253. return self._deinstallMiddle();
  54254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  54255. }))._on_do_($globals.Error,(function(){
  54256. }));
  54257. $ctx1.sendIdx["on:do:"]=2;
  54258. $recv((function(){
  54259. return $core.withContext(function($ctx2) {
  54260. return self._deinstallBottom();
  54261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54262. }))._on_do_($globals.Error,(function(){
  54263. }));
  54264. return self;
  54265. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  54266. },
  54267. args: [],
  54268. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  54269. referencedClasses: ["Error"],
  54270. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  54271. }),
  54272. $globals.MethodInheritanceTest);
  54273. $core.addMethod(
  54274. $core.method({
  54275. selector: "testMNU11",
  54276. protocol: 'tests',
  54277. fn: function (){
  54278. var self=this;
  54279. return $core.withContext(function($ctx1) {
  54280. self["@performBlock"]=(function(x){
  54281. return $core.withContext(function($ctx2) {
  54282. return $recv(x)._foo();
  54283. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54284. });
  54285. self._shouldMNU();
  54286. $ctx1.sendIdx["shouldMNU"]=1;
  54287. self._installTop_("foo ^ false");
  54288. $ctx1.sendIdx["installTop:"]=1;
  54289. self._installTop_("foo ^ true");
  54290. self._deinstallTop();
  54291. self._shouldMNU();
  54292. return self;
  54293. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  54294. },
  54295. args: [],
  54296. 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",
  54297. referencedClasses: [],
  54298. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  54299. }),
  54300. $globals.MethodInheritanceTest);
  54301. $core.addMethod(
  54302. $core.method({
  54303. selector: "testMNU22",
  54304. protocol: 'tests',
  54305. fn: function (){
  54306. var self=this;
  54307. return $core.withContext(function($ctx1) {
  54308. self["@performBlock"]=(function(x){
  54309. return $core.withContext(function($ctx2) {
  54310. return $recv(x)._foo();
  54311. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54312. });
  54313. self._shouldMNU();
  54314. $ctx1.sendIdx["shouldMNU"]=1;
  54315. self._installMiddle_("foo ^ false");
  54316. $ctx1.sendIdx["installMiddle:"]=1;
  54317. self._installMiddle_("foo ^ true");
  54318. self._deinstallMiddle();
  54319. self._shouldMNU();
  54320. return self;
  54321. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  54322. },
  54323. args: [],
  54324. 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",
  54325. referencedClasses: [],
  54326. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  54327. }),
  54328. $globals.MethodInheritanceTest);
  54329. $core.addMethod(
  54330. $core.method({
  54331. selector: "testReturns1",
  54332. protocol: 'tests',
  54333. fn: function (){
  54334. var self=this;
  54335. return $core.withContext(function($ctx1) {
  54336. self["@performBlock"]=(function(x){
  54337. return $core.withContext(function($ctx2) {
  54338. return $recv(x)._foo();
  54339. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  54340. });
  54341. self._installTop_("foo ^ false");
  54342. $ctx1.sendIdx["installTop:"]=1;
  54343. self._shouldReturn_(false);
  54344. $ctx1.sendIdx["shouldReturn:"]=1;
  54345. self._installTop_("foo ^ true");
  54346. self._shouldReturn_(true);
  54347. return self;
  54348. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  54349. },
  54350. args: [],
  54351. 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",
  54352. referencedClasses: [],
  54353. messageSends: ["foo", "installTop:", "shouldReturn:"]
  54354. }),
  54355. $globals.MethodInheritanceTest);
  54356. $core.addClass('NumberTest', $globals.TestCase, [], 'Kernel-Tests');
  54357. $core.addMethod(
  54358. $core.method({
  54359. selector: "testAbs",
  54360. protocol: 'tests',
  54361. fn: function (){
  54362. var self=this;
  54363. return $core.withContext(function($ctx1) {
  54364. var $1;
  54365. $1=(4)._abs();
  54366. $ctx1.sendIdx["abs"]=1;
  54367. self._assert_equals_($1,(4));
  54368. $ctx1.sendIdx["assert:equals:"]=1;
  54369. self._assert_equals_((-4)._abs(),(4));
  54370. return self;
  54371. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  54372. },
  54373. args: [],
  54374. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  54375. referencedClasses: [],
  54376. messageSends: ["assert:equals:", "abs"]
  54377. }),
  54378. $globals.NumberTest);
  54379. $core.addMethod(
  54380. $core.method({
  54381. selector: "testArithmetic",
  54382. protocol: 'tests',
  54383. fn: function (){
  54384. var self=this;
  54385. return $core.withContext(function($ctx1) {
  54386. var $1,$2,$3,$5,$4;
  54387. $1=(1.5).__plus((1));
  54388. $ctx1.sendIdx["+"]=1;
  54389. self._assert_equals_($1,(2.5));
  54390. $ctx1.sendIdx["assert:equals:"]=1;
  54391. $2=(2).__minus((1));
  54392. $ctx1.sendIdx["-"]=1;
  54393. self._assert_equals_($2,(1));
  54394. $ctx1.sendIdx["assert:equals:"]=2;
  54395. self._assert_equals_((-2).__minus((1)),(-3));
  54396. $ctx1.sendIdx["assert:equals:"]=3;
  54397. self._assert_equals_((12).__slash((2)),(6));
  54398. $ctx1.sendIdx["assert:equals:"]=4;
  54399. $3=(3).__star((4));
  54400. $ctx1.sendIdx["*"]=1;
  54401. self._assert_equals_($3,(12));
  54402. $ctx1.sendIdx["assert:equals:"]=5;
  54403. self._assert_equals_((7).__slash_slash((2)),(3));
  54404. $ctx1.sendIdx["assert:equals:"]=6;
  54405. self._assert_equals_((7).__backslash_backslash((2)),(1));
  54406. $ctx1.sendIdx["assert:equals:"]=7;
  54407. $5=(1).__plus((2));
  54408. $ctx1.sendIdx["+"]=2;
  54409. $4=$recv($5).__star((3));
  54410. $ctx1.sendIdx["*"]=2;
  54411. self._assert_equals_($4,(9));
  54412. $ctx1.sendIdx["assert:equals:"]=8;
  54413. self._assert_equals_((1).__plus((2).__star((3))),(7));
  54414. return self;
  54415. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  54416. },
  54417. args: [],
  54418. 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",
  54419. referencedClasses: [],
  54420. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  54421. }),
  54422. $globals.NumberTest);
  54423. $core.addMethod(
  54424. $core.method({
  54425. selector: "testAsNumber",
  54426. protocol: 'tests',
  54427. fn: function (){
  54428. var self=this;
  54429. return $core.withContext(function($ctx1) {
  54430. self._assert_equals_((3)._asNumber(),(3));
  54431. return self;
  54432. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  54433. },
  54434. args: [],
  54435. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  54436. referencedClasses: [],
  54437. messageSends: ["assert:equals:", "asNumber"]
  54438. }),
  54439. $globals.NumberTest);
  54440. $core.addMethod(
  54441. $core.method({
  54442. selector: "testCeiling",
  54443. protocol: 'tests',
  54444. fn: function (){
  54445. var self=this;
  54446. return $core.withContext(function($ctx1) {
  54447. var $1,$2;
  54448. $1=(1.2)._ceiling();
  54449. $ctx1.sendIdx["ceiling"]=1;
  54450. self._assert_equals_($1,(2));
  54451. $ctx1.sendIdx["assert:equals:"]=1;
  54452. $2=(-1.2)._ceiling();
  54453. $ctx1.sendIdx["ceiling"]=2;
  54454. self._assert_equals_($2,(-1));
  54455. $ctx1.sendIdx["assert:equals:"]=2;
  54456. self._assert_equals_((1)._ceiling(),(1));
  54457. return self;
  54458. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  54459. },
  54460. args: [],
  54461. 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.",
  54462. referencedClasses: [],
  54463. messageSends: ["assert:equals:", "ceiling"]
  54464. }),
  54465. $globals.NumberTest);
  54466. $core.addMethod(
  54467. $core.method({
  54468. selector: "testComparison",
  54469. protocol: 'tests',
  54470. fn: function (){
  54471. var self=this;
  54472. return $core.withContext(function($ctx1) {
  54473. var $1,$2,$3,$4;
  54474. $1=(3).__gt((2));
  54475. $ctx1.sendIdx[">"]=1;
  54476. self._assert_($1);
  54477. $ctx1.sendIdx["assert:"]=1;
  54478. $2=(2).__lt((3));
  54479. $ctx1.sendIdx["<"]=1;
  54480. self._assert_($2);
  54481. $ctx1.sendIdx["assert:"]=2;
  54482. self._deny_((3).__lt((2)));
  54483. $ctx1.sendIdx["deny:"]=1;
  54484. self._deny_((2).__gt((3)));
  54485. $3=(3).__gt_eq((3));
  54486. $ctx1.sendIdx[">="]=1;
  54487. self._assert_($3);
  54488. $ctx1.sendIdx["assert:"]=3;
  54489. self._assert_((3.1).__gt_eq((3)));
  54490. $ctx1.sendIdx["assert:"]=4;
  54491. $4=(3).__lt_eq((3));
  54492. $ctx1.sendIdx["<="]=1;
  54493. self._assert_($4);
  54494. $ctx1.sendIdx["assert:"]=5;
  54495. self._assert_((3).__lt_eq((3.1)));
  54496. return self;
  54497. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  54498. },
  54499. args: [],
  54500. 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",
  54501. referencedClasses: [],
  54502. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  54503. }),
  54504. $globals.NumberTest);
  54505. $core.addMethod(
  54506. $core.method({
  54507. selector: "testCopying",
  54508. protocol: 'tests',
  54509. fn: function (){
  54510. var self=this;
  54511. return $core.withContext(function($ctx1) {
  54512. var $1;
  54513. $1=$recv((1)._copy()).__eq_eq((1));
  54514. $ctx1.sendIdx["=="]=1;
  54515. self._assert_($1);
  54516. $ctx1.sendIdx["assert:"]=1;
  54517. self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  54518. return self;
  54519. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  54520. },
  54521. args: [],
  54522. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  54523. referencedClasses: [],
  54524. messageSends: ["assert:", "==", "copy", "deepCopy"]
  54525. }),
  54526. $globals.NumberTest);
  54527. $core.addMethod(
  54528. $core.method({
  54529. selector: "testEquality",
  54530. protocol: 'tests',
  54531. fn: function (){
  54532. var self=this;
  54533. return $core.withContext(function($ctx1) {
  54534. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  54535. $1=(1).__eq((1));
  54536. $ctx1.sendIdx["="]=1;
  54537. self._assert_($1);
  54538. $ctx1.sendIdx["assert:"]=1;
  54539. $2=(0).__eq((0));
  54540. $ctx1.sendIdx["="]=2;
  54541. self._assert_($2);
  54542. $ctx1.sendIdx["assert:"]=2;
  54543. $3=(1).__eq((0));
  54544. $ctx1.sendIdx["="]=3;
  54545. self._deny_($3);
  54546. $ctx1.sendIdx["deny:"]=1;
  54547. $5=(1)._yourself();
  54548. $ctx1.sendIdx["yourself"]=1;
  54549. $4=$recv($5).__eq((1));
  54550. $ctx1.sendIdx["="]=4;
  54551. self._assert_($4);
  54552. $ctx1.sendIdx["assert:"]=3;
  54553. $7=(1)._yourself();
  54554. $ctx1.sendIdx["yourself"]=2;
  54555. $6=(1).__eq($7);
  54556. $ctx1.sendIdx["="]=5;
  54557. self._assert_($6);
  54558. $ctx1.sendIdx["assert:"]=4;
  54559. $9=(1)._yourself();
  54560. $ctx1.sendIdx["yourself"]=3;
  54561. $8=$recv($9).__eq((1)._yourself());
  54562. $ctx1.sendIdx["="]=6;
  54563. self._assert_($8);
  54564. $10=(0).__eq(false);
  54565. $ctx1.sendIdx["="]=7;
  54566. self._deny_($10);
  54567. $ctx1.sendIdx["deny:"]=2;
  54568. $11=false.__eq((0));
  54569. $ctx1.sendIdx["="]=8;
  54570. self._deny_($11);
  54571. $ctx1.sendIdx["deny:"]=3;
  54572. $12="".__eq((0));
  54573. $ctx1.sendIdx["="]=9;
  54574. self._deny_($12);
  54575. $ctx1.sendIdx["deny:"]=4;
  54576. self._deny_((0).__eq(""));
  54577. return self;
  54578. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  54579. },
  54580. args: [],
  54581. 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 = ''",
  54582. referencedClasses: [],
  54583. messageSends: ["assert:", "=", "deny:", "yourself"]
  54584. }),
  54585. $globals.NumberTest);
  54586. $core.addMethod(
  54587. $core.method({
  54588. selector: "testFloor",
  54589. protocol: 'tests',
  54590. fn: function (){
  54591. var self=this;
  54592. return $core.withContext(function($ctx1) {
  54593. var $1,$2;
  54594. $1=(1.2)._floor();
  54595. $ctx1.sendIdx["floor"]=1;
  54596. self._assert_equals_($1,(1));
  54597. $ctx1.sendIdx["assert:equals:"]=1;
  54598. $2=(-1.2)._floor();
  54599. $ctx1.sendIdx["floor"]=2;
  54600. self._assert_equals_($2,(-2));
  54601. $ctx1.sendIdx["assert:equals:"]=2;
  54602. self._assert_equals_((1)._floor(),(1));
  54603. return self;
  54604. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  54605. },
  54606. args: [],
  54607. 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.",
  54608. referencedClasses: [],
  54609. messageSends: ["assert:equals:", "floor"]
  54610. }),
  54611. $globals.NumberTest);
  54612. $core.addMethod(
  54613. $core.method({
  54614. selector: "testHexNumbers",
  54615. protocol: 'tests',
  54616. fn: function (){
  54617. var self=this;
  54618. return $core.withContext(function($ctx1) {
  54619. var $1,$2,$3,$4,$5;
  54620. self._assert_equals_((9),(9));
  54621. $ctx1.sendIdx["assert:equals:"]=1;
  54622. $1=(10)._truncated();
  54623. $ctx1.sendIdx["truncated"]=1;
  54624. self._assert_equals_($1,(10));
  54625. $ctx1.sendIdx["assert:equals:"]=2;
  54626. $2=(11)._truncated();
  54627. $ctx1.sendIdx["truncated"]=2;
  54628. self._assert_equals_($2,(11));
  54629. $ctx1.sendIdx["assert:equals:"]=3;
  54630. $3=(12)._truncated();
  54631. $ctx1.sendIdx["truncated"]=3;
  54632. self._assert_equals_($3,(12));
  54633. $ctx1.sendIdx["assert:equals:"]=4;
  54634. $4=(13)._truncated();
  54635. $ctx1.sendIdx["truncated"]=4;
  54636. self._assert_equals_($4,(13));
  54637. $ctx1.sendIdx["assert:equals:"]=5;
  54638. $5=(14)._truncated();
  54639. $ctx1.sendIdx["truncated"]=5;
  54640. self._assert_equals_($5,(14));
  54641. $ctx1.sendIdx["assert:equals:"]=6;
  54642. self._assert_equals_((15)._truncated(),(15));
  54643. return self;
  54644. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  54645. },
  54646. args: [],
  54647. 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",
  54648. referencedClasses: [],
  54649. messageSends: ["assert:equals:", "truncated"]
  54650. }),
  54651. $globals.NumberTest);
  54652. $core.addMethod(
  54653. $core.method({
  54654. selector: "testIdentity",
  54655. protocol: 'tests',
  54656. fn: function (){
  54657. var self=this;
  54658. return $core.withContext(function($ctx1) {
  54659. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  54660. $1=(1).__eq_eq((1));
  54661. $ctx1.sendIdx["=="]=1;
  54662. self._assert_($1);
  54663. $ctx1.sendIdx["assert:"]=1;
  54664. $2=(0).__eq_eq((0));
  54665. $ctx1.sendIdx["=="]=2;
  54666. self._assert_($2);
  54667. $ctx1.sendIdx["assert:"]=2;
  54668. $3=(1).__eq_eq((0));
  54669. $ctx1.sendIdx["=="]=3;
  54670. self._deny_($3);
  54671. $ctx1.sendIdx["deny:"]=1;
  54672. $5=(1)._yourself();
  54673. $ctx1.sendIdx["yourself"]=1;
  54674. $4=$recv($5).__eq_eq((1));
  54675. $ctx1.sendIdx["=="]=4;
  54676. self._assert_($4);
  54677. $ctx1.sendIdx["assert:"]=3;
  54678. $7=(1)._yourself();
  54679. $ctx1.sendIdx["yourself"]=2;
  54680. $6=(1).__eq_eq($7);
  54681. $ctx1.sendIdx["=="]=5;
  54682. self._assert_($6);
  54683. $ctx1.sendIdx["assert:"]=4;
  54684. $9=(1)._yourself();
  54685. $ctx1.sendIdx["yourself"]=3;
  54686. $8=$recv($9).__eq_eq((1)._yourself());
  54687. $ctx1.sendIdx["=="]=6;
  54688. self._assert_($8);
  54689. self._deny_((1).__eq_eq((2)));
  54690. return self;
  54691. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  54692. },
  54693. args: [],
  54694. 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",
  54695. referencedClasses: [],
  54696. messageSends: ["assert:", "==", "deny:", "yourself"]
  54697. }),
  54698. $globals.NumberTest);
  54699. $core.addMethod(
  54700. $core.method({
  54701. selector: "testInvalidHexNumbers",
  54702. protocol: 'tests',
  54703. fn: function (){
  54704. var self=this;
  54705. return $core.withContext(function($ctx1) {
  54706. self._should_raise_((function(){
  54707. return $core.withContext(function($ctx2) {
  54708. return (16)._rG();
  54709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54710. }),$globals.MessageNotUnderstood);
  54711. $ctx1.sendIdx["should:raise:"]=1;
  54712. self._should_raise_((function(){
  54713. return $core.withContext(function($ctx2) {
  54714. return (16)._rg();
  54715. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  54716. }),$globals.MessageNotUnderstood);
  54717. $ctx1.sendIdx["should:raise:"]=2;
  54718. self._should_raise_((function(){
  54719. return $core.withContext(function($ctx2) {
  54720. return (16)._rH();
  54721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  54722. }),$globals.MessageNotUnderstood);
  54723. $ctx1.sendIdx["should:raise:"]=3;
  54724. self._should_raise_((function(){
  54725. return $core.withContext(function($ctx2) {
  54726. return (16)._rh();
  54727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  54728. }),$globals.MessageNotUnderstood);
  54729. $ctx1.sendIdx["should:raise:"]=4;
  54730. self._should_raise_((function(){
  54731. return $core.withContext(function($ctx2) {
  54732. return (16)._rI();
  54733. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54734. }),$globals.MessageNotUnderstood);
  54735. $ctx1.sendIdx["should:raise:"]=5;
  54736. self._should_raise_((function(){
  54737. return $core.withContext(function($ctx2) {
  54738. return (16)._ri();
  54739. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  54740. }),$globals.MessageNotUnderstood);
  54741. $ctx1.sendIdx["should:raise:"]=6;
  54742. self._should_raise_((function(){
  54743. return $core.withContext(function($ctx2) {
  54744. return (16)._rJ();
  54745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  54746. }),$globals.MessageNotUnderstood);
  54747. $ctx1.sendIdx["should:raise:"]=7;
  54748. self._should_raise_((function(){
  54749. return $core.withContext(function($ctx2) {
  54750. return (16)._rj();
  54751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  54752. }),$globals.MessageNotUnderstood);
  54753. $ctx1.sendIdx["should:raise:"]=8;
  54754. self._should_raise_((function(){
  54755. return $core.withContext(function($ctx2) {
  54756. return (16)._rK();
  54757. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  54758. }),$globals.MessageNotUnderstood);
  54759. $ctx1.sendIdx["should:raise:"]=9;
  54760. self._should_raise_((function(){
  54761. return $core.withContext(function($ctx2) {
  54762. return (16)._rk();
  54763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  54764. }),$globals.MessageNotUnderstood);
  54765. $ctx1.sendIdx["should:raise:"]=10;
  54766. self._should_raise_((function(){
  54767. return $core.withContext(function($ctx2) {
  54768. return (16)._rL();
  54769. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  54770. }),$globals.MessageNotUnderstood);
  54771. $ctx1.sendIdx["should:raise:"]=11;
  54772. self._should_raise_((function(){
  54773. return $core.withContext(function($ctx2) {
  54774. return (16)._rl();
  54775. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  54776. }),$globals.MessageNotUnderstood);
  54777. $ctx1.sendIdx["should:raise:"]=12;
  54778. self._should_raise_((function(){
  54779. return $core.withContext(function($ctx2) {
  54780. return (16)._rM();
  54781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  54782. }),$globals.MessageNotUnderstood);
  54783. $ctx1.sendIdx["should:raise:"]=13;
  54784. self._should_raise_((function(){
  54785. return $core.withContext(function($ctx2) {
  54786. return (16)._rm();
  54787. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  54788. }),$globals.MessageNotUnderstood);
  54789. $ctx1.sendIdx["should:raise:"]=14;
  54790. self._should_raise_((function(){
  54791. return $core.withContext(function($ctx2) {
  54792. return (16)._rN();
  54793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  54794. }),$globals.MessageNotUnderstood);
  54795. $ctx1.sendIdx["should:raise:"]=15;
  54796. self._should_raise_((function(){
  54797. return $core.withContext(function($ctx2) {
  54798. return (16)._rn();
  54799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  54800. }),$globals.MessageNotUnderstood);
  54801. $ctx1.sendIdx["should:raise:"]=16;
  54802. self._should_raise_((function(){
  54803. return $core.withContext(function($ctx2) {
  54804. return (16)._rO();
  54805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  54806. }),$globals.MessageNotUnderstood);
  54807. $ctx1.sendIdx["should:raise:"]=17;
  54808. self._should_raise_((function(){
  54809. return $core.withContext(function($ctx2) {
  54810. return (16)._ro();
  54811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  54812. }),$globals.MessageNotUnderstood);
  54813. $ctx1.sendIdx["should:raise:"]=18;
  54814. self._should_raise_((function(){
  54815. return $core.withContext(function($ctx2) {
  54816. return (16)._rP();
  54817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  54818. }),$globals.MessageNotUnderstood);
  54819. $ctx1.sendIdx["should:raise:"]=19;
  54820. self._should_raise_((function(){
  54821. return $core.withContext(function($ctx2) {
  54822. return (16)._rp();
  54823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  54824. }),$globals.MessageNotUnderstood);
  54825. $ctx1.sendIdx["should:raise:"]=20;
  54826. self._should_raise_((function(){
  54827. return $core.withContext(function($ctx2) {
  54828. return (16)._rQ();
  54829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  54830. }),$globals.MessageNotUnderstood);
  54831. $ctx1.sendIdx["should:raise:"]=21;
  54832. self._should_raise_((function(){
  54833. return $core.withContext(function($ctx2) {
  54834. return (16)._rq();
  54835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  54836. }),$globals.MessageNotUnderstood);
  54837. $ctx1.sendIdx["should:raise:"]=22;
  54838. self._should_raise_((function(){
  54839. return $core.withContext(function($ctx2) {
  54840. return (16)._rR();
  54841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  54842. }),$globals.MessageNotUnderstood);
  54843. $ctx1.sendIdx["should:raise:"]=23;
  54844. self._should_raise_((function(){
  54845. return $core.withContext(function($ctx2) {
  54846. return (16)._rr();
  54847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  54848. }),$globals.MessageNotUnderstood);
  54849. $ctx1.sendIdx["should:raise:"]=24;
  54850. self._should_raise_((function(){
  54851. return $core.withContext(function($ctx2) {
  54852. return (16)._rS();
  54853. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  54854. }),$globals.MessageNotUnderstood);
  54855. $ctx1.sendIdx["should:raise:"]=25;
  54856. self._should_raise_((function(){
  54857. return $core.withContext(function($ctx2) {
  54858. return (16)._rs();
  54859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  54860. }),$globals.MessageNotUnderstood);
  54861. $ctx1.sendIdx["should:raise:"]=26;
  54862. self._should_raise_((function(){
  54863. return $core.withContext(function($ctx2) {
  54864. return (16)._rT();
  54865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  54866. }),$globals.MessageNotUnderstood);
  54867. $ctx1.sendIdx["should:raise:"]=27;
  54868. self._should_raise_((function(){
  54869. return $core.withContext(function($ctx2) {
  54870. return (16)._rt();
  54871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  54872. }),$globals.MessageNotUnderstood);
  54873. $ctx1.sendIdx["should:raise:"]=28;
  54874. self._should_raise_((function(){
  54875. return $core.withContext(function($ctx2) {
  54876. return (16)._rU();
  54877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  54878. }),$globals.MessageNotUnderstood);
  54879. $ctx1.sendIdx["should:raise:"]=29;
  54880. self._should_raise_((function(){
  54881. return $core.withContext(function($ctx2) {
  54882. return (16)._ru();
  54883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  54884. }),$globals.MessageNotUnderstood);
  54885. $ctx1.sendIdx["should:raise:"]=30;
  54886. self._should_raise_((function(){
  54887. return $core.withContext(function($ctx2) {
  54888. return (16)._rV();
  54889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  54890. }),$globals.MessageNotUnderstood);
  54891. $ctx1.sendIdx["should:raise:"]=31;
  54892. self._should_raise_((function(){
  54893. return $core.withContext(function($ctx2) {
  54894. return (16)._rv();
  54895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  54896. }),$globals.MessageNotUnderstood);
  54897. $ctx1.sendIdx["should:raise:"]=32;
  54898. self._should_raise_((function(){
  54899. return $core.withContext(function($ctx2) {
  54900. return (16)._rW();
  54901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  54902. }),$globals.MessageNotUnderstood);
  54903. $ctx1.sendIdx["should:raise:"]=33;
  54904. self._should_raise_((function(){
  54905. return $core.withContext(function($ctx2) {
  54906. return (16)._rw();
  54907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  54908. }),$globals.MessageNotUnderstood);
  54909. $ctx1.sendIdx["should:raise:"]=34;
  54910. self._should_raise_((function(){
  54911. return $core.withContext(function($ctx2) {
  54912. return (16)._rX();
  54913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  54914. }),$globals.MessageNotUnderstood);
  54915. $ctx1.sendIdx["should:raise:"]=35;
  54916. self._should_raise_((function(){
  54917. return $core.withContext(function($ctx2) {
  54918. return (16)._rx();
  54919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  54920. }),$globals.MessageNotUnderstood);
  54921. $ctx1.sendIdx["should:raise:"]=36;
  54922. self._should_raise_((function(){
  54923. return $core.withContext(function($ctx2) {
  54924. return (16)._rY();
  54925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  54926. }),$globals.MessageNotUnderstood);
  54927. $ctx1.sendIdx["should:raise:"]=37;
  54928. self._should_raise_((function(){
  54929. return $core.withContext(function($ctx2) {
  54930. return (16)._ry();
  54931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  54932. }),$globals.MessageNotUnderstood);
  54933. $ctx1.sendIdx["should:raise:"]=38;
  54934. self._should_raise_((function(){
  54935. return $core.withContext(function($ctx2) {
  54936. return (16)._rZ();
  54937. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  54938. }),$globals.MessageNotUnderstood);
  54939. $ctx1.sendIdx["should:raise:"]=39;
  54940. self._should_raise_((function(){
  54941. return $core.withContext(function($ctx2) {
  54942. return (16)._rz();
  54943. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  54944. }),$globals.MessageNotUnderstood);
  54945. $ctx1.sendIdx["should:raise:"]=40;
  54946. self._should_raise_((function(){
  54947. return $core.withContext(function($ctx2) {
  54948. return (11259375)._Z();
  54949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  54950. }),$globals.MessageNotUnderstood);
  54951. return self;
  54952. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  54953. },
  54954. args: [],
  54955. 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.",
  54956. referencedClasses: ["MessageNotUnderstood"],
  54957. 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"]
  54958. }),
  54959. $globals.NumberTest);
  54960. $core.addMethod(
  54961. $core.method({
  54962. selector: "testLog",
  54963. protocol: 'tests',
  54964. fn: function (){
  54965. var self=this;
  54966. return $core.withContext(function($ctx1) {
  54967. self._assert_equals_((10000)._log(),(4));
  54968. $ctx1.sendIdx["assert:equals:"]=1;
  54969. self._assert_equals_((512)._log_((2)),(9));
  54970. $ctx1.sendIdx["assert:equals:"]=2;
  54971. self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  54972. return self;
  54973. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  54974. },
  54975. args: [],
  54976. 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.",
  54977. referencedClasses: ["Number"],
  54978. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  54979. }),
  54980. $globals.NumberTest);
  54981. $core.addMethod(
  54982. $core.method({
  54983. selector: "testMinMax",
  54984. protocol: 'tests',
  54985. fn: function (){
  54986. var self=this;
  54987. return $core.withContext(function($ctx1) {
  54988. self._assert_equals_((2)._max_((5)),(5));
  54989. $ctx1.sendIdx["assert:equals:"]=1;
  54990. self._assert_equals_((2)._min_((5)),(2));
  54991. return self;
  54992. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  54993. },
  54994. args: [],
  54995. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  54996. referencedClasses: [],
  54997. messageSends: ["assert:equals:", "max:", "min:"]
  54998. }),
  54999. $globals.NumberTest);
  55000. $core.addMethod(
  55001. $core.method({
  55002. selector: "testNegated",
  55003. protocol: 'tests',
  55004. fn: function (){
  55005. var self=this;
  55006. return $core.withContext(function($ctx1) {
  55007. var $1;
  55008. $1=(3)._negated();
  55009. $ctx1.sendIdx["negated"]=1;
  55010. self._assert_equals_($1,(-3));
  55011. $ctx1.sendIdx["assert:equals:"]=1;
  55012. self._assert_equals_((-3)._negated(),(3));
  55013. return self;
  55014. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  55015. },
  55016. args: [],
  55017. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  55018. referencedClasses: [],
  55019. messageSends: ["assert:equals:", "negated"]
  55020. }),
  55021. $globals.NumberTest);
  55022. $core.addMethod(
  55023. $core.method({
  55024. selector: "testPrintShowingDecimalPlaces",
  55025. protocol: 'tests',
  55026. fn: function (){
  55027. var self=this;
  55028. return $core.withContext(function($ctx1) {
  55029. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  55030. $1=(23)._printShowingDecimalPlaces_((2));
  55031. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  55032. self._assert_equals_($1,"23.00");
  55033. $ctx1.sendIdx["assert:equals:"]=1;
  55034. $2=(23.5698)._printShowingDecimalPlaces_((2));
  55035. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  55036. self._assert_equals_($2,"23.57");
  55037. $ctx1.sendIdx["assert:equals:"]=2;
  55038. $4=(234.567)._negated();
  55039. $ctx1.sendIdx["negated"]=1;
  55040. $3=$recv($4)._printShowingDecimalPlaces_((5));
  55041. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  55042. self._assert_equals_($3,"-234.56700");
  55043. $ctx1.sendIdx["assert:equals:"]=3;
  55044. $5=(23.4567)._printShowingDecimalPlaces_((0));
  55045. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  55046. self._assert_equals_($5,"23");
  55047. $ctx1.sendIdx["assert:equals:"]=4;
  55048. $6=(23.5567)._printShowingDecimalPlaces_((0));
  55049. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  55050. self._assert_equals_($6,"24");
  55051. $ctx1.sendIdx["assert:equals:"]=5;
  55052. $8=(23.4567)._negated();
  55053. $ctx1.sendIdx["negated"]=2;
  55054. $7=$recv($8)._printShowingDecimalPlaces_((0));
  55055. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  55056. self._assert_equals_($7,"-23");
  55057. $ctx1.sendIdx["assert:equals:"]=6;
  55058. $10=(23.5567)._negated();
  55059. $ctx1.sendIdx["negated"]=3;
  55060. $9=$recv($10)._printShowingDecimalPlaces_((0));
  55061. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  55062. self._assert_equals_($9,"-24");
  55063. $ctx1.sendIdx["assert:equals:"]=7;
  55064. $11=(100000000)._printShowingDecimalPlaces_((1));
  55065. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  55066. self._assert_equals_($11,"100000000.0");
  55067. $ctx1.sendIdx["assert:equals:"]=8;
  55068. $12=(0.98)._printShowingDecimalPlaces_((5));
  55069. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  55070. self._assert_equals_($12,"0.98000");
  55071. $ctx1.sendIdx["assert:equals:"]=9;
  55072. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  55073. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  55074. self._assert_equals_($13,"-0.98");
  55075. $ctx1.sendIdx["assert:equals:"]=10;
  55076. $14=(2.567)._printShowingDecimalPlaces_((2));
  55077. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  55078. self._assert_equals_($14,"2.57");
  55079. $ctx1.sendIdx["assert:equals:"]=11;
  55080. $15=(-2.567)._printShowingDecimalPlaces_((2));
  55081. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  55082. self._assert_equals_($15,"-2.57");
  55083. $ctx1.sendIdx["assert:equals:"]=12;
  55084. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  55085. return self;
  55086. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  55087. },
  55088. args: [],
  55089. 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'.",
  55090. referencedClasses: [],
  55091. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  55092. }),
  55093. $globals.NumberTest);
  55094. $core.addMethod(
  55095. $core.method({
  55096. selector: "testRaisedTo",
  55097. protocol: 'tests',
  55098. fn: function (){
  55099. var self=this;
  55100. return $core.withContext(function($ctx1) {
  55101. var $1,$2,$3;
  55102. $1=(2)._raisedTo_((4));
  55103. $ctx1.sendIdx["raisedTo:"]=1;
  55104. self._assert_equals_($1,(16));
  55105. $ctx1.sendIdx["assert:equals:"]=1;
  55106. $2=(2)._raisedTo_((0));
  55107. $ctx1.sendIdx["raisedTo:"]=2;
  55108. self._assert_equals_($2,(1));
  55109. $ctx1.sendIdx["assert:equals:"]=2;
  55110. $3=(2)._raisedTo_((-3));
  55111. $ctx1.sendIdx["raisedTo:"]=3;
  55112. self._assert_equals_($3,(0.125));
  55113. $ctx1.sendIdx["assert:equals:"]=3;
  55114. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  55115. $ctx1.sendIdx["assert:equals:"]=4;
  55116. self._assert_equals_((2).__star_star((4)),(16));
  55117. return self;
  55118. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  55119. },
  55120. args: [],
  55121. 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.",
  55122. referencedClasses: [],
  55123. messageSends: ["assert:equals:", "raisedTo:", "**"]
  55124. }),
  55125. $globals.NumberTest);
  55126. $core.addMethod(
  55127. $core.method({
  55128. selector: "testRounded",
  55129. protocol: 'tests',
  55130. fn: function (){
  55131. var self=this;
  55132. return $core.withContext(function($ctx1) {
  55133. var $1,$2;
  55134. $1=(3)._rounded();
  55135. $ctx1.sendIdx["rounded"]=1;
  55136. self._assert_equals_($1,(3));
  55137. $ctx1.sendIdx["assert:equals:"]=1;
  55138. $2=(3.212)._rounded();
  55139. $ctx1.sendIdx["rounded"]=2;
  55140. self._assert_equals_($2,(3));
  55141. $ctx1.sendIdx["assert:equals:"]=2;
  55142. self._assert_equals_((3.51)._rounded(),(4));
  55143. return self;
  55144. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  55145. },
  55146. args: [],
  55147. 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",
  55148. referencedClasses: [],
  55149. messageSends: ["assert:equals:", "rounded"]
  55150. }),
  55151. $globals.NumberTest);
  55152. $core.addMethod(
  55153. $core.method({
  55154. selector: "testSign",
  55155. protocol: 'tests',
  55156. fn: function (){
  55157. var self=this;
  55158. return $core.withContext(function($ctx1) {
  55159. var $1,$2;
  55160. $1=(5)._sign();
  55161. $ctx1.sendIdx["sign"]=1;
  55162. self._assert_equals_($1,(1));
  55163. $ctx1.sendIdx["assert:equals:"]=1;
  55164. $2=(0)._sign();
  55165. $ctx1.sendIdx["sign"]=2;
  55166. self._assert_equals_($2,(0));
  55167. $ctx1.sendIdx["assert:equals:"]=2;
  55168. self._assert_equals_((-1.4)._sign(),(-1));
  55169. return self;
  55170. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  55171. },
  55172. args: [],
  55173. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  55174. referencedClasses: [],
  55175. messageSends: ["assert:equals:", "sign"]
  55176. }),
  55177. $globals.NumberTest);
  55178. $core.addMethod(
  55179. $core.method({
  55180. selector: "testSqrt",
  55181. protocol: 'tests',
  55182. fn: function (){
  55183. var self=this;
  55184. return $core.withContext(function($ctx1) {
  55185. var $1;
  55186. $1=(4)._sqrt();
  55187. $ctx1.sendIdx["sqrt"]=1;
  55188. self._assert_equals_($1,(2));
  55189. $ctx1.sendIdx["assert:equals:"]=1;
  55190. self._assert_equals_((16)._sqrt(),(4));
  55191. return self;
  55192. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  55193. },
  55194. args: [],
  55195. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  55196. referencedClasses: [],
  55197. messageSends: ["assert:equals:", "sqrt"]
  55198. }),
  55199. $globals.NumberTest);
  55200. $core.addMethod(
  55201. $core.method({
  55202. selector: "testSquared",
  55203. protocol: 'tests',
  55204. fn: function (){
  55205. var self=this;
  55206. return $core.withContext(function($ctx1) {
  55207. self._assert_equals_((4)._squared(),(16));
  55208. return self;
  55209. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  55210. },
  55211. args: [],
  55212. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  55213. referencedClasses: [],
  55214. messageSends: ["assert:equals:", "squared"]
  55215. }),
  55216. $globals.NumberTest);
  55217. $core.addMethod(
  55218. $core.method({
  55219. selector: "testTimesRepeat",
  55220. protocol: 'tests',
  55221. fn: function (){
  55222. var self=this;
  55223. var i;
  55224. return $core.withContext(function($ctx1) {
  55225. i=(0);
  55226. (0)._timesRepeat_((function(){
  55227. return $core.withContext(function($ctx2) {
  55228. i=$recv(i).__plus((1));
  55229. $ctx2.sendIdx["+"]=1;
  55230. return i;
  55231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55232. }));
  55233. $ctx1.sendIdx["timesRepeat:"]=1;
  55234. self._assert_equals_(i,(0));
  55235. $ctx1.sendIdx["assert:equals:"]=1;
  55236. (5)._timesRepeat_((function(){
  55237. return $core.withContext(function($ctx2) {
  55238. i=$recv(i).__plus((1));
  55239. return i;
  55240. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  55241. }));
  55242. self._assert_equals_(i,(5));
  55243. return self;
  55244. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  55245. },
  55246. args: [],
  55247. 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",
  55248. referencedClasses: [],
  55249. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  55250. }),
  55251. $globals.NumberTest);
  55252. $core.addMethod(
  55253. $core.method({
  55254. selector: "testTo",
  55255. protocol: 'tests',
  55256. fn: function (){
  55257. var self=this;
  55258. return $core.withContext(function($ctx1) {
  55259. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  55260. return self;
  55261. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  55262. },
  55263. args: [],
  55264. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  55265. referencedClasses: [],
  55266. messageSends: ["assert:equals:", "to:"]
  55267. }),
  55268. $globals.NumberTest);
  55269. $core.addMethod(
  55270. $core.method({
  55271. selector: "testToBy",
  55272. protocol: 'tests',
  55273. fn: function (){
  55274. var self=this;
  55275. return $core.withContext(function($ctx1) {
  55276. var $1;
  55277. $1=(0)._to_by_((6),(2));
  55278. $ctx1.sendIdx["to:by:"]=1;
  55279. self._assert_equals_($1,[(0), (2), (4), (6)]);
  55280. self._should_raise_((function(){
  55281. return $core.withContext(function($ctx2) {
  55282. return (1)._to_by_((4),(0));
  55283. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55284. }),$globals.Error);
  55285. return self;
  55286. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  55287. },
  55288. args: [],
  55289. 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",
  55290. referencedClasses: ["Error"],
  55291. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  55292. }),
  55293. $globals.NumberTest);
  55294. $core.addMethod(
  55295. $core.method({
  55296. selector: "testTrigonometry",
  55297. protocol: 'tests',
  55298. fn: function (){
  55299. var self=this;
  55300. return $core.withContext(function($ctx1) {
  55301. self._assert_equals_((0)._cos(),(1));
  55302. $ctx1.sendIdx["assert:equals:"]=1;
  55303. self._assert_equals_((0)._sin(),(0));
  55304. $ctx1.sendIdx["assert:equals:"]=2;
  55305. self._assert_equals_((0)._tan(),(0));
  55306. $ctx1.sendIdx["assert:equals:"]=3;
  55307. self._assert_equals_((1)._arcCos(),(0));
  55308. $ctx1.sendIdx["assert:equals:"]=4;
  55309. self._assert_equals_((0)._arcSin(),(0));
  55310. $ctx1.sendIdx["assert:equals:"]=5;
  55311. self._assert_equals_((0)._arcTan(),(0));
  55312. return self;
  55313. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  55314. },
  55315. args: [],
  55316. 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.",
  55317. referencedClasses: [],
  55318. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"]
  55319. }),
  55320. $globals.NumberTest);
  55321. $core.addMethod(
  55322. $core.method({
  55323. selector: "testTruncated",
  55324. protocol: 'tests',
  55325. fn: function (){
  55326. var self=this;
  55327. return $core.withContext(function($ctx1) {
  55328. var $1,$2;
  55329. $1=(3)._truncated();
  55330. $ctx1.sendIdx["truncated"]=1;
  55331. self._assert_equals_($1,(3));
  55332. $ctx1.sendIdx["assert:equals:"]=1;
  55333. $2=(3.212)._truncated();
  55334. $ctx1.sendIdx["truncated"]=2;
  55335. self._assert_equals_($2,(3));
  55336. $ctx1.sendIdx["assert:equals:"]=2;
  55337. self._assert_equals_((3.51)._truncated(),(3));
  55338. return self;
  55339. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  55340. },
  55341. args: [],
  55342. 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",
  55343. referencedClasses: [],
  55344. messageSends: ["assert:equals:", "truncated"]
  55345. }),
  55346. $globals.NumberTest);
  55347. $core.addClass('ObjectMock', $globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  55348. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  55349. $core.addMethod(
  55350. $core.method({
  55351. selector: "foo",
  55352. protocol: 'not yet classified',
  55353. fn: function (){
  55354. var self=this;
  55355. return self["@foo"];
  55356. },
  55357. args: [],
  55358. source: "foo\x0a\x09^ foo",
  55359. referencedClasses: [],
  55360. messageSends: []
  55361. }),
  55362. $globals.ObjectMock);
  55363. $core.addMethod(
  55364. $core.method({
  55365. selector: "foo:",
  55366. protocol: 'not yet classified',
  55367. fn: function (anObject){
  55368. var self=this;
  55369. self["@foo"]=anObject;
  55370. return self;
  55371. },
  55372. args: ["anObject"],
  55373. source: "foo: anObject\x0a\x09foo := anObject",
  55374. referencedClasses: [],
  55375. messageSends: []
  55376. }),
  55377. $globals.ObjectMock);
  55378. $core.addClass('ObjectTest', $globals.TestCase, [], 'Kernel-Tests');
  55379. $core.addMethod(
  55380. $core.method({
  55381. selector: "notDefined",
  55382. protocol: 'tests',
  55383. fn: function (){
  55384. var self=this;
  55385. return $core.withContext(function($ctx1) {
  55386. return void 0;;
  55387. return self;
  55388. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  55389. },
  55390. args: [],
  55391. source: "notDefined\x0a\x09<return void 0;>",
  55392. referencedClasses: [],
  55393. messageSends: []
  55394. }),
  55395. $globals.ObjectTest);
  55396. $core.addMethod(
  55397. $core.method({
  55398. selector: "testBasicAccess",
  55399. protocol: 'tests',
  55400. fn: function (){
  55401. var self=this;
  55402. var o;
  55403. return $core.withContext(function($ctx1) {
  55404. var $1;
  55405. o=$recv($globals.Object)._new();
  55406. $recv(o)._basicAt_put_("a",(1));
  55407. $1=$recv(o)._basicAt_("a");
  55408. $ctx1.sendIdx["basicAt:"]=1;
  55409. self._assert_equals_($1,(1));
  55410. $ctx1.sendIdx["assert:equals:"]=1;
  55411. self._assert_equals_($recv(o)._basicAt_("b"),nil);
  55412. return self;
  55413. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  55414. },
  55415. args: [],
  55416. 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",
  55417. referencedClasses: ["Object"],
  55418. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  55419. }),
  55420. $globals.ObjectTest);
  55421. $core.addMethod(
  55422. $core.method({
  55423. selector: "testBasicPerform",
  55424. protocol: 'tests',
  55425. fn: function (){
  55426. var self=this;
  55427. var o;
  55428. return $core.withContext(function($ctx1) {
  55429. o=$recv($globals.Object)._new();
  55430. $recv(o)._basicAt_put_("func",(function(){
  55431. return "hello";
  55432. }));
  55433. $ctx1.sendIdx["basicAt:put:"]=1;
  55434. $recv(o)._basicAt_put_("func2",(function(a){
  55435. return $core.withContext(function($ctx2) {
  55436. return $recv(a).__plus((1));
  55437. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  55438. }));
  55439. self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  55440. $ctx1.sendIdx["assert:equals:"]=1;
  55441. self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  55442. return self;
  55443. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  55444. },
  55445. args: [],
  55446. 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",
  55447. referencedClasses: ["Object"],
  55448. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  55449. }),
  55450. $globals.ObjectTest);
  55451. $core.addMethod(
  55452. $core.method({
  55453. selector: "testDNU",
  55454. protocol: 'tests',
  55455. fn: function (){
  55456. var self=this;
  55457. return $core.withContext(function($ctx1) {
  55458. self._should_raise_((function(){
  55459. return $core.withContext(function($ctx2) {
  55460. return $recv($recv($globals.Object)._new())._foo();
  55461. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55462. }),$globals.MessageNotUnderstood);
  55463. return self;
  55464. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  55465. },
  55466. args: [],
  55467. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  55468. referencedClasses: ["Object", "MessageNotUnderstood"],
  55469. messageSends: ["should:raise:", "foo", "new"]
  55470. }),
  55471. $globals.ObjectTest);
  55472. $core.addMethod(
  55473. $core.method({
  55474. selector: "testEquality",
  55475. protocol: 'tests',
  55476. fn: function (){
  55477. var self=this;
  55478. var o;
  55479. return $core.withContext(function($ctx1) {
  55480. var $1,$2,$4,$3;
  55481. o=$recv($globals.Object)._new();
  55482. $ctx1.sendIdx["new"]=1;
  55483. $1=$recv(o).__eq($recv($globals.Object)._new());
  55484. $ctx1.sendIdx["="]=1;
  55485. self._deny_($1);
  55486. $2=$recv(o).__eq(o);
  55487. $ctx1.sendIdx["="]=2;
  55488. self._assert_($2);
  55489. $ctx1.sendIdx["assert:"]=1;
  55490. $4=$recv(o)._yourself();
  55491. $ctx1.sendIdx["yourself"]=1;
  55492. $3=$recv($4).__eq(o);
  55493. $ctx1.sendIdx["="]=3;
  55494. self._assert_($3);
  55495. $ctx1.sendIdx["assert:"]=2;
  55496. self._assert_($recv(o).__eq($recv(o)._yourself()));
  55497. return self;
  55498. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  55499. },
  55500. args: [],
  55501. 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)",
  55502. referencedClasses: ["Object"],
  55503. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  55504. }),
  55505. $globals.ObjectTest);
  55506. $core.addMethod(
  55507. $core.method({
  55508. selector: "testHalt",
  55509. protocol: 'tests',
  55510. fn: function (){
  55511. var self=this;
  55512. return $core.withContext(function($ctx1) {
  55513. self._should_raise_((function(){
  55514. return $core.withContext(function($ctx2) {
  55515. return $recv($recv($globals.Object)._new())._halt();
  55516. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55517. }),$globals.Error);
  55518. return self;
  55519. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  55520. },
  55521. args: [],
  55522. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  55523. referencedClasses: ["Object", "Error"],
  55524. messageSends: ["should:raise:", "halt", "new"]
  55525. }),
  55526. $globals.ObjectTest);
  55527. $core.addMethod(
  55528. $core.method({
  55529. selector: "testIdentity",
  55530. protocol: 'tests',
  55531. fn: function (){
  55532. var self=this;
  55533. var o;
  55534. return $core.withContext(function($ctx1) {
  55535. var $1,$2,$4,$3;
  55536. o=$recv($globals.Object)._new();
  55537. $ctx1.sendIdx["new"]=1;
  55538. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  55539. $ctx1.sendIdx["=="]=1;
  55540. self._deny_($1);
  55541. $2=$recv(o).__eq_eq(o);
  55542. $ctx1.sendIdx["=="]=2;
  55543. self._assert_($2);
  55544. $ctx1.sendIdx["assert:"]=1;
  55545. $4=$recv(o)._yourself();
  55546. $ctx1.sendIdx["yourself"]=1;
  55547. $3=$recv($4).__eq_eq(o);
  55548. $ctx1.sendIdx["=="]=3;
  55549. self._assert_($3);
  55550. $ctx1.sendIdx["assert:"]=2;
  55551. self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  55552. return self;
  55553. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  55554. },
  55555. args: [],
  55556. 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",
  55557. referencedClasses: ["Object"],
  55558. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  55559. }),
  55560. $globals.ObjectTest);
  55561. $core.addMethod(
  55562. $core.method({
  55563. selector: "testIfNil",
  55564. protocol: 'tests',
  55565. fn: function (){
  55566. var self=this;
  55567. return $core.withContext(function($ctx1) {
  55568. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  55569. $2=$recv($globals.Object)._new();
  55570. $ctx1.sendIdx["new"]=1;
  55571. $1=$recv($2)._isNil();
  55572. self._deny_($1);
  55573. $ctx1.sendIdx["deny:"]=1;
  55574. $5=$recv($globals.Object)._new();
  55575. $ctx1.sendIdx["new"]=2;
  55576. if(($receiver = $5) == null || $receiver.isNil){
  55577. $4=true;
  55578. } else {
  55579. $4=$5;
  55580. };
  55581. $3=$recv($4).__eq(true);
  55582. self._deny_($3);
  55583. $7=$recv($globals.Object)._new();
  55584. $ctx1.sendIdx["new"]=3;
  55585. if(($receiver = $7) == null || $receiver.isNil){
  55586. $6=$7;
  55587. } else {
  55588. $6=true;
  55589. };
  55590. self._assert_equals_($6,true);
  55591. $ctx1.sendIdx["assert:equals:"]=1;
  55592. $9=$recv($globals.Object)._new();
  55593. $ctx1.sendIdx["new"]=4;
  55594. if(($receiver = $9) == null || $receiver.isNil){
  55595. $8=false;
  55596. } else {
  55597. $8=true;
  55598. };
  55599. self._assert_equals_($8,true);
  55600. $ctx1.sendIdx["assert:equals:"]=2;
  55601. $11=$recv($globals.Object)._new();
  55602. if(($receiver = $11) == null || $receiver.isNil){
  55603. $10=false;
  55604. } else {
  55605. $10=true;
  55606. };
  55607. self._assert_equals_($10,true);
  55608. return self;
  55609. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  55610. },
  55611. args: [],
  55612. 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",
  55613. referencedClasses: ["Object"],
  55614. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  55615. }),
  55616. $globals.ObjectTest);
  55617. $core.addMethod(
  55618. $core.method({
  55619. selector: "testInstVars",
  55620. protocol: 'tests',
  55621. fn: function (){
  55622. var self=this;
  55623. var o;
  55624. return $core.withContext(function($ctx1) {
  55625. var $1,$2;
  55626. o=$recv($globals.ObjectMock)._new();
  55627. $1=$recv(o)._instVarAt_("foo");
  55628. $ctx1.sendIdx["instVarAt:"]=1;
  55629. self._assert_equals_($1,nil);
  55630. $ctx1.sendIdx["assert:equals:"]=1;
  55631. $recv(o)._instVarAt_put_("foo",(1));
  55632. $2=$recv(o)._instVarAt_("foo");
  55633. $ctx1.sendIdx["instVarAt:"]=2;
  55634. self._assert_equals_($2,(1));
  55635. $ctx1.sendIdx["assert:equals:"]=2;
  55636. self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  55637. return self;
  55638. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  55639. },
  55640. args: [],
  55641. 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",
  55642. referencedClasses: ["ObjectMock"],
  55643. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  55644. }),
  55645. $globals.ObjectTest);
  55646. $core.addMethod(
  55647. $core.method({
  55648. selector: "testNilUndefined",
  55649. protocol: 'tests',
  55650. fn: function (){
  55651. var self=this;
  55652. return $core.withContext(function($ctx1) {
  55653. self._assert_equals_(self._notDefined(),nil);
  55654. return self;
  55655. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  55656. },
  55657. args: [],
  55658. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  55659. referencedClasses: [],
  55660. messageSends: ["assert:equals:", "notDefined"]
  55661. }),
  55662. $globals.ObjectTest);
  55663. $core.addMethod(
  55664. $core.method({
  55665. selector: "testYourself",
  55666. protocol: 'tests',
  55667. fn: function (){
  55668. var self=this;
  55669. var o;
  55670. return $core.withContext(function($ctx1) {
  55671. o=$recv($globals.ObjectMock)._new();
  55672. self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  55673. return self;
  55674. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  55675. },
  55676. args: [],
  55677. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  55678. referencedClasses: ["ObjectMock"],
  55679. messageSends: ["new", "assert:", "==", "yourself"]
  55680. }),
  55681. $globals.ObjectTest);
  55682. $core.addMethod(
  55683. $core.method({
  55684. selector: "testidentityHash",
  55685. protocol: 'tests',
  55686. fn: function (){
  55687. var self=this;
  55688. var o1,o2;
  55689. return $core.withContext(function($ctx1) {
  55690. var $2,$3,$1,$5,$4;
  55691. o1=$recv($globals.Object)._new();
  55692. $ctx1.sendIdx["new"]=1;
  55693. o2=$recv($globals.Object)._new();
  55694. $2=$recv(o1)._identityHash();
  55695. $ctx1.sendIdx["identityHash"]=1;
  55696. $3=$recv(o1)._identityHash();
  55697. $ctx1.sendIdx["identityHash"]=2;
  55698. $1=$recv($2).__eq_eq($3);
  55699. $ctx1.sendIdx["=="]=1;
  55700. self._assert_($1);
  55701. $5=$recv(o1)._identityHash();
  55702. $ctx1.sendIdx["identityHash"]=3;
  55703. $4=$recv($5).__eq_eq($recv(o2)._identityHash());
  55704. self._deny_($4);
  55705. return self;
  55706. }, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},$globals.ObjectTest)});
  55707. },
  55708. args: [],
  55709. 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",
  55710. referencedClasses: ["Object"],
  55711. messageSends: ["new", "assert:", "==", "identityHash", "deny:"]
  55712. }),
  55713. $globals.ObjectTest);
  55714. $core.addClass('PointTest', $globals.TestCase, [], 'Kernel-Tests');
  55715. $core.addMethod(
  55716. $core.method({
  55717. selector: "testAccessing",
  55718. protocol: 'tests',
  55719. fn: function (){
  55720. var self=this;
  55721. return $core.withContext(function($ctx1) {
  55722. var $2,$1,$3,$6,$5,$4;
  55723. $2=$recv($globals.Point)._x_y_((3),(4));
  55724. $ctx1.sendIdx["x:y:"]=1;
  55725. $1=$recv($2)._x();
  55726. $ctx1.sendIdx["x"]=1;
  55727. self._assert_equals_($1,(3));
  55728. $ctx1.sendIdx["assert:equals:"]=1;
  55729. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  55730. $ctx1.sendIdx["y"]=1;
  55731. self._assert_equals_($3,(4));
  55732. $ctx1.sendIdx["assert:equals:"]=2;
  55733. $6=$recv($globals.Point)._new();
  55734. $ctx1.sendIdx["new"]=1;
  55735. $5=$recv($6)._x_((3));
  55736. $4=$recv($5)._x();
  55737. self._assert_equals_($4,(3));
  55738. $ctx1.sendIdx["assert:equals:"]=3;
  55739. self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  55740. return self;
  55741. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  55742. },
  55743. args: [],
  55744. 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",
  55745. referencedClasses: ["Point"],
  55746. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  55747. }),
  55748. $globals.PointTest);
  55749. $core.addMethod(
  55750. $core.method({
  55751. selector: "testArithmetic",
  55752. protocol: 'tests',
  55753. fn: function (){
  55754. var self=this;
  55755. return $core.withContext(function($ctx1) {
  55756. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  55757. $2=(3).__at((4));
  55758. $ctx1.sendIdx["@"]=1;
  55759. $3=(3).__at((4));
  55760. $ctx1.sendIdx["@"]=2;
  55761. $1=$recv($2).__star($3);
  55762. $4=$recv($globals.Point)._x_y_((9),(16));
  55763. $ctx1.sendIdx["x:y:"]=1;
  55764. self._assert_equals_($1,$4);
  55765. $ctx1.sendIdx["assert:equals:"]=1;
  55766. $6=(3).__at((4));
  55767. $ctx1.sendIdx["@"]=3;
  55768. $7=(3).__at((4));
  55769. $ctx1.sendIdx["@"]=4;
  55770. $5=$recv($6).__plus($7);
  55771. $8=$recv($globals.Point)._x_y_((6),(8));
  55772. $ctx1.sendIdx["x:y:"]=2;
  55773. self._assert_equals_($5,$8);
  55774. $ctx1.sendIdx["assert:equals:"]=2;
  55775. $10=(3).__at((4));
  55776. $ctx1.sendIdx["@"]=5;
  55777. $11=(3).__at((4));
  55778. $ctx1.sendIdx["@"]=6;
  55779. $9=$recv($10).__minus($11);
  55780. $12=$recv($globals.Point)._x_y_((0),(0));
  55781. $ctx1.sendIdx["x:y:"]=3;
  55782. self._assert_equals_($9,$12);
  55783. $ctx1.sendIdx["assert:equals:"]=3;
  55784. $14=(6).__at((8));
  55785. $ctx1.sendIdx["@"]=7;
  55786. $13=$recv($14).__slash((3).__at((4)));
  55787. self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  55788. return self;
  55789. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  55790. },
  55791. args: [],
  55792. 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)",
  55793. referencedClasses: ["Point"],
  55794. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  55795. }),
  55796. $globals.PointTest);
  55797. $core.addMethod(
  55798. $core.method({
  55799. selector: "testAt",
  55800. protocol: 'tests',
  55801. fn: function (){
  55802. var self=this;
  55803. return $core.withContext(function($ctx1) {
  55804. self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  55805. return self;
  55806. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  55807. },
  55808. args: [],
  55809. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  55810. referencedClasses: ["Point"],
  55811. messageSends: ["assert:equals:", "@", "x:y:"]
  55812. }),
  55813. $globals.PointTest);
  55814. $core.addMethod(
  55815. $core.method({
  55816. selector: "testComparison",
  55817. protocol: 'tests',
  55818. fn: function (){
  55819. var self=this;
  55820. return $core.withContext(function($ctx1) {
  55821. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  55822. $2=(3).__at((4));
  55823. $ctx1.sendIdx["@"]=1;
  55824. $3=(4).__at((5));
  55825. $ctx1.sendIdx["@"]=2;
  55826. $1=$recv($2).__lt($3);
  55827. $ctx1.sendIdx["<"]=1;
  55828. self._assert_($1);
  55829. $ctx1.sendIdx["assert:"]=1;
  55830. $5=(3).__at((4));
  55831. $ctx1.sendIdx["@"]=3;
  55832. $6=(4).__at((4));
  55833. $ctx1.sendIdx["@"]=4;
  55834. $4=$recv($5).__lt($6);
  55835. self._deny_($4);
  55836. $ctx1.sendIdx["deny:"]=1;
  55837. $8=(4).__at((5));
  55838. $ctx1.sendIdx["@"]=5;
  55839. $9=(4).__at((5));
  55840. $ctx1.sendIdx["@"]=6;
  55841. $7=$recv($8).__lt_eq($9);
  55842. $ctx1.sendIdx["<="]=1;
  55843. self._assert_($7);
  55844. $ctx1.sendIdx["assert:"]=2;
  55845. $11=(4).__at((5));
  55846. $ctx1.sendIdx["@"]=7;
  55847. $12=(3).__at((5));
  55848. $ctx1.sendIdx["@"]=8;
  55849. $10=$recv($11).__lt_eq($12);
  55850. self._deny_($10);
  55851. $ctx1.sendIdx["deny:"]=2;
  55852. $14=(5).__at((6));
  55853. $ctx1.sendIdx["@"]=9;
  55854. $15=(4).__at((5));
  55855. $ctx1.sendIdx["@"]=10;
  55856. $13=$recv($14).__gt($15);
  55857. $ctx1.sendIdx[">"]=1;
  55858. self._assert_($13);
  55859. $ctx1.sendIdx["assert:"]=3;
  55860. $17=(5).__at((6));
  55861. $ctx1.sendIdx["@"]=11;
  55862. $18=(6).__at((6));
  55863. $ctx1.sendIdx["@"]=12;
  55864. $16=$recv($17).__gt($18);
  55865. self._deny_($16);
  55866. $ctx1.sendIdx["deny:"]=3;
  55867. $20=(4).__at((5));
  55868. $ctx1.sendIdx["@"]=13;
  55869. $21=(4).__at((5));
  55870. $ctx1.sendIdx["@"]=14;
  55871. $19=$recv($20).__gt_eq($21);
  55872. $ctx1.sendIdx[">="]=1;
  55873. self._assert_($19);
  55874. $23=(4).__at((5));
  55875. $ctx1.sendIdx["@"]=15;
  55876. $22=$recv($23).__gt_eq((5).__at((5)));
  55877. self._deny_($22);
  55878. return self;
  55879. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  55880. },
  55881. args: [],
  55882. 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)",
  55883. referencedClasses: [],
  55884. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  55885. }),
  55886. $globals.PointTest);
  55887. $core.addMethod(
  55888. $core.method({
  55889. selector: "testEgality",
  55890. protocol: 'tests',
  55891. fn: function (){
  55892. var self=this;
  55893. return $core.withContext(function($ctx1) {
  55894. var $2,$3,$1,$5,$4;
  55895. $2=(3).__at((4));
  55896. $ctx1.sendIdx["@"]=1;
  55897. $3=(3).__at((4));
  55898. $ctx1.sendIdx["@"]=2;
  55899. $1=$recv($2).__eq($3);
  55900. $ctx1.sendIdx["="]=1;
  55901. self._assert_($1);
  55902. $5=(3).__at((5));
  55903. $ctx1.sendIdx["@"]=3;
  55904. $4=$recv($5).__eq((3).__at((6)));
  55905. self._deny_($4);
  55906. return self;
  55907. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  55908. },
  55909. args: [],
  55910. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  55911. referencedClasses: [],
  55912. messageSends: ["assert:", "=", "@", "deny:"]
  55913. }),
  55914. $globals.PointTest);
  55915. $core.addMethod(
  55916. $core.method({
  55917. selector: "testNew",
  55918. protocol: 'tests',
  55919. fn: function (){
  55920. var self=this;
  55921. return $core.withContext(function($ctx1) {
  55922. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  55923. $3=$recv($globals.Point)._new();
  55924. $ctx1.sendIdx["new"]=1;
  55925. $2=$recv($3)._x_((3));
  55926. $ctx1.sendIdx["x:"]=1;
  55927. $1=$recv($2)._y();
  55928. $ctx1.sendIdx["y"]=1;
  55929. self._assert_equals_($1,nil);
  55930. $ctx1.sendIdx["assert:equals:"]=1;
  55931. $7=$recv($globals.Point)._new();
  55932. $ctx1.sendIdx["new"]=2;
  55933. $6=$recv($7)._x_((3));
  55934. $5=$recv($6)._x();
  55935. $ctx1.sendIdx["x"]=1;
  55936. $4=$recv($5).__eq((0));
  55937. $ctx1.sendIdx["="]=1;
  55938. self._deny_($4);
  55939. $ctx1.sendIdx["deny:"]=1;
  55940. $10=$recv($globals.Point)._new();
  55941. $ctx1.sendIdx["new"]=3;
  55942. $9=$recv($10)._y_((4));
  55943. $ctx1.sendIdx["y:"]=1;
  55944. $8=$recv($9)._x();
  55945. self._assert_equals_($8,nil);
  55946. self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  55947. return self;
  55948. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  55949. },
  55950. args: [],
  55951. 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",
  55952. referencedClasses: ["Point"],
  55953. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  55954. }),
  55955. $globals.PointTest);
  55956. $core.addMethod(
  55957. $core.method({
  55958. selector: "testTranslateBy",
  55959. protocol: 'tests',
  55960. fn: function (){
  55961. var self=this;
  55962. return $core.withContext(function($ctx1) {
  55963. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  55964. $2=(3).__at((3));
  55965. $ctx1.sendIdx["@"]=1;
  55966. $3=(0).__at((1));
  55967. $ctx1.sendIdx["@"]=2;
  55968. $1=$recv($2)._translateBy_($3);
  55969. $ctx1.sendIdx["translateBy:"]=1;
  55970. $4=(3).__at((4));
  55971. $ctx1.sendIdx["@"]=3;
  55972. self._assert_equals_($1,$4);
  55973. $ctx1.sendIdx["assert:equals:"]=1;
  55974. $6=(3).__at((3));
  55975. $ctx1.sendIdx["@"]=4;
  55976. $8=(1)._negated();
  55977. $ctx1.sendIdx["negated"]=1;
  55978. $7=(0).__at($8);
  55979. $ctx1.sendIdx["@"]=5;
  55980. $5=$recv($6)._translateBy_($7);
  55981. $ctx1.sendIdx["translateBy:"]=2;
  55982. $9=(3).__at((2));
  55983. $ctx1.sendIdx["@"]=6;
  55984. self._assert_equals_($5,$9);
  55985. $ctx1.sendIdx["assert:equals:"]=2;
  55986. $11=(3).__at((3));
  55987. $ctx1.sendIdx["@"]=7;
  55988. $12=(2).__at((3));
  55989. $ctx1.sendIdx["@"]=8;
  55990. $10=$recv($11)._translateBy_($12);
  55991. $ctx1.sendIdx["translateBy:"]=3;
  55992. $13=(5).__at((6));
  55993. $ctx1.sendIdx["@"]=9;
  55994. self._assert_equals_($10,$13);
  55995. $ctx1.sendIdx["assert:equals:"]=3;
  55996. $15=(3).__at((3));
  55997. $ctx1.sendIdx["@"]=10;
  55998. $16=$recv((3)._negated()).__at((0));
  55999. $ctx1.sendIdx["@"]=11;
  56000. $14=$recv($15)._translateBy_($16);
  56001. self._assert_equals_($14,(0).__at((3)));
  56002. return self;
  56003. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  56004. },
  56005. args: [],
  56006. 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.",
  56007. referencedClasses: [],
  56008. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  56009. }),
  56010. $globals.PointTest);
  56011. $core.addClass('QueueTest', $globals.TestCase, [], 'Kernel-Tests');
  56012. $core.addMethod(
  56013. $core.method({
  56014. selector: "testNextIfAbsent",
  56015. protocol: 'tests',
  56016. fn: function (){
  56017. var self=this;
  56018. var queue;
  56019. return $core.withContext(function($ctx1) {
  56020. var $2,$1;
  56021. queue=$recv($globals.Queue)._new();
  56022. $recv(queue)._nextPut_("index1");
  56023. $2=$recv(queue)._nextIfAbsent_("empty");
  56024. $ctx1.sendIdx["nextIfAbsent:"]=1;
  56025. $1=$recv($2).__eq("index1");
  56026. $ctx1.sendIdx["="]=1;
  56027. self._assert_($1);
  56028. self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  56029. return self;
  56030. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  56031. },
  56032. args: [],
  56033. 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'",
  56034. referencedClasses: ["Queue"],
  56035. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  56036. }),
  56037. $globals.QueueTest);
  56038. $core.addMethod(
  56039. $core.method({
  56040. selector: "testQueueNext",
  56041. protocol: 'tests',
  56042. fn: function (){
  56043. var self=this;
  56044. var queue;
  56045. return $core.withContext(function($ctx1) {
  56046. var $1,$3,$2,$5,$4;
  56047. queue=$recv($globals.Queue)._new();
  56048. $1=queue;
  56049. $recv($1)._nextPut_("index1");
  56050. $ctx1.sendIdx["nextPut:"]=1;
  56051. $recv($1)._nextPut_("index2");
  56052. $3=$recv(queue)._next();
  56053. $ctx1.sendIdx["next"]=1;
  56054. $2=$recv($3).__eq("index1");
  56055. $ctx1.sendIdx["="]=1;
  56056. self._assert_($2);
  56057. $5=$recv(queue)._next();
  56058. $ctx1.sendIdx["next"]=2;
  56059. $4=$recv($5).__eq("index");
  56060. self._deny_($4);
  56061. self._should_raise_((function(){
  56062. return $core.withContext(function($ctx2) {
  56063. return $recv(queue)._next();
  56064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56065. }),$globals.Error);
  56066. return self;
  56067. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  56068. },
  56069. args: [],
  56070. 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",
  56071. referencedClasses: ["Queue", "Error"],
  56072. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  56073. }),
  56074. $globals.QueueTest);
  56075. $core.addClass('RandomTest', $globals.TestCase, [], 'Kernel-Tests');
  56076. $core.addMethod(
  56077. $core.method({
  56078. selector: "testAtRandomNumber",
  56079. protocol: 'tests',
  56080. fn: function (){
  56081. var self=this;
  56082. var val;
  56083. return $core.withContext(function($ctx1) {
  56084. (100)._timesRepeat_((function(){
  56085. return $core.withContext(function($ctx2) {
  56086. val=(10)._atRandom();
  56087. val;
  56088. self._assert_($recv(val).__gt((0)));
  56089. $ctx2.sendIdx["assert:"]=1;
  56090. return self._assert_($recv(val).__lt((11)));
  56091. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56092. }));
  56093. return self;
  56094. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  56095. },
  56096. args: [],
  56097. 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]",
  56098. referencedClasses: [],
  56099. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  56100. }),
  56101. $globals.RandomTest);
  56102. $core.addMethod(
  56103. $core.method({
  56104. selector: "testAtRandomSequenceableCollection",
  56105. protocol: 'tests',
  56106. fn: function (){
  56107. var self=this;
  56108. var val;
  56109. return $core.withContext(function($ctx1) {
  56110. var $3,$4,$2,$1;
  56111. (100)._timesRepeat_((function(){
  56112. return $core.withContext(function($ctx2) {
  56113. val="abc"._atRandom();
  56114. val;
  56115. $3=$recv(val).__eq("a");
  56116. $ctx2.sendIdx["="]=1;
  56117. $4=$recv(val).__eq("b");
  56118. $ctx2.sendIdx["="]=2;
  56119. $2=$recv($3).__or($4);
  56120. $1=$recv($2).__or($recv(val).__eq("c"));
  56121. $ctx2.sendIdx["|"]=1;
  56122. return self._assert_($1);
  56123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56124. }));
  56125. return self;
  56126. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  56127. },
  56128. args: [],
  56129. 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].",
  56130. referencedClasses: [],
  56131. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  56132. }),
  56133. $globals.RandomTest);
  56134. $core.addMethod(
  56135. $core.method({
  56136. selector: "textNext",
  56137. protocol: 'tests',
  56138. fn: function (){
  56139. var self=this;
  56140. return $core.withContext(function($ctx1) {
  56141. var $1;
  56142. (10000)._timesRepeat_((function(){
  56143. var current,next;
  56144. return $core.withContext(function($ctx2) {
  56145. next=$recv($recv($globals.Random)._new())._next();
  56146. next;
  56147. self._assert_($recv(next).__gt_eq((0)));
  56148. $ctx2.sendIdx["assert:"]=1;
  56149. self._assert_($recv(next).__lt((1)));
  56150. $1=$recv(current).__eq(next);
  56151. $ctx2.sendIdx["="]=1;
  56152. self._deny_($1);
  56153. return $recv(next).__eq(current);
  56154. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  56155. }));
  56156. return self;
  56157. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  56158. },
  56159. args: [],
  56160. 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 ]",
  56161. referencedClasses: ["Random"],
  56162. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  56163. }),
  56164. $globals.RandomTest);
  56165. $core.addClass('StreamTest', $globals.TestCase, [], 'Kernel-Tests');
  56166. $core.addMethod(
  56167. $core.method({
  56168. selector: "collectionClass",
  56169. protocol: 'accessing',
  56170. fn: function (){
  56171. var self=this;
  56172. return $core.withContext(function($ctx1) {
  56173. return $recv(self._class())._collectionClass();
  56174. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  56175. },
  56176. args: [],
  56177. source: "collectionClass\x0a\x09^ self class collectionClass",
  56178. referencedClasses: [],
  56179. messageSends: ["collectionClass", "class"]
  56180. }),
  56181. $globals.StreamTest);
  56182. $core.addMethod(
  56183. $core.method({
  56184. selector: "newCollection",
  56185. protocol: 'accessing',
  56186. fn: function (){
  56187. var self=this;
  56188. return $core.withContext(function($ctx1) {
  56189. return $recv(self._collectionClass())._new();
  56190. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  56191. },
  56192. args: [],
  56193. source: "newCollection\x0a\x09^ self collectionClass new",
  56194. referencedClasses: [],
  56195. messageSends: ["new", "collectionClass"]
  56196. }),
  56197. $globals.StreamTest);
  56198. $core.addMethod(
  56199. $core.method({
  56200. selector: "newStream",
  56201. protocol: 'accessing',
  56202. fn: function (){
  56203. var self=this;
  56204. return $core.withContext(function($ctx1) {
  56205. return $recv($recv(self._collectionClass())._new())._stream();
  56206. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  56207. },
  56208. args: [],
  56209. source: "newStream\x0a\x09^ self collectionClass new stream",
  56210. referencedClasses: [],
  56211. messageSends: ["stream", "new", "collectionClass"]
  56212. }),
  56213. $globals.StreamTest);
  56214. $core.addMethod(
  56215. $core.method({
  56216. selector: "testAtStartAtEnd",
  56217. protocol: 'tests',
  56218. fn: function (){
  56219. var self=this;
  56220. var stream;
  56221. return $core.withContext(function($ctx1) {
  56222. var $1,$2,$3,$4;
  56223. stream=self._newStream();
  56224. $1=$recv(stream)._atStart();
  56225. $ctx1.sendIdx["atStart"]=1;
  56226. self._assert_($1);
  56227. $ctx1.sendIdx["assert:"]=1;
  56228. $2=$recv(stream)._atEnd();
  56229. $ctx1.sendIdx["atEnd"]=1;
  56230. self._assert_($2);
  56231. $ctx1.sendIdx["assert:"]=2;
  56232. $recv(stream)._nextPutAll_(self._newCollection());
  56233. $3=$recv(stream)._atEnd();
  56234. $ctx1.sendIdx["atEnd"]=2;
  56235. self._assert_($3);
  56236. $4=$recv(stream)._atStart();
  56237. $ctx1.sendIdx["atStart"]=2;
  56238. self._deny_($4);
  56239. $ctx1.sendIdx["deny:"]=1;
  56240. $recv(stream)._position_((1));
  56241. self._deny_($recv(stream)._atEnd());
  56242. $ctx1.sendIdx["deny:"]=2;
  56243. self._deny_($recv(stream)._atStart());
  56244. return self;
  56245. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  56246. },
  56247. args: [],
  56248. 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",
  56249. referencedClasses: [],
  56250. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  56251. }),
  56252. $globals.StreamTest);
  56253. $core.addMethod(
  56254. $core.method({
  56255. selector: "testContents",
  56256. protocol: 'tests',
  56257. fn: function (){
  56258. var self=this;
  56259. var stream;
  56260. return $core.withContext(function($ctx1) {
  56261. var $1,$2;
  56262. stream=self._newStream();
  56263. $1=stream;
  56264. $2=self._newCollection();
  56265. $ctx1.sendIdx["newCollection"]=1;
  56266. $recv($1)._nextPutAll_($2);
  56267. self._assert_equals_($recv(stream)._contents(),self._newCollection());
  56268. return self;
  56269. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  56270. },
  56271. args: [],
  56272. 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",
  56273. referencedClasses: [],
  56274. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  56275. }),
  56276. $globals.StreamTest);
  56277. $core.addMethod(
  56278. $core.method({
  56279. selector: "testIsEmpty",
  56280. protocol: 'tests',
  56281. fn: function (){
  56282. var self=this;
  56283. var stream;
  56284. return $core.withContext(function($ctx1) {
  56285. var $1;
  56286. stream=self._newStream();
  56287. $1=$recv(stream)._isEmpty();
  56288. $ctx1.sendIdx["isEmpty"]=1;
  56289. self._assert_($1);
  56290. $recv(stream)._nextPutAll_(self._newCollection());
  56291. self._deny_($recv(stream)._isEmpty());
  56292. return self;
  56293. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  56294. },
  56295. args: [],
  56296. 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",
  56297. referencedClasses: [],
  56298. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  56299. }),
  56300. $globals.StreamTest);
  56301. $core.addMethod(
  56302. $core.method({
  56303. selector: "testPosition",
  56304. protocol: 'tests',
  56305. fn: function (){
  56306. var self=this;
  56307. var collection,stream;
  56308. return $core.withContext(function($ctx1) {
  56309. var $1,$2,$3;
  56310. collection=self._newCollection();
  56311. stream=self._newStream();
  56312. $recv(stream)._nextPutAll_(collection);
  56313. $1=$recv(stream)._position();
  56314. $ctx1.sendIdx["position"]=1;
  56315. self._assert_equals_($1,$recv(collection)._size());
  56316. $ctx1.sendIdx["assert:equals:"]=1;
  56317. $recv(stream)._position_((0));
  56318. $2=$recv(stream)._position();
  56319. $ctx1.sendIdx["position"]=2;
  56320. self._assert_equals_($2,(0));
  56321. $ctx1.sendIdx["assert:equals:"]=2;
  56322. $recv(stream)._next();
  56323. $ctx1.sendIdx["next"]=1;
  56324. $3=$recv(stream)._position();
  56325. $ctx1.sendIdx["position"]=3;
  56326. self._assert_equals_($3,(1));
  56327. $ctx1.sendIdx["assert:equals:"]=3;
  56328. $recv(stream)._next();
  56329. self._assert_equals_($recv(stream)._position(),(2));
  56330. return self;
  56331. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  56332. },
  56333. args: [],
  56334. 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",
  56335. referencedClasses: [],
  56336. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  56337. }),
  56338. $globals.StreamTest);
  56339. $core.addMethod(
  56340. $core.method({
  56341. selector: "testReading",
  56342. protocol: 'tests',
  56343. fn: function (){
  56344. var self=this;
  56345. var stream,collection;
  56346. return $core.withContext(function($ctx1) {
  56347. var $1,$2;
  56348. collection=self._newCollection();
  56349. stream=self._newStream();
  56350. $1=stream;
  56351. $recv($1)._nextPutAll_(collection);
  56352. $recv($1)._position_((0));
  56353. $recv(collection)._do_((function(each){
  56354. return $core.withContext(function($ctx2) {
  56355. $2=$recv(stream)._next();
  56356. $ctx2.sendIdx["next"]=1;
  56357. return self._assert_equals_($2,each);
  56358. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56359. }));
  56360. self._assert_($recv($recv(stream)._next())._isNil());
  56361. return self;
  56362. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  56363. },
  56364. args: [],
  56365. 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",
  56366. referencedClasses: [],
  56367. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  56368. }),
  56369. $globals.StreamTest);
  56370. $core.addMethod(
  56371. $core.method({
  56372. selector: "testStreamContents",
  56373. protocol: 'tests',
  56374. fn: function (){
  56375. var self=this;
  56376. return self;
  56377. },
  56378. args: [],
  56379. source: "testStreamContents",
  56380. referencedClasses: [],
  56381. messageSends: []
  56382. }),
  56383. $globals.StreamTest);
  56384. $core.addMethod(
  56385. $core.method({
  56386. selector: "testWrite",
  56387. protocol: 'tests',
  56388. fn: function (){
  56389. var self=this;
  56390. var stream,collection;
  56391. return $core.withContext(function($ctx1) {
  56392. collection=self._newCollection();
  56393. stream=self._newStream();
  56394. $recv(collection)._do_((function(each){
  56395. return $core.withContext(function($ctx2) {
  56396. return $recv(stream).__lt_lt(each);
  56397. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56398. }));
  56399. self._assert_equals_($recv(stream)._contents(),collection);
  56400. return self;
  56401. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  56402. },
  56403. args: [],
  56404. 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",
  56405. referencedClasses: [],
  56406. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  56407. }),
  56408. $globals.StreamTest);
  56409. $core.addMethod(
  56410. $core.method({
  56411. selector: "testWriting",
  56412. protocol: 'tests',
  56413. fn: function (){
  56414. var self=this;
  56415. var stream,collection;
  56416. return $core.withContext(function($ctx1) {
  56417. var $1;
  56418. collection=self._newCollection();
  56419. stream=self._newStream();
  56420. $ctx1.sendIdx["newStream"]=1;
  56421. $recv(collection)._do_((function(each){
  56422. return $core.withContext(function($ctx2) {
  56423. return $recv(stream)._nextPut_(each);
  56424. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56425. }));
  56426. $1=$recv(stream)._contents();
  56427. $ctx1.sendIdx["contents"]=1;
  56428. self._assert_equals_($1,collection);
  56429. $ctx1.sendIdx["assert:equals:"]=1;
  56430. stream=self._newStream();
  56431. $recv(stream)._nextPutAll_(collection);
  56432. self._assert_equals_($recv(stream)._contents(),collection);
  56433. return self;
  56434. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  56435. },
  56436. args: [],
  56437. 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",
  56438. referencedClasses: [],
  56439. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  56440. }),
  56441. $globals.StreamTest);
  56442. $core.addMethod(
  56443. $core.method({
  56444. selector: "collectionClass",
  56445. protocol: 'accessing',
  56446. fn: function (){
  56447. var self=this;
  56448. return nil;
  56449. },
  56450. args: [],
  56451. source: "collectionClass\x0a\x09^ nil",
  56452. referencedClasses: [],
  56453. messageSends: []
  56454. }),
  56455. $globals.StreamTest.klass);
  56456. $core.addMethod(
  56457. $core.method({
  56458. selector: "isAbstract",
  56459. protocol: 'testing',
  56460. fn: function (){
  56461. var self=this;
  56462. return $core.withContext(function($ctx1) {
  56463. return $recv(self._collectionClass())._isNil();
  56464. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.klass)});
  56465. },
  56466. args: [],
  56467. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  56468. referencedClasses: [],
  56469. messageSends: ["isNil", "collectionClass"]
  56470. }),
  56471. $globals.StreamTest.klass);
  56472. $core.addClass('ArrayStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  56473. $core.addMethod(
  56474. $core.method({
  56475. selector: "newCollection",
  56476. protocol: 'accessing',
  56477. fn: function (){
  56478. var self=this;
  56479. return $core.withContext(function($ctx1) {
  56480. return [true,(1),(3).__at((4)),"foo"];
  56481. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  56482. },
  56483. args: [],
  56484. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  56485. referencedClasses: [],
  56486. messageSends: ["@"]
  56487. }),
  56488. $globals.ArrayStreamTest);
  56489. $core.addMethod(
  56490. $core.method({
  56491. selector: "collectionClass",
  56492. protocol: 'accessing',
  56493. fn: function (){
  56494. var self=this;
  56495. return $globals.Array;
  56496. },
  56497. args: [],
  56498. source: "collectionClass\x0a\x09^ Array",
  56499. referencedClasses: ["Array"],
  56500. messageSends: []
  56501. }),
  56502. $globals.ArrayStreamTest.klass);
  56503. $core.addClass('StringStreamTest', $globals.StreamTest, [], 'Kernel-Tests');
  56504. $core.addMethod(
  56505. $core.method({
  56506. selector: "newCollection",
  56507. protocol: 'accessing',
  56508. fn: function (){
  56509. var self=this;
  56510. return "hello world";
  56511. },
  56512. args: [],
  56513. source: "newCollection\x0a\x09^ 'hello world'",
  56514. referencedClasses: [],
  56515. messageSends: []
  56516. }),
  56517. $globals.StringStreamTest);
  56518. $core.addMethod(
  56519. $core.method({
  56520. selector: "collectionClass",
  56521. protocol: 'accessing',
  56522. fn: function (){
  56523. var self=this;
  56524. return $globals.String;
  56525. },
  56526. args: [],
  56527. source: "collectionClass\x0a\x09^ String",
  56528. referencedClasses: ["String"],
  56529. messageSends: []
  56530. }),
  56531. $globals.StringStreamTest.klass);
  56532. $core.addClass('UndefinedTest', $globals.TestCase, [], 'Kernel-Tests');
  56533. $core.addMethod(
  56534. $core.method({
  56535. selector: "testCopying",
  56536. protocol: 'tests',
  56537. fn: function (){
  56538. var self=this;
  56539. return $core.withContext(function($ctx1) {
  56540. self._assert_equals_(nil._copy(),nil);
  56541. return self;
  56542. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  56543. },
  56544. args: [],
  56545. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  56546. referencedClasses: [],
  56547. messageSends: ["assert:equals:", "copy"]
  56548. }),
  56549. $globals.UndefinedTest);
  56550. $core.addMethod(
  56551. $core.method({
  56552. selector: "testDeepCopy",
  56553. protocol: 'tests',
  56554. fn: function (){
  56555. var self=this;
  56556. return $core.withContext(function($ctx1) {
  56557. self._assert_($recv(nil._deepCopy()).__eq(nil));
  56558. return self;
  56559. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  56560. },
  56561. args: [],
  56562. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  56563. referencedClasses: [],
  56564. messageSends: ["assert:", "=", "deepCopy"]
  56565. }),
  56566. $globals.UndefinedTest);
  56567. $core.addMethod(
  56568. $core.method({
  56569. selector: "testIfNil",
  56570. protocol: 'tests',
  56571. fn: function (){
  56572. var self=this;
  56573. return $core.withContext(function($ctx1) {
  56574. var $1,$3,$2,$4,$6,$5,$receiver;
  56575. if(($receiver = nil) == null || $receiver.isNil){
  56576. $1=true;
  56577. } else {
  56578. $1=nil;
  56579. };
  56580. self._assert_equals_($1,true);
  56581. $ctx1.sendIdx["assert:equals:"]=1;
  56582. if(($receiver = nil) == null || $receiver.isNil){
  56583. $3=nil;
  56584. } else {
  56585. $3=true;
  56586. };
  56587. $2=$recv($3).__eq(true);
  56588. $ctx1.sendIdx["="]=1;
  56589. self._deny_($2);
  56590. $ctx1.sendIdx["deny:"]=1;
  56591. if(($receiver = nil) == null || $receiver.isNil){
  56592. $4=true;
  56593. } else {
  56594. $4=false;
  56595. };
  56596. self._assert_equals_($4,true);
  56597. if(($receiver = nil) == null || $receiver.isNil){
  56598. $6=false;
  56599. } else {
  56600. $6=true;
  56601. };
  56602. $5=$recv($6).__eq(true);
  56603. self._deny_($5);
  56604. return self;
  56605. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  56606. },
  56607. args: [],
  56608. 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",
  56609. referencedClasses: [],
  56610. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  56611. }),
  56612. $globals.UndefinedTest);
  56613. $core.addMethod(
  56614. $core.method({
  56615. selector: "testIsNil",
  56616. protocol: 'tests',
  56617. fn: function (){
  56618. var self=this;
  56619. return $core.withContext(function($ctx1) {
  56620. self._assert_(nil._isNil());
  56621. self._deny_(nil._notNil());
  56622. return self;
  56623. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  56624. },
  56625. args: [],
  56626. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  56627. referencedClasses: [],
  56628. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  56629. }),
  56630. $globals.UndefinedTest);
  56631. });
  56632. define("amber_core/SUnit-Tests", ["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  56633. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  56634. $core.addPackage('SUnit-Tests');
  56635. $core.packages["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  56636. $core.packages["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  56637. $core.addClass('ExampleSetTest', $globals.TestCase, ['empty', 'full'], 'SUnit-Tests');
  56638. $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.";
  56639. $core.addMethod(
  56640. $core.method({
  56641. selector: "setUp",
  56642. protocol: 'running',
  56643. fn: function (){
  56644. var self=this;
  56645. return $core.withContext(function($ctx1) {
  56646. self["@empty"]=$recv($globals.Set)._new();
  56647. self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  56648. return self;
  56649. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  56650. },
  56651. args: [],
  56652. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  56653. referencedClasses: ["Set"],
  56654. messageSends: ["new", "with:with:"]
  56655. }),
  56656. $globals.ExampleSetTest);
  56657. $core.addMethod(
  56658. $core.method({
  56659. selector: "testAdd",
  56660. protocol: 'tests',
  56661. fn: function (){
  56662. var self=this;
  56663. return $core.withContext(function($ctx1) {
  56664. $recv(self["@empty"])._add_((5));
  56665. self._assert_($recv(self["@empty"])._includes_((5)));
  56666. return self;
  56667. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  56668. },
  56669. args: [],
  56670. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  56671. referencedClasses: [],
  56672. messageSends: ["add:", "assert:", "includes:"]
  56673. }),
  56674. $globals.ExampleSetTest);
  56675. $core.addMethod(
  56676. $core.method({
  56677. selector: "testGrow",
  56678. protocol: 'tests',
  56679. fn: function (){
  56680. var self=this;
  56681. return $core.withContext(function($ctx1) {
  56682. $recv(self["@empty"])._addAll_((1)._to_((100)));
  56683. self._assert_equals_($recv(self["@empty"])._size(),(100));
  56684. return self;
  56685. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  56686. },
  56687. args: [],
  56688. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  56689. referencedClasses: [],
  56690. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  56691. }),
  56692. $globals.ExampleSetTest);
  56693. $core.addMethod(
  56694. $core.method({
  56695. selector: "testIllegal",
  56696. protocol: 'tests',
  56697. fn: function (){
  56698. var self=this;
  56699. return $core.withContext(function($ctx1) {
  56700. self._should_raise_((function(){
  56701. return $core.withContext(function($ctx2) {
  56702. return $recv(self["@empty"])._at_((5));
  56703. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56704. }),$globals.Error);
  56705. $ctx1.sendIdx["should:raise:"]=1;
  56706. self._should_raise_((function(){
  56707. return $core.withContext(function($ctx2) {
  56708. return $recv(self["@empty"])._at_put_((5),"abc");
  56709. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56710. }),$globals.Error);
  56711. return self;
  56712. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  56713. },
  56714. args: [],
  56715. 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",
  56716. referencedClasses: ["Error"],
  56717. messageSends: ["should:raise:", "at:", "at:put:"]
  56718. }),
  56719. $globals.ExampleSetTest);
  56720. $core.addMethod(
  56721. $core.method({
  56722. selector: "testIncludes",
  56723. protocol: 'tests',
  56724. fn: function (){
  56725. var self=this;
  56726. return $core.withContext(function($ctx1) {
  56727. var $1;
  56728. $1=$recv(self["@full"])._includes_((5));
  56729. $ctx1.sendIdx["includes:"]=1;
  56730. self._assert_($1);
  56731. $ctx1.sendIdx["assert:"]=1;
  56732. self._assert_($recv(self["@full"])._includes_("abc"));
  56733. return self;
  56734. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  56735. },
  56736. args: [],
  56737. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  56738. referencedClasses: [],
  56739. messageSends: ["assert:", "includes:"]
  56740. }),
  56741. $globals.ExampleSetTest);
  56742. $core.addMethod(
  56743. $core.method({
  56744. selector: "testOccurrences",
  56745. protocol: 'tests',
  56746. fn: function (){
  56747. var self=this;
  56748. return $core.withContext(function($ctx1) {
  56749. var $1,$2;
  56750. $1=$recv(self["@empty"])._occurrencesOf_((0));
  56751. $ctx1.sendIdx["occurrencesOf:"]=1;
  56752. self._assert_equals_($1,(0));
  56753. $ctx1.sendIdx["assert:equals:"]=1;
  56754. $2=$recv(self["@full"])._occurrencesOf_((5));
  56755. $ctx1.sendIdx["occurrencesOf:"]=2;
  56756. self._assert_equals_($2,(1));
  56757. $ctx1.sendIdx["assert:equals:"]=2;
  56758. $recv(self["@full"])._add_((5));
  56759. self._assert_equals_($recv(self["@full"])._occurrencesOf_((5)),(1));
  56760. return self;
  56761. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  56762. },
  56763. args: [],
  56764. 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",
  56765. referencedClasses: [],
  56766. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  56767. }),
  56768. $globals.ExampleSetTest);
  56769. $core.addMethod(
  56770. $core.method({
  56771. selector: "testRemove",
  56772. protocol: 'tests',
  56773. fn: function (){
  56774. var self=this;
  56775. return $core.withContext(function($ctx1) {
  56776. var $1;
  56777. $recv(self["@full"])._remove_((5));
  56778. $1=$recv(self["@full"])._includes_("abc");
  56779. $ctx1.sendIdx["includes:"]=1;
  56780. self._assert_($1);
  56781. self._deny_($recv(self["@full"])._includes_((5)));
  56782. return self;
  56783. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  56784. },
  56785. args: [],
  56786. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  56787. referencedClasses: [],
  56788. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  56789. }),
  56790. $globals.ExampleSetTest);
  56791. $core.addClass('SUnitAsyncTest', $globals.TestCase, ['flag'], 'SUnit-Tests');
  56792. $core.addMethod(
  56793. $core.method({
  56794. selector: "fakeError",
  56795. protocol: 'helpers',
  56796. fn: function (){
  56797. var self=this;
  56798. return $core.withContext(function($ctx1) {
  56799. self["@flag"]="bad";
  56800. self._timeout_((30));
  56801. self["@flag"]=$recv(self._async_((function(){
  56802. return $core.withContext(function($ctx2) {
  56803. self["@flag"]="ok";
  56804. self["@flag"];
  56805. return self._error_("Intentional");
  56806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56807. })))._valueWithTimeout_((20));
  56808. return self;
  56809. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  56810. },
  56811. args: [],
  56812. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  56813. referencedClasses: [],
  56814. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  56815. }),
  56816. $globals.SUnitAsyncTest);
  56817. $core.addMethod(
  56818. $core.method({
  56819. selector: "fakeErrorFailingInTearDown",
  56820. protocol: 'helpers',
  56821. fn: function (){
  56822. var self=this;
  56823. return $core.withContext(function($ctx1) {
  56824. self["@flag"]="bad";
  56825. self._timeout_((30));
  56826. self["@flag"]=$recv(self._async_((function(){
  56827. return $core.withContext(function($ctx2) {
  56828. return self._error_("Intentional");
  56829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56830. })))._valueWithTimeout_((20));
  56831. return self;
  56832. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  56833. },
  56834. args: [],
  56835. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  56836. referencedClasses: [],
  56837. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  56838. }),
  56839. $globals.SUnitAsyncTest);
  56840. $core.addMethod(
  56841. $core.method({
  56842. selector: "fakeFailure",
  56843. protocol: 'helpers',
  56844. fn: function (){
  56845. var self=this;
  56846. return $core.withContext(function($ctx1) {
  56847. self["@flag"]="bad";
  56848. self._timeout_((30));
  56849. self["@flag"]=$recv(self._async_((function(){
  56850. return $core.withContext(function($ctx2) {
  56851. self["@flag"]="ok";
  56852. self["@flag"];
  56853. return self._assert_(false);
  56854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56855. })))._valueWithTimeout_((20));
  56856. return self;
  56857. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  56858. },
  56859. args: [],
  56860. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  56861. referencedClasses: [],
  56862. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  56863. }),
  56864. $globals.SUnitAsyncTest);
  56865. $core.addMethod(
  56866. $core.method({
  56867. selector: "fakeMultipleTimeoutFailing",
  56868. protocol: 'helpers',
  56869. fn: function (){
  56870. var self=this;
  56871. return $core.withContext(function($ctx1) {
  56872. var $1;
  56873. self._timeout_((100));
  56874. $ctx1.sendIdx["timeout:"]=1;
  56875. $1=self._async_((function(){
  56876. return $core.withContext(function($ctx2) {
  56877. self._timeout_((20));
  56878. return $recv(self._async_((function(){
  56879. return $core.withContext(function($ctx3) {
  56880. return self._finished();
  56881. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  56882. })))._valueWithTimeout_((30));
  56883. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56884. }));
  56885. $ctx1.sendIdx["async:"]=1;
  56886. $recv($1)._valueWithTimeout_((20));
  56887. $ctx1.sendIdx["valueWithTimeout:"]=1;
  56888. return self;
  56889. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  56890. },
  56891. args: [],
  56892. 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",
  56893. referencedClasses: [],
  56894. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  56895. }),
  56896. $globals.SUnitAsyncTest);
  56897. $core.addMethod(
  56898. $core.method({
  56899. selector: "fakeMultipleTimeoutPassing",
  56900. protocol: 'helpers',
  56901. fn: function (){
  56902. var self=this;
  56903. return $core.withContext(function($ctx1) {
  56904. var $1;
  56905. self._timeout_((20));
  56906. $ctx1.sendIdx["timeout:"]=1;
  56907. $1=self._async_((function(){
  56908. return $core.withContext(function($ctx2) {
  56909. self._timeout_((40));
  56910. return $recv(self._async_((function(){
  56911. return $core.withContext(function($ctx3) {
  56912. return self._finished();
  56913. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  56914. })))._valueWithTimeout_((20));
  56915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56916. }));
  56917. $ctx1.sendIdx["async:"]=1;
  56918. $recv($1)._valueWithTimeout_((10));
  56919. $ctx1.sendIdx["valueWithTimeout:"]=1;
  56920. return self;
  56921. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  56922. },
  56923. args: [],
  56924. 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",
  56925. referencedClasses: [],
  56926. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  56927. }),
  56928. $globals.SUnitAsyncTest);
  56929. $core.addMethod(
  56930. $core.method({
  56931. selector: "fakeTimeout",
  56932. protocol: 'helpers',
  56933. fn: function (){
  56934. var self=this;
  56935. return $core.withContext(function($ctx1) {
  56936. self._timeout_((10));
  56937. $recv(self._async_((function(){
  56938. return $core.withContext(function($ctx2) {
  56939. return self._finished();
  56940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56941. })))._valueWithTimeout_((20));
  56942. return self;
  56943. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  56944. },
  56945. args: [],
  56946. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  56947. referencedClasses: [],
  56948. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  56949. }),
  56950. $globals.SUnitAsyncTest);
  56951. $core.addMethod(
  56952. $core.method({
  56953. selector: "selectorSetOf:",
  56954. protocol: 'private',
  56955. fn: function (aCollection){
  56956. var self=this;
  56957. return $core.withContext(function($ctx1) {
  56958. return $recv($recv(aCollection)._collect_((function(each){
  56959. return $core.withContext(function($ctx2) {
  56960. return $recv(each)._selector();
  56961. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  56962. })))._asSet();
  56963. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  56964. },
  56965. args: ["aCollection"],
  56966. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  56967. referencedClasses: [],
  56968. messageSends: ["asSet", "collect:", "selector"]
  56969. }),
  56970. $globals.SUnitAsyncTest);
  56971. $core.addMethod(
  56972. $core.method({
  56973. selector: "setUp",
  56974. protocol: 'running',
  56975. fn: function (){
  56976. var self=this;
  56977. self["@flag"]="ok";
  56978. return self;
  56979. },
  56980. args: [],
  56981. source: "setUp\x0a\x09flag := 'ok'",
  56982. referencedClasses: [],
  56983. messageSends: []
  56984. }),
  56985. $globals.SUnitAsyncTest);
  56986. $core.addMethod(
  56987. $core.method({
  56988. selector: "tearDown",
  56989. protocol: 'running',
  56990. fn: function (){
  56991. var self=this;
  56992. return $core.withContext(function($ctx1) {
  56993. self._assert_equals_("ok",self["@flag"]);
  56994. return self;
  56995. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  56996. },
  56997. args: [],
  56998. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  56999. referencedClasses: [],
  57000. messageSends: ["assert:equals:"]
  57001. }),
  57002. $globals.SUnitAsyncTest);
  57003. $core.addMethod(
  57004. $core.method({
  57005. selector: "testAsyncErrorsAndFailures",
  57006. protocol: 'tests',
  57007. fn: function (){
  57008. var self=this;
  57009. var suite,runner,result,assertBlock;
  57010. return $core.withContext(function($ctx1) {
  57011. var $1,$2,$3,$4;
  57012. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  57013. return $core.withContext(function($ctx2) {
  57014. return $recv(self._class())._selector_(each);
  57015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57016. }));
  57017. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  57018. self._timeout_((200));
  57019. result=$recv(runner)._result();
  57020. $ctx1.sendIdx["result"]=1;
  57021. assertBlock=self._async_((function(){
  57022. return $core.withContext(function($ctx2) {
  57023. $1=self._selectorSetOf_($recv(result)._errors());
  57024. $ctx2.sendIdx["selectorSetOf:"]=1;
  57025. $2=["fakeError"]._asSet();
  57026. $ctx2.sendIdx["asSet"]=1;
  57027. self._assert_equals_($1,$2);
  57028. $ctx2.sendIdx["assert:equals:"]=1;
  57029. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  57030. return self._finished();
  57031. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57032. }));
  57033. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  57034. return $core.withContext(function($ctx2) {
  57035. $3=$recv($recv(ann)._result()).__eq_eq(result);
  57036. if($core.assert($3)){
  57037. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  57038. return $recv($4)._ifTrue_(assertBlock);
  57039. };
  57040. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  57041. }));
  57042. $recv(runner)._run();
  57043. return self;
  57044. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  57045. },
  57046. args: [],
  57047. 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",
  57048. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  57049. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  57050. }),
  57051. $globals.SUnitAsyncTest);
  57052. $core.addMethod(
  57053. $core.method({
  57054. selector: "testAsyncNeedsTimeout",
  57055. protocol: 'tests',
  57056. fn: function (){
  57057. var self=this;
  57058. return $core.withContext(function($ctx1) {
  57059. self._should_raise_((function(){
  57060. return $core.withContext(function($ctx2) {
  57061. return self._async_((function(){
  57062. }));
  57063. $ctx2.sendIdx["async:"]=1;
  57064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57065. }),$globals.Error);
  57066. self._timeout_((0));
  57067. self._shouldnt_raise_((function(){
  57068. return $core.withContext(function($ctx2) {
  57069. return self._async_((function(){
  57070. }));
  57071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  57072. }),$globals.Error);
  57073. self._finished();
  57074. return self;
  57075. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  57076. },
  57077. args: [],
  57078. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  57079. referencedClasses: ["Error"],
  57080. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  57081. }),
  57082. $globals.SUnitAsyncTest);
  57083. $core.addMethod(
  57084. $core.method({
  57085. selector: "testFinishedNeedsTimeout",
  57086. protocol: 'tests',
  57087. fn: function (){
  57088. var self=this;
  57089. return $core.withContext(function($ctx1) {
  57090. self._should_raise_((function(){
  57091. return $core.withContext(function($ctx2) {
  57092. return self._finished();
  57093. $ctx2.sendIdx["finished"]=1;
  57094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57095. }),$globals.Error);
  57096. self._timeout_((0));
  57097. self._shouldnt_raise_((function(){
  57098. return $core.withContext(function($ctx2) {
  57099. return self._finished();
  57100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57101. }),$globals.Error);
  57102. return self;
  57103. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  57104. },
  57105. args: [],
  57106. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  57107. referencedClasses: ["Error"],
  57108. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  57109. }),
  57110. $globals.SUnitAsyncTest);
  57111. $core.addMethod(
  57112. $core.method({
  57113. selector: "testIsAsyncReturnsCorrectValues",
  57114. protocol: 'tests',
  57115. fn: function (){
  57116. var self=this;
  57117. return $core.withContext(function($ctx1) {
  57118. var $1,$2;
  57119. $1=self._isAsync();
  57120. $ctx1.sendIdx["isAsync"]=1;
  57121. self._deny_($1);
  57122. $ctx1.sendIdx["deny:"]=1;
  57123. self._timeout_((0));
  57124. $2=self._isAsync();
  57125. $ctx1.sendIdx["isAsync"]=2;
  57126. self._assert_($2);
  57127. self._finished();
  57128. self._deny_(self._isAsync());
  57129. return self;
  57130. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  57131. },
  57132. args: [],
  57133. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  57134. referencedClasses: [],
  57135. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  57136. }),
  57137. $globals.SUnitAsyncTest);
  57138. $core.addMethod(
  57139. $core.method({
  57140. selector: "testPass",
  57141. protocol: 'tests',
  57142. fn: function (){
  57143. var self=this;
  57144. return $core.withContext(function($ctx1) {
  57145. self["@flag"]="bad";
  57146. self._timeout_((10));
  57147. self["@flag"]=$recv(self._async_((function(){
  57148. return $core.withContext(function($ctx2) {
  57149. self._assert_(true);
  57150. self._finished();
  57151. self["@flag"]="ok";
  57152. return self["@flag"];
  57153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57154. })))._valueWithTimeout_((5));
  57155. return self;
  57156. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  57157. },
  57158. args: [],
  57159. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  57160. referencedClasses: [],
  57161. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  57162. }),
  57163. $globals.SUnitAsyncTest);
  57164. $core.addMethod(
  57165. $core.method({
  57166. selector: "testTimeouts",
  57167. protocol: 'tests',
  57168. fn: function (){
  57169. var self=this;
  57170. var suite,runner,result,assertBlock;
  57171. return $core.withContext(function($ctx1) {
  57172. var $1,$2,$3;
  57173. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  57174. return $core.withContext(function($ctx2) {
  57175. return $recv(self._class())._selector_(each);
  57176. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57177. }));
  57178. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  57179. self._timeout_((200));
  57180. result=$recv(runner)._result();
  57181. $ctx1.sendIdx["result"]=1;
  57182. assertBlock=self._async_((function(){
  57183. return $core.withContext(function($ctx2) {
  57184. $1=self._selectorSetOf_($recv(result)._errors());
  57185. $ctx2.sendIdx["selectorSetOf:"]=1;
  57186. self._assert_equals_($1,$recv($globals.Set)._new());
  57187. $ctx2.sendIdx["assert:equals:"]=1;
  57188. self._assert_equals_(self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  57189. return self._finished();
  57190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57191. }));
  57192. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  57193. return $core.withContext(function($ctx2) {
  57194. $2=$recv($recv(ann)._result()).__eq_eq(result);
  57195. if($core.assert($2)){
  57196. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  57197. return $recv($3)._ifTrue_(assertBlock);
  57198. };
  57199. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  57200. }));
  57201. $recv(runner)._run();
  57202. return self;
  57203. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  57204. },
  57205. args: [],
  57206. 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",
  57207. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  57208. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  57209. }),
  57210. $globals.SUnitAsyncTest);
  57211. $core.addMethod(
  57212. $core.method({
  57213. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  57214. protocol: 'tests',
  57215. fn: function (){
  57216. var self=this;
  57217. var x;
  57218. return $core.withContext(function($ctx1) {
  57219. var $1;
  57220. self["@flag"]="bad";
  57221. self._timeout_((10));
  57222. x=(0);
  57223. $1=self._async_((function(){
  57224. return $core.withContext(function($ctx2) {
  57225. self._finished();
  57226. $ctx2.sendIdx["finished"]=1;
  57227. self["@flag"]="ok";
  57228. self["@flag"];
  57229. x=$recv(x).__plus((1));
  57230. $ctx2.sendIdx["+"]=1;
  57231. x;
  57232. return self._assert_equals_(x,(1));
  57233. $ctx2.sendIdx["assert:equals:"]=1;
  57234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57235. }));
  57236. $ctx1.sendIdx["async:"]=1;
  57237. self["@flag"]=$recv($1)._valueWithTimeout_((0));
  57238. $ctx1.sendIdx["valueWithTimeout:"]=1;
  57239. self["@flag"]=$recv(self._async_((function(){
  57240. return $core.withContext(function($ctx2) {
  57241. self._finished();
  57242. self["@flag"]="ok";
  57243. self["@flag"];
  57244. x=$recv(x).__plus((1));
  57245. x;
  57246. return self._assert_equals_(x,(1));
  57247. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57248. })))._valueWithTimeout_((0));
  57249. return self;
  57250. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  57251. },
  57252. args: [],
  57253. 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.",
  57254. referencedClasses: [],
  57255. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  57256. }),
  57257. $globals.SUnitAsyncTest);
  57258. });
  57259. define('amber/devel',[
  57260. './helpers', // pre-fetch, dep of ./deploy
  57261. './deploy', // pre-fetch, dep of ./lang
  57262. './lang',
  57263. // --- packages of the development only Amber begin here ---
  57264. 'amber_core/SUnit',
  57265. 'amber_core/Compiler-Tests',
  57266. 'amber_core/Kernel-Tests',
  57267. 'amber_core/SUnit-Tests'
  57268. // --- packages of the development only Amber end here ---
  57269. ], function (amber) { return amber; });
  57270. define("amber_cli/AmberCli", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  57271. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  57272. $core.addPackage('AmberCli');
  57273. $core.packages["AmberCli"].innerEval = function (expr) { return eval(expr); };
  57274. $core.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  57275. $core.addClass('AmberCli', $globals.Object, [], 'AmberCli');
  57276. $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.";
  57277. $core.addMethod(
  57278. $core.method({
  57279. selector: "commandLineSwitches",
  57280. protocol: 'commandline',
  57281. fn: function (){
  57282. var self=this;
  57283. var switches;
  57284. return $core.withContext(function($ctx1) {
  57285. switches=$recv($recv(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  57286. return $core.withContext(function($ctx2) {
  57287. return $recv(each)._selector();
  57288. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57289. }));
  57290. $ctx1.sendIdx["collect:"]=1;
  57291. switches=$recv(switches)._select_((function(each){
  57292. return $core.withContext(function($ctx2) {
  57293. return $recv(each)._match_("^[^:]*:$");
  57294. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  57295. }));
  57296. switches=$recv(switches)._collect_((function(each){
  57297. return $core.withContext(function($ctx2) {
  57298. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  57299. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  57300. }));
  57301. return switches;
  57302. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.klass)});
  57303. },
  57304. args: [],
  57305. 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",
  57306. referencedClasses: [],
  57307. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  57308. }),
  57309. $globals.AmberCli.klass);
  57310. $core.addMethod(
  57311. $core.method({
  57312. selector: "config:",
  57313. protocol: 'commands',
  57314. fn: function (args){
  57315. var self=this;
  57316. return $core.withContext(function($ctx1) {
  57317. $recv($recv($globals.Configurator)._new())._start();
  57318. return self;
  57319. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.klass)});
  57320. },
  57321. args: ["args"],
  57322. source: "config: args\x0a\x09Configurator new start",
  57323. referencedClasses: ["Configurator"],
  57324. messageSends: ["start", "new"]
  57325. }),
  57326. $globals.AmberCli.klass);
  57327. $core.addMethod(
  57328. $core.method({
  57329. selector: "handleArguments:",
  57330. protocol: 'commandline',
  57331. fn: function (args){
  57332. var self=this;
  57333. var selector;
  57334. return $core.withContext(function($ctx1) {
  57335. var $1;
  57336. $1=$recv(args)._first();
  57337. $ctx1.sendIdx["first"]=1;
  57338. selector=self._selectorForCommandLineSwitch_($1);
  57339. $recv(args)._remove_($recv(args)._first());
  57340. self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  57341. return self;
  57342. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.klass)});
  57343. },
  57344. args: ["args"],
  57345. 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)",
  57346. referencedClasses: ["Array"],
  57347. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  57348. }),
  57349. $globals.AmberCli.klass);
  57350. $core.addMethod(
  57351. $core.method({
  57352. selector: "help:",
  57353. protocol: 'commands',
  57354. fn: function (args){
  57355. var self=this;
  57356. return $core.withContext(function($ctx1) {
  57357. $recv($globals.Transcript)._show_("Available commands");
  57358. $recv(self._commandLineSwitches())._do_((function(each){
  57359. return $core.withContext(function($ctx2) {
  57360. return $recv(console)._log_(each);
  57361. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  57362. }));
  57363. return self;
  57364. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.klass)});
  57365. },
  57366. args: ["args"],
  57367. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  57368. referencedClasses: ["Transcript"],
  57369. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  57370. }),
  57371. $globals.AmberCli.klass);
  57372. $core.addMethod(
  57373. $core.method({
  57374. selector: "init:",
  57375. protocol: 'commands',
  57376. fn: function (args){
  57377. var self=this;
  57378. return $core.withContext(function($ctx1) {
  57379. $recv($recv($globals.Initer)._new())._start();
  57380. return self;
  57381. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.klass)});
  57382. },
  57383. args: ["args"],
  57384. source: "init: args\x0a\x09Initer new start",
  57385. referencedClasses: ["Initer"],
  57386. messageSends: ["start", "new"]
  57387. }),
  57388. $globals.AmberCli.klass);
  57389. $core.addMethod(
  57390. $core.method({
  57391. selector: "main",
  57392. protocol: 'startup',
  57393. fn: function (){
  57394. var self=this;
  57395. var args;
  57396. return $core.withContext(function($ctx1) {
  57397. var $3,$2,$1,$4;
  57398. $3=$recv("Welcome to Amber version ".__comma($recv($globals.Smalltalk)._version())).__comma(" (NodeJS ");
  57399. $ctx1.sendIdx[","]=3;
  57400. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  57401. $ctx1.sendIdx[","]=2;
  57402. $1=$recv($2).__comma(").");
  57403. $ctx1.sendIdx[","]=1;
  57404. $recv($globals.Transcript)._show_($1);
  57405. args=$recv(process)._argv();
  57406. $recv(args)._removeFrom_to_((1),(2));
  57407. $4=$recv(args)._isEmpty();
  57408. if($core.assert($4)){
  57409. self._help_(nil);
  57410. } else {
  57411. return self._handleArguments_(args);
  57412. };
  57413. return self;
  57414. }, function($ctx1) {$ctx1.fill(self,"main",{args:args},$globals.AmberCli.klass)});
  57415. },
  57416. args: [],
  57417. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09Parses commandline arguments and starts the according subprogram.\x22\x0a\x09| args |\x0a\x09\x0a\x09Transcript show: 'Welcome to Amber version ', 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\x09(args isEmpty)\x0a\x09\x09ifTrue: [self help: nil]\x0a\x09\x09ifFalse: [^self handleArguments: args]",
  57418. referencedClasses: ["Transcript", "Smalltalk"],
  57419. messageSends: ["show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"]
  57420. }),
  57421. $globals.AmberCli.klass);
  57422. $core.addMethod(
  57423. $core.method({
  57424. selector: "repl:",
  57425. protocol: 'commands',
  57426. fn: function (args){
  57427. var self=this;
  57428. return $core.withContext(function($ctx1) {
  57429. return $recv($recv($globals.Repl)._new())._createInterface();
  57430. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.klass)});
  57431. },
  57432. args: ["args"],
  57433. source: "repl: args\x0a\x09^ Repl new createInterface",
  57434. referencedClasses: ["Repl"],
  57435. messageSends: ["createInterface", "new"]
  57436. }),
  57437. $globals.AmberCli.klass);
  57438. $core.addMethod(
  57439. $core.method({
  57440. selector: "selectorForCommandLineSwitch:",
  57441. protocol: 'commandline',
  57442. fn: function (aSwitch){
  57443. var self=this;
  57444. var command,selector;
  57445. return $core.withContext(function($ctx1) {
  57446. var $1;
  57447. $1=$recv(self._commandLineSwitches())._includes_(aSwitch);
  57448. if($core.assert($1)){
  57449. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  57450. return $core.withContext(function($ctx2) {
  57451. return $recv($recv(each)._second())._asUppercase();
  57452. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  57453. }))).__comma(":");
  57454. selector;
  57455. } else {
  57456. selector="help:";
  57457. selector;
  57458. };
  57459. return selector;
  57460. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.klass)});
  57461. },
  57462. args: ["aSwitch"],
  57463. 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",
  57464. referencedClasses: [],
  57465. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  57466. }),
  57467. $globals.AmberCli.klass);
  57468. $core.addMethod(
  57469. $core.method({
  57470. selector: "serve:",
  57471. protocol: 'commands',
  57472. fn: function (args){
  57473. var self=this;
  57474. return $core.withContext(function($ctx1) {
  57475. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  57476. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.klass)});
  57477. },
  57478. args: ["args"],
  57479. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  57480. referencedClasses: ["FileServer"],
  57481. messageSends: ["start", "createServerWithArguments:"]
  57482. }),
  57483. $globals.AmberCli.klass);
  57484. $core.addMethod(
  57485. $core.method({
  57486. selector: "version:",
  57487. protocol: 'commands',
  57488. fn: function (arguments_){
  57489. var self=this;
  57490. return self;
  57491. },
  57492. args: ["arguments"],
  57493. source: "version: arguments",
  57494. referencedClasses: [],
  57495. messageSends: []
  57496. }),
  57497. $globals.AmberCli.klass);
  57498. $core.addClass('BaseFileManipulator', $globals.Object, ['path', 'fs'], 'AmberCli');
  57499. $core.addMethod(
  57500. $core.method({
  57501. selector: "dirname",
  57502. protocol: 'private',
  57503. fn: function (){
  57504. var self=this;
  57505. return $core.withContext(function($ctx1) {
  57506. return __dirname;
  57507. return self;
  57508. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  57509. },
  57510. args: [],
  57511. source: "dirname\x0a\x09<return __dirname>",
  57512. referencedClasses: [],
  57513. messageSends: []
  57514. }),
  57515. $globals.BaseFileManipulator);
  57516. $core.addMethod(
  57517. $core.method({
  57518. selector: "initialize",
  57519. protocol: 'initialization',
  57520. fn: function (){
  57521. var self=this;
  57522. return $core.withContext(function($ctx1) {
  57523. (
  57524. $ctx1.supercall = true,
  57525. ($globals.BaseFileManipulator.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  57526. $ctx1.supercall = false;
  57527. self["@path"]=$recv(require)._value_("path");
  57528. $ctx1.sendIdx["value:"]=1;
  57529. self["@fs"]=$recv(require)._value_("fs");
  57530. return self;
  57531. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  57532. },
  57533. args: [],
  57534. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  57535. referencedClasses: [],
  57536. messageSends: ["initialize", "value:"]
  57537. }),
  57538. $globals.BaseFileManipulator);
  57539. $core.addMethod(
  57540. $core.method({
  57541. selector: "rootDirname",
  57542. protocol: 'private',
  57543. fn: function (){
  57544. var self=this;
  57545. return $core.withContext(function($ctx1) {
  57546. return $recv(self["@path"])._join_with_(self._dirname(),"..");
  57547. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  57548. },
  57549. args: [],
  57550. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  57551. referencedClasses: [],
  57552. messageSends: ["join:with:", "dirname"]
  57553. }),
  57554. $globals.BaseFileManipulator);
  57555. $core.addClass('Configurator', $globals.BaseFileManipulator, [], 'AmberCli');
  57556. $core.addMethod(
  57557. $core.method({
  57558. selector: "initialize",
  57559. protocol: 'initialization',
  57560. fn: function (){
  57561. var self=this;
  57562. return $core.withContext(function($ctx1) {
  57563. (
  57564. $ctx1.supercall = true,
  57565. ($globals.Configurator.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  57566. $ctx1.supercall = false;
  57567. return self;
  57568. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  57569. },
  57570. args: [],
  57571. source: "initialize\x0a\x09super initialize",
  57572. referencedClasses: [],
  57573. messageSends: ["initialize"]
  57574. }),
  57575. $globals.Configurator);
  57576. $core.addMethod(
  57577. $core.method({
  57578. selector: "start",
  57579. protocol: 'action',
  57580. fn: function (){
  57581. var self=this;
  57582. return $core.withContext(function($ctx1) {
  57583. var $receiver;
  57584. self._writeConfigThenDo_((function(err){
  57585. return $core.withContext(function($ctx2) {
  57586. if(($receiver = err) == null || $receiver.isNil){
  57587. return $recv(process)._exit();
  57588. } else {
  57589. return $recv(process)._exit_((111));
  57590. };
  57591. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  57592. }));
  57593. return self;
  57594. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  57595. },
  57596. args: [],
  57597. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  57598. referencedClasses: [],
  57599. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  57600. }),
  57601. $globals.Configurator);
  57602. $core.addMethod(
  57603. $core.method({
  57604. selector: "writeConfigThenDo:",
  57605. protocol: 'action',
  57606. fn: function (aBlock){
  57607. var self=this;
  57608. return $core.withContext(function($ctx1) {
  57609. $recv($recv($recv(require)._value_("amber-dev"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  57610. return self;
  57611. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  57612. },
  57613. args: ["aBlock"],
  57614. source: "writeConfigThenDo: aBlock\x0a\x09(require value: 'amber-dev') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  57615. referencedClasses: [],
  57616. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  57617. }),
  57618. $globals.Configurator);
  57619. $core.addClass('FileServer', $globals.BaseFileManipulator, ['http', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  57620. $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.";
  57621. $core.addMethod(
  57622. $core.method({
  57623. selector: "base64Decode:",
  57624. protocol: 'private',
  57625. fn: function (aString){
  57626. var self=this;
  57627. return $core.withContext(function($ctx1) {
  57628. return (new Buffer(aString, 'base64').toString());
  57629. return self;
  57630. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  57631. },
  57632. args: ["aString"],
  57633. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  57634. referencedClasses: [],
  57635. messageSends: []
  57636. }),
  57637. $globals.FileServer);
  57638. $core.addMethod(
  57639. $core.method({
  57640. selector: "basePath",
  57641. protocol: 'accessing',
  57642. fn: function (){
  57643. var self=this;
  57644. return $core.withContext(function($ctx1) {
  57645. var $1,$receiver;
  57646. $1=self["@basePath"];
  57647. if(($receiver = $1) == null || $receiver.isNil){
  57648. return $recv(self._class())._defaultBasePath();
  57649. } else {
  57650. return $1;
  57651. };
  57652. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  57653. },
  57654. args: [],
  57655. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  57656. referencedClasses: [],
  57657. messageSends: ["ifNil:", "defaultBasePath", "class"]
  57658. }),
  57659. $globals.FileServer);
  57660. $core.addMethod(
  57661. $core.method({
  57662. selector: "basePath:",
  57663. protocol: 'accessing',
  57664. fn: function (aString){
  57665. var self=this;
  57666. return $core.withContext(function($ctx1) {
  57667. self["@basePath"]=aString;
  57668. self._validateBasePath();
  57669. return self;
  57670. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  57671. },
  57672. args: ["aString"],
  57673. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  57674. referencedClasses: [],
  57675. messageSends: ["validateBasePath"]
  57676. }),
  57677. $globals.FileServer);
  57678. $core.addMethod(
  57679. $core.method({
  57680. selector: "checkDirectoryLayout",
  57681. protocol: 'initialization',
  57682. fn: function (){
  57683. var self=this;
  57684. return $core.withContext(function($ctx1) {
  57685. var $1;
  57686. $1=$recv(self["@fs"])._existsSync_(self._withBasePath_("index.html"));
  57687. if(!$core.assert($1)){
  57688. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  57689. $ctx1.sendIdx["warn:"]=1;
  57690. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  57691. $ctx1.sendIdx["warn:"]=2;
  57692. $recv(console)._warn_(" You can also specify a page to be served by default,");
  57693. $ctx1.sendIdx["warn:"]=3;
  57694. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  57695. };
  57696. return self;
  57697. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  57698. },
  57699. args: [],
  57700. 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.'].",
  57701. referencedClasses: [],
  57702. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  57703. }),
  57704. $globals.FileServer);
  57705. $core.addMethod(
  57706. $core.method({
  57707. selector: "fallbackPage",
  57708. protocol: 'accessing',
  57709. fn: function (){
  57710. var self=this;
  57711. return self["@fallbackPage"];
  57712. },
  57713. args: [],
  57714. source: "fallbackPage\x0a\x09^ fallbackPage",
  57715. referencedClasses: [],
  57716. messageSends: []
  57717. }),
  57718. $globals.FileServer);
  57719. $core.addMethod(
  57720. $core.method({
  57721. selector: "fallbackPage:",
  57722. protocol: 'accessing',
  57723. fn: function (aString){
  57724. var self=this;
  57725. self["@fallbackPage"]=aString;
  57726. return self;
  57727. },
  57728. args: ["aString"],
  57729. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  57730. referencedClasses: [],
  57731. messageSends: []
  57732. }),
  57733. $globals.FileServer);
  57734. $core.addMethod(
  57735. $core.method({
  57736. selector: "handleGETRequest:respondTo:",
  57737. protocol: 'request handling',
  57738. fn: function (aRequest,aResponse){
  57739. var self=this;
  57740. var uri,filename;
  57741. return $core.withContext(function($ctx1) {
  57742. var $1;
  57743. uri=$recv(self["@url"])._parse_($recv(aRequest)._url());
  57744. filename=$recv(self["@path"])._join_with_(self._basePath(),$recv(uri)._pathname());
  57745. $recv(self["@fs"])._exists_do_(filename,(function(aBoolean){
  57746. return $core.withContext(function($ctx2) {
  57747. if($core.assert(aBoolean)){
  57748. $1=$recv($recv(self["@fs"])._statSync_(filename))._isDirectory();
  57749. if($core.assert($1)){
  57750. return self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  57751. } else {
  57752. return self._respondFileNamed_to_(filename,aResponse);
  57753. };
  57754. } else {
  57755. return self._respondNotFoundTo_(aResponse);
  57756. };
  57757. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  57758. }));
  57759. return self;
  57760. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  57761. },
  57762. args: ["aRequest", "aResponse"],
  57763. 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]]]",
  57764. referencedClasses: [],
  57765. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  57766. }),
  57767. $globals.FileServer);
  57768. $core.addMethod(
  57769. $core.method({
  57770. selector: "handleOPTIONSRequest:respondTo:",
  57771. protocol: 'request handling',
  57772. fn: function (aRequest,aResponse){
  57773. var self=this;
  57774. return $core.withContext(function($ctx1) {
  57775. $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)]));
  57776. $recv(aResponse)._end();
  57777. return self;
  57778. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  57779. },
  57780. args: ["aRequest", "aResponse"],
  57781. 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",
  57782. referencedClasses: [],
  57783. messageSends: ["writeHead:options:", "end"]
  57784. }),
  57785. $globals.FileServer);
  57786. $core.addMethod(
  57787. $core.method({
  57788. selector: "handlePUTRequest:respondTo:",
  57789. protocol: 'request handling',
  57790. fn: function (aRequest,aResponse){
  57791. var self=this;
  57792. var file,stream;
  57793. return $core.withContext(function($ctx1) {
  57794. var $1,$2,$3,$4;
  57795. $1=self._isAuthenticated_(aRequest);
  57796. if(!$core.assert($1)){
  57797. self._respondAuthenticationRequiredTo_(aResponse);
  57798. return nil;
  57799. };
  57800. file=".".__comma($recv(aRequest)._url());
  57801. $ctx1.sendIdx[","]=1;
  57802. stream=$recv(self["@fs"])._createWriteStream_(file);
  57803. $recv(stream)._on_do_("error",(function(error){
  57804. return $core.withContext(function($ctx2) {
  57805. $2=console;
  57806. $3="Error creating WriteStream for file ".__comma(file);
  57807. $ctx2.sendIdx[","]=2;
  57808. $recv($2)._warn_($3);
  57809. $ctx2.sendIdx["warn:"]=1;
  57810. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  57811. $ctx2.sendIdx["warn:"]=2;
  57812. $recv(console)._warn_(" The exact error is: ".__comma(error));
  57813. return self._respondNotCreatedTo_(aResponse);
  57814. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57815. }));
  57816. $ctx1.sendIdx["on:do:"]=1;
  57817. $recv(stream)._on_do_("close",(function(){
  57818. return $core.withContext(function($ctx2) {
  57819. return self._respondCreatedTo_(aResponse);
  57820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  57821. }));
  57822. $ctx1.sendIdx["on:do:"]=2;
  57823. $recv(aRequest)._setEncoding_("utf8");
  57824. $recv(aRequest)._on_do_("data",(function(data){
  57825. return $core.withContext(function($ctx2) {
  57826. return $recv(stream)._write_(data);
  57827. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  57828. }));
  57829. $ctx1.sendIdx["on:do:"]=3;
  57830. $recv(aRequest)._on_do_("end",(function(){
  57831. return $core.withContext(function($ctx2) {
  57832. $4=$recv(stream)._writable();
  57833. if($core.assert($4)){
  57834. return $recv(stream)._end();
  57835. };
  57836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  57837. }));
  57838. return self;
  57839. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  57840. },
  57841. args: ["aRequest", "aResponse"],
  57842. 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]]",
  57843. referencedClasses: [],
  57844. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  57845. }),
  57846. $globals.FileServer);
  57847. $core.addMethod(
  57848. $core.method({
  57849. selector: "handleRequest:respondTo:",
  57850. protocol: 'request handling',
  57851. fn: function (aRequest,aResponse){
  57852. var self=this;
  57853. return $core.withContext(function($ctx1) {
  57854. var $2,$1,$4,$3,$5;
  57855. $2=$recv(aRequest)._method();
  57856. $ctx1.sendIdx["method"]=1;
  57857. $1=$recv($2).__eq("PUT");
  57858. $ctx1.sendIdx["="]=1;
  57859. if($core.assert($1)){
  57860. self._handlePUTRequest_respondTo_(aRequest,aResponse);
  57861. };
  57862. $4=$recv(aRequest)._method();
  57863. $ctx1.sendIdx["method"]=2;
  57864. $3=$recv($4).__eq("GET");
  57865. $ctx1.sendIdx["="]=2;
  57866. if($core.assert($3)){
  57867. self._handleGETRequest_respondTo_(aRequest,aResponse);
  57868. };
  57869. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  57870. if($core.assert($5)){
  57871. self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  57872. };
  57873. return self;
  57874. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  57875. },
  57876. args: ["aRequest", "aResponse"],
  57877. 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]",
  57878. referencedClasses: [],
  57879. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  57880. }),
  57881. $globals.FileServer);
  57882. $core.addMethod(
  57883. $core.method({
  57884. selector: "host",
  57885. protocol: 'accessing',
  57886. fn: function (){
  57887. var self=this;
  57888. return self["@host"];
  57889. },
  57890. args: [],
  57891. source: "host\x0a\x09^ host",
  57892. referencedClasses: [],
  57893. messageSends: []
  57894. }),
  57895. $globals.FileServer);
  57896. $core.addMethod(
  57897. $core.method({
  57898. selector: "host:",
  57899. protocol: 'accessing',
  57900. fn: function (hostname){
  57901. var self=this;
  57902. self["@host"]=hostname;
  57903. return self;
  57904. },
  57905. args: ["hostname"],
  57906. source: "host: hostname\x0a\x09host := hostname",
  57907. referencedClasses: [],
  57908. messageSends: []
  57909. }),
  57910. $globals.FileServer);
  57911. $core.addMethod(
  57912. $core.method({
  57913. selector: "initialize",
  57914. protocol: 'initialization',
  57915. fn: function (){
  57916. var self=this;
  57917. return $core.withContext(function($ctx1) {
  57918. var $1;
  57919. (
  57920. $ctx1.supercall = true,
  57921. ($globals.FileServer.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  57922. $ctx1.supercall = false;
  57923. self["@http"]=self._require_("http");
  57924. $ctx1.sendIdx["require:"]=1;
  57925. self["@util"]=self._require_("util");
  57926. $ctx1.sendIdx["require:"]=2;
  57927. self["@url"]=self._require_("url");
  57928. $1=self._class();
  57929. $ctx1.sendIdx["class"]=1;
  57930. self["@host"]=$recv($1)._defaultHost();
  57931. self["@port"]=$recv(self._class())._defaultPort();
  57932. self["@username"]=nil;
  57933. self["@password"]=nil;
  57934. self["@fallbackPage"]=nil;
  57935. return self;
  57936. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  57937. },
  57938. args: [],
  57939. 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.",
  57940. referencedClasses: [],
  57941. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  57942. }),
  57943. $globals.FileServer);
  57944. $core.addMethod(
  57945. $core.method({
  57946. selector: "isAuthenticated:",
  57947. protocol: 'private',
  57948. fn: function (aRequest){
  57949. var self=this;
  57950. var header,token,auth,parts;
  57951. return $core.withContext(function($ctx1) {
  57952. var $2,$1,$3,$4,$5,$6,$9,$10,$8,$7,$receiver;
  57953. $2=$recv(self["@username"])._isNil();
  57954. $ctx1.sendIdx["isNil"]=1;
  57955. $1=$recv($2)._and_((function(){
  57956. return $core.withContext(function($ctx2) {
  57957. return $recv(self["@password"])._isNil();
  57958. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57959. }));
  57960. $ctx1.sendIdx["and:"]=1;
  57961. if($core.assert($1)){
  57962. return true;
  57963. };
  57964. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  57965. $ctx1.sendIdx["at:"]=1;
  57966. if(($receiver = $3) == null || $receiver.isNil){
  57967. header="";
  57968. } else {
  57969. header=$3;
  57970. };
  57971. $4=$recv(header)._isEmpty();
  57972. if($core.assert($4)){
  57973. return false;
  57974. } else {
  57975. $5=$recv(header)._tokenize_(" ");
  57976. $ctx1.sendIdx["tokenize:"]=1;
  57977. if(($receiver = $5) == null || $receiver.isNil){
  57978. token="";
  57979. } else {
  57980. token=$5;
  57981. };
  57982. token;
  57983. $6=$recv(token)._at_((2));
  57984. $ctx1.sendIdx["at:"]=2;
  57985. auth=self._base64Decode_($6);
  57986. auth;
  57987. parts=$recv(auth)._tokenize_(":");
  57988. parts;
  57989. $9=self["@username"];
  57990. $10=$recv(parts)._at_((1));
  57991. $ctx1.sendIdx["at:"]=3;
  57992. $8=$recv($9).__eq($10);
  57993. $ctx1.sendIdx["="]=1;
  57994. $7=$recv($8)._and_((function(){
  57995. return $core.withContext(function($ctx2) {
  57996. return $recv(self["@password"]).__eq($recv(parts)._at_((2)));
  57997. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  57998. }));
  57999. if($core.assert($7)){
  58000. return true;
  58001. } else {
  58002. return false;
  58003. };
  58004. };
  58005. return self;
  58006. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  58007. },
  58008. args: ["aRequest"],
  58009. 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\x09(header isEmpty)\x0a\x09ifTrue: [^ false]\x0a\x09ifFalse: [\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].",
  58010. referencedClasses: [],
  58011. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="]
  58012. }),
  58013. $globals.FileServer);
  58014. $core.addMethod(
  58015. $core.method({
  58016. selector: "password:",
  58017. protocol: 'accessing',
  58018. fn: function (aPassword){
  58019. var self=this;
  58020. self["@password"]=aPassword;
  58021. return self;
  58022. },
  58023. args: ["aPassword"],
  58024. source: "password: aPassword\x0a\x09password := aPassword.",
  58025. referencedClasses: [],
  58026. messageSends: []
  58027. }),
  58028. $globals.FileServer);
  58029. $core.addMethod(
  58030. $core.method({
  58031. selector: "port",
  58032. protocol: 'accessing',
  58033. fn: function (){
  58034. var self=this;
  58035. return self["@port"];
  58036. },
  58037. args: [],
  58038. source: "port\x0a\x09^ port",
  58039. referencedClasses: [],
  58040. messageSends: []
  58041. }),
  58042. $globals.FileServer);
  58043. $core.addMethod(
  58044. $core.method({
  58045. selector: "port:",
  58046. protocol: 'accessing',
  58047. fn: function (aNumber){
  58048. var self=this;
  58049. self["@port"]=aNumber;
  58050. return self;
  58051. },
  58052. args: ["aNumber"],
  58053. source: "port: aNumber\x0a\x09port := aNumber",
  58054. referencedClasses: [],
  58055. messageSends: []
  58056. }),
  58057. $globals.FileServer);
  58058. $core.addMethod(
  58059. $core.method({
  58060. selector: "require:",
  58061. protocol: 'private',
  58062. fn: function (aModuleString){
  58063. var self=this;
  58064. return $core.withContext(function($ctx1) {
  58065. return $recv(require)._value_(aModuleString);
  58066. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  58067. },
  58068. args: ["aModuleString"],
  58069. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  58070. referencedClasses: [],
  58071. messageSends: ["value:"]
  58072. }),
  58073. $globals.FileServer);
  58074. $core.addMethod(
  58075. $core.method({
  58076. selector: "respondAuthenticationRequiredTo:",
  58077. protocol: 'request handling',
  58078. fn: function (aResponse){
  58079. var self=this;
  58080. return $core.withContext(function($ctx1) {
  58081. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  58082. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  58083. $recv(aResponse)._end();
  58084. return self;
  58085. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  58086. },
  58087. args: ["aResponse"],
  58088. 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.",
  58089. referencedClasses: [],
  58090. messageSends: ["writeHead:options:", "write:", "end"]
  58091. }),
  58092. $globals.FileServer);
  58093. $core.addMethod(
  58094. $core.method({
  58095. selector: "respondCreatedTo:",
  58096. protocol: 'request handling',
  58097. fn: function (aResponse){
  58098. var self=this;
  58099. return $core.withContext(function($ctx1) {
  58100. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  58101. $recv(aResponse)._end();
  58102. return self;
  58103. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  58104. },
  58105. args: ["aResponse"],
  58106. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  58107. referencedClasses: [],
  58108. messageSends: ["writeHead:options:", "end"]
  58109. }),
  58110. $globals.FileServer);
  58111. $core.addMethod(
  58112. $core.method({
  58113. selector: "respondDirectoryNamed:from:to:",
  58114. protocol: 'request handling',
  58115. fn: function (aDirname,aUrl,aResponse){
  58116. var self=this;
  58117. return $core.withContext(function($ctx1) {
  58118. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  58119. $2=$recv(aUrl)._pathname();
  58120. $ctx1.sendIdx["pathname"]=1;
  58121. $1=$recv($2)._endsWith_("/");
  58122. if($core.assert($1)){
  58123. $3=$recv(aDirname).__comma("index.html");
  58124. $ctx1.sendIdx[","]=1;
  58125. self._respondFileNamed_to_($3,aResponse);
  58126. } else {
  58127. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  58128. $7=$recv(aUrl)._search();
  58129. if(($receiver = $7) == null || $receiver.isNil){
  58130. $6="";
  58131. } else {
  58132. $6=$7;
  58133. };
  58134. $4=$recv($5).__comma($6);
  58135. $ctx1.sendIdx[","]=2;
  58136. self._respondRedirect_to_($4,aResponse);
  58137. };
  58138. return self;
  58139. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  58140. },
  58141. args: ["aDirname", "aUrl", "aResponse"],
  58142. 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]",
  58143. referencedClasses: [],
  58144. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  58145. }),
  58146. $globals.FileServer);
  58147. $core.addMethod(
  58148. $core.method({
  58149. selector: "respondFileNamed:to:",
  58150. protocol: 'request handling',
  58151. fn: function (aFilename,aResponse){
  58152. var self=this;
  58153. var type,filename;
  58154. return $core.withContext(function($ctx1) {
  58155. var $1,$2,$3,$4;
  58156. filename=aFilename;
  58157. $recv(self["@fs"])._readFile_do_(filename,(function(ex,file){
  58158. return $core.withContext(function($ctx2) {
  58159. $1=$recv(ex)._notNil();
  58160. if($core.assert($1)){
  58161. $2=console;
  58162. $3=$recv(filename).__comma(" does not exist");
  58163. $ctx2.sendIdx[","]=1;
  58164. $recv($2)._log_($3);
  58165. return self._respondNotFoundTo_(aResponse);
  58166. } else {
  58167. type=$recv(self._class())._mimeTypeFor_(filename);
  58168. type;
  58169. $4=$recv(type).__eq("application/javascript");
  58170. if($core.assert($4)){
  58171. type=$recv(type).__comma(";charset=utf-8");
  58172. type;
  58173. };
  58174. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  58175. $recv(aResponse)._write_encoding_(file,"binary");
  58176. return $recv(aResponse)._end();
  58177. };
  58178. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  58179. }));
  58180. return self;
  58181. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  58182. },
  58183. args: ["aFilename", "aResponse"],
  58184. 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]]",
  58185. referencedClasses: [],
  58186. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  58187. }),
  58188. $globals.FileServer);
  58189. $core.addMethod(
  58190. $core.method({
  58191. selector: "respondInternalErrorTo:",
  58192. protocol: 'request handling',
  58193. fn: function (aResponse){
  58194. var self=this;
  58195. return $core.withContext(function($ctx1) {
  58196. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  58197. $recv(aResponse)._write_("500 Internal server error");
  58198. $recv(aResponse)._end();
  58199. return self;
  58200. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  58201. },
  58202. args: ["aResponse"],
  58203. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  58204. referencedClasses: [],
  58205. messageSends: ["writeHead:options:", "write:", "end"]
  58206. }),
  58207. $globals.FileServer);
  58208. $core.addMethod(
  58209. $core.method({
  58210. selector: "respondNotCreatedTo:",
  58211. protocol: 'request handling',
  58212. fn: function (aResponse){
  58213. var self=this;
  58214. return $core.withContext(function($ctx1) {
  58215. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  58216. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  58217. $recv(aResponse)._end();
  58218. return self;
  58219. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  58220. },
  58221. args: ["aResponse"],
  58222. 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.",
  58223. referencedClasses: [],
  58224. messageSends: ["writeHead:options:", "write:", "end"]
  58225. }),
  58226. $globals.FileServer);
  58227. $core.addMethod(
  58228. $core.method({
  58229. selector: "respondNotFoundTo:",
  58230. protocol: 'request handling',
  58231. fn: function (aResponse){
  58232. var self=this;
  58233. return $core.withContext(function($ctx1) {
  58234. var $2,$1;
  58235. $2=self._fallbackPage();
  58236. $ctx1.sendIdx["fallbackPage"]=1;
  58237. $1=$recv($2)._isNil();
  58238. if(!$core.assert($1)){
  58239. return self._respondFileNamed_to_(self._fallbackPage(),aResponse);
  58240. };
  58241. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  58242. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  58243. $ctx1.sendIdx["write:"]=1;
  58244. $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>");
  58245. $ctx1.sendIdx["write:"]=2;
  58246. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  58247. $ctx1.sendIdx["write:"]=3;
  58248. $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>");
  58249. $ctx1.sendIdx["write:"]=4;
  58250. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  58251. $ctx1.sendIdx["write:"]=5;
  58252. $recv(aResponse)._write_("</ul></p></body></html>");
  58253. $recv(aResponse)._end();
  58254. return self;
  58255. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  58256. },
  58257. args: ["aResponse"],
  58258. 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",
  58259. referencedClasses: [],
  58260. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  58261. }),
  58262. $globals.FileServer);
  58263. $core.addMethod(
  58264. $core.method({
  58265. selector: "respondOKTo:",
  58266. protocol: 'request handling',
  58267. fn: function (aResponse){
  58268. var self=this;
  58269. return $core.withContext(function($ctx1) {
  58270. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  58271. $recv(aResponse)._end();
  58272. return self;
  58273. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  58274. },
  58275. args: ["aResponse"],
  58276. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  58277. referencedClasses: [],
  58278. messageSends: ["writeHead:options:", "end"]
  58279. }),
  58280. $globals.FileServer);
  58281. $core.addMethod(
  58282. $core.method({
  58283. selector: "respondRedirect:to:",
  58284. protocol: 'request handling',
  58285. fn: function (aString,aResponse){
  58286. var self=this;
  58287. return $core.withContext(function($ctx1) {
  58288. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  58289. $recv(aResponse)._end();
  58290. return self;
  58291. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  58292. },
  58293. args: ["aString", "aResponse"],
  58294. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  58295. referencedClasses: [],
  58296. messageSends: ["writeHead:options:", "end"]
  58297. }),
  58298. $globals.FileServer);
  58299. $core.addMethod(
  58300. $core.method({
  58301. selector: "start",
  58302. protocol: 'starting',
  58303. fn: function (){
  58304. var self=this;
  58305. return $core.withContext(function($ctx1) {
  58306. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  58307. self._checkDirectoryLayout();
  58308. $1=$recv(self["@http"])._createServer_((function(request,response){
  58309. return $core.withContext(function($ctx2) {
  58310. return self._handleRequest_respondTo_(request,response);
  58311. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  58312. }));
  58313. $recv($1)._on_do_("error",(function(error){
  58314. return $core.withContext(function($ctx2) {
  58315. $2=console;
  58316. $3="Error starting server: ".__comma(error);
  58317. $ctx2.sendIdx[","]=1;
  58318. return $recv($2)._log_($3);
  58319. $ctx2.sendIdx["log:"]=1;
  58320. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  58321. }));
  58322. $ctx1.sendIdx["on:do:"]=1;
  58323. $recv($1)._on_do_("listening",(function(){
  58324. return $core.withContext(function($ctx2) {
  58325. $4=console;
  58326. $8=self._host();
  58327. $ctx2.sendIdx["host"]=1;
  58328. $7="Starting file server on http://".__comma($8);
  58329. $6=$recv($7).__comma(":");
  58330. $ctx2.sendIdx[","]=3;
  58331. $10=self._port();
  58332. $ctx2.sendIdx["port"]=1;
  58333. $9=$recv($10)._asString();
  58334. $5=$recv($6).__comma($9);
  58335. $ctx2.sendIdx[","]=2;
  58336. return $recv($4)._log_($5);
  58337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58338. }));
  58339. $recv($1)._listen_host_(self._port(),self._host());
  58340. return self;
  58341. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  58342. },
  58343. args: [],
  58344. 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.",
  58345. referencedClasses: [],
  58346. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  58347. }),
  58348. $globals.FileServer);
  58349. $core.addMethod(
  58350. $core.method({
  58351. selector: "startOn:",
  58352. protocol: 'starting',
  58353. fn: function (aPort){
  58354. var self=this;
  58355. return $core.withContext(function($ctx1) {
  58356. self._port_(aPort);
  58357. self._start();
  58358. return self;
  58359. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  58360. },
  58361. args: ["aPort"],
  58362. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  58363. referencedClasses: [],
  58364. messageSends: ["port:", "start"]
  58365. }),
  58366. $globals.FileServer);
  58367. $core.addMethod(
  58368. $core.method({
  58369. selector: "username:",
  58370. protocol: 'accessing',
  58371. fn: function (aUsername){
  58372. var self=this;
  58373. self["@username"]=aUsername;
  58374. return self;
  58375. },
  58376. args: ["aUsername"],
  58377. source: "username: aUsername\x0a\x09username := aUsername.",
  58378. referencedClasses: [],
  58379. messageSends: []
  58380. }),
  58381. $globals.FileServer);
  58382. $core.addMethod(
  58383. $core.method({
  58384. selector: "validateBasePath",
  58385. protocol: 'private',
  58386. fn: function (){
  58387. var self=this;
  58388. return $core.withContext(function($ctx1) {
  58389. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  58390. $1=self["@fs"];
  58391. $2=self._basePath();
  58392. $ctx1.sendIdx["basePath"]=1;
  58393. $recv($1)._stat_then_($2,(function(err,stat){
  58394. return $core.withContext(function($ctx2) {
  58395. if(($receiver = err) == null || $receiver.isNil){
  58396. $3=$recv(stat)._isDirectory();
  58397. if(!$core.assert($3)){
  58398. $4=console;
  58399. $7=self._basePath();
  58400. $ctx2.sendIdx["basePath"]=2;
  58401. $6="Warning: --base-path parameter ".__comma($7);
  58402. $ctx2.sendIdx[","]=2;
  58403. $5=$recv($6).__comma(" is not a directory.");
  58404. $ctx2.sendIdx[","]=1;
  58405. return $recv($4)._warn_($5);
  58406. $ctx2.sendIdx["warn:"]=1;
  58407. };
  58408. } else {
  58409. $8=console;
  58410. $9=$recv("Warning: path at --base-path parameter ".__comma(self._basePath())).__comma(" does not exist.");
  58411. $ctx2.sendIdx[","]=3;
  58412. return $recv($8)._warn_($9);
  58413. };
  58414. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  58415. }));
  58416. return self;
  58417. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  58418. },
  58419. args: [],
  58420. 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.' ]].",
  58421. referencedClasses: [],
  58422. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  58423. }),
  58424. $globals.FileServer);
  58425. $core.addMethod(
  58426. $core.method({
  58427. selector: "withBasePath:",
  58428. protocol: 'private',
  58429. fn: function (aBaseRelativePath){
  58430. var self=this;
  58431. return $core.withContext(function($ctx1) {
  58432. return $recv(self["@path"])._join_with_(self._basePath(),aBaseRelativePath);
  58433. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  58434. },
  58435. args: ["aBaseRelativePath"],
  58436. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  58437. referencedClasses: [],
  58438. messageSends: ["join:with:", "basePath"]
  58439. }),
  58440. $globals.FileServer);
  58441. $core.addMethod(
  58442. $core.method({
  58443. selector: "writeData:toFileNamed:",
  58444. protocol: 'private',
  58445. fn: function (data,aFilename){
  58446. var self=this;
  58447. return $core.withContext(function($ctx1) {
  58448. $recv(console)._log_(aFilename);
  58449. return self;
  58450. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  58451. },
  58452. args: ["data", "aFilename"],
  58453. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  58454. referencedClasses: [],
  58455. messageSends: ["log:"]
  58456. }),
  58457. $globals.FileServer);
  58458. $globals.FileServer.klass.iVarNames = ['mimeTypes'];
  58459. $core.addMethod(
  58460. $core.method({
  58461. selector: "commandLineSwitches",
  58462. protocol: 'accessing',
  58463. fn: function (){
  58464. var self=this;
  58465. var switches;
  58466. return $core.withContext(function($ctx1) {
  58467. switches=$recv(self._methodsInProtocol_("accessing"))._collect_((function(each){
  58468. return $core.withContext(function($ctx2) {
  58469. return $recv(each)._selector();
  58470. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58471. }));
  58472. $ctx1.sendIdx["collect:"]=1;
  58473. switches=$recv(switches)._select_((function(each){
  58474. return $core.withContext(function($ctx2) {
  58475. return $recv(each)._match_("^[^:]*:$");
  58476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  58477. }));
  58478. switches=$recv(switches)._collect_((function(each){
  58479. return $core.withContext(function($ctx2) {
  58480. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  58481. $ctx2.sendIdx["replace:with:"]=1;
  58482. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  58483. }));
  58484. return switches;
  58485. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.klass)});
  58486. },
  58487. args: [],
  58488. 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",
  58489. referencedClasses: [],
  58490. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  58491. }),
  58492. $globals.FileServer.klass);
  58493. $core.addMethod(
  58494. $core.method({
  58495. selector: "createServerWithArguments:",
  58496. protocol: 'initialization',
  58497. fn: function (options){
  58498. var self=this;
  58499. var server,popFront,front,optionName,optionValue,switches;
  58500. return $core.withContext(function($ctx1) {
  58501. var $1,$2,$3,$4,$5,$6,$7,$8;
  58502. var $early={};
  58503. try {
  58504. switches=self._commandLineSwitches();
  58505. server=self._new();
  58506. $recv(options)._ifEmpty_((function(){
  58507. throw $early=[server];
  58508. }));
  58509. $1=$recv($recv(options)._size())._even();
  58510. if(!$core.assert($1)){
  58511. $recv(console)._log_("Using default parameters.");
  58512. $ctx1.sendIdx["log:"]=1;
  58513. $2=console;
  58514. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  58515. $ctx1.sendIdx[","]=1;
  58516. $recv($2)._log_($3);
  58517. $ctx1.sendIdx["log:"]=2;
  58518. $4=console;
  58519. $5="Use any of the following ones: ".__comma(switches);
  58520. $ctx1.sendIdx[","]=2;
  58521. $recv($4)._log_($5);
  58522. $ctx1.sendIdx["log:"]=3;
  58523. return server;
  58524. };
  58525. popFront=(function(args){
  58526. return $core.withContext(function($ctx2) {
  58527. front=$recv(args)._first();
  58528. front;
  58529. $recv(args)._remove_(front);
  58530. return front;
  58531. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  58532. });
  58533. $recv((function(){
  58534. return $core.withContext(function($ctx2) {
  58535. return $recv(options)._notEmpty();
  58536. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58537. }))._whileTrue_((function(){
  58538. return $core.withContext(function($ctx2) {
  58539. optionName=$recv(popFront)._value_(options);
  58540. $ctx2.sendIdx["value:"]=1;
  58541. optionName;
  58542. optionValue=$recv(popFront)._value_(options);
  58543. optionValue;
  58544. $6=$recv(switches)._includes_(optionName);
  58545. if($core.assert($6)){
  58546. optionName=self._selectorForCommandLineSwitch_(optionName);
  58547. optionName;
  58548. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  58549. } else {
  58550. $7=console;
  58551. $8=$recv(optionName).__comma(" is not a valid commandline option");
  58552. $ctx2.sendIdx[","]=3;
  58553. $recv($7)._log_($8);
  58554. $ctx2.sendIdx["log:"]=4;
  58555. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  58556. };
  58557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58558. }));
  58559. return server;
  58560. }
  58561. catch(e) {if(e===$early)return e[0]; throw e}
  58562. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.klass)});
  58563. },
  58564. args: ["options"],
  58565. 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.",
  58566. referencedClasses: ["Array"],
  58567. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  58568. }),
  58569. $globals.FileServer.klass);
  58570. $core.addMethod(
  58571. $core.method({
  58572. selector: "defaultBasePath",
  58573. protocol: 'accessing',
  58574. fn: function (){
  58575. var self=this;
  58576. return "./";
  58577. },
  58578. args: [],
  58579. source: "defaultBasePath\x0a\x09^ './'",
  58580. referencedClasses: [],
  58581. messageSends: []
  58582. }),
  58583. $globals.FileServer.klass);
  58584. $core.addMethod(
  58585. $core.method({
  58586. selector: "defaultHost",
  58587. protocol: 'accessing',
  58588. fn: function (){
  58589. var self=this;
  58590. return "127.0.0.1";
  58591. },
  58592. args: [],
  58593. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  58594. referencedClasses: [],
  58595. messageSends: []
  58596. }),
  58597. $globals.FileServer.klass);
  58598. $core.addMethod(
  58599. $core.method({
  58600. selector: "defaultMimeTypes",
  58601. protocol: 'accessing',
  58602. fn: function (){
  58603. var self=this;
  58604. 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"]);
  58605. },
  58606. args: [],
  58607. 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}",
  58608. referencedClasses: [],
  58609. messageSends: []
  58610. }),
  58611. $globals.FileServer.klass);
  58612. $core.addMethod(
  58613. $core.method({
  58614. selector: "defaultPort",
  58615. protocol: 'accessing',
  58616. fn: function (){
  58617. var self=this;
  58618. return (4000);
  58619. },
  58620. args: [],
  58621. source: "defaultPort\x0a\x09^ 4000",
  58622. referencedClasses: [],
  58623. messageSends: []
  58624. }),
  58625. $globals.FileServer.klass);
  58626. $core.addMethod(
  58627. $core.method({
  58628. selector: "main",
  58629. protocol: 'initialization',
  58630. fn: function (){
  58631. var self=this;
  58632. var fileServer,args;
  58633. return $core.withContext(function($ctx1) {
  58634. var $1;
  58635. var $early={};
  58636. try {
  58637. args=$recv(process)._argv();
  58638. $recv(args)._removeFrom_to_((1),(3));
  58639. $recv(args)._detect_ifNone_((function(each){
  58640. return $core.withContext(function($ctx2) {
  58641. $1=$recv(each).__eq("--help");
  58642. if($core.assert($1)){
  58643. return $recv($globals.FileServer)._printHelp();
  58644. };
  58645. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58646. }),(function(){
  58647. return $core.withContext(function($ctx2) {
  58648. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  58649. fileServer;
  58650. throw $early=[$recv(fileServer)._start()];
  58651. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58652. }));
  58653. return self;
  58654. }
  58655. catch(e) {if(e===$early)return e[0]; throw e}
  58656. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.klass)});
  58657. },
  58658. args: [],
  58659. 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]",
  58660. referencedClasses: ["FileServer"],
  58661. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  58662. }),
  58663. $globals.FileServer.klass);
  58664. $core.addMethod(
  58665. $core.method({
  58666. selector: "mimeTypeFor:",
  58667. protocol: 'accessing',
  58668. fn: function (aString){
  58669. var self=this;
  58670. return $core.withContext(function($ctx1) {
  58671. return $recv(self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  58672. return "text/plain";
  58673. }));
  58674. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.klass)});
  58675. },
  58676. args: ["aString"],
  58677. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  58678. referencedClasses: [],
  58679. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  58680. }),
  58681. $globals.FileServer.klass);
  58682. $core.addMethod(
  58683. $core.method({
  58684. selector: "mimeTypes",
  58685. protocol: 'accessing',
  58686. fn: function (){
  58687. var self=this;
  58688. return $core.withContext(function($ctx1) {
  58689. var $1,$receiver;
  58690. $1=self["@mimeTypes"];
  58691. if(($receiver = $1) == null || $receiver.isNil){
  58692. self["@mimeTypes"]=self._defaultMimeTypes();
  58693. return self["@mimeTypes"];
  58694. } else {
  58695. return $1;
  58696. };
  58697. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.klass)});
  58698. },
  58699. args: [],
  58700. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  58701. referencedClasses: [],
  58702. messageSends: ["ifNil:", "defaultMimeTypes"]
  58703. }),
  58704. $globals.FileServer.klass);
  58705. $core.addMethod(
  58706. $core.method({
  58707. selector: "printHelp",
  58708. protocol: 'accessing',
  58709. fn: function (){
  58710. var self=this;
  58711. return $core.withContext(function($ctx1) {
  58712. $recv(console)._log_("Available commandline options are:");
  58713. $ctx1.sendIdx["log:"]=1;
  58714. $recv(console)._log_("--help");
  58715. $ctx1.sendIdx["log:"]=2;
  58716. $recv(self._commandLineSwitches())._do_((function(each){
  58717. return $core.withContext(function($ctx2) {
  58718. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  58719. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58720. }));
  58721. return self;
  58722. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.klass)});
  58723. },
  58724. args: [],
  58725. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  58726. referencedClasses: [],
  58727. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  58728. }),
  58729. $globals.FileServer.klass);
  58730. $core.addMethod(
  58731. $core.method({
  58732. selector: "selectorForCommandLineSwitch:",
  58733. protocol: 'accessing',
  58734. fn: function (aSwitch){
  58735. var self=this;
  58736. return $core.withContext(function($ctx1) {
  58737. var $1;
  58738. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  58739. return $core.withContext(function($ctx2) {
  58740. return $recv($recv(each)._second())._asUppercase();
  58741. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  58742. }));
  58743. $ctx1.sendIdx["replace:with:"]=1;
  58744. return $recv($1).__comma(":");
  58745. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.klass)});
  58746. },
  58747. args: ["aSwitch"],
  58748. 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 ]), ':'",
  58749. referencedClasses: [],
  58750. messageSends: [",", "replace:with:", "asUppercase", "second"]
  58751. }),
  58752. $globals.FileServer.klass);
  58753. $core.addClass('Initer', $globals.BaseFileManipulator, ['childProcess', 'nmPath'], 'AmberCli');
  58754. $core.addMethod(
  58755. $core.method({
  58756. selector: "bowerInstallThenDo:",
  58757. protocol: 'action',
  58758. fn: function (aBlock){
  58759. var self=this;
  58760. var child;
  58761. return $core.withContext(function($ctx1) {
  58762. var $1,$3,$2;
  58763. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("bower","bower"),["install"]);
  58764. $1=child;
  58765. $recv($1)._on_do_("error",aBlock);
  58766. $ctx1.sendIdx["on:do:"]=1;
  58767. $recv($1)._on_do_("close",(function(code){
  58768. return $core.withContext(function($ctx2) {
  58769. $3=$recv(code).__eq((0));
  58770. if($core.assert($3)){
  58771. $2=nil;
  58772. } else {
  58773. $2=code;
  58774. };
  58775. return $recv(aBlock)._value_($2);
  58776. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  58777. }));
  58778. return self;
  58779. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  58780. },
  58781. args: ["aBlock"],
  58782. 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 ]) ]",
  58783. referencedClasses: [],
  58784. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  58785. }),
  58786. $globals.Initer);
  58787. $core.addMethod(
  58788. $core.method({
  58789. selector: "finishMessage",
  58790. protocol: 'action',
  58791. fn: function (){
  58792. var self=this;
  58793. return $core.withContext(function($ctx1) {
  58794. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  58795. $recv((function(){
  58796. }))._valueWithTimeout_((600));
  58797. return self;
  58798. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  58799. },
  58800. args: [],
  58801. 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",
  58802. referencedClasses: ["String"],
  58803. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  58804. }),
  58805. $globals.Initer);
  58806. $core.addMethod(
  58807. $core.method({
  58808. selector: "gruntInitThenDo:",
  58809. protocol: 'action',
  58810. fn: function (aBlock){
  58811. var self=this;
  58812. var child,sanitizedTemplatePath;
  58813. return $core.withContext(function($ctx1) {
  58814. var $1,$3,$2;
  58815. sanitizedTemplatePath=$recv($recv($recv(self["@path"])._join_with_(self["@nmPath"],"grunt-init-amber"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  58816. $ctx1.sendIdx["replace:with:"]=1;
  58817. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  58818. $1=child;
  58819. $recv($1)._on_do_("error",aBlock);
  58820. $ctx1.sendIdx["on:do:"]=1;
  58821. $recv($1)._on_do_("close",(function(code){
  58822. return $core.withContext(function($ctx2) {
  58823. $3=$recv(code).__eq((0));
  58824. if($core.assert($3)){
  58825. $2=nil;
  58826. } else {
  58827. $2=code;
  58828. };
  58829. return $recv(aBlock)._value_($2);
  58830. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  58831. }));
  58832. return self;
  58833. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  58834. },
  58835. args: ["aBlock"],
  58836. 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 ]) ]",
  58837. referencedClasses: [],
  58838. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  58839. }),
  58840. $globals.Initer);
  58841. $core.addMethod(
  58842. $core.method({
  58843. selector: "gruntThenDo:",
  58844. protocol: 'action',
  58845. fn: function (aBlock){
  58846. var self=this;
  58847. var child;
  58848. return $core.withContext(function($ctx1) {
  58849. var $1,$3,$2;
  58850. child=$recv(self["@childProcess"])._fork_args_(self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  58851. $1=child;
  58852. $recv($1)._on_do_("error",aBlock);
  58853. $ctx1.sendIdx["on:do:"]=1;
  58854. $recv($1)._on_do_("close",(function(code){
  58855. return $core.withContext(function($ctx2) {
  58856. $3=$recv(code).__eq((0));
  58857. if($core.assert($3)){
  58858. $2=nil;
  58859. } else {
  58860. $2=code;
  58861. };
  58862. return $recv(aBlock)._value_($2);
  58863. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  58864. }));
  58865. return self;
  58866. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  58867. },
  58868. args: ["aBlock"],
  58869. 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 ]) ]",
  58870. referencedClasses: [],
  58871. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  58872. }),
  58873. $globals.Initer);
  58874. $core.addMethod(
  58875. $core.method({
  58876. selector: "initialize",
  58877. protocol: 'initialization',
  58878. fn: function (){
  58879. var self=this;
  58880. return $core.withContext(function($ctx1) {
  58881. (
  58882. $ctx1.supercall = true,
  58883. ($globals.Initer.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  58884. $ctx1.supercall = false;
  58885. self["@childProcess"]=$recv(require)._value_("child_process");
  58886. self["@nmPath"]=$recv(self["@path"])._join_with_(self._rootDirname(),"node_modules");
  58887. return self;
  58888. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  58889. },
  58890. args: [],
  58891. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  58892. referencedClasses: [],
  58893. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  58894. }),
  58895. $globals.Initer);
  58896. $core.addMethod(
  58897. $core.method({
  58898. selector: "npmInstallThenDo:",
  58899. protocol: 'action',
  58900. fn: function (aBlock){
  58901. var self=this;
  58902. var child;
  58903. return $core.withContext(function($ctx1) {
  58904. var $1;
  58905. child=$recv(self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  58906. $1=$recv(child)._stdout();
  58907. $ctx1.sendIdx["stdout"]=1;
  58908. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  58909. return self;
  58910. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  58911. },
  58912. args: ["aBlock"],
  58913. 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 }",
  58914. referencedClasses: [],
  58915. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  58916. }),
  58917. $globals.Initer);
  58918. $core.addMethod(
  58919. $core.method({
  58920. selector: "npmScriptForModule:named:",
  58921. protocol: 'npm',
  58922. fn: function (aString,anotherString){
  58923. var self=this;
  58924. var modulePath,packageJson,binSection,scriptPath;
  58925. return $core.withContext(function($ctx1) {
  58926. var $1,$3,$4,$2,$5;
  58927. $1=self["@path"];
  58928. $3=$recv($globals.JSObjectProxy)._on_(require);
  58929. $4=$recv(aString).__comma("/package.json");
  58930. $ctx1.sendIdx[","]=1;
  58931. $2=$recv($3)._resolve_($4);
  58932. modulePath=$recv($1)._dirname_($2);
  58933. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  58934. binSection=$recv(packageJson)._at_("bin");
  58935. $ctx1.sendIdx["at:"]=1;
  58936. $5=$recv(binSection)._isString();
  58937. if($core.assert($5)){
  58938. scriptPath=binSection;
  58939. } else {
  58940. scriptPath=$recv(binSection)._at_(anotherString);
  58941. };
  58942. return $recv(self["@path"])._join_with_(modulePath,scriptPath);
  58943. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  58944. },
  58945. args: ["aString", "anotherString"],
  58946. 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",
  58947. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  58948. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  58949. }),
  58950. $globals.Initer);
  58951. $core.addMethod(
  58952. $core.method({
  58953. selector: "start",
  58954. protocol: 'action',
  58955. fn: function (){
  58956. var self=this;
  58957. return $core.withContext(function($ctx1) {
  58958. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  58959. self._gruntInitThenDo_((function(error){
  58960. return $core.withContext(function($ctx2) {
  58961. if(($receiver = error) == null || $receiver.isNil){
  58962. return self._bowerInstallThenDo_((function(error2){
  58963. return $core.withContext(function($ctx3) {
  58964. if(($receiver = error2) == null || $receiver.isNil){
  58965. return self._npmInstallThenDo_((function(error3){
  58966. return $core.withContext(function($ctx4) {
  58967. if(($receiver = error3) == null || $receiver.isNil){
  58968. return self._gruntThenDo_((function(error4){
  58969. return $core.withContext(function($ctx5) {
  58970. if(($receiver = error4) == null || $receiver.isNil){
  58971. self._finishMessage();
  58972. return $recv(process)._exit();
  58973. } else {
  58974. $7=console;
  58975. $recv($7)._log_("grunt exec error:");
  58976. $ctx5.sendIdx["log:"]=7;
  58977. $recv($7)._log_(error4);
  58978. return $recv(process)._exit_((104));
  58979. };
  58980. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  58981. }));
  58982. } else {
  58983. $5=console;
  58984. $recv($5)._log_("npm install exec error:");
  58985. $ctx4.sendIdx["log:"]=5;
  58986. $6=$recv($5)._log_(error3);
  58987. $ctx4.sendIdx["log:"]=6;
  58988. $6;
  58989. return $recv(process)._exit_((103));
  58990. $ctx4.sendIdx["exit:"]=3;
  58991. };
  58992. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  58993. }));
  58994. } else {
  58995. $3=console;
  58996. $recv($3)._log_("bower install exec error:");
  58997. $ctx3.sendIdx["log:"]=3;
  58998. $4=$recv($3)._log_(error2);
  58999. $ctx3.sendIdx["log:"]=4;
  59000. $4;
  59001. return $recv(process)._exit_((102));
  59002. $ctx3.sendIdx["exit:"]=2;
  59003. };
  59004. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  59005. }));
  59006. } else {
  59007. $1=console;
  59008. $recv($1)._log_("grunt-init exec error:");
  59009. $ctx2.sendIdx["log:"]=1;
  59010. $2=$recv($1)._log_(error);
  59011. $ctx2.sendIdx["log:"]=2;
  59012. $2;
  59013. return $recv(process)._exit_((101));
  59014. $ctx2.sendIdx["exit:"]=1;
  59015. };
  59016. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  59017. }));
  59018. return self;
  59019. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  59020. },
  59021. args: [],
  59022. 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 ]]]]]]]]",
  59023. referencedClasses: [],
  59024. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  59025. }),
  59026. $globals.Initer);
  59027. $core.addClass('Repl', $globals.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  59028. $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.";
  59029. $core.addMethod(
  59030. $core.method({
  59031. selector: "addVariableNamed:to:",
  59032. protocol: 'private',
  59033. fn: function (aString,anObject){
  59034. var self=this;
  59035. var newClass,newObject;
  59036. return $core.withContext(function($ctx1) {
  59037. newClass=self._subclass_withVariable_($recv(anObject)._class(),aString);
  59038. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  59039. newObject=$recv(newClass)._new();
  59040. self._setPreviousVariablesFor_from_(newObject,anObject);
  59041. return newObject;
  59042. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  59043. },
  59044. args: ["aString", "anObject"],
  59045. 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",
  59046. referencedClasses: [],
  59047. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  59048. }),
  59049. $globals.Repl);
  59050. $core.addMethod(
  59051. $core.method({
  59052. selector: "assignNewVariable:do:",
  59053. protocol: 'private',
  59054. fn: function (buffer,aBlock){
  59055. var self=this;
  59056. return $core.withContext(function($ctx1) {
  59057. var $2,$3,$1,$receiver;
  59058. return self._parseAssignment_do_(buffer,(function(name,expr){
  59059. var varName,value;
  59060. return $core.withContext(function($ctx2) {
  59061. if(($receiver = name) == null || $receiver.isNil){
  59062. varName=self._nextResultName();
  59063. } else {
  59064. varName=name;
  59065. };
  59066. varName;
  59067. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  59068. self["@session"];
  59069. $recv((function(){
  59070. return $core.withContext(function($ctx3) {
  59071. $2=$recv(varName).__comma(" := ");
  59072. if(($receiver = expr) == null || $receiver.isNil){
  59073. $3=buffer;
  59074. } else {
  59075. $3=expr;
  59076. };
  59077. $1=$recv($2).__comma($3);
  59078. $ctx3.sendIdx[","]=1;
  59079. value=self._eval_on_($1,self["@session"]);
  59080. return value;
  59081. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  59082. }))._on_do_($globals.Error,(function(e){
  59083. return $core.withContext(function($ctx3) {
  59084. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  59085. value=nil;
  59086. return value;
  59087. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  59088. }));
  59089. return $recv(aBlock)._value_value_(varName,value);
  59090. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  59091. }));
  59092. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  59093. },
  59094. args: ["buffer", "aBlock"],
  59095. 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]",
  59096. referencedClasses: ["Error", "ConsoleErrorHandler"],
  59097. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  59098. }),
  59099. $globals.Repl);
  59100. $core.addMethod(
  59101. $core.method({
  59102. selector: "clearScreen",
  59103. protocol: 'actions',
  59104. fn: function (){
  59105. var self=this;
  59106. var esc,cls;
  59107. return $core.withContext(function($ctx1) {
  59108. var $1;
  59109. esc=$recv($globals.String)._fromCharCode_((27));
  59110. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  59111. $ctx1.sendIdx[","]=2;
  59112. cls=$recv($1).__comma("[0;0f");
  59113. $ctx1.sendIdx[","]=1;
  59114. $recv($recv(process)._stdout())._write_(cls);
  59115. $recv(self["@interface"])._prompt();
  59116. return self;
  59117. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  59118. },
  59119. args: [],
  59120. 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",
  59121. referencedClasses: ["String"],
  59122. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  59123. }),
  59124. $globals.Repl);
  59125. $core.addMethod(
  59126. $core.method({
  59127. selector: "close",
  59128. protocol: 'actions',
  59129. fn: function (){
  59130. var self=this;
  59131. return $core.withContext(function($ctx1) {
  59132. $recv($recv(process)._stdin())._destroy();
  59133. return self;
  59134. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  59135. },
  59136. args: [],
  59137. source: "close\x0a\x09process stdin destroy",
  59138. referencedClasses: [],
  59139. messageSends: ["destroy", "stdin"]
  59140. }),
  59141. $globals.Repl);
  59142. $core.addMethod(
  59143. $core.method({
  59144. selector: "commands",
  59145. protocol: 'accessing',
  59146. fn: function (){
  59147. var self=this;
  59148. return self["@commands"];
  59149. },
  59150. args: [],
  59151. source: "commands\x0a\x09^ commands",
  59152. referencedClasses: [],
  59153. messageSends: []
  59154. }),
  59155. $globals.Repl);
  59156. $core.addMethod(
  59157. $core.method({
  59158. selector: "createInterface",
  59159. protocol: 'actions',
  59160. fn: function (){
  59161. var self=this;
  59162. return $core.withContext(function($ctx1) {
  59163. self["@interface"]=$recv(self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  59164. $recv(self["@interface"])._on_do_("line",(function(buffer){
  59165. return $core.withContext(function($ctx2) {
  59166. return self._processLine_(buffer);
  59167. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  59168. }));
  59169. $ctx1.sendIdx["on:do:"]=1;
  59170. $recv(self["@interface"])._on_do_("close",(function(){
  59171. return $core.withContext(function($ctx2) {
  59172. return self._close();
  59173. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59174. }));
  59175. self._printWelcome();
  59176. self._setupHotkeys();
  59177. self._setPrompt();
  59178. $recv(self["@interface"])._prompt();
  59179. return self;
  59180. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  59181. },
  59182. args: [],
  59183. 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",
  59184. referencedClasses: [],
  59185. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  59186. }),
  59187. $globals.Repl);
  59188. $core.addMethod(
  59189. $core.method({
  59190. selector: "encapsulateVariable:withValue:in:",
  59191. protocol: 'private',
  59192. fn: function (aString,anObject,aClass){
  59193. var self=this;
  59194. var compiler;
  59195. return $core.withContext(function($ctx1) {
  59196. var $1,$4,$3,$2,$5,$6;
  59197. compiler=$recv($globals.Compiler)._new();
  59198. $1=compiler;
  59199. $4=$recv(aString).__comma(": anObject ^ ");
  59200. $ctx1.sendIdx[","]=3;
  59201. $3=$recv($4).__comma(aString);
  59202. $ctx1.sendIdx[","]=2;
  59203. $2=$recv($3).__comma(" := anObject");
  59204. $ctx1.sendIdx[","]=1;
  59205. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  59206. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  59207. $5=compiler;
  59208. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  59209. $ctx1.sendIdx[","]=4;
  59210. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  59211. return self;
  59212. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  59213. },
  59214. args: ["aString", "anObject", "aClass"],
  59215. 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'.",
  59216. referencedClasses: ["Compiler"],
  59217. messageSends: ["new", "install:forClass:protocol:", ","]
  59218. }),
  59219. $globals.Repl);
  59220. $core.addMethod(
  59221. $core.method({
  59222. selector: "eval:",
  59223. protocol: 'actions',
  59224. fn: function (buffer){
  59225. var self=this;
  59226. return $core.withContext(function($ctx1) {
  59227. return self._eval_on_(buffer,$recv($globals.DoIt)._new());
  59228. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  59229. },
  59230. args: ["buffer"],
  59231. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  59232. referencedClasses: ["DoIt"],
  59233. messageSends: ["eval:on:", "new"]
  59234. }),
  59235. $globals.Repl);
  59236. $core.addMethod(
  59237. $core.method({
  59238. selector: "eval:on:",
  59239. protocol: 'actions',
  59240. fn: function (buffer,anObject){
  59241. var self=this;
  59242. var result;
  59243. return $core.withContext(function($ctx1) {
  59244. var $1,$2;
  59245. $1=$recv(buffer)._isEmpty();
  59246. if(!$core.assert($1)){
  59247. $recv((function(){
  59248. return $core.withContext(function($ctx2) {
  59249. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  59250. return result;
  59251. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59252. }))._tryCatch_((function(e){
  59253. return $core.withContext(function($ctx2) {
  59254. $2=$recv(e)._isSmalltalkError();
  59255. if($core.assert($2)){
  59256. return $recv(e)._resignal();
  59257. } else {
  59258. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  59259. };
  59260. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)});
  59261. }));
  59262. };
  59263. return result;
  59264. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  59265. },
  59266. args: ["buffer", "anObject"],
  59267. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer isEmpty ifFalse: [\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 ifTrue: [ e resignal ]\x0a\x09\x09\x09 \x09 ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  59268. referencedClasses: ["Compiler"],
  59269. messageSends: ["ifFalse:", "isEmpty", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"]
  59270. }),
  59271. $globals.Repl);
  59272. $core.addMethod(
  59273. $core.method({
  59274. selector: "executeCommand:",
  59275. protocol: 'private',
  59276. fn: function (aString){
  59277. var self=this;
  59278. return $core.withContext(function($ctx1) {
  59279. var $1;
  59280. var $early={};
  59281. try {
  59282. $recv(self._commands())._keysAndValuesDo_((function(names,cmd){
  59283. return $core.withContext(function($ctx2) {
  59284. $1=$recv(names)._includes_(aString);
  59285. if($core.assert($1)){
  59286. $recv(cmd)._value();
  59287. throw $early=[true];
  59288. };
  59289. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  59290. }));
  59291. return false;
  59292. }
  59293. catch(e) {if(e===$early)return e[0]; throw e}
  59294. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  59295. },
  59296. args: ["aString"],
  59297. 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",
  59298. referencedClasses: [],
  59299. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  59300. }),
  59301. $globals.Repl);
  59302. $core.addMethod(
  59303. $core.method({
  59304. selector: "initialize",
  59305. protocol: 'initialization',
  59306. fn: function (){
  59307. var self=this;
  59308. return $core.withContext(function($ctx1) {
  59309. (
  59310. $ctx1.supercall = true,
  59311. ($globals.Repl.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  59312. $ctx1.supercall = false;
  59313. self["@session"]=$recv($globals.DoIt)._new();
  59314. self["@readline"]=$recv(require)._value_("readline");
  59315. $ctx1.sendIdx["value:"]=1;
  59316. self["@util"]=$recv(require)._value_("util");
  59317. self._setupCommands();
  59318. return self;
  59319. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  59320. },
  59321. args: [],
  59322. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  59323. referencedClasses: ["DoIt"],
  59324. messageSends: ["initialize", "new", "value:", "setupCommands"]
  59325. }),
  59326. $globals.Repl);
  59327. $core.addMethod(
  59328. $core.method({
  59329. selector: "instanceVariableNamesFor:",
  59330. protocol: 'private',
  59331. fn: function (aClass){
  59332. var self=this;
  59333. return $core.withContext(function($ctx1) {
  59334. var $1,$2,$receiver;
  59335. $1=$recv(aClass)._superclass();
  59336. $ctx1.sendIdx["superclass"]=1;
  59337. if(($receiver = $1) == null || $receiver.isNil){
  59338. return $recv(aClass)._instanceVariableNames();
  59339. } else {
  59340. $2=$recv(aClass)._instanceVariableNames();
  59341. $ctx1.sendIdx["instanceVariableNames"]=1;
  59342. return $recv($2)._copyWithAll_(self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  59343. };
  59344. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  59345. },
  59346. args: ["aClass"],
  59347. 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]",
  59348. referencedClasses: [],
  59349. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  59350. }),
  59351. $globals.Repl);
  59352. $core.addMethod(
  59353. $core.method({
  59354. selector: "isIdentifier:",
  59355. protocol: 'private',
  59356. fn: function (aString){
  59357. var self=this;
  59358. return $core.withContext(function($ctx1) {
  59359. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  59360. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  59361. },
  59362. args: ["aString"],
  59363. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  59364. referencedClasses: [],
  59365. messageSends: ["match:", "asRegexp"]
  59366. }),
  59367. $globals.Repl);
  59368. $core.addMethod(
  59369. $core.method({
  59370. selector: "isVariableDefined:",
  59371. protocol: 'private',
  59372. fn: function (aString){
  59373. var self=this;
  59374. return $core.withContext(function($ctx1) {
  59375. return $recv(self._instanceVariableNamesFor_($recv(self["@session"])._class()))._includes_(aString);
  59376. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  59377. },
  59378. args: ["aString"],
  59379. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  59380. referencedClasses: [],
  59381. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  59382. }),
  59383. $globals.Repl);
  59384. $core.addMethod(
  59385. $core.method({
  59386. selector: "nextResultName",
  59387. protocol: 'private',
  59388. fn: function (){
  59389. var self=this;
  59390. return $core.withContext(function($ctx1) {
  59391. var $1,$receiver;
  59392. $1=self["@resultCount"];
  59393. if(($receiver = $1) == null || $receiver.isNil){
  59394. self["@resultCount"]=(1);
  59395. } else {
  59396. self["@resultCount"]=$recv(self["@resultCount"]).__plus((1));
  59397. };
  59398. return "res".__comma($recv(self["@resultCount"])._asString());
  59399. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  59400. },
  59401. args: [],
  59402. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  59403. referencedClasses: [],
  59404. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  59405. }),
  59406. $globals.Repl);
  59407. $core.addMethod(
  59408. $core.method({
  59409. selector: "onKeyPress:",
  59410. protocol: 'private',
  59411. fn: function (key){
  59412. var self=this;
  59413. return $core.withContext(function($ctx1) {
  59414. var $1;
  59415. $1=$recv($recv(key)._ctrl())._and_((function(){
  59416. return $core.withContext(function($ctx2) {
  59417. return $recv($recv(key)._name()).__eq("l");
  59418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59419. }));
  59420. if($core.assert($1)){
  59421. self._clearScreen();
  59422. };
  59423. return self;
  59424. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  59425. },
  59426. args: ["key"],
  59427. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  59428. referencedClasses: [],
  59429. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  59430. }),
  59431. $globals.Repl);
  59432. $core.addMethod(
  59433. $core.method({
  59434. selector: "parseAssignment:do:",
  59435. protocol: 'private',
  59436. fn: function (aString,aBlock){
  59437. var self=this;
  59438. var assignment;
  59439. return $core.withContext(function($ctx1) {
  59440. var $2,$1;
  59441. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  59442. return $core.withContext(function($ctx2) {
  59443. return $recv(s)._trimBoth();
  59444. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  59445. }));
  59446. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  59447. return $core.withContext(function($ctx2) {
  59448. $2=$recv(assignment)._first();
  59449. $ctx2.sendIdx["first"]=1;
  59450. return self._isIdentifier_($2);
  59451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59452. }));
  59453. if($core.assert($1)){
  59454. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  59455. $ctx1.sendIdx["value:value:"]=1;
  59456. } else {
  59457. return $recv(aBlock)._value_value_(nil,nil);
  59458. };
  59459. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  59460. },
  59461. args: ["aString", "aBlock"],
  59462. 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 ]",
  59463. referencedClasses: [],
  59464. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  59465. }),
  59466. $globals.Repl);
  59467. $core.addMethod(
  59468. $core.method({
  59469. selector: "presentResultNamed:withValue:",
  59470. protocol: 'private',
  59471. fn: function (varName,value){
  59472. var self=this;
  59473. return $core.withContext(function($ctx1) {
  59474. var $3,$2,$1;
  59475. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  59476. $ctx1.sendIdx[","]=3;
  59477. $2=$recv($3).__comma(" = ");
  59478. $ctx1.sendIdx[","]=2;
  59479. $1=$recv($2).__comma($recv(value)._asString());
  59480. $ctx1.sendIdx[","]=1;
  59481. $recv($globals.Transcript)._show_($1);
  59482. $recv($globals.Transcript)._cr();
  59483. $recv(self["@interface"])._prompt();
  59484. return self;
  59485. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  59486. },
  59487. args: ["varName", "value"],
  59488. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  59489. referencedClasses: ["Transcript"],
  59490. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  59491. }),
  59492. $globals.Repl);
  59493. $core.addMethod(
  59494. $core.method({
  59495. selector: "printWelcome",
  59496. protocol: 'actions',
  59497. fn: function (){
  59498. var self=this;
  59499. return $core.withContext(function($ctx1) {
  59500. $recv($globals.Transcript)._show_("Type :q to exit.");
  59501. $recv($globals.Transcript)._cr();
  59502. return self;
  59503. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  59504. },
  59505. args: [],
  59506. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  59507. referencedClasses: ["Transcript"],
  59508. messageSends: ["show:", "cr"]
  59509. }),
  59510. $globals.Repl);
  59511. $core.addMethod(
  59512. $core.method({
  59513. selector: "processLine:",
  59514. protocol: 'private',
  59515. fn: function (buffer){
  59516. var self=this;
  59517. var show;
  59518. return $core.withContext(function($ctx1) {
  59519. var $1,$2;
  59520. show=(function(varName,value){
  59521. return $core.withContext(function($ctx2) {
  59522. return self._presentResultNamed_withValue_(varName,value);
  59523. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  59524. });
  59525. $1=self._executeCommand_(buffer);
  59526. if(!$core.assert($1)){
  59527. $2=self._isVariableDefined_(buffer);
  59528. if($core.assert($2)){
  59529. $recv(show)._value_value_(buffer,$recv(self["@session"])._perform_(buffer));
  59530. } else {
  59531. self._assignNewVariable_do_(buffer,show);
  59532. };
  59533. };
  59534. return self;
  59535. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  59536. },
  59537. args: ["buffer"],
  59538. 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]]",
  59539. referencedClasses: [],
  59540. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  59541. }),
  59542. $globals.Repl);
  59543. $core.addMethod(
  59544. $core.method({
  59545. selector: "prompt",
  59546. protocol: 'accessing',
  59547. fn: function (){
  59548. var self=this;
  59549. return "amber >> ";
  59550. },
  59551. args: [],
  59552. source: "prompt\x0a\x09^ 'amber >> '",
  59553. referencedClasses: [],
  59554. messageSends: []
  59555. }),
  59556. $globals.Repl);
  59557. $core.addMethod(
  59558. $core.method({
  59559. selector: "setPreviousVariablesFor:from:",
  59560. protocol: 'private',
  59561. fn: function (newObject,oldObject){
  59562. var self=this;
  59563. return $core.withContext(function($ctx1) {
  59564. $recv(self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  59565. return $core.withContext(function($ctx2) {
  59566. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  59567. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  59568. }));
  59569. return self;
  59570. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  59571. },
  59572. args: ["newObject", "oldObject"],
  59573. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  59574. referencedClasses: [],
  59575. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  59576. }),
  59577. $globals.Repl);
  59578. $core.addMethod(
  59579. $core.method({
  59580. selector: "setPrompt",
  59581. protocol: 'actions',
  59582. fn: function (){
  59583. var self=this;
  59584. return $core.withContext(function($ctx1) {
  59585. $recv(self["@interface"])._setPrompt_(self._prompt());
  59586. return self;
  59587. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  59588. },
  59589. args: [],
  59590. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  59591. referencedClasses: [],
  59592. messageSends: ["setPrompt:", "prompt"]
  59593. }),
  59594. $globals.Repl);
  59595. $core.addMethod(
  59596. $core.method({
  59597. selector: "setupCommands",
  59598. protocol: 'initialization',
  59599. fn: function (){
  59600. var self=this;
  59601. return $core.withContext(function($ctx1) {
  59602. var $2,$1;
  59603. $2=$recv([":q"]).__minus_gt((function(){
  59604. return $core.withContext(function($ctx2) {
  59605. return $recv(process)._exit();
  59606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59607. }));
  59608. $ctx1.sendIdx["->"]=1;
  59609. $1=[$2,$recv([""]).__minus_gt((function(){
  59610. return $core.withContext(function($ctx2) {
  59611. return $recv(self["@interface"])._prompt();
  59612. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59613. }))];
  59614. self["@commands"]=$recv($globals.Dictionary)._from_($1);
  59615. return self;
  59616. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  59617. },
  59618. args: [],
  59619. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  59620. referencedClasses: ["Dictionary"],
  59621. messageSends: ["from:", "->", "exit", "prompt"]
  59622. }),
  59623. $globals.Repl);
  59624. $core.addMethod(
  59625. $core.method({
  59626. selector: "setupHotkeys",
  59627. protocol: 'initialization',
  59628. fn: function (){
  59629. var self=this;
  59630. return $core.withContext(function($ctx1) {
  59631. var $receiver;
  59632. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  59633. return $core.withContext(function($ctx2) {
  59634. if(($receiver = key) == null || $receiver.isNil){
  59635. return key;
  59636. } else {
  59637. return self._onKeyPress_(key);
  59638. };
  59639. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  59640. }));
  59641. return self;
  59642. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  59643. },
  59644. args: [],
  59645. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  59646. referencedClasses: [],
  59647. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  59648. }),
  59649. $globals.Repl);
  59650. $core.addMethod(
  59651. $core.method({
  59652. selector: "subclass:withVariable:",
  59653. protocol: 'private',
  59654. fn: function (aClass,varName){
  59655. var self=this;
  59656. return $core.withContext(function($ctx1) {
  59657. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  59658. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  59659. },
  59660. args: ["aClass", "varName"],
  59661. 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'",
  59662. referencedClasses: ["ClassBuilder"],
  59663. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  59664. }),
  59665. $globals.Repl);
  59666. $core.addMethod(
  59667. $core.method({
  59668. selector: "subclassNameFor:",
  59669. protocol: 'private',
  59670. fn: function (aClass){
  59671. var self=this;
  59672. return $core.withContext(function($ctx1) {
  59673. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  59674. $2=$recv(aClass)._name();
  59675. $ctx1.sendIdx["name"]=1;
  59676. $1=$recv($2)._matchesOf_("\x5cd+$");
  59677. $ctx1.sendIdx["matchesOf:"]=1;
  59678. if(($receiver = $1) == null || $receiver.isNil){
  59679. return $recv($recv(aClass)._name()).__comma("2");
  59680. } else {
  59681. var counter;
  59682. $6=$recv(aClass)._name();
  59683. $ctx1.sendIdx["name"]=2;
  59684. $5=$recv($6)._matchesOf_("\x5cd+$");
  59685. $4=$recv($5)._first();
  59686. $3=$recv($4)._asNumber();
  59687. counter=$recv($3).__plus((1));
  59688. counter;
  59689. $7=$recv(aClass)._name();
  59690. $ctx1.sendIdx["name"]=3;
  59691. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  59692. };
  59693. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  59694. },
  59695. args: ["aClass"],
  59696. 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'].",
  59697. referencedClasses: [],
  59698. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  59699. }),
  59700. $globals.Repl);
  59701. $core.addMethod(
  59702. $core.method({
  59703. selector: "main",
  59704. protocol: 'initialization',
  59705. fn: function (){
  59706. var self=this;
  59707. return $core.withContext(function($ctx1) {
  59708. $recv(self._new())._createInterface();
  59709. return self;
  59710. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.klass)});
  59711. },
  59712. args: [],
  59713. source: "main\x0a\x09self new createInterface",
  59714. referencedClasses: [],
  59715. messageSends: ["createInterface", "new"]
  59716. }),
  59717. $globals.Repl.klass);
  59718. });
  59719. (function () {
  59720. define('app',["amber/devel", "amber_cli/AmberCli"], function (amber) {
  59721. amber.initialize().then(function () {
  59722. amber.globals.AmberCli._main();
  59723. });
  59724. });
  59725. }());
  59726. require(["app"]);
  59727. });
  59728. define.require('__wrap__');
  59729. }((function amdefine(module, requireFn) {
  59730. 'use strict';
  59731. var defineCache = {},
  59732. loaderCache = {},
  59733. alreadyCalled = false,
  59734. path = require('path'),
  59735. makeRequire, stringRequire;
  59736. /**
  59737. * Trims the . and .. from an array of path segments.
  59738. * It will keep a leading path segment if a .. will become
  59739. * the first path segment, to help with module name lookups,
  59740. * which act like paths, but can be remapped. But the end result,
  59741. * all paths that use this function should look normalized.
  59742. * NOTE: this method MODIFIES the input array.
  59743. * @param {Array} ary the array of path segments.
  59744. */
  59745. function trimDots(ary) {
  59746. var i, part;
  59747. for (i = 0; ary[i]; i+= 1) {
  59748. part = ary[i];
  59749. if (part === '.') {
  59750. ary.splice(i, 1);
  59751. i -= 1;
  59752. } else if (part === '..') {
  59753. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  59754. //End of the line. Keep at least one non-dot
  59755. //path segment at the front so it can be mapped
  59756. //correctly to disk. Otherwise, there is likely
  59757. //no path mapping for a path starting with '..'.
  59758. //This can still fail, but catches the most reasonable
  59759. //uses of ..
  59760. break;
  59761. } else if (i > 0) {
  59762. ary.splice(i - 1, 2);
  59763. i -= 2;
  59764. }
  59765. }
  59766. }
  59767. }
  59768. function normalize(name, baseName) {
  59769. var baseParts;
  59770. //Adjust any relative paths.
  59771. if (name && name.charAt(0) === '.') {
  59772. //If have a base name, try to normalize against it,
  59773. //otherwise, assume it is a top-level require that will
  59774. //be relative to baseUrl in the end.
  59775. if (baseName) {
  59776. baseParts = baseName.split('/');
  59777. baseParts = baseParts.slice(0, baseParts.length - 1);
  59778. baseParts = baseParts.concat(name.split('/'));
  59779. trimDots(baseParts);
  59780. name = baseParts.join('/');
  59781. }
  59782. }
  59783. return name;
  59784. }
  59785. /**
  59786. * Create the normalize() function passed to a loader plugin's
  59787. * normalize method.
  59788. */
  59789. function makeNormalize(relName) {
  59790. return function (name) {
  59791. return normalize(name, relName);
  59792. };
  59793. }
  59794. function makeLoad(id) {
  59795. function load(value) {
  59796. loaderCache[id] = value;
  59797. }
  59798. load.fromText = function (id, text) {
  59799. //This one is difficult because the text can/probably uses
  59800. //define, and any relative paths and requires should be relative
  59801. //to that id was it would be found on disk. But this would require
  59802. //bootstrapping a module/require fairly deeply from node core.
  59803. //Not sure how best to go about that yet.
  59804. throw new Error('amdefine does not implement load.fromText');
  59805. };
  59806. return load;
  59807. }
  59808. makeRequire = function (systemRequire, exports, module, relId) {
  59809. function amdRequire(deps, callback) {
  59810. if (typeof deps === 'string') {
  59811. //Synchronous, single module require('')
  59812. return stringRequire(systemRequire, exports, module, deps, relId);
  59813. } else {
  59814. //Array of dependencies with a callback.
  59815. //Convert the dependencies to modules.
  59816. deps = deps.map(function (depName) {
  59817. return stringRequire(systemRequire, exports, module, depName, relId);
  59818. });
  59819. //Wait for next tick to call back the require call.
  59820. if (callback) {
  59821. process.nextTick(function () {
  59822. callback.apply(null, deps);
  59823. });
  59824. }
  59825. }
  59826. }
  59827. amdRequire.toUrl = function (filePath) {
  59828. if (filePath.indexOf('.') === 0) {
  59829. return normalize(filePath, path.dirname(module.filename));
  59830. } else {
  59831. return filePath;
  59832. }
  59833. };
  59834. return amdRequire;
  59835. };
  59836. //Favor explicit value, passed in if the module wants to support Node 0.4.
  59837. requireFn = requireFn || function req() {
  59838. return module.require.apply(module, arguments);
  59839. };
  59840. function runFactory(id, deps, factory) {
  59841. var r, e, m, result;
  59842. if (id) {
  59843. e = loaderCache[id] = {};
  59844. m = {
  59845. id: id,
  59846. uri: __filename,
  59847. exports: e
  59848. };
  59849. r = makeRequire(requireFn, e, m, id);
  59850. } else {
  59851. //Only support one define call per file
  59852. if (alreadyCalled) {
  59853. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  59854. }
  59855. alreadyCalled = true;
  59856. //Use the real variables from node
  59857. //Use module.exports for exports, since
  59858. //the exports in here is amdefine exports.
  59859. e = module.exports;
  59860. m = module;
  59861. r = makeRequire(requireFn, e, m, module.id);
  59862. }
  59863. //If there are dependencies, they are strings, so need
  59864. //to convert them to dependency values.
  59865. if (deps) {
  59866. deps = deps.map(function (depName) {
  59867. return r(depName);
  59868. });
  59869. }
  59870. //Call the factory with the right dependencies.
  59871. if (typeof factory === 'function') {
  59872. result = factory.apply(m.exports, deps);
  59873. } else {
  59874. result = factory;
  59875. }
  59876. if (result !== undefined) {
  59877. m.exports = result;
  59878. if (id) {
  59879. loaderCache[id] = m.exports;
  59880. }
  59881. }
  59882. }
  59883. stringRequire = function (systemRequire, exports, module, id, relId) {
  59884. //Split the ID by a ! so that
  59885. var index = id.indexOf('!'),
  59886. originalId = id,
  59887. prefix, plugin;
  59888. if (index === -1) {
  59889. id = normalize(id, relId);
  59890. //Straight module lookup. If it is one of the special dependencies,
  59891. //deal with it, otherwise, delegate to node.
  59892. if (id === 'require') {
  59893. return makeRequire(systemRequire, exports, module, relId);
  59894. } else if (id === 'exports') {
  59895. return exports;
  59896. } else if (id === 'module') {
  59897. return module;
  59898. } else if (loaderCache.hasOwnProperty(id)) {
  59899. return loaderCache[id];
  59900. } else if (defineCache[id]) {
  59901. runFactory.apply(null, defineCache[id]);
  59902. return loaderCache[id];
  59903. } else {
  59904. if(systemRequire) {
  59905. return systemRequire(originalId);
  59906. } else {
  59907. throw new Error('No module with ID: ' + id);
  59908. }
  59909. }
  59910. } else {
  59911. //There is a plugin in play.
  59912. prefix = id.substring(0, index);
  59913. id = id.substring(index + 1, id.length);
  59914. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  59915. if (plugin.normalize) {
  59916. id = plugin.normalize(id, makeNormalize(relId));
  59917. } else {
  59918. //Normalize the ID normally.
  59919. id = normalize(id, relId);
  59920. }
  59921. if (loaderCache[id]) {
  59922. return loaderCache[id];
  59923. } else {
  59924. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  59925. return loaderCache[id];
  59926. }
  59927. }
  59928. };
  59929. //Create a define function specific to the module asking for amdefine.
  59930. function define(id, deps, factory) {
  59931. if (Array.isArray(id)) {
  59932. factory = deps;
  59933. deps = id;
  59934. id = undefined;
  59935. } else if (typeof id !== 'string') {
  59936. factory = id;
  59937. id = deps = undefined;
  59938. }
  59939. if (deps && !Array.isArray(deps)) {
  59940. factory = deps;
  59941. deps = undefined;
  59942. }
  59943. if (!deps) {
  59944. deps = ['require', 'exports', 'module'];
  59945. }
  59946. //Set up properties for this module. If an ID, then use
  59947. //internal cache. If no ID, then use the external variables
  59948. //for this node module.
  59949. if (id) {
  59950. //Put the module in deep freeze until there is a
  59951. //require call for it.
  59952. defineCache[id] = [id, deps, factory];
  59953. } else {
  59954. runFactory(id, deps, factory);
  59955. }
  59956. }
  59957. //define.require, which has access to all the values in the
  59958. //cache. Useful for AMD modules that all have IDs in the file,
  59959. //but need to finally export a value to node based on one of those
  59960. //IDs.
  59961. define.require = function (id) {
  59962. if (loaderCache[id]) {
  59963. return loaderCache[id];
  59964. }
  59965. if (defineCache[id]) {
  59966. runFactory.apply(null, defineCache[id]);
  59967. return loaderCache[id];
  59968. }
  59969. };
  59970. define.amd = {};
  59971. return define;
  59972. }(module)), require));